protected override void ProcessRecord()
 {
     ProcessImpl(
         (filter, top, skip) => Api_18_4.Webhooks.GetWebhooks(filter: filter, top: top, skip: skip, count: false),
         id => Api_18_4.Webhooks.GetById(id),
         dto => Webhook.FromDto(dto));
 }
Example #2
0
        protected override void ProcessRecord()
        {
            var dto = new WebhookDto
            {
                Url              = Url,
                Secret           = Secret,
                Enabled          = Enabled ?? true,
                AllowInsecureSsl = AllowInsecureSsl.IsPresent ? AllowInsecureSsl.ToBool() : false,
            };

            if (ParameterSetName == AllEventsSet)
            {
                dto.Events = new List <WebhookEventDto>();
                dto.SubscribeToAllEvents = true;
            }
            else
            {
                dto.Events = Events.Select(e => new WebhookEventDto {
                    EventType = e
                }).ToList();
                dto.SubscribeToAllEvents = false;
            }

            var webhook = Api_19_4.Webhooks.Post(dto);

            WriteObject(Webhook.FromDto(webhook));
        }
Example #3
0
 protected override void ProcessRecord()
 {
     ProcessImpl(
         filter => Api_18_4.Webhooks.GetWebhooks(filter: filter).Value,
         id => Api_18_4.Webhooks.GetById(id),
         dto => Webhook.FromDto(dto));
 }