示例#1
0
 public TokenProvider(ApigeeClientOptions options, HttpService httpService)
 {
     _authenticationUrl = options.AuthenticationUrl ?? "https://login.apigee.com/oauth/token";
     _login             = options.Email;
     _password          = options.Password;
     _httpService       = httpService;
 }
        protected ApigeeSDK.ApigeeClient GetApigeeClient()
        {
            var http    = MockHttp.ToHttpClient();
            var options = new ApigeeClientOptions(Email, Password, OrgName, EnvName, BaseUrl, AuthUrl,
                                                  TimeSpan.FromSeconds(RequestTimeOut), EntitiesLimit);

            return(new ApigeeSDK.ApigeeClient(options, http));
        }
        private Services.TokenProvider CreateTokenProvider()
        {
            var http    = MockHttp.ToHttpClient();
            var options = new ApigeeClientOptions(Email, Password, OrgName, EnvName, BaseUrl, AuthUrl,
                                                  TimeSpan.FromSeconds(RequestTimeOut), EntitiesLimit);
            var httpService = new HttpService(http);

            return(new Services.TokenProvider(options, httpService));
        }
示例#4
0
        private ApigeeClient CreateClient()
        {
            var options = new ApigeeClientOptions(
                _email,
                _password,
                _orgName,
                _envName);

            return(new ApigeeClient(options));
        }
        private ApigeeClient CreateClient()
        {
            var email    = Environment.GetEnvironmentVariable("APIGEE_EMAIL");
            var password = Environment.GetEnvironmentVariable("APIGEE_PASSWORD");
            var orgName  = Environment.GetEnvironmentVariable("APIGEE_ORGNAME");
            var envName  = "test";
            var options  = new ApigeeClientOptions(
                email,
                password,
                orgName,
                envName);

            return(new ApigeeClient(options));
        }
示例#6
0
        public async Task GetDeveloperByEmailWithWrongCredentialsRaiseError()
        {
            var options = new ApigeeClientOptions(
                "WRONG_USER",
                "WRONG_PASSWORD",
                "WRONG_ORG",
                "WRONG_ENV");
            var client = new ApigeeClient(options);

            var error = await Assert.ThrowsAsync <ApigeeSdkHttpException>(
                () => client.GetApplications());

            Assert.Equal(HttpStatusCode.Unauthorized, error.StatusCode);
            Assert.Equal("{\"error\":\"unauthorized\",\"error_description\":\"Invalid Credentials\"}", error.Message);
        }
示例#7
0
        static async Task Main(string[] args)
        {
            var options = new ApigeeClientOptions(
                Environment.GetEnvironmentVariable("APIGEE_EMAIL"),
                Environment.GetEnvironmentVariable("APIGEE_PASSWORD"),
                Environment.GetEnvironmentVariable("APIGEE_ORGNAME"),
                "test");

            var client = new ApigeeClient(options);

            var developers = await client.GetDevelopers();

            Console.WriteLine("Developers list:");
            foreach (var developer in developers)
            {
                Console.WriteLine($"Developer name: {developer.FirstName} {developer.LastName}");
                Console.WriteLine($"Developer status: {developer.Status}");
            }
        }
        public async Task GetGetApiProductsWithLimitIsSuccessful()
        {
            var email    = Environment.GetEnvironmentVariable("APIGEE_EMAIL");
            var password = Environment.GetEnvironmentVariable("APIGEE_PASSWORD");
            var orgName  = Environment.GetEnvironmentVariable("APIGEE_ORGNAME");
            var envName  = "test";
            var options  = new ApigeeClientOptions(
                email,
                password,
                orgName,
                envName)
            {
                EntitiesLimit = 2
            };

            var client = new ApigeeClient(options);

            await client.GetApiProducts();
        }
示例#9
0
 public HttpServiceAuthenticated(ApigeeClientOptions options, HttpClient http)
 {
     _httpService   = new HttpService(http);
     _tokenProvider = new TokenProvider(options, _httpService);
 }