21 lines
502 B
TypeScript
21 lines
502 B
TypeScript
import type { PaginatedWithCursor, TimePaginationQuery } from './pagination';
|
|
import type { Post } from './posts';
|
|
import { callJSON, withQuery } from './request';
|
|
|
|
export interface Collection {
|
|
id: string;
|
|
name: string;
|
|
slug: string;
|
|
parent: string | null;
|
|
}
|
|
|
|
export const getCollectionPosts = (
|
|
name: string,
|
|
collection: string,
|
|
pagination?: TimePaginationQuery
|
|
) =>
|
|
callJSON<PaginatedWithCursor<Post, string>>(
|
|
'GET',
|
|
withQuery(`collections/${name}/${collection}/posts`, pagination)
|
|
);
|