ExDoppler.Webhooks (ExDoppler v1.0.1)

View Source

Module for interacting with ExDoppler.Webhook

๐Ÿ“– Resources

Summary

Functions

Creates a new ExDoppler.Webhook, given a project, a webhook URL, and options

Same as create_webhook/3 but won't wrap a successful response in {:ok, response}

Same as delete_webhook/2 but won't wrap a successful response in {:ok, response}

Disables a ExDoppler.Webhook, given a project and a webhook

Same as disable_webhook/2 but won't wrap a successful response in {:ok, response}

Enables a ExDoppler.Webhook, given a project and a webhook

Same as enable_webhook/2 but won't wrap a successful response in {:ok, response}

Retrieves a ExDoppler.Webhook, given a project and a webhook id

Same as get_webhook/2 but won't wrap a successful response in {:ok, response}

Same as list_webhooks/1 but won't wrap a successful response in {:ok, response}

Functions

create_webhook(project, url, opts \\ [])

Creates a new ExDoppler.Webhook, given a project, a webhook URL, and options

๐Ÿท๏ธ Params

โคต๏ธ Returns

โœ… On Success

  {:ok, %ExDoppler.Webhook{...}}

โŒ On Failure

  {:error, err}

๐Ÿ’ป Examples

iex> alias ExDoppler.Project
iex> alias ExDoppler.Webhook
iex> alias ExDoppler.Webhooks
iex> _ = Webhooks.delete_webhook!(%Project{name: "example-project"}, %Webhook{id: "doc-webhook"})
iex> {:ok, webhook} = Webhooks.create_webhook(%Project{name: "example-project"}, "https://httpbin.org/post", name: "doc-webhook", enable_configs: ["dev"], authentication: %{type: :Basic, username: "joe", password: "dirt"})
iex> :ok = Webhooks.delete_webhook!(%Project{name: "example-project"}, webhook)

๐Ÿ“– Resources

create_webhook!(project, url, opts \\ [])

Same as create_webhook/3 but won't wrap a successful response in {:ok, response}

delete_webhook(project, webhook)

Deletes a ExDoppler.Webhook

๐Ÿท๏ธ Params

  • project - The ExDoppler.Project for which you want the webhooks (e.g %Project{name: "example-project"})

โคต๏ธ Returns

