-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathPages.ts
More file actions
78 lines (67 loc) · 2.36 KB
/
Pages.ts
File metadata and controls
78 lines (67 loc) · 2.36 KB
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
import { BaseResource } from "./BaseResource";
import { Configuration } from "../Configuration";
import { Page, CreatePage, ListPagesParams } from "../models/Page";
import { PaginatedResponse } from "../models/common";
/**
* Pages API resource
* Handles both workspace and project page operations
*/
export class Pages extends BaseResource {
constructor(config: Configuration) {
super(config);
}
// ===== WORKSPACE PAGES API METHODS =====
/**
* Create a workspace page
*/
async createWorkspacePage(workspaceSlug: string, createPage: CreatePage): Promise<Page> {
return this.post<Page>(`/workspaces/${workspaceSlug}/pages/`, createPage);
}
/**
* Get a workspace page by ID
*/
async getWorkspacePage(workspaceSlug: string, pageId: string): Promise<Page> {
return this.get<Page>(`/workspaces/${workspaceSlug}/pages/${pageId}/`);
}
// ===== PROJECT PAGES API METHODS =====
/**
* Create a project page
*/
async createProjectPage(workspaceSlug: string, projectId: string, createPage: CreatePage): Promise<Page> {
return this.post<Page>(`/workspaces/${workspaceSlug}/projects/${projectId}/pages/`, createPage);
}
/**
* Get a project page by ID
*/
async getProjectPage(workspaceSlug: string, projectId: string, pageId: string): Promise<Page> {
return this.get<Page>(`/workspaces/${workspaceSlug}/projects/${projectId}/pages/${pageId}/`);
}
/**
* Retrieve workspace page
*/
async retrieveWorkspacePage(workspaceSlug: string, pageId: string): Promise<Page> {
return this.getWorkspacePage(workspaceSlug, pageId);
}
/**
* Retrieve project page
*/
async retrieveProjectPage(workspaceSlug: string, projectId: string, pageId: string): Promise<Page> {
return this.getProjectPage(workspaceSlug, projectId, pageId);
}
/**
* List workspace pages with optional filtering
*/
async listWorkspacePages(workspaceSlug: string, params?: ListPagesParams): Promise<PaginatedResponse<Page>> {
return this.get<PaginatedResponse<Page>>(`/workspaces/${workspaceSlug}/pages/`, params);
}
/**
* List project pages with optional filtering
*/
async listProjectPages(
workspaceSlug: string,
projectId: string,
params?: ListPagesParams
): Promise<PaginatedResponse<Page>> {
return this.get<PaginatedResponse<Page>>(`/workspaces/${workspaceSlug}/projects/${projectId}/pages/`, params);
}
}