-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathsanctum.graphql
166 lines (136 loc) · 4.17 KB
/
sanctum.graphql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
type User {
id: ID!
name: String!
email: String!
}
type AccessToken {
token: String!
}
input LoginInput {
email: String! @rules(apply: ["email"])
password: String!
}
type LogoutResponse {
status: LogoutStatus!
message: String!
}
enum LogoutStatus {
"""TOKEN_REVOKED"""
TOKEN_REVOKED
}
type RegisterResponse {
token: String
status: RegisterStatus!
}
enum RegisterStatus {
"""MUST_VERIFY_EMAIL"""
MUST_VERIFY_EMAIL
"""SUCCESS"""
SUCCESS
}
type EmailVerificationResponse {
status: EmailVerificationStatus!
}
enum EmailVerificationStatus {
"""VERIFIED"""
VERIFIED
}
type ResendEmailVerificationResponse {
status: ResendEmailVerificationStatus!
}
enum ResendEmailVerificationStatus {
"""EMAIL_SENT"""
EMAIL_SENT
}
input VerifyEmailInput {
id: ID!
hash: String!
expires: Int
signature: String
}
input ResendEmailVerificationInput {
email: String! @rules(apply: ["email"])
verification_url: VerificationUrlInput
}
input RegisterInput {
name: String!
email: String! @rules(apply: ["bail", "email", "unique:users,email"])
password: String! @rules(apply: ["confirmed"])
password_confirmation: String!
verification_url: VerificationUrlInput
}
"""
The url used to verify the email address.
Use __ID__ and __HASH__ to inject values.
e.g; `https://my-front-end.com/verify-email?id=__ID__&hash=__HASH__`
If the API uses signed email verification urls
you must also use __EXPIRES__ and __SIGNATURE__
e.g; `https://my-front-end.com/verify-email?id=__ID__&hash=__HASH__&expires=__EXPIRES__&signature=__SIGNATURE__`
"""
input VerificationUrlInput {
url: String! @rules(apply: ["url"])
}
input ForgotPasswordInput {
email: String! @rules(apply: ["email"])
reset_password_url: ResetPasswordUrlInput
}
"""
The url used to reset the password.
Use the `__EMAIL__` and `__TOKEN__` placeholders to inject the reset password email and token.
e.g; `https://my-front-end.com?reset-password?email=__EMAIL__&token=__TOKEN__`
"""
input ResetPasswordUrlInput {
url: String! @rules(apply: ["url"])
}
type ForgotPasswordResponse {
status: ForgotPasswordStatus!
message: String
}
enum ForgotPasswordStatus {
"""EMAIL_SENT"""
EMAIL_SENT
}
input ResetPasswordInput {
email: String! @rules(apply: ["email"])
token: String!
password: String! @rules(apply: ["confirmed"])
password_confirmation: String!
}
type ResetPasswordResponse {
status: ResetPasswordStatus!
message: String
}
enum ResetPasswordStatus {
"""PASSWORD_RESET"""
PASSWORD_RESET
}
input UpdatePasswordInput {
current_password: String!
password: String! @rules(apply: ["confirmed"])
password_confirmation: String!
}
type UpdatePasswordResponse {
status: UpdatePasswordStatus!
}
enum UpdatePasswordStatus {
"""PASSWORD_UPDATED"""
PASSWORD_UPDATED
}
extend type Mutation {
login(input: LoginInput @spread): AccessToken!
@field(resolver: "DanielDeWit\\LighthouseSanctum\\GraphQL\\Mutations\\Login")
logout: LogoutResponse! @guard
@field(resolver: "DanielDeWit\\LighthouseSanctum\\GraphQL\\Mutations\\Logout")
register(input: RegisterInput @spread): RegisterResponse!
@field(resolver: "DanielDeWit\\LighthouseSanctum\\GraphQL\\Mutations\\Register")
verifyEmail(input: VerifyEmailInput! @spread): EmailVerificationResponse!
@field(resolver: "DanielDeWit\\LighthouseSanctum\\GraphQL\\Mutations\\VerifyEmail")
resendEmailVerification(input: ResendEmailVerificationInput! @spread): ResendEmailVerificationResponse!
@field(resolver: "DanielDeWit\\LighthouseSanctum\\GraphQL\\Mutations\\ResendEmailVerification")
forgotPassword(input: ForgotPasswordInput! @spread): ForgotPasswordResponse!
@field(resolver: "DanielDeWit\\LighthouseSanctum\\GraphQL\\Mutations\\ForgotPassword")
resetPassword(input: ResetPasswordInput! @spread): ResetPasswordResponse!
@field(resolver: "DanielDeWit\\LighthouseSanctum\\GraphQL\\Mutations\\ResetPassword")
updatePassword(input: UpdatePasswordInput! @spread): UpdatePasswordResponse! @guard
@field(resolver: "DanielDeWit\\LighthouseSanctum\\GraphQL\\Mutations\\UpdatePassword")
}