feat: implement resolvers
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -2,6 +2,13 @@
|
||||
|
||||
package model
|
||||
|
||||
type AddWebhookRequest struct {
|
||||
EventName string `json:"event_name"`
|
||||
Endpoint string `json:"endpoint"`
|
||||
Enabled bool `json:"enabled"`
|
||||
Headers map[string]interface{} `json:"headers"`
|
||||
}
|
||||
|
||||
type AdminLoginInput struct {
|
||||
AdminSecret string `json:"admin_secret"`
|
||||
}
|
||||
@@ -192,6 +199,17 @@ type SignUpInput struct {
|
||||
RedirectURI *string `json:"redirect_uri"`
|
||||
}
|
||||
|
||||
type TestEndpointRequest struct {
|
||||
Endpoint string `json:"endpoint"`
|
||||
EventName string `json:"event_name"`
|
||||
Headers map[string]interface{} `json:"headers"`
|
||||
}
|
||||
|
||||
type TestEndpointResponse struct {
|
||||
HTTPStatus *int64 `json:"http_status"`
|
||||
Response map[string]interface{} `json:"response"`
|
||||
}
|
||||
|
||||
type UpdateAccessInput struct {
|
||||
UserID string `json:"user_id"`
|
||||
}
|
||||
@@ -268,6 +286,14 @@ type UpdateUserInput struct {
|
||||
Roles []*string `json:"roles"`
|
||||
}
|
||||
|
||||
type UpdateWebhookRequest struct {
|
||||
ID string `json:"id"`
|
||||
EventName *string `json:"event_name"`
|
||||
Endpoint *string `json:"endpoint"`
|
||||
Enabled *bool `json:"enabled"`
|
||||
Headers map[string]interface{} `json:"headers"`
|
||||
}
|
||||
|
||||
type User struct {
|
||||
ID string `json:"id"`
|
||||
Email string `json:"email"`
|
||||
@@ -326,12 +352,13 @@ type VerifyEmailInput struct {
|
||||
}
|
||||
|
||||
type Webhook struct {
|
||||
ID string `json:"id"`
|
||||
EventName *string `json:"event_name"`
|
||||
Endpoint *string `json:"endpoint"`
|
||||
Enabled *bool `json:"enabled"`
|
||||
CreatedAt *int64 `json:"created_at"`
|
||||
UpdatedAt *int64 `json:"updated_at"`
|
||||
ID string `json:"id"`
|
||||
EventName *string `json:"event_name"`
|
||||
Endpoint *string `json:"endpoint"`
|
||||
Enabled *bool `json:"enabled"`
|
||||
Headers map[string]interface{} `json:"headers"`
|
||||
CreatedAt *int64 `json:"created_at"`
|
||||
UpdatedAt *int64 `json:"updated_at"`
|
||||
}
|
||||
|
||||
type WebhookLog struct {
|
||||
@@ -349,6 +376,10 @@ type WebhookLogs struct {
|
||||
WebhookLogs []*WebhookLog `json:"webhook_logs"`
|
||||
}
|
||||
|
||||
type WebhookRequest struct {
|
||||
ID string `json:"id"`
|
||||
}
|
||||
|
||||
type Webhooks struct {
|
||||
Pagination *Pagination `json:"pagination"`
|
||||
Webhooks []*Webhook `json:"webhooks"`
|
||||
|
@@ -329,6 +329,7 @@ type Webhook {
|
||||
event_name: String
|
||||
endpoint: String
|
||||
enabled: Boolean
|
||||
headers: Map
|
||||
created_at: Int64
|
||||
updated_at: Int64
|
||||
}
|
||||
@@ -348,11 +349,41 @@ type WebhookLog {
|
||||
updated_at: Int64
|
||||
}
|
||||
|
||||
type TestEndpointResponse {
|
||||
http_status: Int64
|
||||
response: Map
|
||||
}
|
||||
|
||||
input ListWebhookLogRequest {
|
||||
pagination: PaginatedInput!
|
||||
webhook_id: String
|
||||
}
|
||||
|
||||
input AddWebhookRequest {
|
||||
event_name: String!
|
||||
endpoint: String!
|
||||
enabled: Boolean!
|
||||
headers: Map
|
||||
}
|
||||
|
||||
input UpdateWebhookRequest {
|
||||
id: ID!
|
||||
event_name: String
|
||||
endpoint: String
|
||||
enabled: Boolean
|
||||
headers: Map
|
||||
}
|
||||
|
||||
input WebhookRequest {
|
||||
id: ID!
|
||||
}
|
||||
|
||||
input TestEndpointRequest {
|
||||
endpoint: String!
|
||||
event_name: String!
|
||||
headers: Map
|
||||
}
|
||||
|
||||
type WebhookLogs {
|
||||
pagination: Pagination!
|
||||
webhook_logs: [WebhookLog!]!
|
||||
@@ -380,6 +411,10 @@ type Mutation {
|
||||
_revoke_access(param: UpdateAccessInput!): Response!
|
||||
_enable_access(param: UpdateAccessInput!): Response!
|
||||
_generate_jwt_keys(params: GenerateJWTKeysInput!): GenerateJWTKeysResponse!
|
||||
_add_webhook(params: AddWebhookRequest!): Response!
|
||||
_update_webhook(params: UpdateWebhookRequest!): Response!
|
||||
_delete_webhook(params: WebhookRequest!): Response!
|
||||
_test_endpoint(params: TestEndpointRequest!): TestEndpointResponse!
|
||||
}
|
||||
|
||||
type Query {
|
||||
@@ -392,6 +427,7 @@ type Query {
|
||||
_verification_requests(params: PaginatedInput): VerificationRequests!
|
||||
_admin_session: Response!
|
||||
_env: Env!
|
||||
_webhook(params: WebhookRequest!): Webhook!
|
||||
_webhooks(params: PaginatedInput): Webhooks!
|
||||
_webhook_logs(params: ListWebhookLogRequest): WebhookLogs!
|
||||
_webhook_logs(params: ListWebhookLogRequest!): WebhookLogs!
|
||||
}
|
||||
|
@@ -5,7 +5,6 @@ package graph
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/authorizerdev/authorizer/server/graph/generated"
|
||||
"github.com/authorizerdev/authorizer/server/graph/model"
|
||||
@@ -92,6 +91,22 @@ func (r *mutationResolver) GenerateJwtKeys(ctx context.Context, params model.Gen
|
||||
return resolvers.GenerateJWTKeysResolver(ctx, params)
|
||||
}
|
||||
|
||||
func (r *mutationResolver) AddWebhook(ctx context.Context, params model.AddWebhookRequest) (*model.Response, error) {
|
||||
return resolvers.AddWebhookResolver(ctx, params)
|
||||
}
|
||||
|
||||
func (r *mutationResolver) UpdateWebhook(ctx context.Context, params model.UpdateWebhookRequest) (*model.Response, error) {
|
||||
return resolvers.UpdateWebhookResolver(ctx, params)
|
||||
}
|
||||
|
||||
func (r *mutationResolver) DeleteWebhook(ctx context.Context, params model.WebhookRequest) (*model.Response, error) {
|
||||
return resolvers.DeleteWebhookResolver(ctx, params)
|
||||
}
|
||||
|
||||
func (r *mutationResolver) TestEndpoint(ctx context.Context, params model.TestEndpointRequest) (*model.TestEndpointResponse, error) {
|
||||
return resolvers.TestEndpointResolver(ctx, params)
|
||||
}
|
||||
|
||||
func (r *queryResolver) Meta(ctx context.Context) (*model.Meta, error) {
|
||||
return resolvers.MetaResolver(ctx)
|
||||
}
|
||||
@@ -124,12 +139,16 @@ func (r *queryResolver) Env(ctx context.Context) (*model.Env, error) {
|
||||
return resolvers.EnvResolver(ctx)
|
||||
}
|
||||
|
||||
func (r *queryResolver) Webhooks(ctx context.Context, params *model.PaginatedInput) (*model.Webhooks, error) {
|
||||
panic(fmt.Errorf("not implemented"))
|
||||
func (r *queryResolver) Webhook(ctx context.Context, params model.WebhookRequest) (*model.Webhook, error) {
|
||||
return resolvers.WebhookResolver(ctx, params)
|
||||
}
|
||||
|
||||
func (r *queryResolver) WebhookLogs(ctx context.Context, params *model.ListWebhookLogRequest) (*model.WebhookLogs, error) {
|
||||
panic(fmt.Errorf("not implemented"))
|
||||
func (r *queryResolver) Webhooks(ctx context.Context, params *model.PaginatedInput) (*model.Webhooks, error) {
|
||||
return resolvers.WebhooksResolver(ctx, params)
|
||||
}
|
||||
|
||||
func (r *queryResolver) WebhookLogs(ctx context.Context, params model.ListWebhookLogRequest) (*model.WebhookLogs, error) {
|
||||
return resolvers.WebhookLogsResolver(ctx, params)
|
||||
}
|
||||
|
||||
// Mutation returns generated.MutationResolver implementation.
|
||||
|
Reference in New Issue
Block a user