diff --git a/packages/api/src/generated/graphql.ts b/packages/api/src/generated/graphql.ts index 201e76621..d5626cd88 100644 --- a/packages/api/src/generated/graphql.ts +++ b/packages/api/src/generated/graphql.ts @@ -394,6 +394,30 @@ export type CreateReminderSuccess = { reminder: Reminder; }; +export type CreateWebhookError = { + __typename?: 'CreateWebhookError'; + errorCodes: Array; +}; + +export enum CreateWebhookErrorCode { + BadRequest = 'BAD_REQUEST', + Unauthorized = 'UNAUTHORIZED' +} + +export type CreateWebhookInput = { + contentType?: InputMaybe; + eventTypes: Array>; + method?: InputMaybe; + url: Scalars['String']; +}; + +export type CreateWebhookResult = CreateWebhookError | CreateWebhookSuccess; + +export type CreateWebhookSuccess = { + __typename?: 'CreateWebhookSuccess'; + webhook: Webhook; +}; + export type DeleteHighlightError = { __typename?: 'DeleteHighlightError'; errorCodes: Array; @@ -811,6 +835,7 @@ export type Mutation = { createNewsletterEmail: CreateNewsletterEmailResult; createReaction: CreateReactionResult; createReminder: CreateReminderResult; + createWebhook: CreateWebhookResult; deleteHighlight: DeleteHighlightResult; deleteHighlightReply: DeleteHighlightReplyResult; deleteLabel: DeleteLabelResult; @@ -892,6 +917,11 @@ export type MutationCreateReminderArgs = { }; +export type MutationCreateWebhookArgs = { + input: CreateWebhookInput; +}; + + export type MutationDeleteHighlightArgs = { highlightId: Scalars['ID']; }; @@ -2073,6 +2103,30 @@ export type UserSuccess = { user: User; }; +export type Webhook = { + __typename?: 'Webhook'; + active: Scalars['Boolean']; + contentType?: Maybe; + createdAt: Scalars['Date']; + eventTypes: Array; + id: Scalars['ID']; + method?: Maybe; + updatedAt: Scalars['Date']; + url: Scalars['String']; +}; + +export enum WebhookEvent { + HighlightCreated = 'HIGHLIGHT_CREATED', + HighlightDeleted = 'HIGHLIGHT_DELETED', + HighlightUpdated = 'HIGHLIGHT_UPDATED', + LabelCreated = 'LABEL_CREATED', + LabelDeleted = 'LABEL_DELETED', + LabelUpdated = 'LABEL_UPDATED', + PageCreated = 'PAGE_CREATED', + PageDeleted = 'PAGE_DELETED', + PageUpdated = 'PAGE_UPDATED' +} + export type ResolverTypeWrapper = Promise | T; @@ -2209,6 +2263,11 @@ export type ResolversTypes = { CreateReminderInput: CreateReminderInput; CreateReminderResult: ResolversTypes['CreateReminderError'] | ResolversTypes['CreateReminderSuccess']; CreateReminderSuccess: ResolverTypeWrapper; + CreateWebhookError: ResolverTypeWrapper; + CreateWebhookErrorCode: CreateWebhookErrorCode; + CreateWebhookInput: CreateWebhookInput; + CreateWebhookResult: ResolversTypes['CreateWebhookError'] | ResolversTypes['CreateWebhookSuccess']; + CreateWebhookSuccess: ResolverTypeWrapper; Date: ResolverTypeWrapper; DeleteHighlightError: ResolverTypeWrapper; DeleteHighlightErrorCode: DeleteHighlightErrorCode; @@ -2456,6 +2515,8 @@ export type ResolversTypes = { UsersResult: ResolversTypes['UsersError'] | ResolversTypes['UsersSuccess']; UsersSuccess: ResolverTypeWrapper; UserSuccess: ResolverTypeWrapper; + Webhook: ResolverTypeWrapper; + WebhookEvent: WebhookEvent; }; /** Mapping between all available schema types and the resolvers parents */ @@ -2512,6 +2573,10 @@ export type ResolversParentTypes = { CreateReminderInput: CreateReminderInput; CreateReminderResult: ResolversParentTypes['CreateReminderError'] | ResolversParentTypes['CreateReminderSuccess']; CreateReminderSuccess: CreateReminderSuccess; + CreateWebhookError: CreateWebhookError; + CreateWebhookInput: CreateWebhookInput; + CreateWebhookResult: ResolversParentTypes['CreateWebhookError'] | ResolversParentTypes['CreateWebhookSuccess']; + CreateWebhookSuccess: CreateWebhookSuccess; Date: Scalars['Date']; DeleteHighlightError: DeleteHighlightError; DeleteHighlightReplyError: DeleteHighlightReplyError; @@ -2708,6 +2773,7 @@ export type ResolversParentTypes = { UsersResult: ResolversParentTypes['UsersError'] | ResolversParentTypes['UsersSuccess']; UsersSuccess: UsersSuccess; UserSuccess: UserSuccess; + Webhook: Webhook; }; export type SanitizeDirectiveArgs = { @@ -2963,6 +3029,20 @@ export type CreateReminderSuccessResolvers; }; +export type CreateWebhookErrorResolvers = { + errorCodes?: Resolver, ParentType, ContextType>; + __isTypeOf?: IsTypeOfResolverFn; +}; + +export type CreateWebhookResultResolvers = { + __resolveType: TypeResolveFn<'CreateWebhookError' | 'CreateWebhookSuccess', ParentType, ContextType>; +}; + +export type CreateWebhookSuccessResolvers = { + webhook?: Resolver; + __isTypeOf?: IsTypeOfResolverFn; +}; + export interface DateScalarConfig extends GraphQLScalarTypeConfig { name: 'Date'; } @@ -3295,6 +3375,7 @@ export type MutationResolvers; createReaction?: Resolver>; createReminder?: Resolver>; + createWebhook?: Resolver>; deleteHighlight?: Resolver>; deleteHighlightReply?: Resolver>; deleteLabel?: Resolver>; @@ -3928,6 +4009,18 @@ export type UserSuccessResolvers; }; +export type WebhookResolvers = { + active?: Resolver; + contentType?: Resolver, ParentType, ContextType>; + createdAt?: Resolver; + eventTypes?: Resolver, ParentType, ContextType>; + id?: Resolver; + method?: Resolver, ParentType, ContextType>; + updatedAt?: Resolver; + url?: Resolver; + __isTypeOf?: IsTypeOfResolverFn; +}; + export type Resolvers = { AddPopularReadError?: AddPopularReadErrorResolvers; AddPopularReadResult?: AddPopularReadResultResolvers; @@ -3971,6 +4064,9 @@ export type Resolvers = { CreateReminderError?: CreateReminderErrorResolvers; CreateReminderResult?: CreateReminderResultResolvers; CreateReminderSuccess?: CreateReminderSuccessResolvers; + CreateWebhookError?: CreateWebhookErrorResolvers; + CreateWebhookResult?: CreateWebhookResultResolvers; + CreateWebhookSuccess?: CreateWebhookSuccessResolvers; Date?: GraphQLScalarType; DeleteHighlightError?: DeleteHighlightErrorResolvers; DeleteHighlightReplyError?: DeleteHighlightReplyErrorResolvers; @@ -4132,6 +4228,7 @@ export type Resolvers = { UsersResult?: UsersResultResolvers; UsersSuccess?: UsersSuccessResolvers; UserSuccess?: UserSuccessResolvers; + Webhook?: WebhookResolvers; }; export type DirectiveResolvers = { diff --git a/packages/api/src/generated/schema.graphql b/packages/api/src/generated/schema.graphql index d6c81bf3e..79525bf81 100644 --- a/packages/api/src/generated/schema.graphql +++ b/packages/api/src/generated/schema.graphql @@ -342,6 +342,28 @@ type CreateReminderSuccess { reminder: Reminder! } +type CreateWebhookError { + errorCodes: [CreateWebhookErrorCode!]! +} + +enum CreateWebhookErrorCode { + BAD_REQUEST + UNAUTHORIZED +} + +input CreateWebhookInput { + contentType: String + eventTypes: [WebhookEvent]! + method: String + url: String! +} + +union CreateWebhookResult = CreateWebhookError | CreateWebhookSuccess + +type CreateWebhookSuccess { + webhook: Webhook! +} + scalar Date type DeleteHighlightError { @@ -719,6 +741,7 @@ type Mutation { createNewsletterEmail: CreateNewsletterEmailResult! createReaction(input: CreateReactionInput!): CreateReactionResult! createReminder(input: CreateReminderInput!): CreateReminderResult! + createWebhook(input: CreateWebhookInput!): CreateWebhookResult! deleteHighlight(highlightId: ID!): DeleteHighlightResult! deleteHighlightReply(highlightReplyId: ID!): DeleteHighlightReplyResult! deleteLabel(id: ID!): DeleteLabelResult! @@ -1607,3 +1630,26 @@ type UsersSuccess { type UserSuccess { user: User! } + +type Webhook { + active: Boolean! + contentType: String + createdAt: Date! + eventTypes: [WebhookEvent!]! + id: ID! + method: String + updatedAt: Date! + url: String! +} + +enum WebhookEvent { + HIGHLIGHT_CREATED + HIGHLIGHT_DELETED + HIGHLIGHT_UPDATED + LABEL_CREATED + LABEL_DELETED + LABEL_UPDATED + PAGE_CREATED + PAGE_DELETED + PAGE_UPDATED +} diff --git a/packages/api/src/schema.ts b/packages/api/src/schema.ts index 2a0e8959a..c198b7f13 100755 --- a/packages/api/src/schema.ts +++ b/packages/api/src/schema.ts @@ -1571,6 +1571,51 @@ const schema = gql` NOT_FOUND } + input CreateWebhookInput { + url: String! + eventTypes: [WebhookEvent]! + contentType: String + method: String + } + + enum WebhookEvent { + PAGE_CREATED + PAGE_UPDATED + PAGE_DELETED + HIGHLIGHT_CREATED + HIGHLIGHT_UPDATED + HIGHLIGHT_DELETED + LABEL_CREATED + LABEL_UPDATED + LABEL_DELETED + } + + union CreateWebhookResult = CreateWebhookSuccess | CreateWebhookError + + type CreateWebhookSuccess { + webhook: Webhook! + } + + type Webhook { + id: ID! + url: String! + eventTypes: [WebhookEvent!]! + contentType: String + method: String + active: Boolean! + createdAt: Date! + updatedAt: Date! + } + + type CreateWebhookError { + errorCodes: [CreateWebhookErrorCode!]! + } + + enum CreateWebhookErrorCode { + UNAUTHORIZED + BAD_REQUEST + } + # Mutations type Mutation { googleLogin(input: GoogleLoginInput!): LoginResult! @@ -1636,6 +1681,7 @@ const schema = gql` unsubscribe(name: String!): UnsubscribeResult! subscribe(name: String!): SubscribeResult! addPopularRead(name: String!): AddPopularReadResult! + createWebhook(input: CreateWebhookInput!): CreateWebhookResult! } # FIXME: remove sort from feedArticles after all cached tabs are closed