Beispiel #1
0
        internal static NameValueCollection CreateQueryString(this CreateSendBase source, string clientId = null, NameValueCollection query = null)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            query    = query ?? new NameValueCollection();
            clientId = source.PossiblyOptionalClientId(query.Get("clientid") ?? clientId);
            if (clientId != null)
            {
                query["clientid"] = clientId;
            }

            return(query);
        }
Beispiel #2
0
        internal static string PossiblyOptionalClientId(this CreateSendBase source, string clientId)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            var auth = source.AuthDetails as IProvideClientId;

            if (auth != null)
            {
                clientId = clientId ?? auth.ClientId;

                if (clientId == null)
                {
                    throw new RequiredClientIdentierException();
                }
            }

            return(clientId);
        }