โœ… On Success

  {:ok, {:success, true}

โŒ On Failure

  {:error, err}

๐Ÿ’ป Examples

iex> alias ExDoppler.Project
iex> alias ExDoppler.Webhook
iex> alias ExDoppler.Webhooks
iex> _ = Webhooks.delete_webhook!(%Project{name: "example-project"}, %Webhook{id: "doc-webhook"})
iex> {:ok, webhook} = Webhooks.create_webhook(%Project{name: "example-project"}, "https://httpbin.org/post", name: "doc-webhook", enable_configs: ["dev"], authentication: %{type: :Basic, username: "joe", password: "dirt"})
iex> :ok = Webhooks.delete_webhook!(%Project{name: "example-project"}, webhook)

๐Ÿ“– Resources

delete_webhook!(project, webhook)

Same as delete_webhook/2 but won't wrap a successful response in {:ok, response}

disable_webhook(project, webhook)

Disables a ExDoppler.Webhook, given a project and a webhook

๐Ÿท๏ธ Params

  • project - The ExDoppler.Project for which you want the webhooks (e.g %Project{name: "example-project"})
  • webhook - The ExDoppler.Webhook to enable (e.g %Webhook{id: "my-new-webhook" ...}

โคต๏ธ Returns

โœ… On Success

  {:ok, %ExDoppler.Webhook{...}}

โŒ On Failure

  {:error, err}

๐Ÿ’ป Examples

iex> alias ExDoppler.Project
iex> alias ExDoppler.Webhook
iex> alias ExDoppler.Webhooks
iex> _ = Webhooks.delete_webhook!(%Project{name: "example-project"}, %Webhook{id: "doc-webhook"})
iex> {:ok, webhook} = Webhooks.create_webhook(%Project{name: "example-project"}, "https://httpbin.org/post", name: "doc-webhook", enable_configs: ["dev"], authentication: %{type: :Basic, username: "joe", password: "dirt"})
iex> {:ok, %Webhook{enabled: false}} = Webhooks.disable_webhook(%Project{name: "example-project"}, webhook)
iex> :ok = Webhooks.delete_webhook!(%Project{name: "example-project"}, webhook)

๐Ÿ“– Resources

disable_webhook!(project, webhook)

Same as disable_webhook/2 but won't wrap a successful response in {:ok, response}

enable_webhook(project, webhook)

Enables a ExDoppler.Webhook, given a project and a webhook

๐Ÿท๏ธ Params

  • project - The ExDoppler.Project for which you want the webhooks (e.g %Project{name: "example-project"})
  • webhook - The ExDoppler.Webhook to enable (e.g %Webhook{id: "my-new-webhook" ...}

โคต๏ธ Returns

โœ… On Success

  {:ok, %ExDoppler.Webhook{...}}

โŒ On Failure

  {:error, err}

๐Ÿ’ป Examples

iex> alias ExDoppler.Project
iex> alias ExDoppler.Webhook
iex> alias ExDoppler.Webhooks
iex> _ = Webhooks.delete_webhook!(%Project{name: "example-project"}, %Webhook{id: "doc-webhook"})
iex> {:ok, webhook} = Webhooks.create_webhook(%Project{name: "example-project"}, "https://httpbin.org/post", name: "doc-webhook", enable_configs: ["dev"], authentication: %{type: :Basic, username: "joe", password: "dirt"})
iex> {:ok, %Webhook{enabled: true}} = Webhooks.enable_webhook(%Project{name: "example-project"}, webhook)
iex> :ok = Webhooks.delete_webhook!(%Project{name: "example-project"}, webhook)

๐Ÿ“– Resources

enable_webhook!(project, webhook)

Same as enable_webhook/2 but won't wrap a successful response in {:ok, response}

get_webhook(project, id)

Retrieves a ExDoppler.Webhook, given a project and a webhook id

๐Ÿท๏ธ Params

  • project - The ExDoppler.Project for which you want the webhooks (e.g %Project{name: "example-project"})
  • id - ID of the webhook to retrieve

โคต๏ธ Returns

โœ… On Success

  {:ok, %ExDoppler.Webhook{...}}

โŒ On Failure

  {:error, err}

๐Ÿ’ป Examples

iex> alias ExDoppler.Project
iex> alias ExDoppler.Webhook
iex> alias ExDoppler.Webhooks
iex> _ = Webhooks.delete_webhook!(%Project{name: "example-project"}, %Webhook{id: "doc-webhook"})
iex> {:ok, webhook} = Webhooks.create_webhook(%Project{name: "example-project"}, "https://httpbin.org/post", name: "doc-webhook", enable_configs: ["dev"], authentication: %{type: :Basic, username: "joe", password: "dirt"})
iex> {:ok, webhook} = Webhooks.get_webhook(%Project{name: "example-project"}, webhook.id)
iex> :ok = Webhooks.delete_webhook!(%Project{name: "example-project"}, webhook)

๐Ÿ“– Resources

get_webhook!(project, id)

Same as get_webhook/2 but won't wrap a successful response in {:ok, response}

list_webhooks(project)

Lists ExDoppler.Webhook

๐Ÿท๏ธ Params

  • project - The ExDoppler.Project for which you want the webhooks (e.g %Project{name: "example-project"})

โคต๏ธ Returns

โœ… On Success

  {:ok, [%ExDoppler.Webhook{...} ...]}

โŒ On Failure

  {:error, err}

๐Ÿ’ป Examples

iex> alias ExDoppler.Project
iex> alias ExDoppler.Webhooks
iex> {:ok, _webhooks} = Webhooks.list_webhooks(%Project{name: "example-project"})

๐Ÿ“– Resources

list_webhooks!(project)

Same as list_webhooks/1 but won't wrap a successful response in {:ok, response}