Summary description for ApiResponse
            public void ParsesLinkHeader()
            {
                var response = new ApiResponse<string>
                {
                    Headers =
                    {
                        {
                            "Link",
                            "<https://api.github.com/repos/rails/rails/issues?page=4&per_page=5>; rel=\"next\", " +
                            "<https://api.github.com/repos/rails/rails/issues?page=131&per_page=5>; rel=\"last\", " +
                            "<https://api.github.com/repos/rails/rails/issues?page=1&per_page=5>; rel=\"first\", " +
                            "<https://api.github.com/repos/rails/rails/issues?page=2&per_page=5>; rel=\"prev\""
                        }
                    }
                };

                ApiInfoParser.ParseApiHttpHeaders(response);

                var apiInfo = response.ApiInfo;
                Assert.NotNull(apiInfo);
                Assert.Equal(4, apiInfo.Links.Count);
                Assert.Contains("next", apiInfo.Links.Keys);
                Assert.Equal(new Uri("https://api.github.com/repos/rails/rails/issues?page=4&per_page=5"),
                    apiInfo.Links["next"]);
                Assert.Contains("prev", apiInfo.Links.Keys);
                Assert.Equal(new Uri("https://api.github.com/repos/rails/rails/issues?page=2&per_page=5"),
                    apiInfo.Links["prev"]);
                Assert.Contains("first", apiInfo.Links.Keys);
                Assert.Equal(new Uri("https://api.github.com/repos/rails/rails/issues?page=1&per_page=5"),
                    apiInfo.Links["first"]);
                Assert.Contains("last", apiInfo.Links.Keys);
                Assert.Equal(new Uri("https://api.github.com/repos/rails/rails/issues?page=131&per_page=5"),
                    apiInfo.Links["last"]);
            }
            public void HasDefaultMessage()
            {
                var response = new ApiResponse<object> { StatusCode = HttpStatusCode.Forbidden };
                var forbiddenException = new ForbiddenException(response);

                Assert.Equal("Request Forbidden", forbiddenException.Message);
            }
Esempio n. 3
0
		private void ParseResponse(ref ApiResponse apiResponse, string respString)
		{
			try
			{
				JObject jObj = JObject.Parse(respString);

				apiResponse.ResponseObject = jObj;
			}
			catch (Exception ex)
			{
				// Parse failed.
				apiResponse.ResponseObject = null;
				apiResponse.Status = ApiResponse.ResponseStatus.ApiError;
				apiResponse.StatusText = ex.Message;
			}

			if (apiResponse.ResponseObject != null)
			{
				try
				{
					int apiStatus = apiResponse.ResponseObject["status"].ToObject<int>();
					apiResponse.ApiStatusCode = apiStatus;
					if (apiStatus != StatusOk && apiStatus < StatusCustomBase)
					{
						apiResponse.Status = ApiResponse.ResponseStatus.ApiError;
						apiResponse.StatusText = apiResponse.ResponseObject["error"].ToObject<string>();
					}
				}
				catch (Exception ex)
				{
					apiResponse.Status = ApiResponse.ResponseStatus.ApiError;
					apiResponse.StatusText = ex.Message;                    
				}
			}            
		}
            public async Task RequestsCorrectUrlWithApiOptions()
            {
                var result = new List<EventInfo> { new EventInfo() };

                var connection = Substitute.For<IConnection>();
                var gitHubClient = new GitHubClient(connection);
                var client = new ObservableIssuesEventsClient(gitHubClient);
                
                var options = new ApiOptions
                {
                    StartPage = 1,
                    PageCount = 1,
                    PageSize = 1
                };

                IApiResponse<List<EventInfo>> response = new ApiResponse<List<EventInfo>>(
                    new Response
                    {
                        ApiInfo = new ApiInfo(new Dictionary<string, Uri>(), new List<string>(), new List<string>(), "etag", new RateLimit()),
                    }, result);
                gitHubClient.Connection.Get<List<EventInfo>>(Args.Uri, Arg.Is<Dictionary<string, string>>(d => d.Count == 2), null)
                    .Returns(Task.FromResult(response));

                var eventInfos = await client.GetAllForIssue("fake", "repo", 42, options).ToList();

                connection.Received().Get<List<EventInfo>>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues/42/events"), Arg.Is<Dictionary<string, string>>(d => d.Count == 2), null);
                Assert.Equal(1, eventInfos.Count);
            }
