示例#1
0
        /// <summary>Snippet for ListSettingsAsync</summary>
        public async Task ListSettingsRequestObjectAsync()
        {
            // Snippet: ListSettingsAsync(ListSettingsRequest, CallSettings)
            // Create client
            ResourceSettingsServiceClient resourceSettingsServiceClient = await ResourceSettingsServiceClient.CreateAsync();

            // Initialize request argument(s)
            ListSettingsRequest request = new ListSettingsRequest
            {
                ParentAsResourceName = new UnparsedResourceName("a/wildcard/resource"),
                View = SettingView.Unspecified,
            };
            // Make the request
            PagedAsyncEnumerable <ListSettingsResponse, Setting> response = resourceSettingsServiceClient.ListSettingsAsync(request);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((Setting item) =>
            {
                // Do something with each item
                Console.WriteLine(item);
            });

            // Or iterate over pages (of server-defined size), performing one RPC per page
            await response.AsRawResponses().ForEachAsync((ListSettingsResponse page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (Setting item in page)
                {
                    // Do something with each item
                    Console.WriteLine(item);
                }
            });

            // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
            int            pageSize   = 10;
            Page <Setting> singlePage = await response.ReadPageAsync(pageSize);

            // Do something with the page of items
            Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
            foreach (Setting item in singlePage)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // End snippet
        }
        /// <summary>
        /// Enumerate the settings in a bucket
        /// </summary>
        /// <exception cref="Cloudmersive.APIClient.NETCore.ConfigurationAPI.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="request">Request to perform the operation on</param>
        /// <returns>Task of ApiResponse (ListSettingsResponse)</returns>
        public async System.Threading.Tasks.Task <ApiResponse <ListSettingsResponse> > SettingsListSettingsAsyncWithHttpInfo(ListSettingsRequest request)
        {
            // verify the required parameter 'request' is set
            if (request == null)
            {
                throw new ApiException(400, "Missing required parameter 'request' when calling SettingsApi->SettingsListSettings");
            }

            var    localVarPath         = "./config/settings/list";
            var    localVarPathParams   = new Dictionary <String, String>();
            var    localVarQueryParams  = new List <KeyValuePair <String, String> >();
            var    localVarHeaderParams = new Dictionary <String, String>(this.Configuration.DefaultHeader);
            var    localVarFormParams   = new Dictionary <String, String>();
            var    localVarFileParams   = new Dictionary <String, FileParameter>();
            Object localVarPostBody     = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json",
                "text/json",
                "application/xml",
                "text/xml",
                "application/x-www-form-urlencoded"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json",
                "text/json",
                "application/xml",
                "text/xml"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);

            if (localVarHttpHeaderAccept != null)
            {
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
            }

            if (request != null && request.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(request); // http body (model) parameter
            }
            else
            {
                localVarPostBody = request; // byte array
            }

            // authentication (Apikey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Apikey")))
            {
                localVarHeaderParams["Apikey"] = this.Configuration.GetApiKeyWithPrefix("Apikey");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse)await this.Configuration.ApiClient.CallApiAsync(localVarPath,
                                                                                                            Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                                                                                                            localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int)localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("SettingsListSettings", localVarResponse);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(new ApiResponse <ListSettingsResponse>(localVarStatusCode,
                                                          localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()),
                                                          (ListSettingsResponse)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ListSettingsResponse))));
        }
        /// <summary>
        /// Enumerate the settings in a bucket
        /// </summary>
        /// <exception cref="Cloudmersive.APIClient.NETCore.ConfigurationAPI.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="request">Request to perform the operation on</param>
        /// <returns>Task of ListSettingsResponse</returns>
        public async System.Threading.Tasks.Task <ListSettingsResponse> SettingsListSettingsAsync(ListSettingsRequest request)
        {
            ApiResponse <ListSettingsResponse> localVarResponse = await SettingsListSettingsAsyncWithHttpInfo(request);

            return(localVarResponse.Data);
        }
        /// <summary>
        /// Enumerate the settings in a bucket
        /// </summary>
        /// <exception cref="Cloudmersive.APIClient.NETCore.ConfigurationAPI.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="request">Request to perform the operation on</param>
        /// <returns>ListSettingsResponse</returns>
        public ListSettingsResponse SettingsListSettings(ListSettingsRequest request)
        {
            ApiResponse <ListSettingsResponse> localVarResponse = SettingsListSettingsWithHttpInfo(request);

            return(localVarResponse.Data);
        }
示例#5
0
 /// <summary>
 /// Lists all the settings that are available on the Cloud resource `parent`.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>A pageable asynchronous sequence of <see cref="Setting"/> resources.</returns>
 public override gax::PagedAsyncEnumerable <ListSettingsResponse, Setting> ListSettingsAsync(ListSettingsRequest request, gaxgrpc::CallSettings callSettings = null)
 {
     Modify_ListSettingsRequest(ref request, ref callSettings);
     return(new gaxgrpc::GrpcPagedAsyncEnumerable <ListSettingsRequest, ListSettingsResponse, Setting>(_callListSettings, request, callSettings));
 }
示例#6
0
 partial void Modify_ListSettingsRequest(ref ListSettingsRequest request, ref gaxgrpc::CallSettings settings);
示例#7
0
 /// <summary>
 /// Lists all the settings that are available on the Cloud resource `parent`.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>A pageable asynchronous sequence of <see cref="Setting"/> resources.</returns>
 public virtual gax::PagedAsyncEnumerable <ListSettingsResponse, Setting> ListSettingsAsync(ListSettingsRequest request, gaxgrpc::CallSettings callSettings = null) =>
 throw new sys::NotImplementedException();