|
| 1 | +import { makeBindingClass, Options } from 'graphql-binding'; |
| 2 | +import { GraphQLResolveInfo, GraphQLSchema } from 'graphql'; |
| 3 | +import { IResolvers } from 'graphql-tools/dist/Interfaces'; |
| 4 | +import schema from './schema'; |
| 5 | + |
| 6 | +export interface Query { |
| 7 | + currentUser: <T = User | null>( |
| 8 | + args?: {}, |
| 9 | + info?: GraphQLResolveInfo | string, |
| 10 | + options?: Options |
| 11 | + ) => Promise<T>; |
| 12 | +} |
| 13 | + |
| 14 | +export interface Mutation { |
| 15 | + signupByInvite: <T = AuthPayload>( |
| 16 | + args: { data: SignupByInviteInput }, |
| 17 | + info?: GraphQLResolveInfo | string, |
| 18 | + options?: Options |
| 19 | + ) => Promise<T>; |
| 20 | + signup: <T = AuthPayload>( |
| 21 | + args: { data: SignupInput }, |
| 22 | + info?: GraphQLResolveInfo | string, |
| 23 | + options?: Options |
| 24 | + ) => Promise<T>; |
| 25 | + confirmEmail: <T = AuthPayload>( |
| 26 | + args: { email: String; emailConfirmToken: String }, |
| 27 | + info?: GraphQLResolveInfo | string, |
| 28 | + options?: Options |
| 29 | + ) => Promise<T>; |
| 30 | + inviteUser: <T = UserIdPayload>( |
| 31 | + args: { data: InviteUserInput }, |
| 32 | + info?: GraphQLResolveInfo | string, |
| 33 | + options?: Options |
| 34 | + ) => Promise<T>; |
| 35 | + login: <T = AuthPayload>( |
| 36 | + args: { email: String; password: String }, |
| 37 | + info?: GraphQLResolveInfo | string, |
| 38 | + options?: Options |
| 39 | + ) => Promise<T>; |
| 40 | + changePassword: <T = UserIdPayload>( |
| 41 | + args: { oldPassword: String; newPassword: String }, |
| 42 | + info?: GraphQLResolveInfo | string, |
| 43 | + options?: Options |
| 44 | + ) => Promise<T>; |
| 45 | + updateCurrentUser: <T = User | null>( |
| 46 | + args: { data: UserUpdateInput }, |
| 47 | + info?: GraphQLResolveInfo | string, |
| 48 | + options?: Options |
| 49 | + ) => Promise<T>; |
| 50 | + triggerPasswordReset: <T = TriggerPasswordResetPayload>( |
| 51 | + args: { email: String }, |
| 52 | + info?: GraphQLResolveInfo | string, |
| 53 | + options?: Options |
| 54 | + ) => Promise<T>; |
| 55 | + passwordReset: <T = UserIdPayload>( |
| 56 | + args: { email: String; resetToken: String; password: String }, |
| 57 | + info?: GraphQLResolveInfo | string, |
| 58 | + options?: Options |
| 59 | + ) => Promise<T>; |
| 60 | +} |
| 61 | + |
| 62 | +export interface Subscription {} |
| 63 | + |
| 64 | +export interface Binding { |
| 65 | + query: Query; |
| 66 | + mutation: Mutation; |
| 67 | + subscription: Subscription; |
| 68 | + request: <T = any>( |
| 69 | + query: string, |
| 70 | + variables?: { [key: string]: any } |
| 71 | + ) => Promise<T>; |
| 72 | + delegate( |
| 73 | + operation: 'query' | 'mutation', |
| 74 | + fieldName: string, |
| 75 | + args: { |
| 76 | + [key: string]: any; |
| 77 | + }, |
| 78 | + infoOrQuery?: GraphQLResolveInfo | string, |
| 79 | + options?: Options |
| 80 | + ): Promise<any>; |
| 81 | + delegateSubscription( |
| 82 | + fieldName: string, |
| 83 | + args?: { |
| 84 | + [key: string]: any; |
| 85 | + }, |
| 86 | + infoOrQuery?: GraphQLResolveInfo | string, |
| 87 | + options?: Options |
| 88 | + ): Promise<AsyncIterator<any>>; |
| 89 | + getAbstractResolvers(filterSchema?: GraphQLSchema | string): IResolvers; |
| 90 | +} |
| 91 | + |
| 92 | +export interface BindingConstructor<T> { |
| 93 | + new (...args): T; |
| 94 | +} |
| 95 | + |
| 96 | +export const Binding = makeBindingClass<BindingConstructor<Binding>>({ |
| 97 | + schema |
| 98 | +}); |
| 99 | + |
| 100 | +/** |
| 101 | + * Types |
| 102 | + */ |
| 103 | + |
| 104 | +export interface SignupByInviteInput { |
| 105 | + email: String; |
| 106 | + inviteToken: String; |
| 107 | + password: String; |
| 108 | + name: String; |
| 109 | +} |
| 110 | + |
| 111 | +export interface SignupInput { |
| 112 | + email: String; |
| 113 | + password: String; |
| 114 | + name: String; |
| 115 | +} |
| 116 | + |
| 117 | +export interface InviteUserInput { |
| 118 | + email: String; |
| 119 | +} |
| 120 | + |
| 121 | +export interface UserUpdateInput { |
| 122 | + email?: String; |
| 123 | + name?: String; |
| 124 | +} |
| 125 | + |
| 126 | +export interface AuthPayload { |
| 127 | + token: String; |
| 128 | + user: User; |
| 129 | +} |
| 130 | + |
| 131 | +export interface TriggerPasswordResetPayload { |
| 132 | + ok: Boolean; |
| 133 | +} |
| 134 | + |
| 135 | +export interface User { |
| 136 | + id: ID_Output; |
| 137 | + email: String; |
| 138 | + name: String; |
| 139 | + inviteAccepted: Boolean; |
| 140 | + emailConfirmed: Boolean; |
| 141 | + deletedAt?: DateTime; |
| 142 | + lastLogin?: DateTime; |
| 143 | + joinedAt: DateTime; |
| 144 | + isSuper: Boolean; |
| 145 | +} |
| 146 | + |
| 147 | +export interface UserIdPayload { |
| 148 | + id: ID_Output; |
| 149 | +} |
| 150 | + |
| 151 | +/* |
| 152 | +The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text. |
| 153 | +*/ |
| 154 | +export type String = string; |
| 155 | + |
| 156 | +/* |
| 157 | +The `Boolean` scalar type represents `true` or `false`. |
| 158 | +*/ |
| 159 | +export type Boolean = boolean; |
| 160 | + |
| 161 | +export type DateTime = Date | string; |
| 162 | + |
| 163 | +/* |
| 164 | +The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `"4"`) or integer (such as `4`) input value will be accepted as an ID. |
| 165 | +*/ |
| 166 | +export type ID_Input = string | number; |
| 167 | +export type ID_Output = string; |
0 commit comments