Esempio n. 5
0
 public static ApiResponse SignOut(String appKey)
 {
     ApiResponse apiResponse = new ApiResponse();
     apiResponse.status = "ok";
     System.Web.Security.FormsAuthentication.SignOut();
     return apiResponse;
 }
        // List or Find Single
        public override string GetAction(string parameters, System.Collections.Specialized.NameValueCollection querystring)
        {
            string data = string.Empty;


            // Find One Specific Category
            ApiResponse<CategoryProductAssociationDTO> response = new ApiResponse<CategoryProductAssociationDTO>();
            string ids = FirstParameter(parameters);
            long id = 0;
            long.TryParse(ids, out id);

            var item = MTApp.CatalogServices.CategoriesXProducts.Find(id);
            if (item == null)
            {
                response.Errors.Add(new ApiError("NULL", "Could not locate that item. Check bvin and try again."));
            }
            else
            {
                response.Content = item.ToDto();
            }
            data = MerchantTribe.Web.Json.ObjectToJson(response);


            return data;
        }
            public async Task ReturnsReadmeWithRepositoryId()
            {
                string encodedContent = Convert.ToBase64String(Encoding.UTF8.GetBytes("Hello world"));
                var readmeInfo = new ReadmeResponse(
                    encodedContent,
                    "README.md",
                    "https://github.example.com/readme",
                    "https://github.example.com/readme.md",
                    "base64");

                var gitHubClient = Substitute.For<IGitHubClient>();
                var apiConnection = Substitute.For<IApiConnection>();
                apiConnection.GetHtml(new Uri(readmeInfo.Url)).Returns(Task.FromResult("<html>README</html>"));
                var readmeFake = new Readme(readmeInfo, apiConnection);
                var contentsClient = new ObservableRepositoryContentsClient(gitHubClient);

                gitHubClient.Repository.Content.GetReadme(1).Returns(Task.FromResult(readmeFake));

                IApiResponse<string> apiResponse = new ApiResponse<string>(new Response(), "<html>README</html>");
                gitHubClient.Connection.GetHtml(Args.Uri, null)
                    .Returns(Task.FromResult(apiResponse));

                var readme = await contentsClient.GetReadme(1);

                Assert.Equal("README.md", readme.Name);

                gitHubClient.Repository.Content.Received(1).GetReadme(1);
                gitHubClient.Connection.DidNotReceive().GetHtml(Arg.Is<Uri>(u => u.ToString() == "https://github.example.com/readme"),
                    Args.EmptyDictionary);

                var htmlReadme = await readme.GetHtmlContent();
                Assert.Equal("<html>README</html>", htmlReadme);
                apiConnection.Received().GetHtml(Arg.Is<Uri>(u => u.ToString() == "https://github.example.com/readme.md"), null);
            }
            public void CanPopulateObjectFromSerializedData()
            {
                var response = new ApiResponse<object> { StatusCode = HttpStatusCode.Forbidden };
                response.Headers.Add("X-RateLimit-Limit", "100");
                response.Headers.Add("X-RateLimit-Remaining", "42");
                response.Headers.Add("X-RateLimit-Reset", "1372700873");
                response.ApiInfo = CreateApiInfo(response);

                var exception = new RateLimitExceededException(response);

                using (var stream = new MemoryStream())
                {
                    var formatter = new BinaryFormatter();
                    formatter.Serialize(stream, exception);
                    stream.Position = 0;
                    var deserialized = (RateLimitExceededException)formatter.Deserialize(stream);

                    Assert.Equal(HttpStatusCode.Forbidden, deserialized.StatusCode);
                    Assert.Equal(100, deserialized.Limit);
                    Assert.Equal(42, deserialized.Remaining);
                    var expectedReset = DateTimeOffset.ParseExact(
                        "Mon 01 Jul 2013 5:47:53 PM -00:00",
                        "ddd dd MMM yyyy h:mm:ss tt zzz",
                        CultureInfo.InvariantCulture);
                    Assert.Equal(expectedReset, deserialized.Reset);
                }
            }
        public override string DeleteAction(string parameters, System.Collections.Specialized.NameValueCollection querystring, string postdata)
        {
            string data = string.Empty;
            string bvin = FirstParameter(parameters);

            if (bvin == string.Empty)
            {
                string howManyString = querystring["howmany"];
                int howMany = 0;
                int.TryParse(howManyString, out howMany);

                // Clear All Products Requested
                ApiResponse<ClearProductsData> response = new ApiResponse<ClearProductsData>();
                response.Content = MTApp.ClearProducts(howMany);
                data = MerchantTribe.Web.Json.ObjectToJson(response);
            }
            else
            {
                // Single Item Delete
                ApiResponse<bool> response = new ApiResponse<bool>();
                response.Content = MTApp.DestroyProduct(bvin);
                data = MerchantTribe.Web.Json.ObjectToJson(response);
            }

            return data;
        }
Esempio n. 10
0
 public ApiResponse<string> DeleteTrace(string id)
 {
     ApiTraceManager.Inst.DeleteTrace(id);
     ApiResponse<string> res = new ApiResponse<string>();
     res.Success = true;
     return res;
 }
 public ApiResponse<List<FootballItem>> GetItems() {
     List<FootballItem> items = FootballManager.Inst.GetItems();
     ApiResponse<List<FootballItem>> res = new ApiResponse<List<FootballItem>>();
     res.Success = true;
     res.Model = items;
     return res;
 }
 // Create or Update
 public override string PostAction(string parameters, System.Collections.Specialized.NameValueCollection querystring, string postdata)
 {
     string data = string.Empty;
     string objecttype = FirstParameter(parameters);
     string objectid = GetParameterByIndex(1, parameters);
     ApiResponse<bool> response = new ApiResponse<bool>();
     
     try
     {
         if (objecttype.Trim().ToLowerInvariant() == "products")
         {
             SearchManager m = new SearchManager();
             Product p = MTApp.CatalogServices.Products.Find(objectid);
             if (p != null)
             {
                 if (p.Bvin.Length > 0)
                 {
                     m.IndexSingleProduct(p);
                     response.Content = true;
                 }
             }                    
         }                                
     }
     catch(Exception ex)
     {
         response.Errors.Add(new ApiError("EXCEPTION", ex.Message));
         return MerchantTribe.Web.Json.ObjectToJson(response);                
     }
                 
     data = MerchantTribe.Web.Json.ObjectToJson(response);            
     return data;
 }
Esempio n. 13
0
        public void CallCompleted(ApiResponse result)
        {
            RadioGroup radioGrupo = new RadioGroup();
            List<GetSurveyQuestionsResponse> response = result.GetTypedResponse<List<GetSurveyQuestionsResponse>>();

            foreach (GetSurveyQuestionsResponse item in response)
            {

                radioGrupo = new RadioGroup();
                radioGrupo.Text(item.des);
                radioGrupo.IdPregunta = item.qid;
                foreach (var itemAnswers in item.answers)
                {
                    RadioButton radio = new RadioButton();
                    radio.Style = App.Current.Resources["RadioBridgstone"] as Style; ;
                    radio.Content = itemAnswers.des;
                    radio.Name = itemAnswers.aid.ToString();
                    radio.Margin = new Thickness(10, 0, 0, 0);
                    radio.Foreground = new SolidColorBrush(Color.FromArgb(0xFF, 0x47, 0x44, 0x44));
                    radio.BorderBrush = new SolidColorBrush(Color.FromArgb(0xFF, 0x8C, 0x8A, 0x8B));
                    radioGrupo.addChildren(radio);
                }
                stackBody.Children.Add(radioGrupo);
            }
        }
