@antlur/backstage 1.12.6 → 1.12.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.d.ts +5 -5
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +18 -17
- package/dist/endpoints/alerts.d.ts +1 -1
- package/dist/endpoints/alerts.d.ts.map +1 -1
- package/dist/endpoints/alerts.js +2 -2
- package/dist/endpoints/blocks.d.ts +3 -3
- package/dist/endpoints/blocks.d.ts.map +1 -1
- package/dist/endpoints/blocks.js +5 -5
- package/dist/endpoints/events.d.ts +3 -3
- package/dist/endpoints/events.d.ts.map +1 -1
- package/dist/endpoints/events.js +6 -6
- package/dist/endpoints/instagram.d.ts +1 -1
- package/dist/endpoints/instagram.d.ts.map +1 -1
- package/dist/endpoints/instagram.js +2 -2
- package/dist/endpoints/layouts.d.ts +3 -3
- package/dist/endpoints/layouts.d.ts.map +1 -1
- package/dist/endpoints/layouts.js +5 -5
- package/dist/endpoints/locations.d.ts +2 -2
- package/dist/endpoints/locations.d.ts.map +1 -1
- package/dist/endpoints/locations.js +4 -4
- package/dist/endpoints/media.d.ts +1 -1
- package/dist/endpoints/media.d.ts.map +1 -1
- package/dist/endpoints/media.js +2 -2
- package/dist/endpoints/menus.d.ts +3 -3
- package/dist/endpoints/menus.d.ts.map +1 -1
- package/dist/endpoints/menus.js +6 -6
- package/dist/endpoints/navigation.d.ts +3 -3
- package/dist/endpoints/navigation.d.ts.map +1 -1
- package/dist/endpoints/navigation.js +7 -7
- package/dist/endpoints/pages.d.ts +5 -5
- package/dist/endpoints/pages.d.ts.map +1 -1
- package/dist/endpoints/pages.js +10 -10
- package/dist/endpoints/press.d.ts +1 -1
- package/dist/endpoints/press.d.ts.map +1 -1
- package/dist/endpoints/press.js +2 -2
- package/dist/endpoints/routes.d.ts +1 -1
- package/dist/endpoints/routes.d.ts.map +1 -1
- package/dist/endpoints/routes.js +2 -2
- package/dist/endpoints/website.d.ts +2 -2
- package/dist/endpoints/website.d.ts.map +1 -1
- package/dist/endpoints/website.js +5 -5
- package/package.json +1 -1
- package/src/client.ts +18 -17
- package/src/endpoints/alerts.ts +2 -2
- package/src/endpoints/blocks.ts +5 -5
- package/src/endpoints/events.ts +6 -6
- package/src/endpoints/instagram.ts +2 -2
- package/src/endpoints/layouts.ts +5 -5
- package/src/endpoints/locations.ts +4 -4
- package/src/endpoints/media.ts +2 -2
- package/src/endpoints/menus.ts +6 -6
- package/src/endpoints/navigation.ts +7 -7
- package/src/endpoints/pages.ts +10 -10
- package/src/endpoints/press.ts +2 -2
- package/src/endpoints/routes.ts +2 -2
- package/src/endpoints/website.ts +5 -5
package/dist/client.d.ts
CHANGED
|
@@ -32,10 +32,10 @@ export declare class BackstageClient {
|
|
|
32
32
|
readonly website: WebsiteService;
|
|
33
33
|
constructor(config?: BackstageUserConfig);
|
|
34
34
|
private request;
|
|
35
|
-
get<T = unknown>(url: string): Promise<T>;
|
|
36
|
-
post<T = unknown>(url: string, data?: unknown): Promise<T>;
|
|
37
|
-
put<T = unknown>(url: string, data?: unknown): Promise<T>;
|
|
38
|
-
patch<T = unknown>(url: string, data?: unknown): Promise<T>;
|
|
39
|
-
delete<T = unknown>(url: string): Promise<T>;
|
|
35
|
+
get<T = unknown>(url: string, options?: RequestInit): Promise<T>;
|
|
36
|
+
post<T = unknown>(url: string, data?: unknown, options?: RequestInit): Promise<T>;
|
|
37
|
+
put<T = unknown>(url: string, data?: unknown, options?: RequestInit): Promise<T>;
|
|
38
|
+
patch<T = unknown>(url: string, data?: unknown, options?: RequestInit): Promise<T>;
|
|
39
|
+
delete<T = unknown>(url: string, options?: RequestInit): Promise<T>;
|
|
40
40
|
}
|
|
41
41
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,qBAAa,eAAe;IAC1B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,OAAO,CAAC,CAAyB;IAGzC,SAAgB,MAAM,EAAE,YAAY,CAAC;IACrC,SAAgB,MAAM,EAAE,aAAa,CAAC;IACtC,SAAgB,MAAM,EAAE,YAAY,CAAC;IACrC,SAAgB,SAAS,EAAE,gBAAgB,CAAC;IAC5C,SAAgB,OAAO,EAAE,aAAa,CAAC;IACvC,SAAgB,SAAS,EAAE,eAAe,CAAC;IAC3C,SAAgB,KAAK,EAAE,YAAY,CAAC;IACpC,SAAgB,KAAK,EAAE,WAAW,CAAC;IACnC,SAAgB,UAAU,EAAE,iBAAiB,CAAC;IAC9C,SAAgB,KAAK,EAAE,WAAW,CAAC;IACnC,SAAgB,KAAK,EAAE,YAAY,CAAC;IACpC,SAAgB,MAAM,EAAE,YAAY,CAAC;IACrC,SAAgB,OAAO,EAAE,cAAc,CAAC;gBAE5B,MAAM,CAAC,EAAE,mBAAmB;YAuC1B,OAAO;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,qBAAa,eAAe;IAC1B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,OAAO,CAAC,CAAyB;IAGzC,SAAgB,MAAM,EAAE,YAAY,CAAC;IACrC,SAAgB,MAAM,EAAE,aAAa,CAAC;IACtC,SAAgB,MAAM,EAAE,YAAY,CAAC;IACrC,SAAgB,SAAS,EAAE,gBAAgB,CAAC;IAC5C,SAAgB,OAAO,EAAE,aAAa,CAAC;IACvC,SAAgB,SAAS,EAAE,eAAe,CAAC;IAC3C,SAAgB,KAAK,EAAE,YAAY,CAAC;IACpC,SAAgB,KAAK,EAAE,WAAW,CAAC;IACnC,SAAgB,UAAU,EAAE,iBAAiB,CAAC;IAC9C,SAAgB,KAAK,EAAE,WAAW,CAAC;IACnC,SAAgB,KAAK,EAAE,YAAY,CAAC;IACpC,SAAgB,MAAM,EAAE,YAAY,CAAC;IACrC,SAAgB,OAAO,EAAE,cAAc,CAAC;gBAE5B,MAAM,CAAC,EAAE,mBAAmB;YAuC1B,OAAO;IAoCR,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC;IAIhE,IAAI,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC;IAIjF,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC;IAIhF,KAAK,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC;IAIlF,MAAM,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC;CAGjF"}
|
package/dist/client.js
CHANGED
|
@@ -64,23 +64,24 @@ export class BackstageClient {
|
|
|
64
64
|
this.routes = new RouteService(this);
|
|
65
65
|
this.website = new WebsiteService(this);
|
|
66
66
|
}
|
|
67
|
-
async request(method, url, data) {
|
|
67
|
+
async request(method, url, data, options) {
|
|
68
68
|
const fullUrl = `${this.baseURL}${url}`;
|
|
69
|
-
const
|
|
69
|
+
const defaultHeaders = {
|
|
70
70
|
Authorization: `Bearer ${this.token}`,
|
|
71
71
|
"X-Account-ID": this.accountId,
|
|
72
72
|
Accept: "application/json",
|
|
73
73
|
"Content-Type": "application/json",
|
|
74
74
|
};
|
|
75
|
-
const
|
|
75
|
+
const fetchOptions = {
|
|
76
76
|
method,
|
|
77
|
-
headers,
|
|
77
|
+
headers: { ...defaultHeaders, ...options?.headers },
|
|
78
|
+
...options,
|
|
78
79
|
};
|
|
79
|
-
if (data && (method === "POST" || method === "PUT" || method === "PATCH")) {
|
|
80
|
-
|
|
80
|
+
if (data && !fetchOptions.body && (method === "POST" || method === "PUT" || method === "PATCH")) {
|
|
81
|
+
fetchOptions.body = JSON.stringify(data);
|
|
81
82
|
}
|
|
82
83
|
try {
|
|
83
|
-
const response = await fetch(fullUrl,
|
|
84
|
+
const response = await fetch(fullUrl, fetchOptions);
|
|
84
85
|
if (!response.ok) {
|
|
85
86
|
const errorText = await response.text();
|
|
86
87
|
const error = new Error(`HTTP ${response.status}: ${response.statusText} - ${errorText}`);
|
|
@@ -98,19 +99,19 @@ export class BackstageClient {
|
|
|
98
99
|
throw error;
|
|
99
100
|
}
|
|
100
101
|
}
|
|
101
|
-
async get(url) {
|
|
102
|
-
return this.request("GET", url);
|
|
102
|
+
async get(url, options) {
|
|
103
|
+
return this.request("GET", url, undefined, options);
|
|
103
104
|
}
|
|
104
|
-
async post(url, data) {
|
|
105
|
-
return this.request("POST", url, data);
|
|
105
|
+
async post(url, data, options) {
|
|
106
|
+
return this.request("POST", url, data, options);
|
|
106
107
|
}
|
|
107
|
-
async put(url, data) {
|
|
108
|
-
return this.request("PUT", url, data);
|
|
108
|
+
async put(url, data, options) {
|
|
109
|
+
return this.request("PUT", url, data, options);
|
|
109
110
|
}
|
|
110
|
-
async patch(url, data) {
|
|
111
|
-
return this.request("PATCH", url, data);
|
|
111
|
+
async patch(url, data, options) {
|
|
112
|
+
return this.request("PATCH", url, data, options);
|
|
112
113
|
}
|
|
113
|
-
async delete(url) {
|
|
114
|
-
return this.request("DELETE", url);
|
|
114
|
+
async delete(url, options) {
|
|
115
|
+
return this.request("DELETE", url, undefined, options);
|
|
115
116
|
}
|
|
116
117
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Alert } from "../types/index";
|
|
2
2
|
import { BaseService } from "./base.js";
|
|
3
3
|
export declare class AlertService extends BaseService {
|
|
4
|
-
getAlerts(): Promise<Alert[]>;
|
|
4
|
+
getAlerts(options?: RequestInit): Promise<Alert[]>;
|
|
5
5
|
}
|
|
6
6
|
//# sourceMappingURL=alerts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alerts.d.ts","sourceRoot":"","sources":["../../src/endpoints/alerts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyB,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,qBAAa,YAAa,SAAQ,WAAW;IACrC,SAAS,
|
|
1
|
+
{"version":3,"file":"alerts.d.ts","sourceRoot":"","sources":["../../src/endpoints/alerts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyB,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,qBAAa,YAAa,SAAQ,WAAW;IACrC,SAAS,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;CAIzD"}
|
package/dist/endpoints/alerts.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseService } from "./base.js";
|
|
2
2
|
export class AlertService extends BaseService {
|
|
3
|
-
async getAlerts() {
|
|
4
|
-
const { data } = await this.client.get("/alerts");
|
|
3
|
+
async getAlerts(options) {
|
|
4
|
+
const { data } = await this.client.get("/alerts", options);
|
|
5
5
|
return data;
|
|
6
6
|
}
|
|
7
7
|
}
|
|
@@ -10,9 +10,9 @@ export declare class BlocksService extends BaseService {
|
|
|
10
10
|
* Get all blocks
|
|
11
11
|
* @todo Implement this method when the API endpoint is available
|
|
12
12
|
*/
|
|
13
|
-
all(): Promise<void>;
|
|
14
|
-
create(params: BlockParams): Promise<BlockParams>;
|
|
15
|
-
update(id: string, params: BlockParams): Promise<BlockParams>;
|
|
13
|
+
all(options?: RequestInit): Promise<void>;
|
|
14
|
+
create(params: BlockParams, options?: RequestInit): Promise<BlockParams>;
|
|
15
|
+
update(id: string, params: BlockParams, options?: RequestInit): Promise<BlockParams>;
|
|
16
16
|
}
|
|
17
17
|
export {};
|
|
18
18
|
//# sourceMappingURL=blocks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../../src/endpoints/blocks.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,GAAG,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,aAAc,SAAQ,WAAW;IAC5C;;;OAGG;IACG,GAAG;
|
|
1
|
+
{"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../../src/endpoints/blocks.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,GAAG,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,aAAc,SAAQ,WAAW;IAC5C;;;OAGG;IACG,GAAG,CAAC,OAAO,CAAC,EAAE,WAAW;IAIzB,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,WAAW;IAKjD,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,WAAW;CAIpE"}
|
package/dist/endpoints/blocks.js
CHANGED
|
@@ -4,15 +4,15 @@ export class BlocksService extends BaseService {
|
|
|
4
4
|
* Get all blocks
|
|
5
5
|
* @todo Implement this method when the API endpoint is available
|
|
6
6
|
*/
|
|
7
|
-
async all() {
|
|
7
|
+
async all(options) {
|
|
8
8
|
throw new Error("Method not implemented. Please use the Backstage API documentation for available endpoints.");
|
|
9
9
|
}
|
|
10
|
-
async create(params) {
|
|
11
|
-
const res = await this.client.post("/blocks", params);
|
|
10
|
+
async create(params, options) {
|
|
11
|
+
const res = await this.client.post("/blocks", params, options);
|
|
12
12
|
return res.data;
|
|
13
13
|
}
|
|
14
|
-
async update(id, params) {
|
|
15
|
-
const res = await this.client.put(`/blocks/${id}`, params);
|
|
14
|
+
async update(id, params, options) {
|
|
15
|
+
const res = await this.client.put(`/blocks/${id}`, params, options);
|
|
16
16
|
return res.data;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Event } from "../types/index";
|
|
2
2
|
import { BaseService } from "./base.js";
|
|
3
3
|
export declare class EventService extends BaseService {
|
|
4
|
-
getEvents(): Promise<Event[]>;
|
|
5
|
-
getEvent(id: string): Promise<Event | null>;
|
|
6
|
-
getEventBySlug(slug: string): Promise<Event | null>;
|
|
4
|
+
getEvents(options?: RequestInit): Promise<Event[]>;
|
|
5
|
+
getEvent(id: string, options?: RequestInit): Promise<Event | null>;
|
|
6
|
+
getEventBySlug(slug: string, options?: RequestInit): Promise<Event | null>;
|
|
7
7
|
}
|
|
8
8
|
//# sourceMappingURL=events.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/endpoints/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyB,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,qBAAa,YAAa,SAAQ,WAAW;IACrC,SAAS,
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/endpoints/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyB,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,qBAAa,YAAa,SAAQ,WAAW;IACrC,SAAS,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAKlD,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;IAQlE,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;CAOjF"}
|
package/dist/endpoints/events.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { BaseService } from "./base.js";
|
|
2
2
|
export class EventService extends BaseService {
|
|
3
|
-
async getEvents() {
|
|
4
|
-
const { data } = await this.client.get("/events");
|
|
3
|
+
async getEvents(options) {
|
|
4
|
+
const { data } = await this.client.get("/events", options);
|
|
5
5
|
return data;
|
|
6
6
|
}
|
|
7
|
-
async getEvent(id) {
|
|
8
|
-
const { data } = await this.client.get(`/events?filter[id]=${id}
|
|
7
|
+
async getEvent(id, options) {
|
|
8
|
+
const { data } = await this.client.get(`/events?filter[id]=${id}`, options);
|
|
9
9
|
if (!data || data.length === 0) {
|
|
10
10
|
return null;
|
|
11
11
|
}
|
|
12
12
|
return data[0];
|
|
13
13
|
}
|
|
14
|
-
async getEventBySlug(slug) {
|
|
15
|
-
const { data } = await this.client.get(`/events?filter[slug]=${slug}
|
|
14
|
+
async getEventBySlug(slug, options) {
|
|
15
|
+
const { data } = await this.client.get(`/events?filter[slug]=${slug}`, options);
|
|
16
16
|
if (!data || data.length === 0) {
|
|
17
17
|
return null;
|
|
18
18
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { InstagramPost } from "../types/index";
|
|
2
2
|
import { BaseService } from "./base.js";
|
|
3
3
|
export declare class InstagramService extends BaseService {
|
|
4
|
-
latest(): Promise<InstagramPost[]>;
|
|
4
|
+
latest(options?: RequestInit): Promise<InstagramPost[]>;
|
|
5
5
|
}
|
|
6
6
|
//# sourceMappingURL=instagram.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instagram.d.ts","sourceRoot":"","sources":["../../src/endpoints/instagram.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyB,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,qBAAa,gBAAiB,SAAQ,WAAW;IACzC,MAAM,
|
|
1
|
+
{"version":3,"file":"instagram.d.ts","sourceRoot":"","sources":["../../src/endpoints/instagram.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyB,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,qBAAa,gBAAiB,SAAQ,WAAW;IACzC,MAAM,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;CAI9D"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseService } from "./base.js";
|
|
2
2
|
export class InstagramService extends BaseService {
|
|
3
|
-
async latest() {
|
|
4
|
-
const { data } = await this.client.get("/instagram-posts");
|
|
3
|
+
async latest(options) {
|
|
4
|
+
const { data } = await this.client.get("/instagram-posts", options);
|
|
5
5
|
return data;
|
|
6
6
|
}
|
|
7
7
|
}
|
|
@@ -5,9 +5,9 @@ interface LayoutParams {
|
|
|
5
5
|
schema: any;
|
|
6
6
|
}
|
|
7
7
|
export declare class LayoutService extends BaseService {
|
|
8
|
-
all(): Promise<void>;
|
|
9
|
-
create({ name, slug, schema }: LayoutParams): Promise<LayoutParams>;
|
|
10
|
-
update(id: string, { name, slug, schema }: LayoutParams): Promise<LayoutParams>;
|
|
8
|
+
all(options?: RequestInit): Promise<void>;
|
|
9
|
+
create({ name, slug, schema }: LayoutParams, options?: RequestInit): Promise<LayoutParams>;
|
|
10
|
+
update(id: string, { name, slug, schema }: LayoutParams, options?: RequestInit): Promise<LayoutParams>;
|
|
11
11
|
}
|
|
12
12
|
export {};
|
|
13
13
|
//# sourceMappingURL=layouts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layouts.d.ts","sourceRoot":"","sources":["../../src/endpoints/layouts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,GAAG,CAAC;CACb;AAED,qBAAa,aAAc,SAAQ,WAAW;IACtC,GAAG;
|
|
1
|
+
{"version":3,"file":"layouts.d.ts","sourceRoot":"","sources":["../../src/endpoints/layouts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,GAAG,CAAC;CACb;AAED,qBAAa,aAAc,SAAQ,WAAW;IACtC,GAAG,CAAC,OAAO,CAAC,EAAE,WAAW;IAEzB,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,WAAW;IAKlE,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,WAAW;CAIrF"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { BaseService } from "./base.js";
|
|
2
2
|
export class LayoutService extends BaseService {
|
|
3
|
-
async all() { }
|
|
4
|
-
async create({ name, slug, schema }) {
|
|
5
|
-
const res = await this.client.post("/layouts", { name, slug, schema });
|
|
3
|
+
async all(options) { }
|
|
4
|
+
async create({ name, slug, schema }, options) {
|
|
5
|
+
const res = await this.client.post("/layouts", { name, slug, schema }, options);
|
|
6
6
|
return res.data;
|
|
7
7
|
}
|
|
8
|
-
async update(id, { name, slug, schema }) {
|
|
9
|
-
const res = await this.client.put(`/layouts/${id}`, { name, slug, schema });
|
|
8
|
+
async update(id, { name, slug, schema }, options) {
|
|
9
|
+
const res = await this.client.put(`/layouts/${id}`, { name, slug, schema }, options);
|
|
10
10
|
return res.data;
|
|
11
11
|
}
|
|
12
12
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Location } from "../types/index";
|
|
2
2
|
import { BaseService } from "./base.js";
|
|
3
3
|
export declare class LocationService extends BaseService {
|
|
4
|
-
getLocations(): Promise<Location[]>;
|
|
5
|
-
getLocationBySlug(slug: string): Promise<Location | null>;
|
|
4
|
+
getLocations(options?: RequestInit): Promise<Location[]>;
|
|
5
|
+
getLocationBySlug(slug: string, options?: RequestInit): Promise<Location | null>;
|
|
6
6
|
}
|
|
7
7
|
//# sourceMappingURL=locations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locations.d.ts","sourceRoot":"","sources":["../../src/endpoints/locations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyB,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,qBAAa,eAAgB,SAAQ,WAAW;IACxC,YAAY,
|
|
1
|
+
{"version":3,"file":"locations.d.ts","sourceRoot":"","sources":["../../src/endpoints/locations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyB,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,qBAAa,eAAgB,SAAQ,WAAW;IACxC,YAAY,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAOxD,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;CAUvF"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { BaseService } from "./base.js";
|
|
2
2
|
export class LocationService extends BaseService {
|
|
3
|
-
async getLocations() {
|
|
4
|
-
const res = await this.client.get("/locations");
|
|
3
|
+
async getLocations(options) {
|
|
4
|
+
const res = await this.client.get("/locations", options);
|
|
5
5
|
let locations = res.data;
|
|
6
6
|
locations = locations.sort((a, b) => a.name.localeCompare(b.name));
|
|
7
7
|
return locations;
|
|
8
8
|
}
|
|
9
|
-
async getLocationBySlug(slug) {
|
|
10
|
-
const res = await this.client.get(`/locations?filter[slug]=${slug}
|
|
9
|
+
async getLocationBySlug(slug, options) {
|
|
10
|
+
const res = await this.client.get(`/locations?filter[slug]=${slug}`, options);
|
|
11
11
|
const data = res.data;
|
|
12
12
|
if (!data || data.length === 0) {
|
|
13
13
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../src/endpoints/media.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyB,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,qBAAa,YAAa,SAAQ,WAAW;IACrC,GAAG;
|
|
1
|
+
{"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../src/endpoints/media.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyB,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,qBAAa,YAAa,SAAQ,WAAW;IACrC,GAAG,CAAC,OAAO,CAAC,EAAE,WAAW;CAIhC"}
|
package/dist/endpoints/media.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Menu } from "../types/index";
|
|
2
2
|
import { BaseService } from "./base.js";
|
|
3
3
|
export declare class MenuService extends BaseService {
|
|
4
|
-
getMenus(): Promise<Menu[]>;
|
|
5
|
-
getMenu(id: string): Promise<Menu | Menu[]>;
|
|
6
|
-
getMenuBySlug(slug: string): Promise<Menu | Menu[]>;
|
|
4
|
+
getMenus(options?: RequestInit): Promise<Menu[]>;
|
|
5
|
+
getMenu(id: string, options?: RequestInit): Promise<Menu | Menu[]>;
|
|
6
|
+
getMenuBySlug(slug: string, options?: RequestInit): Promise<Menu | Menu[]>;
|
|
7
7
|
}
|
|
8
8
|
//# sourceMappingURL=menus.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menus.d.ts","sourceRoot":"","sources":["../../src/endpoints/menus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyB,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,qBAAa,WAAY,SAAQ,WAAW;IACpC,QAAQ,
|
|
1
|
+
{"version":3,"file":"menus.d.ts","sourceRoot":"","sources":["../../src/endpoints/menus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyB,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,qBAAa,WAAY,SAAQ,WAAW;IACpC,QAAQ,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAMhD,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW;IAWzC,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW;CAYxD"}
|
package/dist/endpoints/menus.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { BaseService } from "./base.js";
|
|
2
2
|
export class MenuService extends BaseService {
|
|
3
|
-
async getMenus() {
|
|
4
|
-
const res = await this.client.get("/menus");
|
|
3
|
+
async getMenus(options) {
|
|
4
|
+
const res = await this.client.get("/menus", options);
|
|
5
5
|
const menus = res.data;
|
|
6
6
|
return menus;
|
|
7
7
|
}
|
|
8
|
-
async getMenu(id) {
|
|
9
|
-
const res = await this.client.get(`/menus?filter[id]=${id}&include=categories.items
|
|
8
|
+
async getMenu(id, options) {
|
|
9
|
+
const res = await this.client.get(`/menus?filter[id]=${id}&include=categories.items`, options);
|
|
10
10
|
const data = res.data;
|
|
11
11
|
if (Array.isArray(data) && data.length > 0) {
|
|
12
12
|
return data[0];
|
|
13
13
|
}
|
|
14
14
|
return data;
|
|
15
15
|
}
|
|
16
|
-
async getMenuBySlug(slug) {
|
|
17
|
-
const res = await this.client.get(`/menus?filter[slug]=${slug}&include=categories.items
|
|
16
|
+
async getMenuBySlug(slug, options) {
|
|
17
|
+
const res = await this.client.get(`/menus?filter[slug]=${slug}&include=categories.items`, options);
|
|
18
18
|
const data = res.data;
|
|
19
19
|
if (Array.isArray(data) && data.length > 0) {
|
|
20
20
|
return data[0];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Navigation } from "../types/index";
|
|
2
2
|
import { BaseService } from "./base.js";
|
|
3
3
|
export declare class NavigationService extends BaseService {
|
|
4
|
-
getNavigations(): Promise<Navigation[]>;
|
|
5
|
-
getDefaultNavigation(): Promise<Navigation>;
|
|
6
|
-
getNavigation(id: string): Promise<Navigation>;
|
|
4
|
+
getNavigations(options?: RequestInit): Promise<Navigation[]>;
|
|
5
|
+
getDefaultNavigation(options?: RequestInit): Promise<Navigation>;
|
|
6
|
+
getNavigation(id: string, options?: RequestInit): Promise<Navigation>;
|
|
7
7
|
}
|
|
8
8
|
//# sourceMappingURL=navigation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/endpoints/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA4C,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC3F,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,qBAAa,iBAAkB,SAAQ,WAAW;IAC1C,cAAc,
|
|
1
|
+
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/endpoints/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA4C,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC3F,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,qBAAa,iBAAkB,SAAQ,WAAW;IAC1C,cAAc,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAY5D,oBAAoB,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;IAKhE,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;CAc5E"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { BaseService } from "./base.js";
|
|
2
2
|
export class NavigationService extends BaseService {
|
|
3
|
-
async getNavigations() {
|
|
4
|
-
const res = await this.client.get("/navigations");
|
|
3
|
+
async getNavigations(options) {
|
|
4
|
+
const res = await this.client.get("/navigations", options);
|
|
5
5
|
const navigations = res.data;
|
|
6
6
|
return Promise.all(navigations.map(async (navigation) => {
|
|
7
|
-
const res = await this.client.get("/navigations/" + navigation.id);
|
|
7
|
+
const res = await this.client.get("/navigations/" + navigation.id, options);
|
|
8
8
|
return res.data[0];
|
|
9
9
|
}));
|
|
10
10
|
}
|
|
11
|
-
async getDefaultNavigation() {
|
|
12
|
-
const navigations = await this.getNavigations();
|
|
11
|
+
async getDefaultNavigation(options) {
|
|
12
|
+
const navigations = await this.getNavigations(options);
|
|
13
13
|
return navigations[0];
|
|
14
14
|
}
|
|
15
|
-
async getNavigation(id) {
|
|
16
|
-
const res = await this.client.get(`/navigations/${id}
|
|
15
|
+
async getNavigation(id, options) {
|
|
16
|
+
const res = await this.client.get(`/navigations/${id}`, options);
|
|
17
17
|
const navigation = res.data;
|
|
18
18
|
const topLevelItems = navigation.items.filter((item) => item.parent_id === null);
|
|
19
19
|
topLevelItems.forEach((item) => {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Page } from "../types/index";
|
|
2
2
|
import { BaseService } from "./base.js";
|
|
3
3
|
export declare class PageService extends BaseService {
|
|
4
|
-
getPages(): Promise<Page[]>;
|
|
5
|
-
getPage(id: string): Promise<Page | null>;
|
|
6
|
-
getPageBySlug(slug: string): Promise<Page | null>;
|
|
7
|
-
getHomePage(): Promise<Page | null>;
|
|
8
|
-
getPageByPathname(pathname: string): Promise<Page | null>;
|
|
4
|
+
getPages(options?: RequestInit): Promise<Page[]>;
|
|
5
|
+
getPage(id: string, options?: RequestInit): Promise<Page | null>;
|
|
6
|
+
getPageBySlug(slug: string, options?: RequestInit): Promise<Page | null>;
|
|
7
|
+
getHomePage(options?: RequestInit): Promise<Page | null>;
|
|
8
|
+
getPageByPathname(pathname: string, options?: RequestInit): Promise<Page | null>;
|
|
9
9
|
}
|
|
10
10
|
//# sourceMappingURL=pages.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pages.d.ts","sourceRoot":"","sources":["../../src/endpoints/pages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyB,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,qBAAa,WAAY,SAAQ,WAAW;IACpC,QAAQ,
|
|
1
|
+
{"version":3,"file":"pages.d.ts","sourceRoot":"","sources":["../../src/endpoints/pages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyB,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,qBAAa,WAAY,SAAQ,WAAW;IACpC,QAAQ,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAKhD,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAQhE,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAQxE,WAAW,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAQxD,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;CAOvF"}
|
package/dist/endpoints/pages.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import { BaseService } from "./base.js";
|
|
2
2
|
export class PageService extends BaseService {
|
|
3
|
-
async getPages() {
|
|
4
|
-
const res = await this.client.get("/pages");
|
|
3
|
+
async getPages(options) {
|
|
4
|
+
const res = await this.client.get("/pages", options);
|
|
5
5
|
return res.data;
|
|
6
6
|
}
|
|
7
|
-
async getPage(id) {
|
|
8
|
-
const res = await this.client.get(`/pages/${id}
|
|
7
|
+
async getPage(id, options) {
|
|
8
|
+
const res = await this.client.get(`/pages/${id}`, options);
|
|
9
9
|
if (!res.data || res.data.length === 0) {
|
|
10
10
|
return null;
|
|
11
11
|
}
|
|
12
12
|
return res.data[0];
|
|
13
13
|
}
|
|
14
|
-
async getPageBySlug(slug) {
|
|
15
|
-
const res = await this.client.get(`/pages?filter[slug]=${slug}
|
|
14
|
+
async getPageBySlug(slug, options) {
|
|
15
|
+
const res = await this.client.get(`/pages?filter[slug]=${slug}`, options);
|
|
16
16
|
if (!res.data || res.data.length === 0) {
|
|
17
17
|
return null;
|
|
18
18
|
}
|
|
19
19
|
return res.data[0];
|
|
20
20
|
}
|
|
21
|
-
async getHomePage() {
|
|
22
|
-
const res = await this.client.get("/pages?filter[slug]=/");
|
|
21
|
+
async getHomePage(options) {
|
|
22
|
+
const res = await this.client.get("/pages?filter[slug]=/", options);
|
|
23
23
|
if (!res.data || res.data.length === 0) {
|
|
24
24
|
return null;
|
|
25
25
|
}
|
|
26
26
|
return res.data[0];
|
|
27
27
|
}
|
|
28
|
-
async getPageByPathname(pathname) {
|
|
29
|
-
const res = await this.client.get(`/pages?filter[pathname]=${pathname}
|
|
28
|
+
async getPageByPathname(pathname, options) {
|
|
29
|
+
const res = await this.client.get(`/pages?filter[pathname]=${pathname}`, options);
|
|
30
30
|
if (!res.data || res.data.length === 0) {
|
|
31
31
|
return null;
|
|
32
32
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Press } from "../types/index";
|
|
2
2
|
import { BaseService } from "./base.js";
|
|
3
3
|
export declare class PressService extends BaseService {
|
|
4
|
-
getPress(): Promise<Press[]>;
|
|
4
|
+
getPress(options?: RequestInit): Promise<Press[]>;
|
|
5
5
|
}
|
|
6
6
|
//# sourceMappingURL=press.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"press.d.ts","sourceRoot":"","sources":["../../src/endpoints/press.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyB,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,qBAAa,YAAa,SAAQ,WAAW;IACrC,QAAQ,
|
|
1
|
+
{"version":3,"file":"press.d.ts","sourceRoot":"","sources":["../../src/endpoints/press.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyB,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,qBAAa,YAAa,SAAQ,WAAW;IACrC,QAAQ,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;CAIxD"}
|
package/dist/endpoints/press.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseService } from "./base.js";
|
|
2
2
|
export class PressService extends BaseService {
|
|
3
|
-
async getPress() {
|
|
4
|
-
const { data } = await this.client.get("/press");
|
|
3
|
+
async getPress(options) {
|
|
4
|
+
const { data } = await this.client.get("/press", options);
|
|
5
5
|
return data;
|
|
6
6
|
}
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Route } from "../types/index";
|
|
2
2
|
import { BaseService } from "./base.js";
|
|
3
3
|
export declare class RouteService extends BaseService {
|
|
4
|
-
resolve<T = Route>(path: string): Promise<T>;
|
|
4
|
+
resolve<T = Route>(path: string, options?: RequestInit): Promise<T>;
|
|
5
5
|
}
|
|
6
6
|
//# sourceMappingURL=routes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/endpoints/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,qBAAa,YAAa,SAAQ,WAAW;IACrC,OAAO,CAAC,CAAC,GAAG,KAAK,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/endpoints/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,qBAAa,YAAa,SAAQ,WAAW;IACrC,OAAO,CAAC,CAAC,GAAG,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC;CAI1E"}
|
package/dist/endpoints/routes.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseService } from "./base.js";
|
|
2
2
|
export class RouteService extends BaseService {
|
|
3
|
-
async resolve(path) {
|
|
3
|
+
async resolve(path, options) {
|
|
4
4
|
const query = new URLSearchParams({ path }).toString();
|
|
5
|
-
return this.client.get(`/routes/resolve?${query}
|
|
5
|
+
return this.client.get(`/routes/resolve?${query}`, options);
|
|
6
6
|
}
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Website } from "../types/index";
|
|
2
2
|
import { BaseService } from "./base.js";
|
|
3
3
|
export declare class WebsiteService extends BaseService {
|
|
4
|
-
getWebsite(): Promise<Website>;
|
|
5
|
-
routes(): Promise<string[]>;
|
|
4
|
+
getWebsite(options?: RequestInit): Promise<Website>;
|
|
5
|
+
routes(options?: RequestInit): Promise<string[]>;
|
|
6
6
|
}
|
|
7
7
|
//# sourceMappingURL=website.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"website.d.ts","sourceRoot":"","sources":["../../src/endpoints/website.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyB,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,qBAAa,cAAe,SAAQ,WAAW;IACvC,UAAU,
|
|
1
|
+
{"version":3,"file":"website.d.ts","sourceRoot":"","sources":["../../src/endpoints/website.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyB,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,qBAAa,cAAe,SAAQ,WAAW;IACvC,UAAU,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;IAKnD,MAAM,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAKvD"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { BaseService } from "./base.js";
|
|
2
2
|
export class WebsiteService extends BaseService {
|
|
3
|
-
async getWebsite() {
|
|
4
|
-
const res = await this.client.get("/websites");
|
|
3
|
+
async getWebsite(options) {
|
|
4
|
+
const res = await this.client.get("/websites", options);
|
|
5
5
|
return res.data[0];
|
|
6
6
|
}
|
|
7
|
-
async routes() {
|
|
8
|
-
const website = await this.getWebsite();
|
|
9
|
-
return this.client.get(`/websites/${website.id}/routes
|
|
7
|
+
async routes(options) {
|
|
8
|
+
const website = await this.getWebsite(options);
|
|
9
|
+
return this.client.get(`/websites/${website.id}/routes`, options);
|
|
10
10
|
}
|
|
11
11
|
}
|
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -73,26 +73,27 @@ export class BackstageClient {
|
|
|
73
73
|
this.website = new WebsiteService(this);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
private async request<T = unknown>(method: string, url: string, data?: unknown): Promise<T> {
|
|
76
|
+
private async request<T = unknown>(method: string, url: string, data?: unknown, options?: RequestInit): Promise<T> {
|
|
77
77
|
const fullUrl = `${this.baseURL}${url}`;
|
|
78
|
-
const
|
|
78
|
+
const defaultHeaders: Record<string, string> = {
|
|
79
79
|
Authorization: `Bearer ${this.token}`,
|
|
80
80
|
"X-Account-ID": this.accountId,
|
|
81
81
|
Accept: "application/json",
|
|
82
82
|
"Content-Type": "application/json",
|
|
83
83
|
};
|
|
84
84
|
|
|
85
|
-
const
|
|
85
|
+
const fetchOptions: RequestInit = {
|
|
86
86
|
method,
|
|
87
|
-
headers,
|
|
87
|
+
headers: { ...defaultHeaders, ...options?.headers },
|
|
88
|
+
...options,
|
|
88
89
|
};
|
|
89
90
|
|
|
90
|
-
if (data && (method === "POST" || method === "PUT" || method === "PATCH")) {
|
|
91
|
-
|
|
91
|
+
if (data && !fetchOptions.body && (method === "POST" || method === "PUT" || method === "PATCH")) {
|
|
92
|
+
fetchOptions.body = JSON.stringify(data);
|
|
92
93
|
}
|
|
93
94
|
|
|
94
95
|
try {
|
|
95
|
-
const response = await fetch(fullUrl,
|
|
96
|
+
const response = await fetch(fullUrl, fetchOptions);
|
|
96
97
|
if (!response.ok) {
|
|
97
98
|
const errorText = await response.text();
|
|
98
99
|
const error = new Error(`HTTP ${response.status}: ${response.statusText} - ${errorText}`);
|
|
@@ -108,23 +109,23 @@ export class BackstageClient {
|
|
|
108
109
|
}
|
|
109
110
|
}
|
|
110
111
|
|
|
111
|
-
public async get<T = unknown>(url: string): Promise<T> {
|
|
112
|
-
return this.request<T>("GET", url);
|
|
112
|
+
public async get<T = unknown>(url: string, options?: RequestInit): Promise<T> {
|
|
113
|
+
return this.request<T>("GET", url, undefined, options);
|
|
113
114
|
}
|
|
114
115
|
|
|
115
|
-
public async post<T = unknown>(url: string, data?: unknown): Promise<T> {
|
|
116
|
-
return this.request<T>("POST", url, data);
|
|
116
|
+
public async post<T = unknown>(url: string, data?: unknown, options?: RequestInit): Promise<T> {
|
|
117
|
+
return this.request<T>("POST", url, data, options);
|
|
117
118
|
}
|
|
118
119
|
|
|
119
|
-
public async put<T = unknown>(url: string, data?: unknown): Promise<T> {
|
|
120
|
-
return this.request<T>("PUT", url, data);
|
|
120
|
+
public async put<T = unknown>(url: string, data?: unknown, options?: RequestInit): Promise<T> {
|
|
121
|
+
return this.request<T>("PUT", url, data, options);
|
|
121
122
|
}
|
|
122
123
|
|
|
123
|
-
public async patch<T = unknown>(url: string, data?: unknown): Promise<T> {
|
|
124
|
-
return this.request<T>("PATCH", url, data);
|
|
124
|
+
public async patch<T = unknown>(url: string, data?: unknown, options?: RequestInit): Promise<T> {
|
|
125
|
+
return this.request<T>("PATCH", url, data, options);
|
|
125
126
|
}
|
|
126
127
|
|
|
127
|
-
public async delete<T = unknown>(url: string): Promise<T> {
|
|
128
|
-
return this.request<T>("DELETE", url);
|
|
128
|
+
public async delete<T = unknown>(url: string, options?: RequestInit): Promise<T> {
|
|
129
|
+
return this.request<T>("DELETE", url, undefined, options);
|
|
129
130
|
}
|
|
130
131
|
}
|
package/src/endpoints/alerts.ts
CHANGED
|
@@ -2,8 +2,8 @@ import type { ApiCollectionResponse, Alert } from "../types/index";
|
|
|
2
2
|
import { BaseService } from "./base.js";
|
|
3
3
|
|
|
4
4
|
export class AlertService extends BaseService {
|
|
5
|
-
async getAlerts(): Promise<Alert[]> {
|
|
6
|
-
const { data } = await this.client.get<ApiCollectionResponse<Alert>>("/alerts");
|
|
5
|
+
async getAlerts(options?: RequestInit): Promise<Alert[]> {
|
|
6
|
+
const { data } = await this.client.get<ApiCollectionResponse<Alert>>("/alerts", options);
|
|
7
7
|
return data;
|
|
8
8
|
}
|
|
9
9
|
}
|
package/src/endpoints/blocks.ts
CHANGED
|
@@ -13,17 +13,17 @@ export class BlocksService extends BaseService {
|
|
|
13
13
|
* Get all blocks
|
|
14
14
|
* @todo Implement this method when the API endpoint is available
|
|
15
15
|
*/
|
|
16
|
-
async all() {
|
|
16
|
+
async all(options?: RequestInit) {
|
|
17
17
|
throw new Error("Method not implemented. Please use the Backstage API documentation for available endpoints.");
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
async create(params: BlockParams) {
|
|
21
|
-
const res = await this.client.post<ApiSingleResponse<BlockParams>>("/blocks", params);
|
|
20
|
+
async create(params: BlockParams, options?: RequestInit) {
|
|
21
|
+
const res = await this.client.post<ApiSingleResponse<BlockParams>>("/blocks", params, options);
|
|
22
22
|
return res.data;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
async update(id: string, params: BlockParams) {
|
|
26
|
-
const res = await this.client.put<ApiSingleResponse<BlockParams>>(`/blocks/${id}`, params);
|
|
25
|
+
async update(id: string, params: BlockParams, options?: RequestInit) {
|
|
26
|
+
const res = await this.client.put<ApiSingleResponse<BlockParams>>(`/blocks/${id}`, params, options);
|
|
27
27
|
return res.data;
|
|
28
28
|
}
|
|
29
29
|
}
|
package/src/endpoints/events.ts
CHANGED
|
@@ -2,21 +2,21 @@ import type { ApiCollectionResponse, Event } from "../types/index";
|
|
|
2
2
|
import { BaseService } from "./base.js";
|
|
3
3
|
|
|
4
4
|
export class EventService extends BaseService {
|
|
5
|
-
async getEvents(): Promise<Event[]> {
|
|
6
|
-
const { data } = await this.client.get<ApiCollectionResponse<Event>>("/events");
|
|
5
|
+
async getEvents(options?: RequestInit): Promise<Event[]> {
|
|
6
|
+
const { data } = await this.client.get<ApiCollectionResponse<Event>>("/events", options);
|
|
7
7
|
return data;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
async getEvent(id: string): Promise<Event | null> {
|
|
11
|
-
const { data } = await this.client.get<ApiCollectionResponse<Event>>(`/events?filter[id]=${id}
|
|
10
|
+
async getEvent(id: string, options?: RequestInit): Promise<Event | null> {
|
|
11
|
+
const { data } = await this.client.get<ApiCollectionResponse<Event>>(`/events?filter[id]=${id}`, options);
|
|
12
12
|
if (!data || data.length === 0) {
|
|
13
13
|
return null;
|
|
14
14
|
}
|
|
15
15
|
return data[0];
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
async getEventBySlug(slug: string): Promise<Event | null> {
|
|
19
|
-
const { data } = await this.client.get<ApiCollectionResponse<Event>>(`/events?filter[slug]=${slug}
|
|
18
|
+
async getEventBySlug(slug: string, options?: RequestInit): Promise<Event | null> {
|
|
19
|
+
const { data } = await this.client.get<ApiCollectionResponse<Event>>(`/events?filter[slug]=${slug}`, options);
|
|
20
20
|
if (!data || data.length === 0) {
|
|
21
21
|
return null;
|
|
22
22
|
}
|
|
@@ -2,8 +2,8 @@ import type { ApiCollectionResponse, InstagramPost } from "../types/index";
|
|
|
2
2
|
import { BaseService } from "./base.js";
|
|
3
3
|
|
|
4
4
|
export class InstagramService extends BaseService {
|
|
5
|
-
async latest(): Promise<InstagramPost[]> {
|
|
6
|
-
const { data } = await this.client.get<ApiCollectionResponse<InstagramPost>>("/instagram-posts");
|
|
5
|
+
async latest(options?: RequestInit): Promise<InstagramPost[]> {
|
|
6
|
+
const { data } = await this.client.get<ApiCollectionResponse<InstagramPost>>("/instagram-posts", options);
|
|
7
7
|
return data;
|
|
8
8
|
}
|
|
9
9
|
}
|
package/src/endpoints/layouts.ts
CHANGED
|
@@ -8,15 +8,15 @@ interface LayoutParams {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export class LayoutService extends BaseService {
|
|
11
|
-
async all() {}
|
|
11
|
+
async all(options?: RequestInit) {}
|
|
12
12
|
|
|
13
|
-
async create({ name, slug, schema }: LayoutParams) {
|
|
14
|
-
const res = await this.client.post<ApiSingleResponse<LayoutParams>>("/layouts", { name, slug, schema });
|
|
13
|
+
async create({ name, slug, schema }: LayoutParams, options?: RequestInit) {
|
|
14
|
+
const res = await this.client.post<ApiSingleResponse<LayoutParams>>("/layouts", { name, slug, schema }, options);
|
|
15
15
|
return res.data;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
async update(id: string, { name, slug, schema }: LayoutParams) {
|
|
19
|
-
const res = await this.client.put<ApiSingleResponse<LayoutParams>>(`/layouts/${id}`, { name, slug, schema });
|
|
18
|
+
async update(id: string, { name, slug, schema }: LayoutParams, options?: RequestInit) {
|
|
19
|
+
const res = await this.client.put<ApiSingleResponse<LayoutParams>>(`/layouts/${id}`, { name, slug, schema }, options);
|
|
20
20
|
return res.data;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -2,15 +2,15 @@ import type { ApiCollectionResponse, Location } from "../types/index";
|
|
|
2
2
|
import { BaseService } from "./base.js";
|
|
3
3
|
|
|
4
4
|
export class LocationService extends BaseService {
|
|
5
|
-
async getLocations(): Promise<Location[]> {
|
|
6
|
-
const res = await this.client.get<ApiCollectionResponse<Location>>("/locations");
|
|
5
|
+
async getLocations(options?: RequestInit): Promise<Location[]> {
|
|
6
|
+
const res = await this.client.get<ApiCollectionResponse<Location>>("/locations", options);
|
|
7
7
|
let locations = res.data;
|
|
8
8
|
locations = locations.sort((a, b) => a.name.localeCompare(b.name));
|
|
9
9
|
return locations;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
async getLocationBySlug(slug: string): Promise<Location | null> {
|
|
13
|
-
const res = await this.client.get<ApiCollectionResponse<Location>>(`/locations?filter[slug]=${slug}
|
|
12
|
+
async getLocationBySlug(slug: string, options?: RequestInit): Promise<Location | null> {
|
|
13
|
+
const res = await this.client.get<ApiCollectionResponse<Location>>(`/locations?filter[slug]=${slug}`, options);
|
|
14
14
|
const data = res.data;
|
|
15
15
|
|
|
16
16
|
if (!data || data.length === 0) {
|
package/src/endpoints/media.ts
CHANGED
|
@@ -2,8 +2,8 @@ import type { ApiCollectionResponse, Media } from "../types/index";
|
|
|
2
2
|
import { BaseService } from "./base.js";
|
|
3
3
|
|
|
4
4
|
export class MediaService extends BaseService {
|
|
5
|
-
async all() {
|
|
6
|
-
const res = await this.client.get<ApiCollectionResponse<Media>>("/media");
|
|
5
|
+
async all(options?: RequestInit) {
|
|
6
|
+
const res = await this.client.get<ApiCollectionResponse<Media>>("/media", options);
|
|
7
7
|
return res.data;
|
|
8
8
|
}
|
|
9
9
|
}
|
package/src/endpoints/menus.ts
CHANGED
|
@@ -2,14 +2,14 @@ import type { ApiCollectionResponse, Menu } from "../types/index";
|
|
|
2
2
|
import { BaseService } from "./base.js";
|
|
3
3
|
|
|
4
4
|
export class MenuService extends BaseService {
|
|
5
|
-
async getMenus(): Promise<Menu[]> {
|
|
6
|
-
const res = await this.client.get<ApiCollectionResponse<Menu>>("/menus");
|
|
5
|
+
async getMenus(options?: RequestInit): Promise<Menu[]> {
|
|
6
|
+
const res = await this.client.get<ApiCollectionResponse<Menu>>("/menus", options);
|
|
7
7
|
const menus = res.data;
|
|
8
8
|
return menus;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
async getMenu(id: string) {
|
|
12
|
-
const res = await this.client.get<ApiCollectionResponse<Menu>>(`/menus?filter[id]=${id}&include=categories.items
|
|
11
|
+
async getMenu(id: string, options?: RequestInit) {
|
|
12
|
+
const res = await this.client.get<ApiCollectionResponse<Menu>>(`/menus?filter[id]=${id}&include=categories.items`, options);
|
|
13
13
|
const data = res.data;
|
|
14
14
|
|
|
15
15
|
if (Array.isArray(data) && data.length > 0) {
|
|
@@ -19,9 +19,9 @@ export class MenuService extends BaseService {
|
|
|
19
19
|
return data;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
async getMenuBySlug(slug: string) {
|
|
22
|
+
async getMenuBySlug(slug: string, options?: RequestInit) {
|
|
23
23
|
const res = await this.client.get<ApiCollectionResponse<Menu>>(
|
|
24
|
-
`/menus?filter[slug]=${slug}&include=categories.items
|
|
24
|
+
`/menus?filter[slug]=${slug}&include=categories.items`, options
|
|
25
25
|
);
|
|
26
26
|
const data = res.data;
|
|
27
27
|
|
|
@@ -2,25 +2,25 @@ import type { ApiSingleResponse, ApiCollectionResponse, Navigation } from "../ty
|
|
|
2
2
|
import { BaseService } from "./base.js";
|
|
3
3
|
|
|
4
4
|
export class NavigationService extends BaseService {
|
|
5
|
-
async getNavigations(): Promise<Navigation[]> {
|
|
6
|
-
const res = await this.client.get<ApiCollectionResponse<Navigation>>("/navigations");
|
|
5
|
+
async getNavigations(options?: RequestInit): Promise<Navigation[]> {
|
|
6
|
+
const res = await this.client.get<ApiCollectionResponse<Navigation>>("/navigations", options);
|
|
7
7
|
const navigations = res.data;
|
|
8
8
|
|
|
9
9
|
return Promise.all(
|
|
10
10
|
navigations.map(async (navigation: any) => {
|
|
11
|
-
const res = await this.client.get<ApiCollectionResponse<Navigation>>("/navigations/" + navigation.id);
|
|
11
|
+
const res = await this.client.get<ApiCollectionResponse<Navigation>>("/navigations/" + navigation.id, options);
|
|
12
12
|
return res.data[0];
|
|
13
13
|
})
|
|
14
14
|
);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
async getDefaultNavigation(): Promise<Navigation> {
|
|
18
|
-
const navigations = await this.getNavigations();
|
|
17
|
+
async getDefaultNavigation(options?: RequestInit): Promise<Navigation> {
|
|
18
|
+
const navigations = await this.getNavigations(options);
|
|
19
19
|
return navigations[0];
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
async getNavigation(id: string): Promise<Navigation> {
|
|
23
|
-
const res = await this.client.get<ApiSingleResponse<Navigation>>(`/navigations/${id}
|
|
22
|
+
async getNavigation(id: string, options?: RequestInit): Promise<Navigation> {
|
|
23
|
+
const res = await this.client.get<ApiSingleResponse<Navigation>>(`/navigations/${id}`, options);
|
|
24
24
|
const navigation = res.data;
|
|
25
25
|
|
|
26
26
|
const topLevelItems = navigation.items.filter((item: any) => item.parent_id === null);
|
package/src/endpoints/pages.ts
CHANGED
|
@@ -2,37 +2,37 @@ import type { ApiCollectionResponse, Page } from "../types/index";
|
|
|
2
2
|
import { BaseService } from "./base.js";
|
|
3
3
|
|
|
4
4
|
export class PageService extends BaseService {
|
|
5
|
-
async getPages(): Promise<Page[]> {
|
|
6
|
-
const res = await this.client.get<ApiCollectionResponse<Page>>("/pages");
|
|
5
|
+
async getPages(options?: RequestInit): Promise<Page[]> {
|
|
6
|
+
const res = await this.client.get<ApiCollectionResponse<Page>>("/pages", options);
|
|
7
7
|
return res.data;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
async getPage(id: string): Promise<Page | null> {
|
|
11
|
-
const res = await this.client.get<ApiCollectionResponse<Page>>(`/pages/${id}
|
|
10
|
+
async getPage(id: string, options?: RequestInit): Promise<Page | null> {
|
|
11
|
+
const res = await this.client.get<ApiCollectionResponse<Page>>(`/pages/${id}`, options);
|
|
12
12
|
if (!res.data || res.data.length === 0) {
|
|
13
13
|
return null;
|
|
14
14
|
}
|
|
15
15
|
return res.data[0];
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
async getPageBySlug(slug: string): Promise<Page | null> {
|
|
19
|
-
const res = await this.client.get<ApiCollectionResponse<Page>>(`/pages?filter[slug]=${slug}
|
|
18
|
+
async getPageBySlug(slug: string, options?: RequestInit): Promise<Page | null> {
|
|
19
|
+
const res = await this.client.get<ApiCollectionResponse<Page>>(`/pages?filter[slug]=${slug}`, options);
|
|
20
20
|
if (!res.data || res.data.length === 0) {
|
|
21
21
|
return null;
|
|
22
22
|
}
|
|
23
23
|
return res.data[0];
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
async getHomePage(): Promise<Page | null> {
|
|
27
|
-
const res = await this.client.get<ApiCollectionResponse<Page>>("/pages?filter[slug]=/");
|
|
26
|
+
async getHomePage(options?: RequestInit): Promise<Page | null> {
|
|
27
|
+
const res = await this.client.get<ApiCollectionResponse<Page>>("/pages?filter[slug]=/", options);
|
|
28
28
|
if (!res.data || res.data.length === 0) {
|
|
29
29
|
return null;
|
|
30
30
|
}
|
|
31
31
|
return res.data[0];
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
async getPageByPathname(pathname: string): Promise<Page | null> {
|
|
35
|
-
const res = await this.client.get<ApiCollectionResponse<Page>>(`/pages?filter[pathname]=${pathname}
|
|
34
|
+
async getPageByPathname(pathname: string, options?: RequestInit): Promise<Page | null> {
|
|
35
|
+
const res = await this.client.get<ApiCollectionResponse<Page>>(`/pages?filter[pathname]=${pathname}`, options);
|
|
36
36
|
if (!res.data || res.data.length === 0) {
|
|
37
37
|
return null;
|
|
38
38
|
}
|
package/src/endpoints/press.ts
CHANGED
|
@@ -2,8 +2,8 @@ import type { ApiCollectionResponse, Press } from "../types/index";
|
|
|
2
2
|
import { BaseService } from "./base.js";
|
|
3
3
|
|
|
4
4
|
export class PressService extends BaseService {
|
|
5
|
-
async getPress(): Promise<Press[]> {
|
|
6
|
-
const { data } = await this.client.get<ApiCollectionResponse<Press>>("/press");
|
|
5
|
+
async getPress(options?: RequestInit): Promise<Press[]> {
|
|
6
|
+
const { data } = await this.client.get<ApiCollectionResponse<Press>>("/press", options);
|
|
7
7
|
return data;
|
|
8
8
|
}
|
|
9
9
|
}
|
package/src/endpoints/routes.ts
CHANGED
|
@@ -2,8 +2,8 @@ import type { Route } from "../types/index";
|
|
|
2
2
|
import { BaseService } from "./base.js";
|
|
3
3
|
|
|
4
4
|
export class RouteService extends BaseService {
|
|
5
|
-
async resolve<T = Route>(path: string): Promise<T> {
|
|
5
|
+
async resolve<T = Route>(path: string, options?: RequestInit): Promise<T> {
|
|
6
6
|
const query = new URLSearchParams({ path }).toString();
|
|
7
|
-
return this.client.get<T>(`/routes/resolve?${query}
|
|
7
|
+
return this.client.get<T>(`/routes/resolve?${query}`, options);
|
|
8
8
|
}
|
|
9
9
|
}
|
package/src/endpoints/website.ts
CHANGED
|
@@ -2,14 +2,14 @@ import type { ApiCollectionResponse, Website } from "../types/index";
|
|
|
2
2
|
import { BaseService } from "./base.js";
|
|
3
3
|
|
|
4
4
|
export class WebsiteService extends BaseService {
|
|
5
|
-
async getWebsite(): Promise<Website> {
|
|
6
|
-
const res = await this.client.get<ApiCollectionResponse<Website>>("/websites");
|
|
5
|
+
async getWebsite(options?: RequestInit): Promise<Website> {
|
|
6
|
+
const res = await this.client.get<ApiCollectionResponse<Website>>("/websites", options);
|
|
7
7
|
return res.data[0];
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
async routes(): Promise<string[]> {
|
|
11
|
-
const website = await this.getWebsite();
|
|
10
|
+
async routes(options?: RequestInit): Promise<string[]> {
|
|
11
|
+
const website = await this.getWebsite(options);
|
|
12
12
|
|
|
13
|
-
return this.client.get<string[]>(`/websites/${website.id}/routes
|
|
13
|
+
return this.client.get<string[]>(`/websites/${website.id}/routes`, options);
|
|
14
14
|
}
|
|
15
15
|
}
|