public async void CRUDTest() { var webhookService = new WebHookService(ApiService, SearchService); var model = new CreateWebHookModel { Type = WebHookType.Site, URL = "https://api.monsite.com/key=d4s5qd4f8sf" }; // Création string webhookId = await webhookService.Create(model); // Listing var WebHooks = await webhookService.List(); var webhook = WebHooks.Find(w => w.Id == webhookId); Assert.NotNull(webhook); Assert.Equal(model.Type, webhook.Type); Assert.Equal(model.URL, webhook.URL); // Delete await webhookService.Delete(webhookId); // Listing WebHooks = await webhookService.List(); Assert.False(WebHooks.Exists(w => w.Id == webhookId)); }
/// <summary> /// Création d'un webhook /// </summary> /// <param name="createWebHookModel">Modèle de création du webhook</param> /// <returns>Identifiant du webhook créé</returns> public Task <string> Create(CreateWebHookModel createWebHookModel) { return(_apiService.Post <CreateWebHookModel, LabelIdModel <string> >($"{BaseRoot}", createWebHookModel) .ContinueWith(r => r.Result.Id)); }