Esempio n. 14
0
 public ApiResponse<string> DeleteError(string id)
 {
     ApiErrorManager.Inst.DeleteError(id);
     ApiResponse<string> res = new ApiResponse<string>();
     res.Success = true;
     return res;
 }
        public static async Task<IApiResponse<Index>> RetrieveOrCreateIndexAsync()
        {
            var managementClient = GetIndexManagementClient();

            IApiResponse<Index> index = new ApiResponse<Index>();
            try
            {
                index = await managementClient.GetIndexAsync(Keys.ListingsServiceIndexName);
            }
            catch (Exception e)
            {
                Console.WriteLine("Index doesn't yet exist, create it");
            }

            if (index.Body == null)
            {
                var newIndex = new Index(Keys.ListingsServiceIndexName)
                   .WithStringField("Id", opt => opt.IsKey().IsRetrievable())
                   .WithStringField("Color", opt => opt.IsSearchable().IsSortable().IsFilterable().IsRetrievable())
                   .WithStringField("Package", opt => opt.IsSearchable().IsFilterable().IsRetrievable())
                   .WithStringField("Options", opt => opt.IsSearchable().IsFilterable().IsRetrievable())
                   .WithStringField("Type", opt => opt.IsSearchable().IsFilterable().IsRetrievable())
                   .WithStringField("Image", opt => opt.IsRetrievable());
                index = await managementClient.CreateIndexAsync(newIndex);

                if (!index.IsSuccess)
                {
                    Console.WriteLine("Error when making index");
                }
            }

            return index;
        }
        public ApiResponse<List<FootballItem>> GetItems() {
            ApiResponse<List<FootballItem>> res = new ApiResponse<List<FootballItem>>();
            res.Success = false;
            List<FootballItem> items = new List<FootballItem>();
            HttpWebRequest request = WebRequest.CreateHttp(c_sServerUrl);
            request.Method = "get";
            request.Accept = "application/json";
            request.Timeout = 60*30*1000;
            try {
                WebResponse webResponse = request.GetResponse();
                Stream requestStream = webResponse.GetResponseStream();
                string json;
                using (StreamReader sr = new StreamReader(requestStream)) {
                    json = sr.ReadToEnd();
                }
                if (!string.IsNullOrEmpty(json)) {
                    JsonSerializer serializer = new JsonSerializer();
                    items = serializer.Deserialize<List<FootballItem>>(new JsonTextReader(new StringReader(json)));
                }
                res.Success = true;
                res.Model = items;
            }
            catch (Exception ex) {
            }


            return res;
        }
Esempio n. 17
0
 // List or Find Single
 public override string GetAction(string parameters, System.Collections.Specialized.NameValueCollection querystring)
 {            
     string data = string.Empty;                        
     ApiResponse<string> response = new ApiResponse<string>();                        
     data = MerchantTribe.Web.Json.ObjectToJson(response);
     return data;
 }
        public void SetUp()
        {
            _response = WebRequester.Post(ApplicationRoot + "/baskets/", new Basket());

            _basket = _response.Body;

            _basketUrl = _response["Location"];
        }
Esempio n. 19
0
 public override string DeleteAction(string parameters, System.Collections.Specialized.NameValueCollection querystring, string postdata)
 {
     string data = string.Empty;
     ApiResponse<bool> response = new ApiResponse<bool>();
     response.Content = false;            
     data = MerchantTribe.Web.Json.ObjectToJson(response);
     return data;
 }
 public override string DeleteAction(string parameters, System.Collections.Specialized.NameValueCollection querystring, string postdata)
 {
     ApiResponse<bool> response = new ApiResponse<bool>();
     response.Errors.Add(new ApiError("NOTSUPPORTED", "Delete method is not supported for this object."));
     response.Content = false;            
     string data = string.Empty;
     data = MerchantTribe.Web.Json.ObjectToJson(response);            
     return data;
 }
        // Create or Update
        public override string PostAction(string parameters, System.Collections.Specialized.NameValueCollection querystring, string postdata)
        {
            string data = string.Empty;
            string bvin = FirstParameter(parameters);
            
            //
            // <site Url>/producttypes/<guid>/properties/<propertyid>/<sortOrder>
            //
            string isProperty = GetParameterByIndex(1, parameters);
            if (isProperty.Trim().ToLowerInvariant() == "properties")
            {
                ApiResponse<bool> response2 = new ApiResponse<bool>();

                string propertyIds = GetParameterByIndex(2, parameters);
                long propertyId = 0;
                long.TryParse(propertyIds, out propertyId);                              

                response2.Content = MTApp.CatalogServices.ProductTypeAddProperty(bvin, propertyId);
                data = MerchantTribe.Web.Json.ObjectToJson(response2);            
            }
            else
            {
                ApiResponse<ProductTypeDTO> response = new ApiResponse<ProductTypeDTO>();
                ProductTypeDTO postedItem = null;
                try
                {
                    postedItem = MerchantTribe.Web.Json.ObjectFromJson<ProductTypeDTO>(postdata);
                }
                catch (Exception ex)
                {
                    response.Errors.Add(new ApiError("EXCEPTION", ex.Message));
                    return MerchantTribe.Web.Json.ObjectToJson(response);
                }

                ProductType item = new ProductType();
                item.FromDto(postedItem);

                if (bvin == string.Empty)
                {
                    if (MTApp.CatalogServices.ProductTypes.Create(item))
                    {
                        bvin = item.Bvin;
                    }
                }
                else
                {
                    MTApp.CatalogServices.ProductTypes.Update(item);
                }
                ProductType resultItem = MTApp.CatalogServices.ProductTypes.Find(bvin);
                if (resultItem != null) response.Content = resultItem.ToDto();
                data = MerchantTribe.Web.Json.ObjectToJson(response);            
            }


            
            return data;
        }
Esempio n. 22
0
            public void IdentifiesMaxLoginAttepmtsExceededReason()
            {
                const string responseBody = "{\"message\":\"YOU SHALL NOT PASS!\"," +
                                            "\"documentation_url\":\"http://developer.github.com/v3\"}";
                var response = new ApiResponse<object> { Body = responseBody, StatusCode = HttpStatusCode.Forbidden };
                var forbiddenException = new ForbiddenException(response);

                Assert.Equal("YOU SHALL NOT PASS!", forbiddenException.ApiError.Message);
            }
