public async Task AddFirstReachedWebhook()
        {
            var apiKey = KeyHelper.GetAdminKey();

            using (var api = new GetAddesssApi(new AdminKey(apiKey)))
            {
                var request = new AddFirstLimitReachedWebhookRequest("https://getaddress.io/webhook");

                var result = await api.FirstLimitReachedWebhook.Add(request);

                Assert.IsTrue(result.IsSuccess);
            }
        }
 public async Task <AddFirstLimitReachedWebhookResponse> Add(AddFirstLimitReachedWebhookRequest request)
 {
     return(await Add(Api, request, Path, AdminKey));
 }
        public async static Task <AddFirstLimitReachedWebhookResponse> Add(GetAddesssApi api, AddFirstLimitReachedWebhookRequest request, string path, AdminKey adminKey)
        {
            if (api == null)
            {
                throw new ArgumentNullException(nameof(api));
            }
            if (request == null)
            {
                throw new ArgumentNullException(nameof(request));
            }

            api.SetAuthorizationKey(adminKey);

            var response = await api.Post(path, request);

            var body = await response.Content.ReadAsStringAsync();


            if (response.IsSuccessStatusCode)
            {
                var messageAndId = GetMessageAndId(body);

                return(new AddFirstLimitReachedWebhookResponse.Success((int)response.StatusCode, response.ReasonPhrase, body, messageAndId.Message, messageAndId.Id));
            }

            return(new AddFirstLimitReachedWebhookResponse.Failed((int)response.StatusCode, response.ReasonPhrase, body));
        }
        public async static Task <AddFirstLimitReachedWebhookResponse> Add(GetAddesssApi api, AddFirstLimitReachedWebhookRequest request, string path, AdminKey adminKey)
        {
            var result = await Add(api, new AddWebhookRequest(request.Url), path, adminKey);

            return(result.FormerResult());
        }