Exemple #1
0
        /// <summary>
        /// Initializes the request object with the given query options. This is only used for
        /// the collection API, because the record API only takes one mandatory id parameter.
        /// </summary>
        /// <param name="options">The query parameters object.</param>
        /// <returns>A RestRequest with all the query parameters set.</returns>
        private RestRequest CreateRequest(TleRecordCollectionOptions options)
        {
            // We allow the options object to be null, because the user may want to not set any
            // additional options

            var request = new RestRequest();

            // Set all possible options
            if (options?.Search != null)
            {
                request.AddQueryParameter(OptionsStrings.Search, options.Search);
            }

            if (options?.Prn != null)
            {
                request.AddQueryParameter(OptionsStrings.Prn, options.Prn.ToString());
            }

            if (options?.Sort != null)
            {
                request.AddQueryParameter(OptionsStrings.Sort, options.Sort.ToString());
            }

            if (options?.SortDir != null)
            {
                request.AddQueryParameter(OptionsStrings.SortDir, options.SortDir);
            }

            if (options?.Page != null)
            {
                request.AddQueryParameter(OptionsStrings.Page, options.Page.ToString());
            }

            if (options?.PageSize != null)
            {
                request.AddQueryParameter(OptionsStrings.PageSize, options.PageSize.ToString());
            }

            return(request);
        }
Exemple #2
0
        /// <summary>
        /// Returns a collection of TLE records with default pagination.
        /// </summary>
        /// <param name="options">The query parameters for the collection request.</param>
        /// <returns>A TleRecordCollection.</returns>
        public TleRecordCollection GetAllTleRecords(TleRecordCollectionOptions options = null)
        {
            RestRequest request = CreateRequest(options);

            return(Execute <TleRecordCollection>(request));
        }