Esempio n. 23
0
        public virtual ApiResponse<bool> IsEnabled()
        {
            var response = new ApiResponse<bool>
                {
                    Result = true
                };

            return response.Success();
        }
            public void ReturnsEveryPageOfIssues()
            {
                var firstPageUrl = new Uri("repos/fake/repo/issues", UriKind.Relative);
                var secondPageUrl = new Uri("https://example.com/page/2");
                var firstPageLinks = new Dictionary<string, Uri> { { "next", secondPageUrl } };
                var firstPageResponse = new ApiResponse<List<Issue>>
                {
                    BodyAsObject = new List<Issue>
                    {
                        new Issue {Number = 1},
                        new Issue {Number = 2},
                        new Issue {Number = 3},
                    },
                    ApiInfo = CreateApiInfo(firstPageLinks)
                };
                var thirdPageUrl = new Uri("https://example.com/page/3");
                var secondPageLinks = new Dictionary<string, Uri> { { "next", thirdPageUrl } };
                var secondPageResponse = new ApiResponse<List<Issue>>
                {
                    BodyAsObject = new List<Issue>
                    {
                        new Issue {Number = 4},
                        new Issue {Number = 5},
                        new Issue {Number = 6},
                    },
                    ApiInfo = CreateApiInfo(secondPageLinks)
                };
                var lastPageResponse = new ApiResponse<List<Issue>>
                {
                    BodyAsObject = new List<Issue>
                    {
                        new Issue {Number = 7},
                    },
                    ApiInfo = CreateApiInfo(new Dictionary<string, Uri>())
                };
                var gitHubClient = Substitute.For<IGitHubClient>();
                gitHubClient.Connection.GetAsync<List<Issue>>(Arg.Is(firstPageUrl),
                    Arg.Is<Dictionary<string, string>>(d => d.Count == 4
                        && d["direction"] == "desc"
                        && d["state"] == "open"
                        && d["sort"] == "created"
                        && d["filter"] == "assigned"), Arg.Any<string>())
                    .Returns(Task.Factory.StartNew<IResponse<List<Issue>>>(() => firstPageResponse));
                gitHubClient.Connection.GetAsync<List<Issue>>(secondPageUrl, null, null)
                    .Returns(Task.Factory.StartNew<IResponse<List<Issue>>>(() => secondPageResponse));
                gitHubClient.Connection.GetAsync<List<Issue>>(thirdPageUrl, null, null)
                    .Returns(Task.Factory.StartNew<IResponse<List<Issue>>>(() => lastPageResponse));
                var client = new ObservableIssuesClient(gitHubClient);

                var results = client.GetForRepository("fake", "repo").ToArray().Wait();

                Assert.Equal(7, results.Length);
                Assert.Equal(firstPageResponse.BodyAsObject[0].Number, results[0].Number);
                Assert.Equal(secondPageResponse.BodyAsObject[1].Number, results[4].Number);
                Assert.Equal(lastPageResponse.BodyAsObject[0].Number, results[6].Number);
            }
Esempio n. 25
0
        public HttpResponseMessage Autocomplete([FromBody]SearchAutocompleteModel model)
        {
            var rdata = new ApiResponse<List<string>>();

            if (!this.ModelState.IsValid)
            {
                rdata.Result = SearchApiActionCodes.ValidationFailure;
                rdata.Errors = this.ModelState.GetErrorList();
                return this.Request.CreateResponse<ApiResponse<List<string>>>(HttpStatusCode.BadRequest, rdata);
            }

            //TODO: Custom parameter binder for CultureInfo will be implemented
            CultureInfo culture = null;

            try
            {
                culture = CultureInfo.GetCultureInfo(model.Culture);
            }
            catch(CultureNotFoundException)
            {
                rdata.Result = SearchApiActionCodes.ValidationFailure;
                rdata.Errors = new List<string>() { "Culture is not valid" };
                return this.Request.CreateResponse<ApiResponse<List<string>>>(HttpStatusCode.BadRequest, rdata);
            }

            OperationResult<OperationResults, List<string>> rslt = null;

            try
            {
                rslt = this.SearchRepository.Autocomplete(model.Text, this.AccessToken.Value, model.MaxResultCount.Value, culture);
            }
            catch (Exception ex)
            {
                this.Logger.WriteError(ex);

                rdata.Result = SearchApiActionCodes.Failure;
                rdata.Errors = new List<string>() { "Error inside autocomplete method" };
                return this.Request.CreateResponse<ApiResponse<List<string>>>(HttpStatusCode.InternalServerError, rdata);
            }

            switch(rslt.Result)
            {
                case OperationResults.Unathorized:
                    return this.Request.CreateResponse<ApiResponse<List<string>>>(HttpStatusCode.Unauthorized, null);
                case OperationResults.Success:
                    {
                        rdata.Result = SearchApiActionCodes.Success;
                        rdata.Output = rslt.Output;
                        return this.Request.CreateResponse<ApiResponse<List<string>>>(HttpStatusCode.NotFound, rdata);
                    }
                case OperationResults.Failure:
                    return this.Request.CreateResponse<ApiResponse<List<string>>>(HttpStatusCode.InternalServerError, null);
                default:
                    throw new NotImplementedException();
            }
        }
        public async Task ReturnsEveryPageOfIssues()
        {
            var firstPageUrl = new Uri("repos/fake/repo/issues", UriKind.Relative);
            var secondPageUrl = new Uri("https://example.com/page/2");
            var firstPageLinks = new Dictionary<string, Uri> { { "next", secondPageUrl } };
            var firstPageResponse = new ApiResponse<List<Issue>>
            (
                CreateResponseWithApiInfo(firstPageLinks),
                new List<Issue>
                {
                    CreateIssue(1),
                    CreateIssue(2),
                    CreateIssue(3)
                }
            );
            var thirdPageUrl = new Uri("https://example.com/page/3");
            var secondPageLinks = new Dictionary<string, Uri> { { "next", thirdPageUrl } };
            var secondPageResponse = new ApiResponse<List<Issue>>
            (
                CreateResponseWithApiInfo(secondPageLinks),
                new List<Issue>
                {
                    CreateIssue(4),
                    CreateIssue(5),
                    CreateIssue(6)
                }
            );
            var lastPageResponse = new ApiResponse<List<Issue>>
            (
                new Response(),
                new List<Issue>
                {
                    CreateIssue(7)
                }
            );
            var gitHubClient = Substitute.For<IGitHubClient>();
            gitHubClient.Connection.Get<List<Issue>>(Arg.Is(firstPageUrl),
                Arg.Is<Dictionary<string, string>>(d => d.Count == 4
                    && d["direction"] == "desc"
                    && d["state"] == "open"
                    && d["sort"] == "created"
                    && d["filter"] == "assigned"), Arg.Any<string>())
                .Returns(Task.Factory.StartNew<IApiResponse<List<Issue>>>(() => firstPageResponse));
            gitHubClient.Connection.Get<List<Issue>>(secondPageUrl, null, null)
                .Returns(Task.Factory.StartNew<IApiResponse<List<Issue>>>(() => secondPageResponse));
            gitHubClient.Connection.Get<List<Issue>>(thirdPageUrl, null, null)
                .Returns(Task.Factory.StartNew<IApiResponse<List<Issue>>>(() => lastPageResponse));
            var client = new ObservableIssuesClient(gitHubClient);

            var results = await client.GetForRepository("fake", "repo").ToArray();

            Assert.Equal(7, results.Length);
            Assert.Equal(firstPageResponse.Body[0].Number, results[0].Number);
            Assert.Equal(secondPageResponse.Body[1].Number, results[4].Number);
            Assert.Equal(lastPageResponse.Body[0].Number, results[6].Number);
        }
