работаем бля работаем
This commit is contained in:
382
server/Api.ts
382
server/Api.ts
@@ -10,6 +10,167 @@
|
||||
* ---------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Attachment
|
||||
* Attachment
|
||||
*/
|
||||
export interface Attachment {
|
||||
id: string;
|
||||
name: string;
|
||||
mimetype: string;
|
||||
/** @min 0 */
|
||||
size: number;
|
||||
/** @format date-time */
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Channel
|
||||
* Channel
|
||||
*/
|
||||
export interface Channel {
|
||||
id: string;
|
||||
ownerId: string | null;
|
||||
name: string;
|
||||
persistent: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* ChatMessage
|
||||
* ChatMessage
|
||||
*/
|
||||
export interface ChatMessage {
|
||||
/** @format uuid */
|
||||
id: string;
|
||||
/** @format uuid */
|
||||
senderId: string;
|
||||
/** @minLength 1 */
|
||||
text: string;
|
||||
/** @format date-time */
|
||||
createdAt: string;
|
||||
/** @format date-time */
|
||||
updatedAt: string;
|
||||
attachments: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* CreateChannelPayload
|
||||
* CreateChannelPayload
|
||||
*/
|
||||
export interface CreateChannelPayload {
|
||||
name: string;
|
||||
persistent: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* CreateUser
|
||||
* CreateUser
|
||||
*/
|
||||
export interface CreateUser {
|
||||
/** @minLength 1 */
|
||||
username: string;
|
||||
/** @minLength 6 */
|
||||
password: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* GetAttachmentParams
|
||||
* GetAttachmentParams
|
||||
*/
|
||||
export interface GetAttachmentParams {
|
||||
/** @format uuid */
|
||||
id: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* GetUserQuery
|
||||
* GetUserQuery
|
||||
*/
|
||||
export interface GetUserQuery {
|
||||
username?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Login
|
||||
* Login
|
||||
*/
|
||||
export interface Login {
|
||||
/** @minLength 1 */
|
||||
username: string;
|
||||
/** @minLength 1 */
|
||||
password: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* NewChatMessagePayload
|
||||
* NewChatMessagePayload
|
||||
*/
|
||||
export interface NewChatMessagePayload {
|
||||
/** @minLength 1 */
|
||||
text: string;
|
||||
attachments?: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Reply
|
||||
* Reply
|
||||
*/
|
||||
export interface Reply {
|
||||
/** @format uuid */
|
||||
messageId: string;
|
||||
/** @format uuid */
|
||||
senderId: string;
|
||||
text: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* ResponseError
|
||||
* ResponseError
|
||||
*/
|
||||
export interface ResponseError {
|
||||
statusCode: number;
|
||||
error: string;
|
||||
message: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* UpdateUserPayload
|
||||
* UpdateUserPayload
|
||||
*/
|
||||
export interface UpdateUserPayload {
|
||||
displayName: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* UpdateUserPreferencesPayload
|
||||
* UpdateUserPreferencesPayload
|
||||
*/
|
||||
export interface UpdateUserPreferencesPayload {
|
||||
toggleInputHotkey?: string;
|
||||
toggleOutputHotkey?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* UserPreferences
|
||||
* UserPreferences
|
||||
*/
|
||||
export interface UserPreferences {
|
||||
toggleInputHotkey: string;
|
||||
toggleOutputHotkey: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* User
|
||||
* User
|
||||
*/
|
||||
export interface User {
|
||||
id: string;
|
||||
username: string;
|
||||
displayName: string;
|
||||
/** @format date-time */
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
export type QueryParamsType = Record<string | number, any>;
|
||||
export type ResponseFormat = keyof Omit<Body, "body" | "bodyUsed">;
|
||||
|
||||
@@ -282,14 +443,7 @@ export class Api<
|
||||
* @request POST:/chad/attachment/upload
|
||||
*/
|
||||
attachmentUpload: (params: RequestParams = {}) =>
|
||||
this.request<
|
||||
string,
|
||||
{
|
||||
statusCode: number;
|
||||
error: string;
|
||||
message: string;
|
||||
}
|
||||
>({
|
||||
this.request<string, ResponseError>({
|
||||
path: `/chad/attachment/upload`,
|
||||
method: "POST",
|
||||
format: "json",
|
||||
@@ -305,14 +459,7 @@ export class Api<
|
||||
* @request GET:/chad/attachment/{id}
|
||||
*/
|
||||
attachmentGet: (id: string, params: RequestParams = {}) =>
|
||||
this.request<
|
||||
any,
|
||||
{
|
||||
statusCode: number;
|
||||
error: string;
|
||||
message: string;
|
||||
}
|
||||
>({
|
||||
this.request<any, ResponseError>({
|
||||
path: `/chad/attachment/${id}`,
|
||||
method: "GET",
|
||||
format: "json",
|
||||
@@ -327,29 +474,8 @@ export class Api<
|
||||
* @summary Register
|
||||
* @request POST:/chad/auth/register
|
||||
*/
|
||||
authRegister: (
|
||||
data: {
|
||||
/** @minLength 1 */
|
||||
username: string;
|
||||
/** @minLength 6 */
|
||||
password: string;
|
||||
},
|
||||
params: RequestParams = {},
|
||||
) =>
|
||||
this.request<
|
||||
{
|
||||
id: string;
|
||||
username: string;
|
||||
displayName: string;
|
||||
/** @format date-time */
|
||||
createdAt: string;
|
||||
},
|
||||
{
|
||||
statusCode: number;
|
||||
error: string;
|
||||
message: string;
|
||||
}
|
||||
>({
|
||||
authRegister: (data: CreateUser, params: RequestParams = {}) =>
|
||||
this.request<User, ResponseError>({
|
||||
path: `/chad/auth/register`,
|
||||
method: "POST",
|
||||
body: data,
|
||||
@@ -366,29 +492,8 @@ export class Api<
|
||||
* @summary Login
|
||||
* @request POST:/chad/auth/login
|
||||
*/
|
||||
authLogin: (
|
||||
data: {
|
||||
/** @minLength 1 */
|
||||
username: string;
|
||||
/** @minLength 1 */
|
||||
password: string;
|
||||
},
|
||||
params: RequestParams = {},
|
||||
) =>
|
||||
this.request<
|
||||
{
|
||||
id: string;
|
||||
username: string;
|
||||
displayName: string;
|
||||
/** @format date-time */
|
||||
createdAt: string;
|
||||
},
|
||||
{
|
||||
statusCode: number;
|
||||
error: string;
|
||||
message: string;
|
||||
}
|
||||
>({
|
||||
authLogin: (data: Login, params: RequestParams = {}) =>
|
||||
this.request<User, ResponseError>({
|
||||
path: `/chad/auth/login`,
|
||||
method: "POST",
|
||||
body: data,
|
||||
@@ -406,20 +511,7 @@ export class Api<
|
||||
* @request GET:/chad/auth/me
|
||||
*/
|
||||
authMe: (params: RequestParams = {}) =>
|
||||
this.request<
|
||||
{
|
||||
id: string;
|
||||
username: string;
|
||||
displayName: string;
|
||||
/** @format date-time */
|
||||
createdAt: string;
|
||||
},
|
||||
{
|
||||
statusCode: number;
|
||||
error: string;
|
||||
message: string;
|
||||
}
|
||||
>({
|
||||
this.request<User, ResponseError>({
|
||||
path: `/chad/auth/me`,
|
||||
method: "GET",
|
||||
format: "json",
|
||||
@@ -435,19 +527,61 @@ export class Api<
|
||||
* @request POST:/chad/auth/logout
|
||||
*/
|
||||
authLogout: (params: RequestParams = {}) =>
|
||||
this.request<
|
||||
any,
|
||||
{
|
||||
statusCode: number;
|
||||
error: string;
|
||||
message: string;
|
||||
}
|
||||
>({
|
||||
this.request<any, ResponseError>({
|
||||
path: `/chad/auth/logout`,
|
||||
method: "POST",
|
||||
...params,
|
||||
}),
|
||||
|
||||
/**
|
||||
* No description
|
||||
*
|
||||
* @tags Channel
|
||||
* @name ChannelList
|
||||
* @summary Get channel list
|
||||
* @request GET:/chad/channels
|
||||
*/
|
||||
channelList: (params: RequestParams = {}) =>
|
||||
this.request<Channel[], ResponseError>({
|
||||
path: `/chad/channels`,
|
||||
method: "GET",
|
||||
format: "json",
|
||||
...params,
|
||||
}),
|
||||
|
||||
/**
|
||||
* No description
|
||||
*
|
||||
* @tags Channel
|
||||
* @name ChannelCreate
|
||||
* @summary Create channel
|
||||
* @request POST:/chad/channels
|
||||
*/
|
||||
channelCreate: (data: CreateChannelPayload, params: RequestParams = {}) =>
|
||||
this.request<Channel, ResponseError>({
|
||||
path: `/chad/channels`,
|
||||
method: "POST",
|
||||
body: data,
|
||||
type: ContentType.Json,
|
||||
format: "json",
|
||||
...params,
|
||||
}),
|
||||
|
||||
/**
|
||||
* No description
|
||||
*
|
||||
* @tags Channel
|
||||
* @name ChannelDelete
|
||||
* @summary Delete channel
|
||||
* @request DELETE:/chad/channels/{id}
|
||||
*/
|
||||
channelDelete: (id: string, params: RequestParams = {}) =>
|
||||
this.request<any, ResponseError>({
|
||||
path: `/chad/channels/${id}`,
|
||||
method: "DELETE",
|
||||
...params,
|
||||
}),
|
||||
|
||||
/**
|
||||
* No description
|
||||
*
|
||||
@@ -460,6 +594,7 @@ export class Api<
|
||||
data: {
|
||||
/** @minLength 1 */
|
||||
text: string;
|
||||
attachments?: string[];
|
||||
},
|
||||
params: RequestParams = {},
|
||||
) =>
|
||||
@@ -475,12 +610,9 @@ export class Api<
|
||||
createdAt: string;
|
||||
/** @format date-time */
|
||||
updatedAt: string;
|
||||
attachments: string[];
|
||||
},
|
||||
{
|
||||
statusCode: number;
|
||||
error: string;
|
||||
message: string;
|
||||
}
|
||||
ResponseError
|
||||
>({
|
||||
path: `/chad/chat/send`,
|
||||
method: "POST",
|
||||
@@ -508,7 +640,7 @@ export class Api<
|
||||
/**
|
||||
* @min 1
|
||||
* @max 100
|
||||
* @default 2
|
||||
* @default 10
|
||||
*/
|
||||
limit: number;
|
||||
},
|
||||
@@ -527,6 +659,7 @@ export class Api<
|
||||
createdAt: string;
|
||||
/** @format date-time */
|
||||
updatedAt: string;
|
||||
attachments: string[];
|
||||
}[];
|
||||
/**
|
||||
* Cursor to last message
|
||||
@@ -534,11 +667,7 @@ export class Api<
|
||||
*/
|
||||
nextCursor?: string;
|
||||
},
|
||||
{
|
||||
statusCode: number;
|
||||
error: string;
|
||||
message: string;
|
||||
}
|
||||
ResponseError
|
||||
>({
|
||||
path: `/chad/chat`,
|
||||
method: "GET",
|
||||
@@ -561,20 +690,7 @@ export class Api<
|
||||
},
|
||||
params: RequestParams = {},
|
||||
) =>
|
||||
this.request<
|
||||
{
|
||||
id: string;
|
||||
username: string;
|
||||
displayName: string;
|
||||
/** @format date-time */
|
||||
createdAt: string;
|
||||
},
|
||||
{
|
||||
statusCode: number;
|
||||
error: string;
|
||||
message: string;
|
||||
}
|
||||
>({
|
||||
this.request<User, ResponseError>({
|
||||
path: `/chad/user`,
|
||||
method: "GET",
|
||||
query: query,
|
||||
@@ -591,17 +707,7 @@ export class Api<
|
||||
* @request GET:/chad/user/preferences
|
||||
*/
|
||||
userGetPreferences: (params: RequestParams = {}) =>
|
||||
this.request<
|
||||
{
|
||||
toggleInputHotkey: string;
|
||||
toggleOutputHotkey: string;
|
||||
},
|
||||
{
|
||||
statusCode: number;
|
||||
error: string;
|
||||
message: string;
|
||||
}
|
||||
>({
|
||||
this.request<UserPreferences, ResponseError>({
|
||||
path: `/chad/user/preferences`,
|
||||
method: "GET",
|
||||
format: "json",
|
||||
@@ -617,20 +723,10 @@ export class Api<
|
||||
* @request PATCH:/chad/user/preferences
|
||||
*/
|
||||
userUpdatePreferences: (
|
||||
data: {
|
||||
toggleInputHotkey?: string;
|
||||
toggleOutputHotkey?: string;
|
||||
},
|
||||
data: UpdateUserPreferencesPayload,
|
||||
params: RequestParams = {},
|
||||
) =>
|
||||
this.request<
|
||||
any,
|
||||
{
|
||||
statusCode: number;
|
||||
error: string;
|
||||
message: string;
|
||||
}
|
||||
>({
|
||||
this.request<any, ResponseError>({
|
||||
path: `/chad/user/preferences`,
|
||||
method: "PATCH",
|
||||
body: data,
|
||||
@@ -646,26 +742,8 @@ export class Api<
|
||||
* @summary Update profile
|
||||
* @request PATCH:/chad/profile
|
||||
*/
|
||||
userUpdateProfile: (
|
||||
data: {
|
||||
displayName: string;
|
||||
},
|
||||
params: RequestParams = {},
|
||||
) =>
|
||||
this.request<
|
||||
{
|
||||
id: string;
|
||||
username: string;
|
||||
displayName: string;
|
||||
/** @format date-time */
|
||||
createdAt: string;
|
||||
},
|
||||
{
|
||||
statusCode: number;
|
||||
error: string;
|
||||
message: string;
|
||||
}
|
||||
>({
|
||||
userUpdateProfile: (data: UpdateUserPayload, params: RequestParams = {}) =>
|
||||
this.request<User, ResponseError>({
|
||||
path: `/chad/profile`,
|
||||
method: "PATCH",
|
||||
body: data,
|
||||
|
||||
Reference in New Issue
Block a user