Add createWebhook gql schema

This commit is contained in:
Hongbo Wu 2022-05-25 20:56:18 +08:00
parent fe09487a6a
commit aaab02c9d8
3 changed files with 189 additions and 0 deletions

View file

@ -394,6 +394,30 @@ export type CreateReminderSuccess = {
reminder: Reminder;
};
export type CreateWebhookError = {
__typename?: 'CreateWebhookError';
errorCodes: Array<CreateWebhookErrorCode>;
};
export enum CreateWebhookErrorCode {
BadRequest = 'BAD_REQUEST',
Unauthorized = 'UNAUTHORIZED'
}
export type CreateWebhookInput = {
contentType?: InputMaybe<Scalars['String']>;
eventTypes: Array<InputMaybe<WebhookEvent>>;
method?: InputMaybe<Scalars['String']>;
url: Scalars['String'];
};
export type CreateWebhookResult = CreateWebhookError | CreateWebhookSuccess;
export type CreateWebhookSuccess = {
__typename?: 'CreateWebhookSuccess';
webhook: Webhook;
};
export type DeleteHighlightError = {
__typename?: 'DeleteHighlightError';
errorCodes: Array<DeleteHighlightErrorCode>;
@ -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<Scalars['String']>;
createdAt: Scalars['Date'];
eventTypes: Array<WebhookEvent>;
id: Scalars['ID'];
method?: Maybe<Scalars['String']>;
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<T> = Promise<T> | T;
@ -2209,6 +2263,11 @@ export type ResolversTypes = {
CreateReminderInput: CreateReminderInput;
CreateReminderResult: ResolversTypes['CreateReminderError'] | ResolversTypes['CreateReminderSuccess'];
CreateReminderSuccess: ResolverTypeWrapper<CreateReminderSuccess>;
CreateWebhookError: ResolverTypeWrapper<CreateWebhookError>;
CreateWebhookErrorCode: CreateWebhookErrorCode;
CreateWebhookInput: CreateWebhookInput;
CreateWebhookResult: ResolversTypes['CreateWebhookError'] | ResolversTypes['CreateWebhookSuccess'];
CreateWebhookSuccess: ResolverTypeWrapper<CreateWebhookSuccess>;
Date: ResolverTypeWrapper<Scalars['Date']>;
DeleteHighlightError: ResolverTypeWrapper<DeleteHighlightError>;
DeleteHighlightErrorCode: DeleteHighlightErrorCode;
@ -2456,6 +2515,8 @@ export type ResolversTypes = {
UsersResult: ResolversTypes['UsersError'] | ResolversTypes['UsersSuccess'];
UsersSuccess: ResolverTypeWrapper<UsersSuccess>;
UserSuccess: ResolverTypeWrapper<UserSuccess>;
Webhook: ResolverTypeWrapper<Webhook>;
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<ContextType = ResolverContext, Parent
__isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
};
export type CreateWebhookErrorResolvers<ContextType = ResolverContext, ParentType extends ResolversParentTypes['CreateWebhookError'] = ResolversParentTypes['CreateWebhookError']> = {
errorCodes?: Resolver<Array<ResolversTypes['CreateWebhookErrorCode']>, ParentType, ContextType>;
__isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
};
export type CreateWebhookResultResolvers<ContextType = ResolverContext, ParentType extends ResolversParentTypes['CreateWebhookResult'] = ResolversParentTypes['CreateWebhookResult']> = {
__resolveType: TypeResolveFn<'CreateWebhookError' | 'CreateWebhookSuccess', ParentType, ContextType>;
};
export type CreateWebhookSuccessResolvers<ContextType = ResolverContext, ParentType extends ResolversParentTypes['CreateWebhookSuccess'] = ResolversParentTypes['CreateWebhookSuccess']> = {
webhook?: Resolver<ResolversTypes['Webhook'], ParentType, ContextType>;
__isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
};
export interface DateScalarConfig extends GraphQLScalarTypeConfig<ResolversTypes['Date'], any> {
name: 'Date';
}
@ -3295,6 +3375,7 @@ export type MutationResolvers<ContextType = ResolverContext, ParentType extends
createNewsletterEmail?: Resolver<ResolversTypes['CreateNewsletterEmailResult'], ParentType, ContextType>;
createReaction?: Resolver<ResolversTypes['CreateReactionResult'], ParentType, ContextType, RequireFields<MutationCreateReactionArgs, 'input'>>;
createReminder?: Resolver<ResolversTypes['CreateReminderResult'], ParentType, ContextType, RequireFields<MutationCreateReminderArgs, 'input'>>;
createWebhook?: Resolver<ResolversTypes['CreateWebhookResult'], ParentType, ContextType, RequireFields<MutationCreateWebhookArgs, 'input'>>;
deleteHighlight?: Resolver<ResolversTypes['DeleteHighlightResult'], ParentType, ContextType, RequireFields<MutationDeleteHighlightArgs, 'highlightId'>>;
deleteHighlightReply?: Resolver<ResolversTypes['DeleteHighlightReplyResult'], ParentType, ContextType, RequireFields<MutationDeleteHighlightReplyArgs, 'highlightReplyId'>>;
deleteLabel?: Resolver<ResolversTypes['DeleteLabelResult'], ParentType, ContextType, RequireFields<MutationDeleteLabelArgs, 'id'>>;
@ -3928,6 +4009,18 @@ export type UserSuccessResolvers<ContextType = ResolverContext, ParentType exten
__isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
};
export type WebhookResolvers<ContextType = ResolverContext, ParentType extends ResolversParentTypes['Webhook'] = ResolversParentTypes['Webhook']> = {
active?: Resolver<ResolversTypes['Boolean'], ParentType, ContextType>;
contentType?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
createdAt?: Resolver<ResolversTypes['Date'], ParentType, ContextType>;
eventTypes?: Resolver<Array<ResolversTypes['WebhookEvent']>, ParentType, ContextType>;
id?: Resolver<ResolversTypes['ID'], ParentType, ContextType>;
method?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
updatedAt?: Resolver<ResolversTypes['Date'], ParentType, ContextType>;
url?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
__isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
};
export type Resolvers<ContextType = ResolverContext> = {
AddPopularReadError?: AddPopularReadErrorResolvers<ContextType>;
AddPopularReadResult?: AddPopularReadResultResolvers<ContextType>;
@ -3971,6 +4064,9 @@ export type Resolvers<ContextType = ResolverContext> = {
CreateReminderError?: CreateReminderErrorResolvers<ContextType>;
CreateReminderResult?: CreateReminderResultResolvers<ContextType>;
CreateReminderSuccess?: CreateReminderSuccessResolvers<ContextType>;
CreateWebhookError?: CreateWebhookErrorResolvers<ContextType>;
CreateWebhookResult?: CreateWebhookResultResolvers<ContextType>;
CreateWebhookSuccess?: CreateWebhookSuccessResolvers<ContextType>;
Date?: GraphQLScalarType;
DeleteHighlightError?: DeleteHighlightErrorResolvers<ContextType>;
DeleteHighlightReplyError?: DeleteHighlightReplyErrorResolvers<ContextType>;
@ -4132,6 +4228,7 @@ export type Resolvers<ContextType = ResolverContext> = {
UsersResult?: UsersResultResolvers<ContextType>;
UsersSuccess?: UsersSuccessResolvers<ContextType>;
UserSuccess?: UserSuccessResolvers<ContextType>;
Webhook?: WebhookResolvers<ContextType>;
};
export type DirectiveResolvers<ContextType = ResolverContext> = {

View file

@ -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
}

View file

@ -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