Esempio n. 27
0
 public static ApiResponse SignIn(String appKey, String username, String password)
 {
     ApiResponse apiResponse = new ApiResponse();
     if (username=="username" && password=="password")
     {
         apiResponse.status = "ok";
         System.Web.Security.FormsAuthentication.SetAuthCookie(username, false);
     }
     return apiResponse;
 }
        public void SetUp()
        {
            var postResponse = WebRequester.Post(ApplicationRoot + "/baskets/", new Basket());

            var basketUrl = postResponse["Location"];

            _response = WebRequester.Get<Basket>(basketUrl + "/");

            _basket = _response.Body;
        }
 private static string GetMessage(ApiResponse response)
 {
     try
     {
         return string.Empty;
     }
     catch (SerializationException)
     {
         return response.Exception.Message;
     }
 }
            public void ProvidesDefaultMessage()
            {
                var response = new ApiResponse<object>
                {
                    StatusCode = (HttpStatusCode)422
                };

                var exception = new ApiValidationException(response);

                Assert.Equal("Validation Failed", exception.Message);
            }
Esempio n. 31
0
        /// <summary>
        /// Get wallet fund records
        /// </summary>
        /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="startDate">Start point for result (optional)</param>
        /// <param name="endDate">End point for result (optional)</param>
        /// <param name="coin">Currency (optional)</param>
        /// <param name="status">Withdraw status (optional)</param>
        /// <param name="page">Page. Default getting first page data (optional)</param>
        /// <param name="limit">Limit for data size per page, max size is 50. Default as showing 20 pieces of data per page (optional)</param>
        /// <returns>Task of Object</returns>
        public async System.Threading.Tasks.Task <Object> WalletWithdrawAsync(string startDate = null, string endDate = null, string coin = null, string status = null, string page = null, string limit = null)
        {
            ApiResponse <Object> localVarResponse = await WalletWithdrawAsyncWithHttpInfo(startDate, endDate, coin, status, page, limit);

            return(localVarResponse.Data);
        }
Esempio n. 32
0
        /// <summary>
        /// Get your API Keys.
        /// </summary>
        /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="reverse">If true, will sort results newest first. (optional, default to false)</param>
        /// <returns>Task of List&lt;APIKey&gt;</returns>
        public async System.Threading.Tasks.Task <List <APIKey> > APIKeyGetAsync(bool?reverse = null)
        {
            ApiResponse <List <APIKey> > localVarResponse = await APIKeyGetAsyncWithHttpInfo(reverse);

            return(localVarResponse.Data);
        }
        public async Task <ApiResponse <AppUserVm> > AddUser([FromBody] AppUserVm userCredentials)
        {
            var defaultErrorResponse = new ApiResponse <AppUserVm>
            {
                ErrorMessage = "Пожалуйста, предоставьте все необходимые данные для создания учетной записи пользователя"
            };

            if (userCredentials == null)
            {
                return(defaultErrorResponse);
            }

            if (string.IsNullOrWhiteSpace(userCredentials.UserName))
            {
                return(defaultErrorResponse);
            }

            if (repository.AppUsers.Items.Any(userEmail => userEmail.Email == userCredentials.Email) ||
                repository.AppUsers.Items.Any(userLogin => userLogin.UserName == userCredentials.UserName))
            {
                return(new ApiResponse <AppUserVm>
                {
                    ErrorMessage = "Пользователь с данной эл. почтой или логином уже существует"
                });
            }

            if (!userCredentials.Email.IsEmail())
            {
                return(new ApiResponse <AppUserVm>
                {
                    ErrorMessage = "Не корректная эл. почта"
                });
            }

            var user = new AppUser
            {
                UserName = userCredentials.UserName.Trim(),
                Email    = userCredentials.Email.Trim()
            };

            user.AppUserCustomRoles = userCredentials.CustomRoles.Where(x => x.IsSelected).Select(cr => new AppUserCustomRole
            {
                CustomRoleId = cr.Id,
                AppUserId    = user.Id
            }).ToList();

            var randomPassword = RandomPasswordGenerator.GenerateRandomPassword();

            var result = await userManager.CreateAsync(user, randomPassword);

            if (result.Succeeded)
            {
                TestProjectEmailSender.SendAccountPasswordEmailAsync(user.Email, randomPassword);

                var customRolesIds = userCredentials.CustomRoles.Where(x => x.IsSelected).Select(r => r.Id).ToList();

                var appRolesToAdd = repository.CustomRoles.Items.Where(cr => customRolesIds.Contains(cr.Id))
                                    .SelectMany(cRole => cRole.AppRoleCustomRoles).Select(x => x.AppRole.Name).ToList();

                var rolesResult = await userManager.AddToRolesAsync(user, appRolesToAdd);

                if (rolesResult.Succeeded)
                {
                    var allRoles = repository.CustomRoles.Items.ToList();

                    var userVm = new AppUserVm(user);

                    userVm.CustomRoles.AddRange(allRoles.Select(r => new CustomRoleVm
                    {
                        Id          = r.Id,
                        Name        = r.Name,
                        Description = r.Description,
                        IsSelected  = customRolesIds.Contains(r.Id)
                    }).OrderBy(x => x.Name));

                    return(new ApiResponse <AppUserVm>
                    {
                        Response = userVm,
                        Message = $"Пользователь успешно создан, пароль от учётной записи будет выслан на почту {userVm.Email} \n ... pass: {randomPassword}"
                    });
                }

                return(new ApiResponse <AppUserVm>
                {
                    ErrorMessage = "Произошла ошибка при обработке вашего запроса"
                });
            }

            return(new ApiResponse <AppUserVm>
            {
                ErrorMessage = result.Errors.AggregateErrors()
            });
        }
Esempio n. 34
0
        /// <summary>
        /// Place an order for a pet
        /// </summary>
        /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="body">order placed for purchasing the pet</param>
        /// <returns>Order</returns>
        public Order PlaceOrder(Order body)
        {
            ApiResponse <Order> localVarResponse = PlaceOrderWithHttpInfo(body);

            return(localVarResponse.Data);
        }
Esempio n. 35
0
        /// <summary>
        /// Returns pet inventories by status Returns a map of status codes to quantities
        /// </summary>
        /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
        /// <returns>Dictionary&lt;string, int?&gt;</returns>
        public Dictionary <string, int?> GetInventory()
        {
            ApiResponse <Dictionary <string, int?> > localVarResponse = GetInventoryWithHttpInfo();

            return(localVarResponse.Data);
        }
