diff --git a/plugin/types/pull_request.go b/plugin/types/pull_request.go index 0feecc71..af816e8f 100644 --- a/plugin/types/pull_request.go +++ b/plugin/types/pull_request.go @@ -46,12 +46,30 @@ type GitPullRequestCommentLister interface { // GitPullRequestHandler list, get and create pr function type GitPullRequestHandler interface { + Interface + GitPullRequestLister + GitPullRequestGetter + GitPullRequestCreator +} + +// GitPullRequestLister list pull requests +type GitPullRequestLister interface { Interface ListGitPullRequest( ctx context.Context, option metav1alpha1.GitPullRequestListOption, listOption metav1alpha1.ListOptions, ) (metav1alpha1.GitPullRequestList, error) +} + +// GitPullRequestGetter get a pull request +type GitPullRequestGetter interface { + Interface GetGitPullRequest(ctx context.Context, option metav1alpha1.GitPullRequestOption) (metav1alpha1.GitPullRequest, error) +} + +// GitPullRequestCreator create a new pull request +type GitPullRequestCreator interface { + Interface CreatePullRequest(ctx context.Context, payload metav1alpha1.CreatePullRequestPayload) (metav1alpha1.GitPullRequest, error) } diff --git a/plugin/types/webhook.go b/plugin/types/webhook.go index e98bb786..587906e7 100644 --- a/plugin/types/webhook.go +++ b/plugin/types/webhook.go @@ -28,10 +28,29 @@ import ( // WebhookRegister used to register and manage webhooks type WebhookRegister interface { - // Use the methods below to manage webhooks in the target platform + WebhookCreator + WebhookUpdater + WebhookDeleter + WebhookLister +} + +// WebhookCreator create a new webhook +type WebhookCreator interface { CreateWebhook(ctx context.Context, spec metav1alpha1.WebhookRegisterSpec, secret corev1.Secret) (metav1alpha1.WebhookRegisterStatus, error) +} + +// WebhookUpdater update a webhook +type WebhookUpdater interface { UpdateWebhook(ctx context.Context, spec metav1alpha1.WebhookRegisterSpec, secret corev1.Secret) (metav1alpha1.WebhookRegisterStatus, error) +} + +// WebhookDeleter delete a webhook +type WebhookDeleter interface { DeleteWebhook(ctx context.Context, spec metav1alpha1.WebhookRegisterSpec, secret corev1.Secret) error +} + +// WebhookLister list webhooks +type WebhookLister interface { ListWebhooks(ctx context.Context, uri apis.URL, secret corev1.Secret) ([]metav1alpha1.WebhookRegisterStatus, error) }