CreatePostRequestAsync() public method

public CreatePostRequestAsync ( string relativeUrl, Region region, string body, List addedArguments = null, bool useHttps = true ) : Task
relativeUrl string
region Region
body string
addedArguments List
useHttps bool
return Task
Exemplo n.º 1
0
        /// <summary>
        ///     Creates a tournament provider and returns its object.
        /// </summary>
        /// <param name="region">The region in which the provider will be running tournaments.</param>
        /// <param name="url">
        ///     The provider's callback URL to which tournament game results in this region should be posted. The URL
        ///     must be well-formed, use the http or https protocol, and use the default port for the protocol (http URLs must use
        ///     port 80, https URLs must use port 443).
        /// </param>
        /// <returns>The ID of the provider.</returns>
        public async Task <TournamentProvider> CreateProviderAsync(Region region, string url)
        {
            var body = new Dictionary <string, object> {
                { "url", url }, { "region", region.ToString().ToUpper() }
            };
            var json =
                await
                requester.CreatePostRequestAsync(TournamentRootUrl + CreateProviderUrl, Region.global,
                                                 JsonConvert.SerializeObject(body));

            return(new TournamentProvider {
                Id = int.Parse(json)
            });
        }