Type Definitions
A list of TypeScript type definitions used across various methods provided by sauthbase
.
APIResult
type APIResult<T> =
| {
code: string;
success: true;
data: T;
}
| {
code: string;
success: false;
status: number;
message: string;
error?: unknown;
};
Description: Response type for both success and failure. The combination of success
and code
identifies the response type.
sauthbaseOptions
interface sauthbaseOptions {
secretKey: string;
redirect_url: string;
}
Description: Options required for sauthbase.init()
.
userInfoProps
interface userInfoProps {
id: number;
username: string;
scratchteam: boolean;
history: {
joined: string;
};
profile: {
id: number;
images: {
"90x90": string;
"60x60": string;
"55x55": string;
"50x50": string;
"32x32": string;
};
status: string;
bio: string;
country: string;
};
};
Description: Basic user information from Scratch. Returned by getUser()
.
verifySessionProps
interface verifySessionProps {
valid: boolean;
username: string;
redirect: string;
}
Description: Structure of the verification result returned by the authentication server in verifySession()
.
verifySessionResponse
interface verifySessionResponse {
token: string;
payload: verifySessionProps;
}
Description: Data structure returned on success from verifySession()
.
Last updated on