Esempio n. 36
0
        /// <summary>
        /// Get automatic order status transition list
        /// </summary>
        /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
        /// <returns>Task of AutomaticTransitionInfos</returns>
        public async System.Threading.Tasks.Task <AutomaticTransitionInfos> GetAutomaticTransitionsAsync()
        {
            ApiResponse <AutomaticTransitionInfos> localVarResponse = await GetAutomaticTransitionsAsyncWithHttpInfo();

            return(localVarResponse.Data);
        }
Esempio n. 37
0
        /// <summary>
        /// Buy dedicated number Buy dedicated number
        /// </summary>
        /// <exception cref="IO.ClickSend.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="dedicatedNumber">Phone number to purchase</param>
        /// <returns>Task of string</returns>
        public async System.Threading.Tasks.Task <string> NumbersBuyByDedicatedNumberPostAsync(string dedicatedNumber)
        {
            ApiResponse <string> localVarResponse = await NumbersBuyByDedicatedNumberPostAsyncWithHttpInfo(dedicatedNumber);

            return(localVarResponse.Data);
        }
        /// <summary>
        /// Get autoshape info.
        /// </summary>
        /// <exception cref="Aspose.Cells.Cloud.SDK.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="name">Document name.</param>
        /// <param name="sheetName">Worksheet name.</param>
        /// <param name="autoshapeNumber">The autoshape number.</param>
        /// <param name="folder">The document folder. (optional)</param>
        /// <returns>Task of System.IO.Stream</returns>
        public async System.Threading.Tasks.Task <System.IO.Stream> CellsAutoshapesGetWorksheetAutoshapeAsync(string name, string sheetName, int?autoshapeNumber, string folder = null)
        {
            ApiResponse <System.IO.Stream> localVarResponse = await CellsAutoshapesGetWorksheetAutoshapeAsyncWithHttpInfo(name, sheetName, autoshapeNumber, folder);

            return(localVarResponse.Data);
        }
        /// <summary>
        /// Get autoshape info.
        /// </summary>
        /// <exception cref="Aspose.Cells.Cloud.SDK.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="name">Document name.</param>
        /// <param name="sheetName">Worksheet name.</param>
        /// <param name="autoshapeNumber">The autoshape number.</param>
        /// <param name="folder">The document folder. (optional)</param>
        /// <returns>System.IO.Stream</returns>
        public System.IO.Stream CellsAutoshapesGetWorksheetAutoshape(string name, string sheetName, int?autoshapeNumber, string folder = null)
        {
            ApiResponse <System.IO.Stream> localVarResponse = CellsAutoshapesGetWorksheetAutoshapeWithHttpInfo(name, sheetName, autoshapeNumber, folder);

            return(localVarResponse.Data);
        }
        /// <summary>
        /// Get worksheet autoshapes info.
        /// </summary>
        /// <exception cref="Aspose.Cells.Cloud.SDK.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="name">Document name.</param>
        /// <param name="sheetName">The worksheet name.</param>
        /// <param name="folder">Document&#39;s folder. (optional)</param>
        /// <returns>AutoShapesResponse</returns>
        public AutoShapesResponse CellsAutoshapesGetWorksheetAutoshapes(string name, string sheetName, string folder = null)
        {
            ApiResponse <AutoShapesResponse> localVarResponse = CellsAutoshapesGetWorksheetAutoshapesWithHttpInfo(name, sheetName, folder);

            return(localVarResponse.Data);
        }
        /// <summary>
        /// Get worksheet autoshapes info.
        /// </summary>
        /// <exception cref="Aspose.Cells.Cloud.SDK.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="name">Document name.</param>
        /// <param name="sheetName">The worksheet name.</param>
        /// <param name="folder">Document&#39;s folder. (optional)</param>
        /// <returns>Task of AutoShapesResponse</returns>
        public async System.Threading.Tasks.Task <AutoShapesResponse> CellsAutoshapesGetWorksheetAutoshapesAsync(string name, string sheetName, string folder = null)
        {
            ApiResponse <AutoShapesResponse> localVarResponse = await CellsAutoshapesGetWorksheetAutoshapesAsyncWithHttpInfo(name, sheetName, folder);

            return(localVarResponse.Data);
        }
        /// <summary>
        /// Used to test the authentication
        /// </summary>
        /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="echo"> (optional)</param>
        /// <returns>string</returns>
        public string CheckoutpaymentgatewayEchoGet(string echo = null)
        {
            ApiResponse <string> localVarResponse = CheckoutpaymentgatewayEchoGetWithHttpInfo(echo);

            return(localVarResponse.Data);
        }
Esempio n. 43
0
        /// <summary>
        /// Get wallet fund records
        /// </summary>
        /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="startDate">Start point for result (optional)</param>
        /// <param name="endDate">End point for result (optional)</param>
        /// <param name="coin">Currency (optional)</param>
        /// <param name="status">Withdraw status (optional)</param>
        /// <param name="page">Page. Default getting first page data (optional)</param>
        /// <param name="limit">Limit for data size per page, max size is 50. Default as showing 20 pieces of data per page (optional)</param>
        /// <returns>Object</returns>
        public Object WalletWithdraw(string startDate = null, string endDate = null, string coin = null, string status = null, string page = null, string limit = null)
        {
            ApiResponse <Object> localVarResponse = WalletWithdrawWithHttpInfo(startDate, endDate, coin, status, page, limit);

            return(localVarResponse.Data);
        }
Esempio n. 44
0
        /// <summary>
        /// Get automatic order status transition list
        /// </summary>
        /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
        /// <returns>AutomaticTransitionInfos</returns>
        public AutomaticTransitionInfos GetAutomaticTransitions()
        {
            ApiResponse <AutomaticTransitionInfos> localVarResponse = GetAutomaticTransitionsWithHttpInfo();

            return(localVarResponse.Data);
        }
Esempio n. 45
0
        /// <summary>
        /// Get all availible dedicated numbers Get all availible dedicated numbers
        /// </summary>
        /// <exception cref="IO.ClickSend.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="page">Page number (optional, default to 1)</param>
        /// <param name="limit">Number of records per page (optional, default to 10)</param>
        /// <returns>string</returns>
        public string NumbersGet(int?page = null, int?limit = null)
        {
            ApiResponse <string> localVarResponse = NumbersGetWithHttpInfo(page, limit);

            return(localVarResponse.Data);
        }
