Example #1
0
        private async Task <dynamic> SearchByAnythingAsync(String Uri, IDictionary <FilterSearch, String> Query = null, Int32 Page = 1, Int32 PerPage = 20, FilterSearch filterSearch = FilterSearch.id, SortOrder sortOrder = SortOrder.asc)
        {
            dynamic Result = "";

            try {
                Result = await $@"{UrlApi}/{Uri}?Page={Page}&per_Page={PerPage}&sort_by={filterSearch.ToString()}&sort_order={sortOrder.ToString()}{QueryString(Query)}"
                         .WithBasicAuth(Convert.ToString(Authorization), "")
                         .GetJsonAsync();
            } catch (FlurlHttpException Except) {
                FExceptionHlp = new FlurlExceptionHlp();
                String ExceptResult = FExceptionHlp.ConvertToJson(Except);
                throw new Exception(ExceptResult);
            }
            return(Result);
        }
Example #2
0
        private async Task <dynamic> SearchByAnythingAsync(String Uri, IDictionary <FilterSearch, String> Query = null, Int32 Page = 1, Int32 PerPage = 20, FilterSearch filterSearch = FilterSearch.id, SortOrder sortOrder = SortOrder.asc)
        {
            ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => { return(true); };
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            dynamic Result = "";

            try {
                Result = await $@"{UrlApi}/{Uri}?Page={Page}&per_Page={PerPage}&sort_by={filterSearch.ToString()}&sort_order={sortOrder.ToString()}{QueryString(Query)}"
                         .WithBasicAuth(Convert.ToString(Authorization), "")
                         .GetJsonAsync();
            } catch (FlurlHttpException Except) {
                FExceptionHlp = new FlurlExceptionHlp();
                String ExceptResult = FExceptionHlp.ConvertToJson(Except);
                throw new Exception(ExceptResult);
            }
            return(Result);
        }