Ejemplo n.º 1
0
        /// <summary>
        /// Retrieves items from pocket
        /// with the given filters
        /// </summary>
        /// <param name="state">The state.</param>
        /// <param name="favorite">The favorite.</param>
        /// <param name="tag">The tag.</param>
        /// <param name="contentType">Type of the content.</param>
        /// <param name="sort">The sort.</param>
        /// <param name="search">The search.</param>
        /// <param name="domain">The domain.</param>
        /// <param name="since">The since.</param>
        /// <param name="count">The count.</param>
        /// <param name="offset">The offset.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns></returns>
        /// <exception cref="PocketException"></exception>
        public async Task <List <PocketItem> > Get(
            State?state             = null,
            bool?favorite           = null,
            string tag              = null,
            ContentType?contentType = null,
            Sort?sort      = null,
            string search  = null,
            string domain  = null,
            DateTime?since = null,
            int?count      = null,
            int?offset     = null,
            CancellationToken cancellationToken = default(CancellationToken)
            )
        {
            RetrieveParameters parameters = new RetrieveParameters()
            {
                State       = state,
                Favorite    = favorite,
                Tag         = tag,
                ContentType = contentType,
                Sort        = sort,
                DetailType  = DetailType.complete,
                Search      = search,
                Domain      = domain,
                Since       = since,
                Count       = count,
                Offset      = offset
            };

            Retrieve response = await Request <Retrieve>("get", cancellationToken, parameters.Convert());

            return(response.Items);
        }