Esempio n. 46
0
        /// <summary>
        /// CreateOrder Creates an [Order](#type-order) that can then be referenced as &#x60;order_id&#x60; in a request to the [Charge](#endpoint-charge) endpoint. Orders specify products for purchase, along with discounts, taxes, and other settings to apply to the purchase.  To associate a created order with a request to the Charge endpoint, provide the order&#39;s &#x60;id&#x60; in the &#x60;order_id&#x60; field of your request.  You cannot modify an order after you create it. If you need to modify an order, instead create a new order with modified details.  To learn more about the Orders API, see the [Orders API Overview](/products/orders/overview).
        /// </summary>
        /// <exception cref="Square.Connect.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="locationId">The ID of the business location to associate the order with.</param>
        /// <param name="body">An object containing the fields to POST for the request.  See the corresponding object definition for field details.</param>
        /// <returns>Task of CreateOrderResponse</returns>
        public async System.Threading.Tasks.Task <CreateOrderResponse> CreateOrderAsync(string locationId, CreateOrderRequest body)
        {
            ApiResponse <CreateOrderResponse> localVarResponse = await CreateOrderAsyncWithHttpInfo(locationId, body);

            return(localVarResponse.Data);
        }
Esempio n. 47
0
        /// <summary>
        /// Buy dedicated number Buy dedicated number
        /// </summary>
        /// <exception cref="IO.ClickSend.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="dedicatedNumber">Phone number to purchase</param>
        /// <returns>string</returns>
        public string NumbersBuyByDedicatedNumberPost(string dedicatedNumber)
        {
            ApiResponse <string> localVarResponse = NumbersBuyByDedicatedNumberPostWithHttpInfo(dedicatedNumber);

            return(localVarResponse.Data);
        }
Esempio n. 48
0
        /// <summary>
        /// CreateOrder Creates an [Order](#type-order) that can then be referenced as &#x60;order_id&#x60; in a request to the [Charge](#endpoint-charge) endpoint. Orders specify products for purchase, along with discounts, taxes, and other settings to apply to the purchase.  To associate a created order with a request to the Charge endpoint, provide the order&#39;s &#x60;id&#x60; in the &#x60;order_id&#x60; field of your request.  You cannot modify an order after you create it. If you need to modify an order, instead create a new order with modified details.  To learn more about the Orders API, see the [Orders API Overview](/products/orders/overview).
        /// </summary>
        /// <exception cref="Square.Connect.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="locationId">The ID of the business location to associate the order with.</param>
        /// <param name="body">An object containing the fields to POST for the request.  See the corresponding object definition for field details.</param>
        /// <returns>CreateOrderResponse</returns>
        public CreateOrderResponse CreateOrder(string locationId, CreateOrderRequest body)
        {
            ApiResponse <CreateOrderResponse> localVarResponse = CreateOrderWithHttpInfo(locationId, body);

            return(localVarResponse.Data);
        }
Esempio n. 49
0
        /// <summary>
        /// Find purchase order by ID For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
        /// </summary>
        /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="orderId">ID of pet that needs to be fetched</param>
        /// <returns>Order</returns>
        public Order GetOrderById(int?orderId)
        {
            ApiResponse <Order> localVarResponse = GetOrderByIdWithHttpInfo(orderId);

            return(localVarResponse.Data);
        }
Esempio n. 50
0
        /// <summary>
        /// BatchRetrieveOrders Retrieves a set of [Order](#type-order)s by their IDs.  If a given Order ID does not exist, the ID is ignored instead of generating an error.
        /// </summary>
        /// <exception cref="Square.Connect.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="locationId">The ID of the orders&#39; associated location.</param>
        /// <param name="body">An object containing the fields to POST for the request.  See the corresponding object definition for field details.</param>
        /// <returns>Task of BatchRetrieveOrdersResponse</returns>
        public async System.Threading.Tasks.Task <BatchRetrieveOrdersResponse> BatchRetrieveOrdersAsync(string locationId, BatchRetrieveOrdersRequest body)
        {
            ApiResponse <BatchRetrieveOrdersResponse> localVarResponse = await BatchRetrieveOrdersAsyncWithHttpInfo(locationId, body);

            return(localVarResponse.Data);
        }
        public async Task ReturnsEveryPageOfIssues()
        {
            var firstPageUrl   = new Uri("repos/fake/repo/issues", UriKind.Relative);
            var secondPageUrl  = new Uri("https://example.com/page/2");
            var firstPageLinks = new Dictionary <string, Uri> {
                { "next", secondPageUrl }
            };
            var firstPageResponse = new ApiResponse <List <Issue> >
                                    (
                CreateResponseWithApiInfo(firstPageLinks),
                new List <Issue>
            {
                CreateIssue(1),
                CreateIssue(2),
                CreateIssue(3)
            }
                                    );
            var thirdPageUrl    = new Uri("https://example.com/page/3");
            var secondPageLinks = new Dictionary <string, Uri> {
                { "next", thirdPageUrl }
            };
            var secondPageResponse = new ApiResponse <List <Issue> >
                                     (
                CreateResponseWithApiInfo(secondPageLinks),
                new List <Issue>
            {
                CreateIssue(4),
                CreateIssue(5),
                CreateIssue(6)
            }
                                     );
            var lastPageResponse = new ApiResponse <List <Issue> >
                                   (
                new Response(),
                new List <Issue>
            {
                CreateIssue(7)
            }
                                   );
            var gitHubClient = Substitute.For <IGitHubClient>();

            gitHubClient.Connection.Get <List <Issue> >(Arg.Is(firstPageUrl),
                                                        Arg.Is <Dictionary <string, string> >(d => d.Count == 4 &&
                                                                                              d["direction"] == "desc" &&
                                                                                              d["state"] == "open" &&
                                                                                              d["sort"] == "created" &&
                                                                                              d["filter"] == "assigned"), Arg.Any <string>())
            .Returns(Task.Factory.StartNew <IApiResponse <List <Issue> > >(() => firstPageResponse));
            gitHubClient.Connection.Get <List <Issue> >(secondPageUrl, null, null)
            .Returns(Task.Factory.StartNew <IApiResponse <List <Issue> > >(() => secondPageResponse));
            gitHubClient.Connection.Get <List <Issue> >(thirdPageUrl, null, null)
            .Returns(Task.Factory.StartNew <IApiResponse <List <Issue> > >(() => lastPageResponse));
            var client = new ObservableIssuesClient(gitHubClient);

            var results = await client.GetAllForRepository("fake", "repo").ToArray();

            Assert.Equal(7, results.Length);
            Assert.Equal(firstPageResponse.Body[0].Number, results[0].Number);
            Assert.Equal(secondPageResponse.Body[1].Number, results[4].Number);
            Assert.Equal(lastPageResponse.Body[0].Number, results[6].Number);
        }
