src/types/roblox.ts (view raw)
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 |
type V2ErrorCode =
| "INVALID_ARGUMENT"
| "PERMISSION_DENIED"
| "NOT_FOUND"
| "ABORTED"
| "RESOURCE_EXHAUSTED"
| "CANCELLED"
| "INTERNAL"
| "NOT_IMPLEMENTED"
| "UNAVAILABLE";
interface V2ErrorResponse {
code: V2ErrorCode;
message: string;
details: Array<Record<string, unknown>>;
}
// v1 resource err model
export type V1ErrorCode =
| "INVALID_ARGUMENT"
| "INSUFFICIENT_SCOPE"
| "PERMISSION_DENIED"
| "NOT_FOUND"
| "ABORTED"
| "RESOURCE_EXHAUSTED"
| "CANCELLED"
| "INTERNAL"
| "NOT_IMPLEMENTED"
| "UNAVAILABLE";
export interface V1ErrorResponse {
error: V1ErrorCode;
message: string;
errorDetails: Array<{
errorDetailType: string;
[key: string]: unknown;
}>;
}
// OrderedDataStores err model
export interface OrderedDataStoresErrorResponse {
code: V1ErrorCode;
message: string;
}
// UserSearch api
export interface UserSearchParams {
keyword: string;
sessionId?: string;
limit?: 10 | 25 | 50 | 100;
cursor?: string;
}
export type UserSearchResponse =
| UserSearchOkResponse
| UserSearchBadResponse
| UserSearchRateLimitResponse;
export type BLApiResponse =
| {
robloxID: string;
resolved: object;
}
| {
error: "User not found";
};
export type ThumbnailResponse =
| {
done: true;
response: { imageUri: string };
}
| {
done: false;
};
export interface UserSearchPlayer {
previousUsernames: string[];
hasVerifiedBadge: boolean;
id: number;
name: string;
displayName: string;
}
export interface UserSearchOkResponse {
previousPageCursor: string | null;
nextPageCursor: string | null;
data: Array<UserSearchPlayer>;
}
export interface UserSearchBadResponse {
statusCode: 400;
error: "INVALID_ARGUMENT";
message: "The keyword was filtered." | "The keyword is too short.";
}
export interface UserSearchRateLimitResponse {
statusCode: 429;
error: "RESOURCE_EXHAUSTED";
message: "Too many requests.";
}
export type UserSearchError =
| UserSearchBadResponse
| UserSearchRateLimitResponse;
export interface GetUserOkResponse {
path: string;
/** RFC 3339 formatted date string */
createTime: string;
id: string;
name: string;
displayName: string | null;
about?: string;
locale: string;
premium: boolean;
idVerified?: boolean;
socialNetworkProfiles: {
facebook?: string;
twitter?: string;
youtube?: string;
twitch?: string;
guilded?: string;
visibility:
| "SOCIAL_NETWORK_VISIBILITY_UNSPECIFIED"
| "NO_ONE"
| "FRIENDS"
| "FRIENDS_AND_FOLLOWING"
| "FRIENDS_FOLLOWING_AND_FOLLOWERS"
| "EVERYONE";
};
}
export type GetUserResponse = GetUserOkResponse | V2ErrorResponse;
export interface RobloxSearchUser {
previousUsernames: string[];
hasVerifiedBadge: boolean;
id: number;
name: string;
displayName: string;
}
export interface RobloxSearchResponse {
previousPageCursor: string | null;
nextPageCursor: string | null;
data: RobloxSearchUser[];
}
export type AvatarSize =
| 48
| 50
| 60
| 75
| 100
| 110
| 150
| 180
| 352
| 420
| 720;
|