Ejemplo n.º 2
0
        public static async Task <string> GetTagSearchDataAsync(
            NiconicoContext context
            , string tag
            , uint from
            , uint limit
            , Sort?sort
            , Order?order
            )
        {
            var dict = new Dictionary <string, string>();

            dict.Add("__format", "json");

            dict.Add(nameof(tag), tag);
            dict.Add(nameof(from), from.ToString());
            dict.Add(nameof(limit), limit.ToString());
            if (order.HasValue)
            {
                dict.Add(nameof(order), order.Value == Order.Ascending ? "a" : "d");
            }
            if (sort.HasValue)
            {
                dict.Add(nameof(sort), sort.Value.ToShortString());
            }

            return(await context.GetStringAsync(NiconicoUrls.NICOVIDEO_CE_NICOAPI_V1_TAG_SEARCH, dict));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Retrieves items from pocket
        /// with the given filters
        /// </summary>
        /// <param name="state">The state.</param>
        /// <param name="favorite">The favorite.</param>
        /// <param name="tag">The tag.</param>
        /// <param name="contentType">Type of the content.</param>
        /// <param name="sort">The sort.</param>
        /// <param name="search">The search.</param>
        /// <param name="domain">The domain.</param>
        /// <param name="since">The since.</param>
        /// <param name="count">The count.</param>
        /// <param name="offset">The offset.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns></returns>
        /// <exception cref="PocketException"></exception>
        public async Task <IEnumerable <PocketItem> > Get(
            State?state             = null,
            bool?favorite           = null,
            string tag              = null,
            ContentType?contentType = null,
            Sort?sort      = null,
            string search  = null,
            string domain  = null,
            DateTime?since = null,
            int?count      = null,
            int?offset     = null,
            CancellationToken cancellationToken = default(CancellationToken)
            )
        {
            RetrieveParameters parameters = new RetrieveParameters()
            {
                State       = state,
                Favorite    = favorite,
                Tag         = tag,
                ContentType = contentType,
                Sort        = sort,
                DetailType  = DetailType.complete,
                Search      = search,
                Domain      = domain,
                Since       = since.HasValue ? ((DateTime)since).ToUniversalTime() : since,
                Count       = count,
                Offset      = offset
            };

            return((await Request <Retrieve>("get", cancellationToken, parameters.Convert())).Items ?? new List <PocketItem>());
        }
Ejemplo n.º 4
0
        public static Task <string> GetMylistSearchDataAsync(
            NiconicoContext context
            , string str
            , uint from
            , uint limit
            , Sort?sort
            , Order?order
            )
        {
            var dict = new Dictionary <string, string>();

            dict.Add("__format", "json");

            dict.Add(nameof(str), str);
            dict.Add(nameof(from), from.ToString());
            dict.Add(nameof(limit), limit.ToString());
            if (order.HasValue)
            {
                dict.Add(nameof(order), order.Value.ToChar().ToString());
            }

            if (sort.HasValue)
            {
                dict.Add(nameof(sort), sort.Value.ToShortString());
            }


            return(context.GetStringAsync(NiconicoUrls.NICOVIDEO_CE_NICOAPI_V1_MYLIST_SEARCH, dict));
        }
Ejemplo n.º 5
0
 public SearchPhotosRequest(string query,
                            uint?page               = null,
                            uint?perPage            = null,
                            Sort?sort               = null,
                            string[]?collections    = null,
                            ColorFilter?color       = null,
                            Orientation?orientation = null) =>
 (Query, Page, PerPage, Sort, Collections, Color, Orientation) =
Ejemplo n.º 6
0
        public IEnumerable <TaskDto> Get(TaskListType taskListType, int?pageNo, Sort?sort = null, string sortColumn = null)
        {
            if (pageNo == null)
            {
                pageNo = 1;
            }

            return(_taskService.GetTaskList(taskListType, pageNo.Value, sort, sortColumn));
        }
Ejemplo n.º 7
0
 public static Task <VideoListingResponse> GetTagSearchAsync(
     NiconicoContext context
     , string tag
     , uint from
     , uint limit
     , Sort?sort
     , Order?order
     )
 {
     return(GetTagSearchDataAsync(context, tag, from, limit, sort, order)
            .ContinueWith(prevTask => ParseVideoResponseJson(prevTask.Result)));
 }
Ejemplo n.º 8
0
 public Request(string accessToken, string type, string id = null, string measured_from = null, string measured_to = null, int?limit = null, string cursor = null, IEnumerable <Fields> fields = null, Sort?sort = null)
 {
     AccessToken  = accessToken;
     Type         = type;
     Id           = id;
     MeasuredFrom = measured_from;
     MeasuredTo   = measured_to;
     Limit        = limit;
     Cursor       = cursor;
     Fields       = fields;
     Sort         = sort;
 }
Ejemplo n.º 9
0
        public WordsList ListCustomWords(string customizationId, WordType?wordType, Sort?sort)
        {
            if (string.IsNullOrEmpty(customizationId))
            {
                throw new ArgumentNullException($"{nameof(customizationId)}");
            }

            WordsList result = null;

            try
            {
                var request =
                    this.Client.WithAuthentication(this.UserName, this.Password)
                    .GetAsync($"{this.Endpoint}{PATH_CUSTOM_MODEL}/{customizationId}/words");

                if (wordType.HasValue)
                {
                    request.WithArgument("word_type", wordType.Value.ToString().ToLower());
                }

                if (sort.HasValue)
                {
                    switch (sort.Value)
                    {
                    case Sort.AscendingAlphabetical:
                        request.WithArgument("sort", "+alphabetical");
                        break;

                    case Sort.DescendingAlphabetical:
                        request.WithArgument("sort", "-alphabetical");
                        break;

                    case Sort.AscendingCount:
                        request.WithArgument("sort", "+count");
                        break;

                    case Sort.DescendingCount:
                        request.WithArgument("sort", "-count");
                        break;
                    }
                }

                result =
                    request.As <WordsList>()
                    .Result;
            }
            catch (AggregateException ae)
            {
                throw ae.InnerException as ServiceResponseException;
            }

            return(result);
        }
Ejemplo n.º 10
0
 public static Task <MylistSearchResponse> GetMylistSearchAsync(
     NiconicoContext context
     , string keyword
     , uint from
     , uint limit
     , Sort?sort
     , Order?order
     )
 {
     return(GetMylistSearchDataAsync(context, keyword, from, limit, sort, order)
            .ContinueWith(prevTask => ParseVideoResponseJson(prevTask.Result)));
 }
Ejemplo n.º 11
0
        public async Task <Response <List <Image> > > GetTopicGallery(int topicId, Sort?sort = null, int?page = null)
        {
            //{topicId}/{sort}/{page}
            string uri = "topics/" + topicId;

            if (sort != null)
            {
                if (page != null)
                {
                    uri += "/" + page;
                }
            }
            return(await networkHelper.GetRequest <List <Image> >(uri));
        }
Ejemplo n.º 12
0
 public VideosResponse Videos(
     string[] id,
     string user_id,
     string game_id,
     string after,
     string before,
     string first,
     string language,
     Period?period,
     Sort?sort,
     VideoType?type)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 13
0
        public WordsList ListCustomWords(string customizationId, WordType?wordType, Sort?sort)
        {
            if (string.IsNullOrEmpty(customizationId))
            {
                throw new ArgumentNullException($"{nameof(customizationId)}");
            }

            try
            {
                var request = RepositoryClient.WithAuthentication(ApiKeys.SpeechToTextUsername, ApiKeys.SpeechToTextPassword)
                              .GetAsync($"{ApiKeys.SpeechToTextEndpoint}{customizationsUrl}/{customizationId}/words");

                if (wordType.HasValue)
                {
                    request.WithArgument("word_type", wordType.Value.ToString().ToLower());
                }

                if (sort.HasValue)
                {
                    switch (sort.Value)
                    {
                    case Sort.AscendingAlphabetical:
                        request.WithArgument("sort", "+alphabetical");
                        break;

                    case Sort.DescendingAlphabetical:
                        request.WithArgument("sort", "-alphabetical");
                        break;

                    case Sort.AscendingCount:
                        request.WithArgument("sort", "+count");
                        break;

                    case Sort.DescendingCount:
                        request.WithArgument("sort", "-count");
                        break;
                    }
                }

                var result = request.As <WordsList>()
                             .Result;

                return(result);
            }
            catch (AggregateException ae)
            {
                throw ae.InnerException as ServiceResponseException;
            }
        }
Ejemplo n.º 14
0
        public WordsList ListCustomWords(string customizationId, WordType?wordType, Sort?sort)
        {
            try
            {
                var result = SpeechToTextRepository.ListCustomWords(customizationId, wordType, sort);

                return(result);
            }
            catch (Exception ex)
            {
                Logger.Error("SpeechToTextService.ListCustomWords failed", this, ex);
            }

            return(null);
        }
Ejemplo n.º 15
0
        public async Task <IEnumerable <Article> > GetAllArticlesAsync(string keyword,
                                                                       string titleKeyword,
                                                                       string sources,
                                                                       string domains,
                                                                       string excludedDomains,
                                                                       DateTime?fromDate,
                                                                       DateTime?toDate,
                                                                       Language?language,
                                                                       Sort?sortBy,
                                                                       int?pageSize,
                                                                       int?page)
        {
            var articles = await _newsService.GetAllArticlesAsync(keyword, titleKeyword, sources, domains, excludedDomains, fromDate, toDate, language, sortBy, pageSize, page);

            return(articles);
        }
Ejemplo n.º 16
0
        public async Task <Response <List <Image> > > SearchGallery(string query, Sort?sort = null, int?page = null)
        {
            //gallery/search/{sort}/{page}
            string uri = "gallery/search";

            if (sort != null)
            {
                uri += "/" + sort.ToString().ToLower();
                if (page != null)
                {
                    uri += "/" + page;
                }
            }
            uri = $"{uri}?q={query}";
            return(await networkHelper.GetRequest <List <Image> >(uri));
        }
Ejemplo n.º 17
0
 public Task <Mylist.MylistSearchResponse> MylistSearchAsync(
     string keyword
     , uint from   = 0
     , uint limit  = 30
     , Sort?sort   = null
     , Order?order = null
     )
 {
     return(Mylist.MylistSearchClient.GetMylistSearchAsync(
                this._context
                , keyword
                , from
                , limit
                , sort
                , order
                ));
 }
Ejemplo n.º 18
0
 public Task <Video.VideoListingResponse> VideoSearchWithTagAsync(
     string tag
     , uint from   = 0
     , uint limit  = 30
     , Sort?sort   = null
     , Order?order = null
     )
 {
     return(Video.VideoSearchClient.GetTagSearchAsync(
                this._context
                , tag
                , from
                , limit
                , sort
                , order
                ));
 }
Ejemplo n.º 19
0
        public async Task <Response <List <Image> > > GetTopicGallery(int topicId, Sort?sort = null, Window?window = null, int?page = null)
        {
            //{topicId}/{sort}/{window}/{page}
            string uri = "topics/" + topicId;

            if (sort != null)
            {
                uri += "/" + sort.ToString().ToLower();
                if (window != null)
                {
                    uri += "/" + window.ToString().ToLower();

                    if (page != null)
                    {
                        uri += "/" + page;
                    }
                }
            }
            return(await networkHelper.GetRequest <List <Image> >(uri));
        }
Ejemplo n.º 20
0
        internal override void Compile(Compiler compiler)
        {
            CompileAttributes(compiler);
            CheckEmpty(compiler);
            if (_selectKey == Compiler.InvalidQueryKey)
            {
                _selectKey = compiler.AddQuery(".");
            }

            _forwardCompatibility = compiler.ForwardCompatibility;
            _manager = compiler.CloneScopeManager();

            _lang      = ParseLang(PrecalculateAvt(ref _langAvt));
            _dataType  = ParseDataType(PrecalculateAvt(ref _dataTypeAvt), _manager);
            _order     = ParseOrder(PrecalculateAvt(ref _orderAvt));
            _caseOrder = ParseCaseOrder(PrecalculateAvt(ref _caseOrderAvt));

            if (_langAvt == null && _dataTypeAvt == null && _orderAvt == null && _caseOrderAvt == null)
            {
                _sort = new Sort(_selectKey, _lang, _dataType, _order, _caseOrder);
            }
        }
Ejemplo n.º 21
0
        public static IQueryParams GetQueryParams(this Request request)
        {
            dynamic count        = request.Query["count"];
            dynamic start        = request.Query["start"];
            dynamic sort         = request.Query["sort"];
            dynamic sortProperty = request.Query["sortIndex"];

            Sort?_sort = null;

            if (sort != null)
            {
                _sort = (sort == "AS") ? Sort.Ascending : Sort.Descending;
            }

            return(new QueryParams
            {
                Count = count != null ? count : null,
                Sort = (_sort != null) ? _sort : null,
                SortProperty = sortProperty != null ? sortProperty : null,
                Start = start != null ? start : null
            });
        }
        public IList <TaskDto> GetTaskList(TaskListType taskListType, int pageNo, Sort?sort = null, string sortColumn = null)
        {
            var taskBatchSize = _settingService.GetTaskBatchSize();

            IEnumerable <Task> taskList = _taskProvider.GetTaskList(taskListType);

            Func <Task, object> funcTaskKeySelector = null;

            if (sort != null &&
                !string.IsNullOrEmpty(sortColumn) &&
                _selectors.TryGetValue(sortColumn, out funcTaskKeySelector))
            {
                taskList = sort == Sort.Asc ? taskList.OrderBy(funcTaskKeySelector)
                                            : taskList.OrderByDescending(funcTaskKeySelector);
            }

            if (pageNo != Consts.AllTasks)
            {
                taskList = taskList.Skip((pageNo - 1) * taskBatchSize).Take(taskBatchSize);
            }

            return(taskList.Select(ConvertToDto).ToList());
        }
Ejemplo n.º 23
0
        public static async Task <AggregateResponse> GetPolygonAggregatesBarsV2(this HttpClient client, string apiKey, string symbol, int multiplier, AggregateTimespan timespan,
                                                                                LocalDate from, LocalDate to, CancellationToken cancellationToken = default, bool?unadjusted = null, Sort?sort = null, int?limit = null)
        {
            if (to < from)
            {
                throw new ArgumentException($"To '{to}' must not be earlier than from '{from}'.", nameof(to));
            }

            var url = ApiUrl
                      .AppendPathSegments(ApiVersionV2, AggsString, TickerString, symbol, RangeString, multiplier, timespan.ToString().ToLower(), from.ToString(DateFormat, CultureInfo.InvariantCulture), to.ToString(DateFormat, CultureInfo.InvariantCulture))
                      .SetQueryParamIfNotNull(nameof(unadjusted), unadjusted)
                      .SetQueryParamIfNotNull(nameof(sort), sort)
                      .SetQueryParamIfNotNull(nameof(limit), limit);

            return(await GetResponse <AggregateResponse>(client, apiKey, url, cancellationToken));
        }
Ejemplo n.º 24
0
        public async Task <Response <List <Image> > > GetSubreddditGallery(string subreddit, Sort?sort = null, Window?window = null, int?page = null)
        {
            //{ subreddit}/{ sort}/{ window}/{ page}
            string uri = "gallery/r/" + subreddit;

            if (sort != null)
            {
                uri += "/" + sort.ToString().ToLower();
                if (window != null)
                {
                    uri += "/" + window.ToString().ToLower();

                    if (page != null)
                    {
                        uri += "/" + page;
                    }
                }
            }
            return(await networkHelper.GetRequest <List <Image> >(uri));
        }
Ejemplo n.º 25
0
        /// <summary>
        /// Gets the gallery
        /// </summary>
        /// <param name="section"></param>
        /// <param name="sort"></param>
        /// <param name="page"></param>
        /// <param name="showViral">Used only when section is "user"</param>
        /// <returns></returns>
        public async Task <Response <List <Image> > > GetGallery(Section?section = null, Sort?sort = null, int?page = null, bool?showViral = null)
        {
            string uri = "gallery";

            if (section != null)
            {
                uri += "/" + section.ToString().ToLower();
                if (sort != null)
                {
                    if (page != null)
                    {
                        uri += "/" + page;
                    }
                }
            }
            if (showViral != null)
            {
                uri += ("?showViral=" + showViral.ToString().ToLower());
            }
            var response = await networkHelper.GetRequest <List <Image> >(uri);

            return(response);
        }
Ejemplo n.º 26
0
        public async Task <Response <List <Image> > > GetGallery(Section?section = null, Sort?sort = null, Window?window = null, bool?showViral = null, int?page = null)
        {
            string uri = "gallery";

            if (section != null)
            {
                uri += "/" + section.ToString().ToLower();
                if (sort != null)
                {
                    uri += "/" + sort.ToString().ToLower();
                    if (window != null)
                    {
                        uri += "/" + window.ToString().ToLower();
                        if (showViral != null)
                        {
                            uri += "/" + showViral.ToString();
                            if (page != null)
                            {
                                uri += "/" + page;
                            }
                        }
                    }
                }
            }
            return(await networkHelper.GetRequest <List <Image> >(uri));
        }
Ejemplo n.º 27
0
        /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
        /// <summary>Returns a list of airports and cities matching a given keyword.</summary>
        /// <param name="subType">sub type of the location (AIRPORT and/or CITY)</param>
        /// <param name="keyword">keyword that should represent the start of a word in a city or airport name or code</param>
        /// <param name="countryCode">Country code of the location using [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code format (e.g. US).</param>
        /// <param name="pagelimit">maximum items in one page</param>
        /// <param name="pageoffset">start index of the requested page</param>
        /// <param name="sort">defines on which attribute the sorting will be done:
        /// * analytics.travelers.score - sort by the number of travelers by airport or city, the airports and cities with the highest traffic are on top of the results</param>
        /// <param name="view">select the level of information of the reply:
        /// * LIGHT - Gives only the IATACode, name, detailedName, cityName and countryName
        /// * FULL - Adds on top of the LIGHT information the timeZoneOffset, geocode, detailed address and travelers.score
        /// default option is FULL</param>
        /// <returns>Successful Operation</returns>
        /// <exception cref="ApiException">A server side error occurred.</exception>
        public async System.Threading.Tasks.Task <Success> GetAirportCitySearchAsync(System.Collections.Generic.IEnumerable <Anonymous> subType, string keyword, string countryCode, int?pagelimit, int?pageoffset, Sort?sort, View?view, System.Threading.CancellationToken cancellationToken)
        {
            if (subType == null)
            {
                throw new System.ArgumentNullException("subType");
            }

            if (keyword == null)
            {
                throw new System.ArgumentNullException("keyword");
            }

            var urlBuilder_ = new System.Text.StringBuilder();

            urlBuilder_.Append("reference-data/locations?");
            foreach (var item_ in subType)
            {
                urlBuilder_.Append(System.Uri.EscapeDataString("subType") + "=").Append(System.Uri.EscapeDataString(ConvertToString(item_, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
            }
            urlBuilder_.Append(System.Uri.EscapeDataString("keyword") + "=").Append(System.Uri.EscapeDataString(ConvertToString(keyword, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
            if (countryCode != null)
            {
                urlBuilder_.Append(System.Uri.EscapeDataString("countryCode") + "=").Append(System.Uri.EscapeDataString(ConvertToString(countryCode, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
            }
            if (pagelimit != null)
            {
                urlBuilder_.Append(System.Uri.EscapeDataString("page[limit]") + "=").Append(System.Uri.EscapeDataString(ConvertToString(pagelimit, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
            }
            if (pageoffset != null)
            {
                urlBuilder_.Append(System.Uri.EscapeDataString("page[offset]") + "=").Append(System.Uri.EscapeDataString(ConvertToString(pageoffset, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
            }
            if (sort != null)
            {
                urlBuilder_.Append(System.Uri.EscapeDataString("sort") + "=").Append(System.Uri.EscapeDataString(ConvertToString(sort, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
            }
            if (view != null)
            {
                urlBuilder_.Append(System.Uri.EscapeDataString("view") + "=").Append(System.Uri.EscapeDataString(ConvertToString(view, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
            }
            urlBuilder_.Length--;

            var client_ = _httpClient;

            try
            {
                using (var request_ = new System.Net.Http.HttpRequestMessage())
                {
                    request_.Method = new System.Net.Http.HttpMethod("GET");
                    request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/vnd.amadeus+json"));

                    PrepareRequest(client_, request_, urlBuilder_);
                    var url_ = urlBuilder_.ToString();
                    request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
                    PrepareRequest(client_, request_, url_);

                    var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);

                    try
                    {
                        var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
                        if (response_.Content != null && response_.Content.Headers != null)
                        {
                            foreach (var item_ in response_.Content.Headers)
                            {
                                headers_[item_.Key] = item_.Value;
                            }
                        }

                        ProcessResponse(client_, response_);

                        var status_ = ((int)response_.StatusCode).ToString();
                        if (status_ == "200")
                        {
                            var objectResponse_ = await ReadObjectResponseAsync <Success>(response_, headers_).ConfigureAwait(false);

                            return(objectResponse_.Object);
                        }
                        else
                        if (status_ == "400")
                        {
                            var objectResponse_ = await ReadObjectResponseAsync <Error_400>(response_, headers_).ConfigureAwait(false);

                            throw new ApiException <Error_400>("code    | title                                 \n------- | ------------------------------------- \n477     | INVALID FORMAT\n572     | INVALID OPTION \n2781    | INVALID LENGTH\n4926    | INVALID DATA RECEIVED               \n32171   | MANDATORY DATA MISSING \t     \n", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null);
                        }
                        else
                        {
                            var objectResponse_ = await ReadObjectResponseAsync <Error_500>(response_, headers_).ConfigureAwait(false);

                            throw new ApiException <Error_500>("Unexpected Error", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null);
                        }
                    }
                    finally
                    {
                        if (response_ != null)
                        {
                            response_.Dispose();
                        }
                    }
                }
            }
            finally
            {
            }
        }
Ejemplo n.º 28
0
 /// <summary>Returns a list of airports and cities matching a given keyword.</summary>
 /// <param name="subType">sub type of the location (AIRPORT and/or CITY)</param>
 /// <param name="keyword">keyword that should represent the start of a word in a city or airport name or code</param>
 /// <param name="countryCode">Country code of the location using [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code format (e.g. US).</param>
 /// <param name="pagelimit">maximum items in one page</param>
 /// <param name="pageoffset">start index of the requested page</param>
 /// <param name="sort">defines on which attribute the sorting will be done:
 /// * analytics.travelers.score - sort by the number of travelers by airport or city, the airports and cities with the highest traffic are on top of the results</param>
 /// <param name="view">select the level of information of the reply:
 /// * LIGHT - Gives only the IATACode, name, detailedName, cityName and countryName
 /// * FULL - Adds on top of the LIGHT information the timeZoneOffset, geocode, detailed address and travelers.score
 /// default option is FULL</param>
 /// <returns>Successful Operation</returns>
 /// <exception cref="ApiException">A server side error occurred.</exception>
 public System.Threading.Tasks.Task <Success> GetAirportCitySearchAsync(System.Collections.Generic.IEnumerable <Anonymous> subType, string keyword, string countryCode, int?pagelimit, int?pageoffset, Sort?sort, View?view)
 {
     return(GetAirportCitySearchAsync(subType, keyword, countryCode, pagelimit, pageoffset, sort, view, System.Threading.CancellationToken.None));
 }
Ejemplo n.º 29
0
        SqlBuilder DynamicSqlBuilder(DateTime?eventStart, DateTime?eventEnd, string correlationId, Fields?orderBy, Sort?sortOrder,
                                     string siteId, string webId, string listId, string docId, string itemName, string itemFullUrl, string modifiedBy, int topRecords)
        {
            var correlationIdGuid = ValidateGuid(correlationId);
            var siteIdGuid        = ValidateGuid(siteId);
            var webIdGuid         = ValidateGuid(webId);
            var listIdGuid        = ValidateGuid(listId);
            var docIdGuid         = ValidateGuid(docId);

            var topQuery   = topRecords > 0 ? string.Format("TOP({0}) * ", _topRecords) : @"* ";
            var orderQuery = string.Empty;

            if (orderBy.HasValue && orderBy != Fields.NoField)
            {
                orderQuery = string.Format("{0}", orderBy.Value);

                if (sortOrder.HasValue && sortOrder != Sort.NoOrder)
                {
                    orderQuery = string.Format("{0} {1}", orderQuery, sortOrder.Value);
                }
            }

            var query = SQL
                        .SELECT(topQuery)
                        .FROM("EventCache ")
                        .WITH("(NoLock)")
                        .WHERE()
                        ._If(eventStart.HasValue && eventStart != DateTime.MinValue,
                             string.Format("EventTime > '{0}'", eventStart))
                        ._If(eventEnd.HasValue && eventEnd != DateTime.MaxValue, string.Format("EventTime < '{0}'", eventEnd))
                        ._If(correlationIdGuid != Guid.Empty, string.Format("CorrelationId = '{0}'", correlationIdGuid))
                        ._If(siteIdGuid != Guid.Empty, string.Format("SiteId = '{0}'", siteIdGuid))
                        ._If(webIdGuid != Guid.Empty, string.Format("WebId = '{0}'", webIdGuid))
                        ._If(listIdGuid != Guid.Empty, string.Format("ListId = '{0}'", listIdGuid))
                        ._If(docIdGuid != Guid.Empty, string.Format("DocId = '{0}'", docIdGuid))
                        ._If(!string.IsNullOrEmpty(itemName), string.Format("ItemName LIKE '%{0}%'", itemName))
                        ._If(!string.IsNullOrEmpty(itemFullUrl), string.Format("ItemFullUrl LIKE '%{0}%'", itemFullUrl))
                        ._If(!string.IsNullOrEmpty(modifiedBy), string.Format("ModifiedBy LIKE '%{0}%'", modifiedBy));

            if (!string.IsNullOrEmpty(orderQuery))
            {
                query.ORDER_BY(orderQuery);
            }

            return(query);
        }
Ejemplo n.º 30
0
 public Task <IEnumerable <PocketItem> > Get(State?state = null, bool?favorite = null, string tag = null, ContentType?contentType = null, Sort?sort = null, string search = null, string domain = null, DateTime?since = null, int?count = null, int?offset = null, CancellationToken cancellationToken = new CancellationToken())
 {
     throw new NotImplementedException();
 }