File: webhooks_interface.go

package info (click to toggle)
golang-github-meilisearch-meilisearch-go 0.33.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 956 kB
  • sloc: makefile: 9
file content (39 lines) | stat: -rw-r--r-- 1,781 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package meilisearch

import "context"

type WebhookManager interface {
	WebhookReader

	// AddWebhook add a new webhook to meilisearch.
	AddWebhook(params *AddWebhookRequest) (*Webhook, error)
	// AddWebhookWithContext add a new webhook to meilisearch with a context.
	AddWebhookWithContext(ctx context.Context, params *AddWebhookRequest) (*Webhook, error)

	// UpdateWebhook modifies a previously existing webhook.
	// If the webhook has isEditable to false the HTTP call returns an error.
	UpdateWebhook(uuid string, params *UpdateWebhookRequest) (*Webhook, error)
	// UpdateWebhookWithContext modifies a previously existing webhook with a context.
	// If the webhook has isEditable to false the HTTP call returns an error.
	UpdateWebhookWithContext(ctx context.Context, uuid string, params *UpdateWebhookRequest) (*Webhook, error)

	// DeleteWebhook deletes an existing webhook. Will also fail when the webhook doesn’t exist.
	// If the webhook has isEditable to false the HTTP call returns an error.
	DeleteWebhook(uuid string) error

	// DeleteWebhookWithContext deletes an existing webhook with a context. Will also fail when the webhook doesn’t exist.
	// If the webhook has isEditable to false the HTTP call returns an error.
	DeleteWebhookWithContext(ctx context.Context, uuid string) error
}

type WebhookReader interface {
	// ListWebhooks lists all the webhooks.
	ListWebhooks() (*WebhookResults, error)
	// ListWebhooksWithContext lists all the webhooks with context.
	ListWebhooksWithContext(ctx context.Context) (*WebhookResults, error)

	// GetWebhook gets a webhook by uuid.
	GetWebhook(uuid string) (*Webhook, error)
	// GetWebhookWithContext gets a webhook by uuid with a context.
	GetWebhookWithContext(ctx context.Context, uuid string) (*Webhook, error)
}