cloudflare/cloudflare-typescript

Public

mirrored from https://github.com/cloudflare/cloudflare-typescriptAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
7609e84ab3db53e79aefce6a112e90cb2a2bbba0

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

src/resources/access/custom-pages.ts

255lines · modecode

1// File generated from our OpenAPI spec by Stainless.
2
3import * as Core from 'cloudflare/core';
4import { APIResource } from 'cloudflare/resource';
5import * as CustomPagesAPI from 'cloudflare/resources/access/custom-pages';
6
7export class CustomPages extends APIResource {
8 /**
9 * Create a custom page
10 */
11 create(
12 identifier: string,
13 body: CustomPageCreateParams,
14 options?: Core.RequestOptions,
15 ): Core.APIPromise<CustomPageCreateResponse> {
16 return (
17 this._client.post(`/accounts/${identifier}/access/custom_pages`, {
18 body,
19 ...options,
20 }) as Core.APIPromise<{ result: CustomPageCreateResponse }>
21 )._thenUnwrap((obj) => obj.result);
22 }
23
24 /**
25 * List custom pages
26 */
27 list(identifier: string, options?: Core.RequestOptions): Core.APIPromise<CustomPageListResponse | null> {
28 return (
29 this._client.get(`/accounts/${identifier}/access/custom_pages`, options) as Core.APIPromise<{
30 result: CustomPageListResponse | null;
31 }>
32 )._thenUnwrap((obj) => obj.result);
33 }
34
35 /**
36 * Delete a custom page
37 */
38 delete(
39 identifier: string,
40 uuid: string,
41 options?: Core.RequestOptions,
42 ): Core.APIPromise<CustomPageDeleteResponse> {
43 return (
44 this._client.delete(`/accounts/${identifier}/access/custom_pages/${uuid}`, options) as Core.APIPromise<{
45 result: CustomPageDeleteResponse;
46 }>
47 )._thenUnwrap((obj) => obj.result);
48 }
49
50 /**
51 * Fetches a custom page and also returns its HTML.
52 */
53 get(
54 identifier: string,
55 uuid: string,
56 options?: Core.RequestOptions,
57 ): Core.APIPromise<CustomPageGetResponse> {
58 return (
59 this._client.get(`/accounts/${identifier}/access/custom_pages/${uuid}`, options) as Core.APIPromise<{
60 result: CustomPageGetResponse;
61 }>
62 )._thenUnwrap((obj) => obj.result);
63 }
64
65 /**
66 * Update a custom page
67 */
68 replace(
69 identifier: string,
70 uuid: string,
71 body: CustomPageReplaceParams,
72 options?: Core.RequestOptions,
73 ): Core.APIPromise<CustomPageReplaceResponse> {
74 return (
75 this._client.put(`/accounts/${identifier}/access/custom_pages/${uuid}`, {
76 body,
77 ...options,
78 }) as Core.APIPromise<{ result: CustomPageReplaceResponse }>
79 )._thenUnwrap((obj) => obj.result);
80 }
81}
82
83export interface CustomPageCreateResponse {
84 /**
85 * Custom page name.
86 */
87 name: string;
88
89 /**
90 * Custom page type.
91 */
92 type: 'identity_denied' | 'forbidden';
93
94 /**
95 * Number of apps the custom page is assigned to.
96 */
97 app_count?: number;
98
99 created_at?: string;
100
101 /**
102 * UUID
103 */
104 uid?: string;
105
106 updated_at?: string;
107}
108
109export type CustomPageListResponse = Array<CustomPageListResponse.CustomPageListResponseItem>;
110
111export namespace CustomPageListResponse {
112 export interface CustomPageListResponseItem {
113 /**
114 * Custom page name.
115 */
116 name: string;
117
118 /**
119 * Custom page type.
120 */
121 type: 'identity_denied' | 'forbidden';
122
123 /**
124 * Number of apps the custom page is assigned to.
125 */
126 app_count?: number;
127
128 created_at?: string;
129
130 /**
131 * UUID
132 */
133 uid?: string;
134
135 updated_at?: string;
136 }
137}
138
139export interface CustomPageDeleteResponse {
140 /**
141 * UUID
142 */
143 id?: string;
144}
145
146export interface CustomPageGetResponse {
147 /**
148 * Custom page HTML.
149 */
150 custom_html: string;
151
152 /**
153 * Custom page name.
154 */
155 name: string;
156
157 /**
158 * Custom page type.
159 */
160 type: 'identity_denied' | 'forbidden';
161
162 /**
163 * Number of apps the custom page is assigned to.
164 */
165 app_count?: number;
166
167 created_at?: string;
168
169 /**
170 * UUID
171 */
172 uid?: string;
173
174 updated_at?: string;
175}
176
177export interface CustomPageReplaceResponse {
178 /**
179 * Custom page name.
180 */
181 name: string;
182
183 /**
184 * Custom page type.
185 */
186 type: 'identity_denied' | 'forbidden';
187
188 /**
189 * Number of apps the custom page is assigned to.
190 */
191 app_count?: number;
192
193 created_at?: string;
194
195 /**
196 * UUID
197 */
198 uid?: string;
199
200 updated_at?: string;
201}
202
203export interface CustomPageCreateParams {
204 /**
205 * Custom page HTML.
206 */
207 custom_html: string;
208
209 /**
210 * Custom page name.
211 */
212 name: string;
213
214 /**
215 * Custom page type.
216 */
217 type: 'identity_denied' | 'forbidden';
218
219 /**
220 * Number of apps the custom page is assigned to.
221 */
222 app_count?: number;
223}
224
225export interface CustomPageReplaceParams {
226 /**
227 * Custom page HTML.
228 */
229 custom_html: string;
230
231 /**
232 * Custom page name.
233 */
234 name: string;
235
236 /**
237 * Custom page type.
238 */
239 type: 'identity_denied' | 'forbidden';
240
241 /**
242 * Number of apps the custom page is assigned to.
243 */
244 app_count?: number;
245}
246
247export namespace CustomPages {
248 export import CustomPageCreateResponse = CustomPagesAPI.CustomPageCreateResponse;
249 export import CustomPageListResponse = CustomPagesAPI.CustomPageListResponse;
250 export import CustomPageDeleteResponse = CustomPagesAPI.CustomPageDeleteResponse;
251 export import CustomPageGetResponse = CustomPagesAPI.CustomPageGetResponse;
252 export import CustomPageReplaceResponse = CustomPagesAPI.CustomPageReplaceResponse;
253 export import CustomPageCreateParams = CustomPagesAPI.CustomPageCreateParams;
254 export import CustomPageReplaceParams = CustomPagesAPI.CustomPageReplaceParams;
255}
256