34 lines
883 B
TypeScript
34 lines
883 B
TypeScript
/**
|
|
* Google 登录请求 DTO
|
|
*/
|
|
import {
|
|
GoogleLoginRequestSchema,
|
|
type GoogleLoginRequestInput,
|
|
type GoogleLoginRequestData,
|
|
} from "@/data/schemas/auth/google_login_request";
|
|
|
|
export class GoogleLoginRequest {
|
|
declare readonly idToken: string;
|
|
declare readonly platform: string;
|
|
declare readonly guestId: string;
|
|
declare readonly isTestAccount: boolean;
|
|
|
|
private constructor(input: GoogleLoginRequestInput) {
|
|
const data = GoogleLoginRequestSchema.parse(input);
|
|
Object.assign(this, data);
|
|
Object.freeze(this);
|
|
}
|
|
|
|
static from(input: GoogleLoginRequestInput): GoogleLoginRequest {
|
|
return new GoogleLoginRequest(input);
|
|
}
|
|
|
|
static fromJson(json: unknown): GoogleLoginRequest {
|
|
return GoogleLoginRequest.from(json as GoogleLoginRequestInput);
|
|
}
|
|
|
|
toJson(): GoogleLoginRequestData {
|
|
return GoogleLoginRequestSchema.parse(this);
|
|
}
|
|
}
|