Esempio n. 52
0
        /// <summary>
        /// BatchRetrieveOrders Retrieves a set of [Order](#type-order)s by their IDs.  If a given Order ID does not exist, the ID is ignored instead of generating an error.
        /// </summary>
        /// <exception cref="Square.Connect.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="locationId">The ID of the orders&#39; associated location.</param>
        /// <param name="body">An object containing the fields to POST for the request.  See the corresponding object definition for field details.</param>
        /// <returns>BatchRetrieveOrdersResponse</returns>
        public BatchRetrieveOrdersResponse BatchRetrieveOrders(string locationId, BatchRetrieveOrdersRequest body)
        {
            ApiResponse <BatchRetrieveOrdersResponse> localVarResponse = BatchRetrieveOrdersWithHttpInfo(locationId, body);

            return(localVarResponse.Data);
        }
        /// <summary>
        /// Retrieve a list of API tokens
        /// </summary>
        /// <exception cref="SignRequest.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="page">A page number within the paginated result set. (optional)</param>
        /// <param name="limit">Number of results to return per page. (optional)</param>
        /// <returns>Task of InlineResponse200</returns>
        public async System.Threading.Tasks.Task <InlineResponse200> ApiTokensListAsync(int?page = null, int?limit = null)
        {
            ApiResponse <InlineResponse200> localVarResponse = await ApiTokensListAsyncWithHttpInfo(page, limit);

            return(localVarResponse.Data);
        }
Esempio n. 54
0
        /// <summary>
        /// Get all dedicated numbers by country Get all dedicated numbers by country
        /// </summary>
        /// <exception cref="IO.ClickSend.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="country">Country code to search</param>
        /// <param name="search">Your search pattern or query. (optional)</param>
        /// <param name="searchType">Your strategy for searching, 0 &#x3D; starts with, 1 &#x3D; anywhere, 2 &#x3D; ends with. (optional)</param>
        /// <param name="page">Page number (optional, default to 1)</param>
        /// <param name="limit">Number of records per page (optional, default to 10)</param>
        /// <returns>Task of string</returns>
        public async System.Threading.Tasks.Task <string> NumbersSearchByCountryGetAsync(string country, string search = null, int?searchType = null, int?page = null, int?limit = null)
        {
            ApiResponse <string> localVarResponse = await NumbersSearchByCountryGetAsyncWithHttpInfo(country, search, searchType, page, limit);

            return(localVarResponse.Data);
        }
        /// <summary>
        /// Retrieve a list of API tokens
        /// </summary>
        /// <exception cref="SignRequest.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="page">A page number within the paginated result set. (optional)</param>
        /// <param name="limit">Number of results to return per page. (optional)</param>
        /// <returns>InlineResponse200</returns>
        public InlineResponse200 ApiTokensList(int?page = null, int?limit = null)
        {
            ApiResponse <InlineResponse200> localVarResponse = ApiTokensListWithHttpInfo(page, limit);

            return(localVarResponse.Data);
        }
Esempio n. 56
0
        /// <summary>
        /// Get all dedicated numbers by country Get all dedicated numbers by country
        /// </summary>
        /// <exception cref="IO.ClickSend.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="country">Country code to search</param>
        /// <param name="search">Your search pattern or query. (optional)</param>
        /// <param name="searchType">Your strategy for searching, 0 &#x3D; starts with, 1 &#x3D; anywhere, 2 &#x3D; ends with. (optional)</param>
        /// <param name="page">Page number (optional, default to 1)</param>
        /// <param name="limit">Number of records per page (optional, default to 10)</param>
        /// <returns>string</returns>
        public string NumbersSearchByCountryGet(string country, string search = null, int?searchType = null, int?page = null, int?limit = null)
        {
            ApiResponse <string> localVarResponse = NumbersSearchByCountryGetWithHttpInfo(country, search, searchType, page, limit);

            return(localVarResponse.Data);
        }
Esempio n. 57
0
        /// <summary>
        /// Get your API Keys.
        /// </summary>
        /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="reverse">If true, will sort results newest first. (optional, default to false)</param>
        /// <returns>List&lt;APIKey&gt;</returns>
        public List <APIKey> APIKeyGet(bool?reverse = null)
        {
            ApiResponse <List <APIKey> > localVarResponse = APIKeyGetWithHttpInfo(reverse);

            return(localVarResponse.Data);
        }
Esempio n. 58
0
        /// <summary>
        /// Get all availible dedicated numbers Get all availible dedicated numbers
        /// </summary>
        /// <exception cref="IO.ClickSend.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="page">Page number (optional, default to 1)</param>
        /// <param name="limit">Number of records per page (optional, default to 10)</param>
        /// <returns>Task of string</returns>
        public async System.Threading.Tasks.Task <string> NumbersGetAsync(int?page = null, int?limit = null)
        {
            ApiResponse <string> localVarResponse = await NumbersGetAsyncWithHttpInfo(page, limit);

            return(localVarResponse.Data);
        }
Esempio n. 59
0
        /// <summary>
        /// Get wallet fund records
        /// </summary>
        /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="startDate">Start point for result (optional)</param>
        /// <param name="endDate">End point for result (optional)</param>
        /// <param name="currency">Currency type (optional)</param>
        /// <param name="walletFundType">wallet fund type (optional)</param>
        /// <param name="page">Page. Default getting first page data (optional)</param>
        /// <param name="limit">Limit for data size per page, max size is 50. Default as showing 20 pieces of data per page (optional)</param>
        /// <returns>Task of Object</returns>
        public async System.Threading.Tasks.Task <Object> WalletGetRecordsAsync(string startDate = null, string endDate = null, string currency = null, string walletFundType = null, string page = null, string limit = null)
        {
            ApiResponse <Object> localVarResponse = await WalletGetRecordsAsyncWithHttpInfo(startDate, endDate, currency, walletFundType, page, limit);

            return(localVarResponse.Data);
        }
        /// <summary>
        /// Used to test the authentication
        /// </summary>
        /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="echo"> (optional)</param>
        /// <returns>Task of string</returns>
        public async System.Threading.Tasks.Task <string> CheckoutpaymentgatewayEchoGetAsync(string echo = null)
        {
            ApiResponse <string> localVarResponse = await CheckoutpaymentgatewayEchoGetAsyncWithHttpInfo(echo);

            return(localVarResponse.Data);
        }