Пример #1
0
        public async Task <Server> ServerGetAsync(CancellationToken cancellationToken = default(CancellationToken))
        {
            try
            {
                var server = await APIClient.APICallAsync <Server>(HttpMethod.Get, APIEndpoint.ServerGet, cancellationToken : cancellationToken);

                return(server);
            }
            catch (Exception)
            {
                return(null);
            }
        }
Пример #2
0
        public async Task <string> PostHookAsync(object hook, string worldName = null)
        {
            var response = await APIClient.APICallAsync <object>(
                HttpMethod.Post, APIEndpoint.WorldHook, queryStringContent : new { worldName }, bodyContent : hook);

            return(JsonConvert.SerializeObject(response, Formatting.Indented));
        }
Пример #3
0
        public async Task <TokenResponseModel> AuthenticateAsync(
            TokenRequestModel tokenRequest,
            CancellationToken cancellationToken = default(CancellationToken)
            )
        {
            var tokenResponse = await APIClient.APICallAsync <TokenResponseModel>(HttpMethod.Post, APIEndpoint.UserAuthenticate,
                                                                                  bodyContent : tokenRequest,
                                                                                  cancellationToken : cancellationToken);

            APIClient.Token = tokenResponse.Token;

            return(tokenResponse);
        }