export class Api<
SecurityDataType extends unknown
> extends HttpClient<SecurityDataType> {
posts = {
postsList: (params: RequestParams = {}) =>
this.request<Post[], any>({
path: `/posts`,
method: "GET",
format: "json",
...params,
}),
postsCreate: (
data: {
post: Post;
},
params: RequestParams = {}
) =>
this.request<
Post,
{
message: string;
}
>({
path: `/posts`,
method: "POST",
body: data,
type: ContentType.Json,
format: "json",
...params,
}),
postsFetch: (id: Uuid, params: RequestParams = {}) =>
this.request<
Post,
{
message: string;
}
>({
path: `/posts/${id}`,
method: "GET",
format: "json",
...params,
}),
};
}