505 lines
13 KiB
TypeScript
505 lines
13 KiB
TypeScript
// This file is auto-generated by @hey-api/openapi-ts
|
|
|
|
import type { Client, Options as ClientOptions, TDataShape } from "./client";
|
|
import { client as _heyApiClient } from "./client.gen";
|
|
import type {
|
|
CreateBoardData,
|
|
CreateBoardErrors,
|
|
CreateBoardResponses,
|
|
CreateDealData,
|
|
CreateDealErrors,
|
|
CreateDealResponses,
|
|
CreateProjectData,
|
|
CreateProjectErrors,
|
|
CreateProjectResponses,
|
|
CreateStatusData,
|
|
CreateStatusErrors,
|
|
CreateStatusResponses,
|
|
DeleteBoardData,
|
|
DeleteBoardErrors,
|
|
DeleteBoardResponses,
|
|
DeleteDealData,
|
|
DeleteDealErrors,
|
|
DeleteDealResponses,
|
|
DeleteProjectData,
|
|
DeleteProjectErrors,
|
|
DeleteProjectResponses,
|
|
DeleteStatusData,
|
|
DeleteStatusErrors,
|
|
DeleteStatusResponses,
|
|
GetBoardsData,
|
|
GetBoardsErrors,
|
|
GetBoardsResponses,
|
|
GetDealsData,
|
|
GetDealsErrors,
|
|
GetDealsResponses,
|
|
GetProjectsData,
|
|
GetProjectsResponses,
|
|
GetStatusesData,
|
|
GetStatusesErrors,
|
|
GetStatusesResponses,
|
|
UpdateBoardData,
|
|
UpdateBoardErrors,
|
|
UpdateBoardResponses,
|
|
UpdateDealData,
|
|
UpdateDealErrors,
|
|
UpdateDealResponses,
|
|
UpdateProjectData,
|
|
UpdateProjectErrors,
|
|
UpdateProjectResponses,
|
|
UpdateStatusData,
|
|
UpdateStatusErrors,
|
|
UpdateStatusResponses,
|
|
} from "./types.gen";
|
|
import {
|
|
zCreateBoardData,
|
|
zCreateBoardResponse2,
|
|
zCreateDealData,
|
|
zCreateDealResponse2,
|
|
zCreateProjectData,
|
|
zCreateProjectResponse2,
|
|
zCreateStatusData,
|
|
zCreateStatusResponse2,
|
|
zDeleteBoardData,
|
|
zDeleteBoardResponse2,
|
|
zDeleteDealData,
|
|
zDeleteDealResponse2,
|
|
zDeleteProjectData,
|
|
zDeleteProjectResponse2,
|
|
zDeleteStatusData,
|
|
zDeleteStatusResponse2,
|
|
zGetBoardsData,
|
|
zGetBoardsResponse2,
|
|
zGetDealsData,
|
|
zGetDealsResponse2,
|
|
zGetProjectsData,
|
|
zGetProjectsResponse2,
|
|
zGetStatusesData,
|
|
zGetStatusesResponse2,
|
|
zUpdateBoardData,
|
|
zUpdateBoardResponse2,
|
|
zUpdateDealData,
|
|
zUpdateDealResponse2,
|
|
zUpdateProjectData,
|
|
zUpdateProjectResponse2,
|
|
zUpdateStatusData,
|
|
zUpdateStatusResponse2,
|
|
} from "./zod.gen";
|
|
|
|
export type Options<
|
|
TData extends TDataShape = TDataShape,
|
|
ThrowOnError extends boolean = boolean,
|
|
> = ClientOptions<TData, ThrowOnError> & {
|
|
/**
|
|
* You can provide a client instance returned by `createClient()` instead of
|
|
* individual options. This might be also useful if you want to implement a
|
|
* custom client.
|
|
*/
|
|
client?: Client;
|
|
/**
|
|
* You can pass arbitrary values through the `meta` object. This can be
|
|
* used to access values that aren't defined as part of the SDK function.
|
|
*/
|
|
meta?: Record<string, unknown>;
|
|
};
|
|
|
|
/**
|
|
* Get Boards
|
|
*/
|
|
export const getBoards = <ThrowOnError extends boolean = false>(
|
|
options: Options<GetBoardsData, ThrowOnError>
|
|
) => {
|
|
return (options.client ?? _heyApiClient).get<
|
|
GetBoardsResponses,
|
|
GetBoardsErrors,
|
|
ThrowOnError
|
|
>({
|
|
requestValidator: async data => {
|
|
return await zGetBoardsData.parseAsync(data);
|
|
},
|
|
responseType: "json",
|
|
responseValidator: async data => {
|
|
return await zGetBoardsResponse2.parseAsync(data);
|
|
},
|
|
url: "/board/{projectId}",
|
|
...options,
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Create Board
|
|
*/
|
|
export const createBoard = <ThrowOnError extends boolean = false>(
|
|
options: Options<CreateBoardData, ThrowOnError>
|
|
) => {
|
|
return (options.client ?? _heyApiClient).post<
|
|
CreateBoardResponses,
|
|
CreateBoardErrors,
|
|
ThrowOnError
|
|
>({
|
|
requestValidator: async data => {
|
|
return await zCreateBoardData.parseAsync(data);
|
|
},
|
|
responseType: "json",
|
|
responseValidator: async data => {
|
|
return await zCreateBoardResponse2.parseAsync(data);
|
|
},
|
|
url: "/board/",
|
|
...options,
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
...options.headers,
|
|
},
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Delete Board
|
|
*/
|
|
export const deleteBoard = <ThrowOnError extends boolean = false>(
|
|
options: Options<DeleteBoardData, ThrowOnError>
|
|
) => {
|
|
return (options.client ?? _heyApiClient).delete<
|
|
DeleteBoardResponses,
|
|
DeleteBoardErrors,
|
|
ThrowOnError
|
|
>({
|
|
requestValidator: async data => {
|
|
return await zDeleteBoardData.parseAsync(data);
|
|
},
|
|
responseType: "json",
|
|
responseValidator: async data => {
|
|
return await zDeleteBoardResponse2.parseAsync(data);
|
|
},
|
|
url: "/board/{pk}",
|
|
...options,
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Update Board
|
|
*/
|
|
export const updateBoard = <ThrowOnError extends boolean = false>(
|
|
options: Options<UpdateBoardData, ThrowOnError>
|
|
) => {
|
|
return (options.client ?? _heyApiClient).patch<
|
|
UpdateBoardResponses,
|
|
UpdateBoardErrors,
|
|
ThrowOnError
|
|
>({
|
|
requestValidator: async data => {
|
|
return await zUpdateBoardData.parseAsync(data);
|
|
},
|
|
responseType: "json",
|
|
responseValidator: async data => {
|
|
return await zUpdateBoardResponse2.parseAsync(data);
|
|
},
|
|
url: "/board/{pk}",
|
|
...options,
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
...options.headers,
|
|
},
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Get Deals
|
|
*/
|
|
export const getDeals = <ThrowOnError extends boolean = false>(
|
|
options: Options<GetDealsData, ThrowOnError>
|
|
) => {
|
|
return (options.client ?? _heyApiClient).get<
|
|
GetDealsResponses,
|
|
GetDealsErrors,
|
|
ThrowOnError
|
|
>({
|
|
requestValidator: async data => {
|
|
return await zGetDealsData.parseAsync(data);
|
|
},
|
|
responseType: "json",
|
|
responseValidator: async data => {
|
|
return await zGetDealsResponse2.parseAsync(data);
|
|
},
|
|
url: "/deal/{boardId}",
|
|
...options,
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Create Deal
|
|
*/
|
|
export const createDeal = <ThrowOnError extends boolean = false>(
|
|
options: Options<CreateDealData, ThrowOnError>
|
|
) => {
|
|
return (options.client ?? _heyApiClient).post<
|
|
CreateDealResponses,
|
|
CreateDealErrors,
|
|
ThrowOnError
|
|
>({
|
|
requestValidator: async data => {
|
|
return await zCreateDealData.parseAsync(data);
|
|
},
|
|
responseType: "json",
|
|
responseValidator: async data => {
|
|
return await zCreateDealResponse2.parseAsync(data);
|
|
},
|
|
url: "/deal/",
|
|
...options,
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
...options.headers,
|
|
},
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Delete Deal
|
|
*/
|
|
export const deleteDeal = <ThrowOnError extends boolean = false>(
|
|
options: Options<DeleteDealData, ThrowOnError>
|
|
) => {
|
|
return (options.client ?? _heyApiClient).delete<
|
|
DeleteDealResponses,
|
|
DeleteDealErrors,
|
|
ThrowOnError
|
|
>({
|
|
requestValidator: async data => {
|
|
return await zDeleteDealData.parseAsync(data);
|
|
},
|
|
responseType: "json",
|
|
responseValidator: async data => {
|
|
return await zDeleteDealResponse2.parseAsync(data);
|
|
},
|
|
url: "/deal/{pk}",
|
|
...options,
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Update Deal
|
|
*/
|
|
export const updateDeal = <ThrowOnError extends boolean = false>(
|
|
options: Options<UpdateDealData, ThrowOnError>
|
|
) => {
|
|
return (options.client ?? _heyApiClient).patch<
|
|
UpdateDealResponses,
|
|
UpdateDealErrors,
|
|
ThrowOnError
|
|
>({
|
|
requestValidator: async data => {
|
|
return await zUpdateDealData.parseAsync(data);
|
|
},
|
|
responseType: "json",
|
|
responseValidator: async data => {
|
|
return await zUpdateDealResponse2.parseAsync(data);
|
|
},
|
|
url: "/deal/{pk}",
|
|
...options,
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
...options.headers,
|
|
},
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Get Projects
|
|
*/
|
|
export const getProjects = <ThrowOnError extends boolean = false>(
|
|
options?: Options<GetProjectsData, ThrowOnError>
|
|
) => {
|
|
return (options?.client ?? _heyApiClient).get<
|
|
GetProjectsResponses,
|
|
unknown,
|
|
ThrowOnError
|
|
>({
|
|
requestValidator: async data => {
|
|
return await zGetProjectsData.parseAsync(data);
|
|
},
|
|
responseType: "json",
|
|
responseValidator: async data => {
|
|
return await zGetProjectsResponse2.parseAsync(data);
|
|
},
|
|
url: "/project/",
|
|
...options,
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Create Project
|
|
*/
|
|
export const createProject = <ThrowOnError extends boolean = false>(
|
|
options: Options<CreateProjectData, ThrowOnError>
|
|
) => {
|
|
return (options.client ?? _heyApiClient).post<
|
|
CreateProjectResponses,
|
|
CreateProjectErrors,
|
|
ThrowOnError
|
|
>({
|
|
requestValidator: async data => {
|
|
return await zCreateProjectData.parseAsync(data);
|
|
},
|
|
responseType: "json",
|
|
responseValidator: async data => {
|
|
return await zCreateProjectResponse2.parseAsync(data);
|
|
},
|
|
url: "/project/",
|
|
...options,
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
...options.headers,
|
|
},
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Delete Project
|
|
*/
|
|
export const deleteProject = <ThrowOnError extends boolean = false>(
|
|
options: Options<DeleteProjectData, ThrowOnError>
|
|
) => {
|
|
return (options.client ?? _heyApiClient).delete<
|
|
DeleteProjectResponses,
|
|
DeleteProjectErrors,
|
|
ThrowOnError
|
|
>({
|
|
requestValidator: async data => {
|
|
return await zDeleteProjectData.parseAsync(data);
|
|
},
|
|
responseType: "json",
|
|
responseValidator: async data => {
|
|
return await zDeleteProjectResponse2.parseAsync(data);
|
|
},
|
|
url: "/project/{pk}",
|
|
...options,
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Update Project
|
|
*/
|
|
export const updateProject = <ThrowOnError extends boolean = false>(
|
|
options: Options<UpdateProjectData, ThrowOnError>
|
|
) => {
|
|
return (options.client ?? _heyApiClient).patch<
|
|
UpdateProjectResponses,
|
|
UpdateProjectErrors,
|
|
ThrowOnError
|
|
>({
|
|
requestValidator: async data => {
|
|
return await zUpdateProjectData.parseAsync(data);
|
|
},
|
|
responseType: "json",
|
|
responseValidator: async data => {
|
|
return await zUpdateProjectResponse2.parseAsync(data);
|
|
},
|
|
url: "/project/{pk}",
|
|
...options,
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
...options.headers,
|
|
},
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Get Statuses
|
|
*/
|
|
export const getStatuses = <ThrowOnError extends boolean = false>(
|
|
options: Options<GetStatusesData, ThrowOnError>
|
|
) => {
|
|
return (options.client ?? _heyApiClient).get<
|
|
GetStatusesResponses,
|
|
GetStatusesErrors,
|
|
ThrowOnError
|
|
>({
|
|
requestValidator: async data => {
|
|
return await zGetStatusesData.parseAsync(data);
|
|
},
|
|
responseType: "json",
|
|
responseValidator: async data => {
|
|
return await zGetStatusesResponse2.parseAsync(data);
|
|
},
|
|
url: "/status/{boardId}",
|
|
...options,
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Create Status
|
|
*/
|
|
export const createStatus = <ThrowOnError extends boolean = false>(
|
|
options: Options<CreateStatusData, ThrowOnError>
|
|
) => {
|
|
return (options.client ?? _heyApiClient).post<
|
|
CreateStatusResponses,
|
|
CreateStatusErrors,
|
|
ThrowOnError
|
|
>({
|
|
requestValidator: async data => {
|
|
return await zCreateStatusData.parseAsync(data);
|
|
},
|
|
responseType: "json",
|
|
responseValidator: async data => {
|
|
return await zCreateStatusResponse2.parseAsync(data);
|
|
},
|
|
url: "/status/",
|
|
...options,
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
...options.headers,
|
|
},
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Delete Status
|
|
*/
|
|
export const deleteStatus = <ThrowOnError extends boolean = false>(
|
|
options: Options<DeleteStatusData, ThrowOnError>
|
|
) => {
|
|
return (options.client ?? _heyApiClient).delete<
|
|
DeleteStatusResponses,
|
|
DeleteStatusErrors,
|
|
ThrowOnError
|
|
>({
|
|
requestValidator: async data => {
|
|
return await zDeleteStatusData.parseAsync(data);
|
|
},
|
|
responseType: "json",
|
|
responseValidator: async data => {
|
|
return await zDeleteStatusResponse2.parseAsync(data);
|
|
},
|
|
url: "/status/{pk}",
|
|
...options,
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Update Status
|
|
*/
|
|
export const updateStatus = <ThrowOnError extends boolean = false>(
|
|
options: Options<UpdateStatusData, ThrowOnError>
|
|
) => {
|
|
return (options.client ?? _heyApiClient).patch<
|
|
UpdateStatusResponses,
|
|
UpdateStatusErrors,
|
|
ThrowOnError
|
|
>({
|
|
requestValidator: async data => {
|
|
return await zUpdateStatusData.parseAsync(data);
|
|
},
|
|
responseType: "json",
|
|
responseValidator: async data => {
|
|
return await zUpdateStatusResponse2.parseAsync(data);
|
|
},
|
|
url: "/status/{pk}",
|
|
...options,
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
...options.headers,
|
|
},
|
|
});
|
|
};
|