102 lines
3.2 KiB
TypeScript
102 lines
3.2 KiB
TypeScript
|
/* eslint-disable */
|
||
|
// @ts-nocheck
|
||
|
/*
|
||
|
* This file is a generated Typescript file for GRPC Gateway, DO NOT MODIFY
|
||
|
*/
|
||
|
|
||
|
import * as fm from "../../../../../fetch.pb"
|
||
|
import * as GoogleProtobufEmpty from "../../../../../google/protobuf/empty.pb"
|
||
|
import * as GoogleProtobufTimestamp from "../../../../../google/protobuf/timestamp.pb"
|
||
|
export type Token = {
|
||
|
token?: string
|
||
|
expires?: GoogleProtobufTimestamp.Timestamp
|
||
|
}
|
||
|
|
||
|
export type OAuthCodeRequest = {
|
||
|
}
|
||
|
|
||
|
export type OAuthCodeResponse = {
|
||
|
redirectURI?: string
|
||
|
}
|
||
|
|
||
|
export type TokenRequest = {
|
||
|
code?: string
|
||
|
state?: string
|
||
|
}
|
||
|
|
||
|
export type DeleteTokenRequest = {
|
||
|
all?: boolean
|
||
|
token?: Token
|
||
|
}
|
||
|
|
||
|
export type User = {
|
||
|
id?: string
|
||
|
name?: string
|
||
|
email?: string
|
||
|
picture?: string
|
||
|
gradeLevel?: number
|
||
|
admin?: boolean
|
||
|
createdAt?: GoogleProtobufTimestamp.Timestamp
|
||
|
}
|
||
|
|
||
|
export type UpdateFields = {
|
||
|
name?: string
|
||
|
email?: string
|
||
|
gradeLevel?: number
|
||
|
admin?: boolean
|
||
|
}
|
||
|
|
||
|
export type UserRequest = {
|
||
|
}
|
||
|
|
||
|
export type AllUsersRequest = {
|
||
|
}
|
||
|
|
||
|
export type UpdateUserRequest = {
|
||
|
email?: string
|
||
|
body?: UpdateFields
|
||
|
}
|
||
|
|
||
|
export type UserByEmailRequest = {
|
||
|
email?: string
|
||
|
}
|
||
|
|
||
|
export type DeleteUserRequest = {
|
||
|
email?: string
|
||
|
}
|
||
|
|
||
|
export type AllUsersResponse = {
|
||
|
users?: User[]
|
||
|
}
|
||
|
|
||
|
export class AuthService {
|
||
|
static OAuthCode(req: OAuthCodeRequest, initReq?: fm.InitReq): Promise<OAuthCodeResponse> {
|
||
|
return fm.fetchReq<OAuthCodeRequest, OAuthCodeResponse>(`/v1/auth/code?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
|
||
|
}
|
||
|
static Token(req: TokenRequest, initReq?: fm.InitReq): Promise<Token> {
|
||
|
return fm.fetchReq<TokenRequest, Token>(`/v1/auth/token?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
|
||
|
}
|
||
|
static DeleteToken(req: DeleteTokenRequest, initReq?: fm.InitReq): Promise<GoogleProtobufEmpty.Empty> {
|
||
|
return fm.fetchReq<DeleteTokenRequest, GoogleProtobufEmpty.Empty>(`/v1/auth/token`, {...initReq, method: "DELETE"})
|
||
|
}
|
||
|
}
|
||
|
export class UserService {
|
||
|
static User(req: UserRequest, initReq?: fm.InitReq): Promise<User> {
|
||
|
return fm.fetchReq<UserRequest, User>(`/v1/users/me?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
|
||
|
}
|
||
|
static UserByEmail(req: UserByEmailRequest, initReq?: fm.InitReq): Promise<User> {
|
||
|
return fm.fetchReq<UserByEmailRequest, User>(`/v1/admin/users/${req["email"]}?${fm.renderURLSearchParams(req, ["email"])}`, {...initReq, method: "GET"})
|
||
|
}
|
||
|
static AllUsers(req: AllUsersRequest, initReq?: fm.InitReq): Promise<AllUsersResponse> {
|
||
|
return fm.fetchReq<AllUsersRequest, AllUsersResponse>(`/v1/admin/users?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
|
||
|
}
|
||
|
static UpdateUser(req: UpdateUserRequest, initReq?: fm.InitReq): Promise<User> {
|
||
|
return fm.fetchReq<UpdateUserRequest, User>(`/v1/users/me`, {...initReq, method: "PUT", body: JSON.stringify(req["Body"])})
|
||
|
}
|
||
|
static AdminUpdateUser(req: UpdateUserRequest, initReq?: fm.InitReq): Promise<User> {
|
||
|
return fm.fetchReq<UpdateUserRequest, User>(`/v1/admin/users/${req["email"]}`, {...initReq, method: "PUT", body: JSON.stringify(req["Body"])})
|
||
|
}
|
||
|
static DeleteUser(req: DeleteUserRequest, initReq?: fm.InitReq): Promise<User> {
|
||
|
return fm.fetchReq<DeleteUserRequest, User>(`/v1/admin/users/${req["email"]}`, {...initReq, method: "DELETE"})
|
||
|
}
|
||
|
}
|