username: string,
password: string,
videoQuota = 1000000,
+ videoQuotaDaily = -1,
role: UserRole = UserRole.USER,
specialStatus = 200
) {
password,
role,
email: username + '@example.com',
- videoQuota
+ videoQuota,
+ videoQuotaDaily
}
return request(url)
accessToken: string,
email?: string,
videoQuota?: number,
+ videoQuotaDaily?: number,
role?: UserRole
}) {
const path = '/api/v1/users/' + options.userId
const toSend = {}
if (options.email !== undefined && options.email !== null) toSend['email'] = options.email
if (options.videoQuota !== undefined && options.videoQuota !== null) toSend['videoQuota'] = options.videoQuota
+ if (options.videoQuotaDaily !== undefined && options.videoQuotaDaily !== null) toSend['videoQuotaDaily'] = options.videoQuotaDaily
if (options.role !== undefined && options.role !== null) toSend['role'] = options.role
return makePutBodyRequest({
})
}
+function askSendVerifyEmail (url: string, email: string) {
+ const path = '/api/v1/users/ask-send-verify-email'
+
+ return makePostBodyRequest({
+ url,
+ path,
+ fields: { email },
+ statusCodeExpected: 204
+ })
+}
+
+function verifyEmail (url: string, userId: number, verificationString: string, statusCodeExpected = 204) {
+ const path = '/api/v1/users/' + userId + '/verify-email'
+
+ return makePostBodyRequest({
+ url,
+ path,
+ fields: { verificationString },
+ statusCodeExpected
+ })
+}
+
// ---------------------------------------------------------------------------
export {
unblockUser,
askResetPassword,
resetPassword,
- updateMyAvatar
+ updateMyAvatar,
+ askSendVerifyEmail,
+ verifyEmail
}