Пример #1
0
        /// <summary>
        /// Get player information Get information about a single player by player tag. Player tags can be found either in game or by from clan member lists. Note that player tags start with hash character &#39;#&#39; and that needs to be URL-encoded properly to work in URL, so for example player tag &#39;#2ABC&#39; would become &#39;%232ABC&#39; in the URL.
        /// </summary>
        /// <exception cref="CocApi.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="playerTag">Tag of the player.</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of Player</returns>
        public async System.Threading.Tasks.Task <Player?> FetchPlayerOrDefaultAsync(string playerTag, System.Threading.CancellationToken?cancellationToken = null)
        {
            CocApi.Client.ApiResponse <Player> result = await FetchPlayerResponseAsync(playerTag, cancellationToken).ConfigureAwait(false);

            return(result.IsSuccessStatusCode
                ? result.Data
                : null);
        }
Пример #2
0
        /// <summary>
        /// List clan labels List clan labels
        /// </summary>
        /// <exception cref="CocApi.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="limit">Limit the number of items returned in the response. (optional)</param>
        /// <param name="after">Return only items that occur after this marker. Before marker can be found from the response, inside the &#39;paging&#39; property. Note that only after or before can be specified for a request, not both.  (optional)</param>
        /// <param name="before">Return only items that occur before this marker. Before marker can be found from the response, inside the &#39;paging&#39; property. Note that only after or before can be specified for a request, not both.  (optional)</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of LabelsObject</returns>
        public async System.Threading.Tasks.Task <LabelsObject?> FetchClanLabelsOrDefaultAsync(int?limit = null, string?after = null, string?before = null, System.Threading.CancellationToken?cancellationToken = null)
        {
            CocApi.Client.ApiResponse <LabelsObject> result = await FetchClanLabelsResponseAsync(limit, after, before, cancellationToken).ConfigureAwait(false);

            return(result.IsSuccessStatusCode
                ? result.Data
                : null);
        }
Пример #3
0
        /// <summary>
        /// Get player information Get information about a single player by player tag. Player tags can be found either in game or by from clan member lists. Note that player tags start with hash character &#39;#&#39; and that needs to be URL-encoded properly to work in URL, so for example player tag &#39;#2ABC&#39; would become &#39;%232ABC&#39; in the URL.
        /// </summary>
        /// <exception cref="CocApi.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="playerTag">Tag of the player.</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of Player</returns>
        public async System.Threading.Tasks.Task <Player> FetchPlayerAsync(string playerTag, System.Threading.CancellationToken?cancellationToken = null)
        {
            CocApi.Client.ApiResponse <Player> result = await FetchPlayerResponseAsync(playerTag, cancellationToken).ConfigureAwait(false);

            return(result.Data ?? throw new NullReferenceException());
        }
Пример #4
0
        /// <summary>
        /// List clan labels List clan labels
        /// </summary>
        /// <exception cref="CocApi.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="limit">Limit the number of items returned in the response. (optional)</param>
        /// <param name="after">Return only items that occur after this marker. Before marker can be found from the response, inside the &#39;paging&#39; property. Note that only after or before can be specified for a request, not both.  (optional)</param>
        /// <param name="before">Return only items that occur before this marker. Before marker can be found from the response, inside the &#39;paging&#39; property. Note that only after or before can be specified for a request, not both.  (optional)</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of LabelsObject</returns>
        public async System.Threading.Tasks.Task <LabelsObject> FetchClanLabelsAsync(int?limit = null, string?after = null, string?before = null, System.Threading.CancellationToken?cancellationToken = null)
        {
            CocApi.Client.ApiResponse <LabelsObject> result = await FetchClanLabelsResponseAsync(limit, after, before, cancellationToken).ConfigureAwait(false);

            return(result.Data ?? throw new NullReferenceException());
        }