コード例 #1
0
        public ApiOperationBuilder <TApiClientOptions> JwtOrKey(ApiKeyParameters apiKeyParameters = null)
        {
            var user = requestContext.User;

            if (user != null)
            {
                return(Jwt());
            }

            return(Key(apiKeyParameters));
        }
コード例 #2
0
        public ApiOperationBuilder <TApiClientOptions> Key(ApiKeyParameters apiKeyParameters = null)
        {
            if (apiKeyParameters == null)
            {
                apiKeyParameters = options.ApiKey;
            }

            if (!httpClient.DefaultRequestHeaders.Contains(apiKeyParameters.Name))
            {
                httpClient.DefaultRequestHeaders.Add(apiKeyParameters.Name, apiKeyParameters.Value);
            }

            return(this);
        }
コード例 #3
0
 protected ApiClientOptionsBase()
 {
     Token  = new JwtTokenParameters();
     ApiKey = new ApiKeyParameters();
 }