@rezamirzapour/pod-sdk 1.0.7 → 1.0.9
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/README.md +115 -25
- package/dist/index.d.mts +307 -17
- package/dist/index.d.ts +307 -17
- package/dist/index.js +332 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +332 -23
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @rezamirzapour/pod-sdk
|
|
2
2
|
|
|
3
|
-
> Unified, type-safe, enterprise-grade SDK for **POD Platform** microservices (CMS Content, CMS Product, SSO, CustomPost, Podspace, Podform, Notification, Social, IUMS), engineered specifically for **Next.js App Router**, **Server Components**, and **Server Actions**.
|
|
3
|
+
> Unified, type-safe, enterprise-grade SDK for **POD Platform** microservices (CMS Content, CMS Product, SSO, Captcha, CustomPost, Podspace, Podform, Notification, Social, IUMS), engineered specifically for **Next.js App Router**, **Server Components**, and **Server Actions**.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@rezamirzapour/pod-sdk)
|
|
6
6
|
[](LICENSE)
|
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
## Features
|
|
12
|
-
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- **Captcha Protection**: Generate configurable SVG/PNG challenges and validate user answers with a single, typed service.
|
|
13
14
|
- 🌐 **Unified Multi-Service Architecture**: Single entry-point managing official POD microservices with official endpoints and configurations.
|
|
14
15
|
- ⚡ **Powered by `@rezamirzapour/http`**: Automatic exponential backoff retries, Next.js incremental static regeneration (ISR) caching (`next.revalidate`, tags), and isomorphic execution.
|
|
15
16
|
- 🧬 **First-Class TypeScript Generics (`<T, P>`)**: CMS Content, CMS Product, and CustomPost endpoints allow you to define and receive strongly typed metadata structures according to your business schemas.
|
|
@@ -20,18 +21,19 @@
|
|
|
20
21
|
- 🚀 **Next.js App Router Ready**: Seamless support for Server Components, Server Actions, Route Handlers, and Client Components.
|
|
21
22
|
- 🌳 **Treeshakeable & Dual ESM/CJS**: Ships clean ES modules (`.mjs`) and CommonJS (`.js`) with 100% complete TypeScript declarations (`.d.ts`).
|
|
22
23
|
|
|
23
|
-
---
|
|
24
|
-
|
|
25
|
-
## Microservices Included
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Microservices Included
|
|
26
27
|
|
|
27
28
|
| Service | Accessor | Swagger Tag | Description |
|
|
28
29
|
| :--- | :--- | :--- | :--- |
|
|
29
30
|
| **CMS Content** | `sdk.cms` | `content` | Fetch, publish, edit, draft, archive, and categorize CMS articles with generic metadata `<T, P>`. |
|
|
30
31
|
| **CMS Product** | `sdk.product` / `sdk.cms.products` | `product` | Product catalog, price & discount range filters, barcode lookup, batch publish, and AI search. |
|
|
31
32
|
| **CMS Tags & Tree** | `sdk.tags` / `sdk.cms.tags` | `tags` | Manage tag categories and hierarchical tag trees (nodes, parent updates, ancestors, codes). |
|
|
32
|
-
| **CustomPost** | `sdk.customPost` | - | Search timeline by metadata `<T>`, custom post CRUD, and high-level typed repository. |
|
|
33
|
-
| **SSO** | `sdk.sso` | - | OAuth2 handshake, OTP dispatch with digital RSA signature, OTP verify, token generation, and user profile. |
|
|
34
|
-
| **
|
|
33
|
+
| **CustomPost** | `sdk.customPost` | - | Search timeline by metadata `<T>`, custom post CRUD, and high-level typed repository. |
|
|
34
|
+
| **SSO** | `sdk.sso` | - | OAuth2 handshake, OTP dispatch with digital RSA signature, OTP verify, token generation, and user profile. |
|
|
35
|
+
| **Captcha** | `sdk.captcha` | `captcha` | Generate SVG/PNG captcha images with configurable options and verify submitted values. |
|
|
36
|
+
| **Podspace** | `sdk.podspace` | `public-apis` | Complete Cloud Storage: file/image uploads, resumable chunked uploads, folders, versions, share links, workspaces, trash, tags, & metadata. |
|
|
35
37
|
| **Podform** | `sdk.podform` | - | Survey & form response submission, question/form structure retrieval. |
|
|
36
38
|
| **Notification** | `sdk.notification` | - | SMS delivery and bulk messaging with tracking. |
|
|
37
39
|
| **Social** | `sdk.social` | - | User comments, reactions (likes/dislikes), rates, and social post interactions. |
|
|
@@ -58,9 +60,10 @@ NEXT_PUBLIC_API_POD_URL=https://api.pod.ir
|
|
|
58
60
|
NEXT_PUBLIC_API_POD_SANDBOX_URL=https://api.sandpod.ir
|
|
59
61
|
NEXT_PUBLIC_CMS_URL=https://api.pod.ir/srv/cms-server
|
|
60
62
|
NEXT_PUBLIC_IUMS_URL=https://indra.khatam.ac.ir/srv
|
|
61
|
-
NEXT_PUBLIC_NOTIFICATION_URL=https://api.pod.ir/srv/notification
|
|
62
|
-
NEXT_PUBLIC_PODREPORT_URL=https://reporting.pod.ir
|
|
63
|
-
NEXT_PUBLIC_PODSPACE_URL=https://podspace.pod.ir
|
|
63
|
+
NEXT_PUBLIC_NOTIFICATION_URL=https://api.pod.ir/srv/notification
|
|
64
|
+
NEXT_PUBLIC_PODREPORT_URL=https://reporting.pod.ir
|
|
65
|
+
NEXT_PUBLIC_PODSPACE_URL=https://podspace.pod.ir
|
|
66
|
+
NEXT_PUBLIC_PODFORM_URL=https://podform.pod.ir
|
|
64
67
|
|
|
65
68
|
# Sandbox Endpoints (Development & Staging)
|
|
66
69
|
NEXT_PUBLIC_SANDBOX_CMS_URL=http://api.sandpod.ir/srv/cms-sandbox
|
|
@@ -69,8 +72,10 @@ NEXT_PUBLIC_SANDBOX_PODSPACE_URL=http://podspace.sandpod.ir
|
|
|
69
72
|
NEXT_PUBLIC_SANDBOX_STREAM_URL=https://sandbox-offline-stream.sandpod.ir
|
|
70
73
|
```
|
|
71
74
|
|
|
72
|
-
> [!TIP]
|
|
73
|
-
> If you have defined these `NEXT_PUBLIC_*` variables in your `.env` or `.env.local`, `@rezamirzapour/pod-sdk` will automatically detect and apply them without any manual URL mapping.
|
|
75
|
+
> [!TIP]
|
|
76
|
+
> If you have defined these `NEXT_PUBLIC_*` variables in your `.env` or `.env.local`, `@rezamirzapour/pod-sdk` will automatically detect and apply them without any manual URL mapping.
|
|
77
|
+
|
|
78
|
+
Captcha requests use the resolved `apiPod` URL (`NEXT_PUBLIC_API_POD_URL` in production or `NEXT_PUBLIC_API_POD_SANDBOX_URL` when `sandbox: true`); there is no separate captcha URL setting.
|
|
74
79
|
|
|
75
80
|
---
|
|
76
81
|
|
|
@@ -854,9 +859,9 @@ await podSdk.podspace.trash.deletePermanently(fileHash);
|
|
|
854
859
|
|
|
855
860
|
---
|
|
856
861
|
|
|
857
|
-
## Other POD Microservices
|
|
858
|
-
|
|
859
|
-
### 1. POD SSO (OTP Handshake with Web Crypto RSA Signature)
|
|
862
|
+
## Other POD Microservices
|
|
863
|
+
|
|
864
|
+
### 1. POD SSO (OTP Handshake with Web Crypto RSA Signature)
|
|
860
865
|
|
|
861
866
|
```typescript
|
|
862
867
|
// app/actions/auth.ts
|
|
@@ -894,12 +899,97 @@ export async function verifyOtp(authorization: string, phoneNumber: string, code
|
|
|
894
899
|
export async function getProfile(accessToken: string) {
|
|
895
900
|
const profile = await podSdk.sso.getUserProfile(accessToken);
|
|
896
901
|
return profile.result;
|
|
897
|
-
}
|
|
898
|
-
```
|
|
899
|
-
|
|
900
|
-
---
|
|
901
|
-
|
|
902
|
-
### 2.
|
|
902
|
+
}
|
|
903
|
+
```
|
|
904
|
+
|
|
905
|
+
---
|
|
906
|
+
|
|
907
|
+
### 2. Captcha (Generate and Verify)
|
|
908
|
+
|
|
909
|
+
The captcha service exposes the POD captcha API through `podSdk.captcha`. It creates a short-lived challenge image and checks the value entered by the user. Both calls return the SDK's standard `PodResponse<T>` shape (`hasError`, `result`, `message`, and `errorCode`).
|
|
910
|
+
|
|
911
|
+
`Client-Id` and `Access-Token` headers are added automatically from `createPodSdk({ clientId, apiToken })`. Keep these credentials on the server and call captcha methods from a Server Action or Route Handler; do not expose the SDK token in a Client Component.
|
|
912
|
+
|
|
913
|
+
#### Generate a captcha
|
|
914
|
+
|
|
915
|
+
```typescript
|
|
916
|
+
// app/actions/captcha.ts
|
|
917
|
+
'use server';
|
|
918
|
+
|
|
919
|
+
import { podSdk } from '@/lib/pod';
|
|
920
|
+
|
|
921
|
+
export async function createCaptcha() {
|
|
922
|
+
const response = await podSdk.captcha.get({
|
|
923
|
+
width: 280,
|
|
924
|
+
height: 96,
|
|
925
|
+
length: 6,
|
|
926
|
+
type: 'alphanumeric',
|
|
927
|
+
format: 'png',
|
|
928
|
+
noise: true,
|
|
929
|
+
bgColor: '#ffffff',
|
|
930
|
+
fontColor: '#1f2937',
|
|
931
|
+
fontSize: 36,
|
|
932
|
+
});
|
|
933
|
+
|
|
934
|
+
if (response.hasError || !response.result) {
|
|
935
|
+
throw new Error(response.message || 'Captcha generation failed');
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
// `image` is a data URI or SVG string, depending on `format`.
|
|
939
|
+
return {
|
|
940
|
+
captchaId: response.result.captchaId,
|
|
941
|
+
image: response.result.image,
|
|
942
|
+
mimeType: response.result.mimeType,
|
|
943
|
+
expiresAt: response.result.expiresAt,
|
|
944
|
+
};
|
|
945
|
+
}
|
|
946
|
+
```
|
|
947
|
+
|
|
948
|
+
#### Verify the submitted value
|
|
949
|
+
|
|
950
|
+
```typescript
|
|
951
|
+
import { podSdk } from '@/lib/pod';
|
|
952
|
+
|
|
953
|
+
export async function verifyCaptcha(captchaId: string, captchaValue: string) {
|
|
954
|
+
const response = await podSdk.captcha.check(captchaId, { captchaValue });
|
|
955
|
+
|
|
956
|
+
if (response.hasError) {
|
|
957
|
+
return { valid: false, message: response.message || 'Captcha verification failed' };
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
return {
|
|
961
|
+
valid: response.result?.valid === true,
|
|
962
|
+
message: response.result?.message,
|
|
963
|
+
};
|
|
964
|
+
}
|
|
965
|
+
```
|
|
966
|
+
|
|
967
|
+
#### Captcha methods
|
|
968
|
+
|
|
969
|
+
| Method | HTTP | Path | Description |
|
|
970
|
+
| :--- | :--- | :--- | :--- |
|
|
971
|
+
| `get(options?)` | `POST` | `/api/core/captchas/generate` | Generate a captcha image. Options are sent as query parameters. |
|
|
972
|
+
| `check(captchaId, { captchaValue })` | `POST` | `/api/core/captchas/check/{captchaId}` | Verify the value entered for a generated captcha. |
|
|
973
|
+
|
|
974
|
+
`GenerateCaptchaOptions` supports the following fields:
|
|
975
|
+
|
|
976
|
+
| Option | Type | Default | Description |
|
|
977
|
+
| :--- | :--- | :--- | :--- |
|
|
978
|
+
| `width` | `number` | `200` | Image width in pixels. |
|
|
979
|
+
| `height` | `number` | `80` | Image height in pixels. |
|
|
980
|
+
| `length` | `number` | `5` | Number of characters in the challenge. |
|
|
981
|
+
| `type` | `string` | Server default | Challenge type, such as `numeric` or `alphanumeric`. |
|
|
982
|
+
| `format` | `'svg' \| 'png'` | `'svg'` | Image output format. |
|
|
983
|
+
| `noise` | `boolean` | `true` | Add visual noise to the image. |
|
|
984
|
+
| `bgColor` | `string` | Server default | Background color in hex format. |
|
|
985
|
+
| `fontColor` | `string` | Server default | Character color in hex format. |
|
|
986
|
+
| `fontSize` | `number` | Server default | Character font size. |
|
|
987
|
+
|
|
988
|
+
The generated response contains `captchaId`, `image`, `expiresAt`, and `mimeType`; `image` is returned as a data URI or SVG string. Always treat the challenge as temporary and request a new one after expiration or a failed attempt, according to your server-side policy.
|
|
989
|
+
|
|
990
|
+
---
|
|
991
|
+
|
|
992
|
+
### 3. Notification (SMS Delivery)
|
|
903
993
|
|
|
904
994
|
```typescript
|
|
905
995
|
// app/actions/notify.ts
|
|
@@ -917,7 +1007,7 @@ export async function sendSms(phoneNumber: string, text: string) {
|
|
|
917
1007
|
|
|
918
1008
|
---
|
|
919
1009
|
|
|
920
|
-
###
|
|
1010
|
+
### 4. Social (Comments & Likes)
|
|
921
1011
|
|
|
922
1012
|
```typescript
|
|
923
1013
|
// app/actions/social.ts
|
|
@@ -939,7 +1029,7 @@ export async function likePost(postId: number) {
|
|
|
939
1029
|
|
|
940
1030
|
---
|
|
941
1031
|
|
|
942
|
-
###
|
|
1032
|
+
### 5. IUMS (Identity & University Management Service)
|
|
943
1033
|
|
|
944
1034
|
```typescript
|
|
945
1035
|
// app/actions/iums.ts
|
package/dist/index.d.mts
CHANGED
|
@@ -131,6 +131,70 @@ declare class SsoService {
|
|
|
131
131
|
getUserProfile(accessToken: string): Promise<PodResponse<SsoUserProfile>>;
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
+
/**
|
|
135
|
+
* Types for Captcha service
|
|
136
|
+
*/
|
|
137
|
+
interface GenerateCaptchaOptions {
|
|
138
|
+
/** Width of captcha image (default: 200) */
|
|
139
|
+
width?: number;
|
|
140
|
+
/** Height of captcha image (default: 80) */
|
|
141
|
+
height?: number;
|
|
142
|
+
/** Length of captcha code (default: 5) */
|
|
143
|
+
length?: number;
|
|
144
|
+
/** Type of captcha (e.g., 'numeric', 'alphanumeric') */
|
|
145
|
+
type?: string;
|
|
146
|
+
/** Output format: 'svg' or 'png' (default: 'svg') */
|
|
147
|
+
format?: 'svg' | 'png';
|
|
148
|
+
/** Add noise to image (default: true) */
|
|
149
|
+
noise?: boolean;
|
|
150
|
+
/** Background color (hex) */
|
|
151
|
+
bgColor?: string;
|
|
152
|
+
/** Font color (hex) */
|
|
153
|
+
fontColor?: string;
|
|
154
|
+
/** Font size */
|
|
155
|
+
fontSize?: number;
|
|
156
|
+
}
|
|
157
|
+
interface GenerateCaptchaResponse {
|
|
158
|
+
/** Unique identifier for this captcha */
|
|
159
|
+
captchaId: string;
|
|
160
|
+
/** Captcha image as data URI or SVG string */
|
|
161
|
+
image: string;
|
|
162
|
+
/** Expiration timestamp (Unix epoch) */
|
|
163
|
+
expiresAt: number;
|
|
164
|
+
/** Mime type of image */
|
|
165
|
+
mimeType: string;
|
|
166
|
+
}
|
|
167
|
+
interface CheckCaptchaOptions {
|
|
168
|
+
/** The captcha value entered by user */
|
|
169
|
+
captchaValue: string;
|
|
170
|
+
}
|
|
171
|
+
interface CheckCaptchaResponse {
|
|
172
|
+
/** Whether captcha is valid */
|
|
173
|
+
valid: boolean;
|
|
174
|
+
/** Optional message */
|
|
175
|
+
message?: string;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
interface CaptchaServiceOptions {
|
|
179
|
+
baseUrl: string;
|
|
180
|
+
clientId: string;
|
|
181
|
+
accessToken: string;
|
|
182
|
+
}
|
|
183
|
+
declare class CaptchaService {
|
|
184
|
+
private http;
|
|
185
|
+
private clientId;
|
|
186
|
+
private accessToken;
|
|
187
|
+
constructor(options: CaptchaServiceOptions);
|
|
188
|
+
/**
|
|
189
|
+
* Get a new captcha image
|
|
190
|
+
*/
|
|
191
|
+
get(options?: GenerateCaptchaOptions): Promise<PodResponse<GenerateCaptchaResponse>>;
|
|
192
|
+
/**
|
|
193
|
+
* Check if the entered captcha value is valid
|
|
194
|
+
*/
|
|
195
|
+
check(captchaId: string, options: CheckCaptchaOptions): Promise<PodResponse<CheckCaptchaResponse>>;
|
|
196
|
+
}
|
|
197
|
+
|
|
134
198
|
interface SearchTimelineParamMetaQuery<T extends object = any> {
|
|
135
199
|
field?: string;
|
|
136
200
|
is?: string | number | boolean;
|
|
@@ -1793,38 +1857,263 @@ declare class PodspaceService {
|
|
|
1793
1857
|
removeBookmark(hash: string, options?: PodspaceRequestOptions): Promise<PodspaceRestResponse<boolean>>;
|
|
1794
1858
|
}
|
|
1795
1859
|
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
}
|
|
1860
|
+
type PodFormId = number | string;
|
|
1861
|
+
type PodFormJson = Record<string, any>;
|
|
1862
|
+
/** Request options accepted by PodForm methods. */
|
|
1863
|
+
type PodFormRequestOptions = RequestOptions;
|
|
1864
|
+
/** Standard response envelope returned by PodForm. */
|
|
1802
1865
|
interface PodFormResponse<T = any> {
|
|
1803
1866
|
hasError: boolean;
|
|
1804
1867
|
message?: string;
|
|
1805
1868
|
errorCode?: number;
|
|
1806
1869
|
result?: T;
|
|
1807
1870
|
referenceNumber?: string;
|
|
1871
|
+
count?: number;
|
|
1872
|
+
[key: string]: any;
|
|
1873
|
+
}
|
|
1874
|
+
/** Form returned by the `/forms` endpoints. */
|
|
1875
|
+
interface PodFormItem extends PodFormJson {
|
|
1876
|
+
id: number;
|
|
1877
|
+
hash?: string;
|
|
1878
|
+
name?: string;
|
|
1879
|
+
title?: string;
|
|
1880
|
+
elements?: any[];
|
|
1881
|
+
fields?: PodFormField[];
|
|
1882
|
+
}
|
|
1883
|
+
/** Field returned by or sent to a form endpoint. */
|
|
1884
|
+
interface PodFormField extends PodFormJson {
|
|
1885
|
+
id?: number;
|
|
1886
|
+
title?: string;
|
|
1887
|
+
type?: string;
|
|
1888
|
+
required?: boolean;
|
|
1889
|
+
order?: number;
|
|
1890
|
+
}
|
|
1891
|
+
interface PodFormCreationDto extends PodFormJson {
|
|
1892
|
+
name: string;
|
|
1893
|
+
type: 'GENERAL' | 'SHOP' | 'EXAM' | string;
|
|
1894
|
+
display: 'CLASSIC' | 'CARD' | string;
|
|
1895
|
+
fields?: PodFormField[];
|
|
1896
|
+
}
|
|
1897
|
+
interface PodFormUpdateDto extends PodFormJson {
|
|
1898
|
+
name?: string;
|
|
1899
|
+
enabled?: boolean;
|
|
1900
|
+
activate?: boolean;
|
|
1901
|
+
state?: string;
|
|
1902
|
+
fieldsRandomization?: boolean;
|
|
1903
|
+
tags?: string[];
|
|
1904
|
+
}
|
|
1905
|
+
interface PodFormSettingsUpdateDto extends PodFormJson {
|
|
1906
|
+
name?: string;
|
|
1907
|
+
display?: 'CLASSIC' | 'CARD' | string;
|
|
1908
|
+
enabled?: boolean;
|
|
1909
|
+
activate?: boolean;
|
|
1910
|
+
fieldsRandomization?: boolean;
|
|
1911
|
+
tags?: string[];
|
|
1912
|
+
}
|
|
1913
|
+
interface PodFormListParams {
|
|
1914
|
+
page?: number;
|
|
1915
|
+
size?: number;
|
|
1916
|
+
sortBy?: string;
|
|
1917
|
+
ascending?: boolean;
|
|
1918
|
+
name?: string;
|
|
1919
|
+
ownership?: string;
|
|
1920
|
+
status?: string;
|
|
1921
|
+
technicalStatus?: string;
|
|
1922
|
+
tags?: string[];
|
|
1923
|
+
folderId?: number;
|
|
1924
|
+
[key: string]: any;
|
|
1925
|
+
}
|
|
1926
|
+
interface PodFormGetParams {
|
|
1927
|
+
lockForEdit?: boolean;
|
|
1928
|
+
}
|
|
1929
|
+
interface PodFormPreviewParams {
|
|
1930
|
+
responseId?: number;
|
|
1931
|
+
code?: string;
|
|
1932
|
+
responseHash?: string;
|
|
1933
|
+
userParams?: string;
|
|
1934
|
+
}
|
|
1935
|
+
interface PodFormResponseCreationDto extends PodFormJson {
|
|
1936
|
+
responses?: PodFormJson[];
|
|
1937
|
+
parentFieldIds?: number[];
|
|
1938
|
+
seenFieldIds?: number[];
|
|
1939
|
+
screen?: string;
|
|
1940
|
+
cookies?: boolean;
|
|
1941
|
+
userMetadata?: PodFormJson;
|
|
1942
|
+
userResponseTimeMilliSeconds?: number;
|
|
1943
|
+
}
|
|
1944
|
+
interface PodFormResponseInitiationDto extends PodFormJson {
|
|
1945
|
+
owner?: string;
|
|
1946
|
+
responses: PodFormJson[];
|
|
1947
|
+
}
|
|
1948
|
+
interface PodFormResponseListParams {
|
|
1949
|
+
page?: number;
|
|
1950
|
+
size?: number;
|
|
1951
|
+
ssoId?: number;
|
|
1952
|
+
username?: string;
|
|
1953
|
+
gradingStatus?: string;
|
|
1954
|
+
scoreFrom?: number;
|
|
1955
|
+
scoreTo?: number;
|
|
1956
|
+
startDate?: string;
|
|
1957
|
+
endDate?: string;
|
|
1958
|
+
sortDirection?: string;
|
|
1959
|
+
[key: string]: any;
|
|
1960
|
+
}
|
|
1961
|
+
interface PodFormPaymentListParams {
|
|
1962
|
+
page?: number;
|
|
1963
|
+
size?: number;
|
|
1964
|
+
payed?: boolean;
|
|
1965
|
+
ssoId?: number;
|
|
1966
|
+
username?: string;
|
|
1967
|
+
startDate?: string;
|
|
1968
|
+
endDate?: string;
|
|
1969
|
+
[key: string]: any;
|
|
1970
|
+
}
|
|
1971
|
+
interface PodFormTemplateDto extends PodFormJson {
|
|
1972
|
+
name: string;
|
|
1973
|
+
theme?: PodFormJson;
|
|
1974
|
+
}
|
|
1975
|
+
interface PodFormFolderDto extends PodFormJson {
|
|
1976
|
+
name: string;
|
|
1977
|
+
config?: PodFormJson;
|
|
1978
|
+
}
|
|
1979
|
+
interface PodFormOtpParams {
|
|
1980
|
+
contact: string;
|
|
1981
|
+
}
|
|
1982
|
+
interface PodFormDownloadLinkParams {
|
|
1983
|
+
fileHash: string;
|
|
1984
|
+
formId?: number;
|
|
1985
|
+
isTemporary?: boolean;
|
|
1986
|
+
}
|
|
1987
|
+
interface PodFormExportParams {
|
|
1988
|
+
fileType?: string;
|
|
1989
|
+
dataType?: string;
|
|
1990
|
+
ssoId?: number;
|
|
1991
|
+
username?: string;
|
|
1992
|
+
isTemplate?: boolean;
|
|
1993
|
+
startDate?: string;
|
|
1994
|
+
endDate?: string;
|
|
1808
1995
|
}
|
|
1809
1996
|
|
|
1810
1997
|
interface PodFormServiceOptions {
|
|
1998
|
+
/** API base URL, e.g. `https://podformapi.pod.ir`. */
|
|
1811
1999
|
baseUrl: string;
|
|
1812
|
-
|
|
2000
|
+
/** POD SSO token sent as the `token` header. */
|
|
2001
|
+
apiToken?: string;
|
|
1813
2002
|
revalidate?: number | string;
|
|
2003
|
+
http?: NextHttp;
|
|
1814
2004
|
}
|
|
2005
|
+
/**
|
|
2006
|
+
* Typed client for the official PodForm API (Swagger OAS 3, v2.0.5).
|
|
2007
|
+
*
|
|
2008
|
+
* The API authenticates with the `token` header. All methods keep the raw
|
|
2009
|
+
* PodForm response envelope so callers can inspect `hasError` and metadata.
|
|
2010
|
+
*/
|
|
1815
2011
|
declare class PodFormService {
|
|
1816
|
-
private http;
|
|
1817
|
-
private
|
|
1818
|
-
private revalidate;
|
|
2012
|
+
private readonly http;
|
|
2013
|
+
private readonly revalidate;
|
|
1819
2014
|
constructor(options: PodFormServiceOptions);
|
|
2015
|
+
private requestOptions;
|
|
2016
|
+
private languageHeaders;
|
|
2017
|
+
/** Retrieves a form by its numeric ID. Swagger: GET `/forms/{formId}`. */
|
|
2018
|
+
getForm(formId: PodFormId, params?: PodFormGetParams, options?: PodFormRequestOptions): Promise<PodFormResponse<PodFormItem>>;
|
|
2019
|
+
/** Backward-compatible alias for `getForm`. */
|
|
2020
|
+
getPodformById(id: PodFormId, options?: PodFormRequestOptions): Promise<PodFormResponse<PodFormItem>>;
|
|
2021
|
+
/** Lists forms with the filters supported by Swagger. */
|
|
2022
|
+
getForms(params?: PodFormListParams, options?: PodFormRequestOptions): Promise<PodFormResponse<PodFormItem[]>>;
|
|
2023
|
+
/** Creates a form. Swagger: POST `/forms`. */
|
|
2024
|
+
createForm(data: PodFormCreationDto, language?: string, options?: PodFormRequestOptions): Promise<PodFormResponse<PodFormItem>>;
|
|
2025
|
+
/** Updates a form. Swagger: PATCH `/forms/{formId}`. */
|
|
2026
|
+
updateForm(formId: PodFormId, data: PodFormUpdateDto, options?: PodFormRequestOptions): Promise<PodFormResponse<PodFormItem>>;
|
|
2027
|
+
/** Deletes a form (or moves it to trash). */
|
|
2028
|
+
deleteForm(formId: PodFormId, params?: {
|
|
2029
|
+
removeFromTrash?: boolean;
|
|
2030
|
+
}, options?: PodFormRequestOptions): Promise<PodFormResponse>;
|
|
2031
|
+
/** Gets form settings. Swagger: GET `/forms/{formId}/settings`. */
|
|
2032
|
+
getFormSettings(formId: PodFormId, lockForEdit?: boolean, options?: PodFormRequestOptions): Promise<PodFormResponse>;
|
|
2033
|
+
/** Updates form settings. */
|
|
2034
|
+
updateFormSettings(formId: PodFormId, data: PodFormSettingsUpdateDto, params?: {
|
|
2035
|
+
allowClearCache?: boolean;
|
|
2036
|
+
}, options?: PodFormRequestOptions): Promise<PodFormResponse>;
|
|
2037
|
+
/** Adds a field to a form. */
|
|
2038
|
+
addField(formId: PodFormId, field: PodFormField, language?: string, options?: PodFormRequestOptions): Promise<PodFormResponse>;
|
|
2039
|
+
/** Adds multiple fields to a form. */
|
|
2040
|
+
addFields(formId: PodFormId, fields: PodFormField[], language?: string, options?: PodFormRequestOptions): Promise<PodFormResponse>;
|
|
2041
|
+
/** Updates one or more fields. */
|
|
2042
|
+
updateFields(formId: PodFormId, fields: PodFormJson[], options?: PodFormRequestOptions): Promise<PodFormResponse>;
|
|
2043
|
+
/** Deletes selected fields from a form. */
|
|
2044
|
+
deleteFields(formId: PodFormId, fieldIds: Array<number | string>, options?: PodFormRequestOptions): Promise<PodFormResponse>;
|
|
2045
|
+
/** Gets a form preview by ID. */
|
|
2046
|
+
getFormPreview(formId: PodFormId, params?: PodFormPreviewParams, options?: PodFormRequestOptions): Promise<PodFormResponse>;
|
|
2047
|
+
/** Gets a public form preview by hash. */
|
|
2048
|
+
getFormPreviewByHash(formHash: string, params?: Omit<PodFormPreviewParams, 'responseId'>, options?: PodFormRequestOptions): Promise<PodFormResponse>;
|
|
2049
|
+
/** Generates the captcha associated with a public form. */
|
|
2050
|
+
generateCaptcha(formHash: string, options?: PodFormRequestOptions): Promise<PodFormResponse>;
|
|
2051
|
+
/** Saves a response using the Swagger JSON contract. */
|
|
2052
|
+
saveResponse(formHash: string, data: PodFormResponseCreationDto, params?: Record<string, any>, language?: string, options?: PodFormRequestOptions): Promise<PodFormResponse>;
|
|
2053
|
+
/**
|
|
2054
|
+
* Backward-compatible response helper. The form identifier can be numeric
|
|
2055
|
+
* or a hash; the payload is now sent as JSON per the official API.
|
|
2056
|
+
*/
|
|
2057
|
+
sendForm<T extends Record<string, any>>(formHash: PodFormId, data: T, options?: PodFormRequestOptions): Promise<PodFormResponse>;
|
|
2058
|
+
/** Initiates a response before collecting field values. */
|
|
2059
|
+
initiateResponse(formId: PodFormId, data: PodFormResponseInitiationDto, language?: string, options?: PodFormRequestOptions): Promise<PodFormResponse>;
|
|
2060
|
+
/** Retrieves responses for a form with filtering and pagination. */
|
|
2061
|
+
getAllFormResponses(formId: PodFormId, params?: PodFormResponseListParams, options?: PodFormRequestOptions): Promise<PodFormResponse>;
|
|
2062
|
+
/** Retrieves responses by a public form hash. */
|
|
2063
|
+
getAllFormResponsesByHash(formHash: string, params?: Pick<PodFormResponseListParams, 'page' | 'size'>, options?: PodFormRequestOptions): Promise<PodFormResponse>;
|
|
2064
|
+
/** Gets an individual response. */
|
|
2065
|
+
getResponse(responseId: PodFormId, containsNonInputFields?: boolean, options?: PodFormRequestOptions): Promise<PodFormResponse>;
|
|
2066
|
+
/** Updates fields of an existing response. */
|
|
2067
|
+
updateResponseFields(responseId: PodFormId, fields: PodFormJson[], options?: PodFormRequestOptions): Promise<PodFormResponse>;
|
|
2068
|
+
/** Deletes selected/all responses for a form. */
|
|
2069
|
+
deleteResponses(formId: PodFormId, data: PodFormJson | Array<number | string>, options?: PodFormRequestOptions): Promise<PodFormResponse>;
|
|
2070
|
+
/** Lists templates available to the current user. */
|
|
2071
|
+
getTemplates(params?: {
|
|
2072
|
+
page?: number;
|
|
2073
|
+
size?: number;
|
|
2074
|
+
templateOwnership?: string;
|
|
2075
|
+
}, options?: PodFormRequestOptions): Promise<PodFormResponse>;
|
|
2076
|
+
/** Creates a template. */
|
|
2077
|
+
createTemplate(data: PodFormTemplateDto, templateOwnership?: string, options?: PodFormRequestOptions): Promise<PodFormResponse>;
|
|
2078
|
+
/** Updates or deletes a template. */
|
|
2079
|
+
updateTemplate(templateId: PodFormId, data: Partial<PodFormTemplateDto>, options?: PodFormRequestOptions): Promise<PodFormResponse>;
|
|
2080
|
+
deleteTemplate(templateId: PodFormId, options?: PodFormRequestOptions): Promise<PodFormResponse>;
|
|
2081
|
+
/** Lists or creates folders. */
|
|
2082
|
+
getFolders(params?: {
|
|
2083
|
+
page?: number;
|
|
2084
|
+
size?: number;
|
|
2085
|
+
name?: string;
|
|
2086
|
+
ownership?: string;
|
|
2087
|
+
}, options?: PodFormRequestOptions): Promise<PodFormResponse>;
|
|
2088
|
+
createFolder(data: PodFormFolderDto, options?: PodFormRequestOptions): Promise<PodFormResponse>;
|
|
2089
|
+
updateFolder(folderId: PodFormId, data: Partial<PodFormFolderDto>, options?: PodFormRequestOptions): Promise<PodFormResponse>;
|
|
2090
|
+
deleteFolder(folderId: PodFormId, removeFromTrash?: boolean, options?: PodFormRequestOptions): Promise<PodFormResponse>;
|
|
2091
|
+
/** Sends or validates a form OTP. */
|
|
2092
|
+
sendOtp(formHash: string, params: PodFormOtpParams, options?: PodFormRequestOptions): Promise<PodFormResponse>;
|
|
2093
|
+
validateOtp(formHash: string, params: PodFormOtpParams & {
|
|
2094
|
+
code: string;
|
|
2095
|
+
}, options?: PodFormRequestOptions): Promise<PodFormResponse>;
|
|
2096
|
+
/** Retrieves the authenticated PodForm user. */
|
|
2097
|
+
getUser(options?: PodFormRequestOptions): Promise<PodFormResponse>;
|
|
2098
|
+
getUploadLink(options?: PodFormRequestOptions): Promise<PodFormResponse>;
|
|
2099
|
+
getDownloadLink(params: PodFormDownloadLinkParams, options?: PodFormRequestOptions): Promise<PodFormResponse>;
|
|
2100
|
+
/** Gets plans and the current user's plan. */
|
|
2101
|
+
getPlans(params?: {
|
|
2102
|
+
page?: number;
|
|
2103
|
+
size?: number;
|
|
2104
|
+
}, options?: PodFormRequestOptions): Promise<PodFormResponse>;
|
|
2105
|
+
getUserPlan(options?: PodFormRequestOptions): Promise<PodFormResponse>;
|
|
2106
|
+
/** Exports form responses using the official export endpoint. */
|
|
2107
|
+
exportResponses(formId: PodFormId, params?: PodFormExportParams, options?: PodFormRequestOptions): Promise<PodFormResponse>;
|
|
2108
|
+
/** Retrieves the statistical report for a form. */
|
|
2109
|
+
getFormReport(formId: PodFormId, options?: PodFormRequestOptions): Promise<PodFormResponse>;
|
|
1820
2110
|
/**
|
|
1821
|
-
*
|
|
1822
|
-
|
|
1823
|
-
sendForm<T extends Record<string, any>>(formId: number, data: T): Promise<PodFormResponse>;
|
|
1824
|
-
/**
|
|
1825
|
-
* Retrieves a form and its questions by ID.
|
|
2111
|
+
* Escape hatch for any newly-added Swagger operation not yet represented by
|
|
2112
|
+
* a convenience method. Authentication and base URL are still applied.
|
|
1826
2113
|
*/
|
|
1827
|
-
|
|
2114
|
+
request<T = PodFormResponse>(method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE', path: string, options?: PodFormRequestOptions & {
|
|
2115
|
+
body?: any;
|
|
2116
|
+
}): Promise<T>;
|
|
1828
2117
|
}
|
|
1829
2118
|
|
|
1830
2119
|
interface SendSmsParams {
|
|
@@ -3077,6 +3366,7 @@ declare class IumsService {
|
|
|
3077
3366
|
|
|
3078
3367
|
declare class PodSdk {
|
|
3079
3368
|
readonly sso: SsoService;
|
|
3369
|
+
readonly captcha: CaptchaService;
|
|
3080
3370
|
readonly customPost: CustomPostService;
|
|
3081
3371
|
readonly podspace: PodspaceService;
|
|
3082
3372
|
readonly podform: PodFormService;
|
|
@@ -3137,4 +3427,4 @@ declare function resolvePodUrls(urls?: PodUrlsConfig, sandbox?: boolean): Requir
|
|
|
3137
3427
|
declare function encodeBase64(str: string): string;
|
|
3138
3428
|
declare function generatePodSignatureHeader(keyId: string, privateKeyPem?: string): Promise<string>;
|
|
3139
3429
|
|
|
3140
|
-
export { type AccessLevel, type AddCommentParams, type AddContentParams, type AddCustomPostParams, type AddCustomPostResponse, type AddProductParams, type ApiPageLink, type ApiPageList, type ApiSimplePageList, type ArchiveParams, type ArchiveProductParams, type BatchPublishParams, type BatchPublishProductParams, type BatchUnpublishParams, type BatchUnpublishProductParams, type Business, type CachePolicy, CmsDataFormatter, type CmsMetadata, CmsProductService, type CmsProductServiceOptions, type CmsRequestOptions, CmsService, type CmsServiceOptions, CmsTagService, type CmsTagServiceOptions, type CommentItem, type ContentBody, type CreateFolderParams, type CreateLinkParams, type CreateTagCategoryParams, type CreateTagTreeItemParams, type CreateUserGroupParams, type CreateWorkspaceParams, type CustomPostCrudConfig, CustomPostCrudService, type CustomPostItem, CustomPostService, type CustomPostServiceOptions, DEFAULT_POD_URLS, type DownloadFileParams, type DownloadImageParams, type DownloadThumbnailParams, type DownloadZipParams, type EditContentParams, type EditProductParams, type FileVersion, type FinalizeResumableParams, type FormattedGetContentResponse, type FormattedGetProductResponse, type FormattedProductSubject, type FormattedSubject, type GetBookmarksParams, type GetCategoriesParams, type GetCategoryResponse, type GetCommentListParams, type GetCommentsParams, type GetContentByEntityIdParams, type GetContentParams, type GetContentResponse, type GetCustomPostParams, type GetCustomPostResponse, type GetFolderChildrenParams, type GetInfOfGraduatedByGraduateDateResponse, type GetProductByEntityIdParams, type GetProductParams, type GetProductResponse, type GetReactionsParams, type GetSessionClassInCurrentDayResponse, type GetTagCategoriesResponse, type GetTagTreeParams, type GetTagTreeResponse, type GetUploadLinkParams, type HandshakeResponse, type IumsResponse, IumsService, type IumsServiceOptions, type LikeCommentParams, type LikePostParams, type MakePublicParams, type MetaContent, type Metadata, NotificationService, type NotificationServiceOptions, type PaginationParams, type PodFormItem, type PodFormResponse, PodFormService, type PodFormServiceOptions, type PodResponse, PodSdk, type PodSdkConfig, type PodUrlsConfig, PodspaceBookmarksService, type PodspaceBookmarksServiceOptions, PodspaceFilesService, type PodspaceFilesServiceOptions, PodspaceFoldersService, type PodspaceFoldersServiceOptions, PodspaceLinksService, type PodspaceLinksServiceOptions, PodspaceMeService, type PodspaceMeServiceOptions, PodspaceMetadataService, type PodspaceMetadataServiceOptions, type PodspaceRequestOptions, type PodspaceRestResponse, PodspaceResumableService, type PodspaceResumableServiceOptions, PodspaceService, type PodspaceServiceOptions, PodspaceSharesService, type PodspaceSharesServiceOptions, PodspaceTagsService, type PodspaceTagsServiceOptions, PodspaceTrashService, type PodspaceTrashServiceOptions, PodspaceUploadDownloadService, type PodspaceUploadDownloadServiceOptions, type PodspaceUploadResponse, type PodspaceUploadResult, type PodspaceUser, PodspaceUserGroupsService, type PodspaceUserGroupsServiceOptions, PodspaceWorkspacesService, type PodspaceWorkspacesServiceOptions, type ProductBody, type ProductItem, type ProductItemWithFormatted, type Rate, type ReplaceFileParams, type ResultItem, type ResultItemWithFormatted, SANDBOX_POD_URLS, type SearchFilesParams, type SearchTimelineByMetadataParam, type SearchTimelineParamMetaQuery, type SearchTimelineResponse, type SearchTimelineResultItem, type SendOtpOptions, type SendSmsParams, type SendSmsResponse, type SeoType, type Share, type ShareAccess, type ShareEntityParams, type ShareType, type SocialResponse, SocialService, type SocialServiceOptions, type SpaceEntity, type SpaceFile, type SpaceFolder, SsoService, type SsoServiceOptions, type SsoUserProfile, type Subject, type TagCategoryItem, type TagCategoryListParams, type TagTreeAncestorsParams, type TagTreeMetadata, type TagtreesType, type ThumbnailStatus, type TimelineResponse, type TimelineSearchBody, type TokenResponse, type UpdateCustomPostParams, type UpdateLinkParams, type UpdateTagCategoryParams, type UpdateTagTreeItemParams, type UpdateWorkspaceParams, type UploadFileParams, type UploadImageBase64Params, type UploadMultipleFilesParams, type UserGroup, type UserPlan, type UserPostInfo, type UserUsageReport, type VerifyResponse, type Workspace, type WorkspaceMember, createPodSdk, PodSdk as default, encodeBase64, generatePodSignatureHeader, resolvePodUrls };
|
|
3430
|
+
export { type AccessLevel, type AddCommentParams, type AddContentParams, type AddCustomPostParams, type AddCustomPostResponse, type AddProductParams, type ApiPageLink, type ApiPageList, type ApiSimplePageList, type ArchiveParams, type ArchiveProductParams, type BatchPublishParams, type BatchPublishProductParams, type BatchUnpublishParams, type BatchUnpublishProductParams, type Business, type CachePolicy, CaptchaService, type CaptchaServiceOptions, type CheckCaptchaOptions, type CheckCaptchaResponse, CmsDataFormatter, type CmsMetadata, CmsProductService, type CmsProductServiceOptions, type CmsRequestOptions, CmsService, type CmsServiceOptions, CmsTagService, type CmsTagServiceOptions, type CommentItem, type ContentBody, type CreateFolderParams, type CreateLinkParams, type CreateTagCategoryParams, type CreateTagTreeItemParams, type CreateUserGroupParams, type CreateWorkspaceParams, type CustomPostCrudConfig, CustomPostCrudService, type CustomPostItem, CustomPostService, type CustomPostServiceOptions, DEFAULT_POD_URLS, type DownloadFileParams, type DownloadImageParams, type DownloadThumbnailParams, type DownloadZipParams, type EditContentParams, type EditProductParams, type FileVersion, type FinalizeResumableParams, type FormattedGetContentResponse, type FormattedGetProductResponse, type FormattedProductSubject, type FormattedSubject, type GenerateCaptchaOptions, type GenerateCaptchaResponse, type GetBookmarksParams, type GetCategoriesParams, type GetCategoryResponse, type GetCommentListParams, type GetCommentsParams, type GetContentByEntityIdParams, type GetContentParams, type GetContentResponse, type GetCustomPostParams, type GetCustomPostResponse, type GetFolderChildrenParams, type GetInfOfGraduatedByGraduateDateResponse, type GetProductByEntityIdParams, type GetProductParams, type GetProductResponse, type GetReactionsParams, type GetSessionClassInCurrentDayResponse, type GetTagCategoriesResponse, type GetTagTreeParams, type GetTagTreeResponse, type GetUploadLinkParams, type HandshakeResponse, type IumsResponse, IumsService, type IumsServiceOptions, type LikeCommentParams, type LikePostParams, type MakePublicParams, type MetaContent, type Metadata, NotificationService, type NotificationServiceOptions, type PaginationParams, type PodFormCreationDto, type PodFormDownloadLinkParams, type PodFormExportParams, type PodFormField, type PodFormFolderDto, type PodFormGetParams, type PodFormId, type PodFormItem, type PodFormJson, type PodFormListParams, type PodFormOtpParams, type PodFormPaymentListParams, type PodFormPreviewParams, type PodFormRequestOptions, type PodFormResponse, type PodFormResponseCreationDto, type PodFormResponseInitiationDto, type PodFormResponseListParams, PodFormService, type PodFormServiceOptions, type PodFormSettingsUpdateDto, type PodFormTemplateDto, type PodFormUpdateDto, type PodResponse, PodSdk, type PodSdkConfig, type PodUrlsConfig, PodspaceBookmarksService, type PodspaceBookmarksServiceOptions, PodspaceFilesService, type PodspaceFilesServiceOptions, PodspaceFoldersService, type PodspaceFoldersServiceOptions, PodspaceLinksService, type PodspaceLinksServiceOptions, PodspaceMeService, type PodspaceMeServiceOptions, PodspaceMetadataService, type PodspaceMetadataServiceOptions, type PodspaceRequestOptions, type PodspaceRestResponse, PodspaceResumableService, type PodspaceResumableServiceOptions, PodspaceService, type PodspaceServiceOptions, PodspaceSharesService, type PodspaceSharesServiceOptions, PodspaceTagsService, type PodspaceTagsServiceOptions, PodspaceTrashService, type PodspaceTrashServiceOptions, PodspaceUploadDownloadService, type PodspaceUploadDownloadServiceOptions, type PodspaceUploadResponse, type PodspaceUploadResult, type PodspaceUser, PodspaceUserGroupsService, type PodspaceUserGroupsServiceOptions, PodspaceWorkspacesService, type PodspaceWorkspacesServiceOptions, type ProductBody, type ProductItem, type ProductItemWithFormatted, type Rate, type ReplaceFileParams, type ResultItem, type ResultItemWithFormatted, SANDBOX_POD_URLS, type SearchFilesParams, type SearchTimelineByMetadataParam, type SearchTimelineParamMetaQuery, type SearchTimelineResponse, type SearchTimelineResultItem, type SendOtpOptions, type SendSmsParams, type SendSmsResponse, type SeoType, type Share, type ShareAccess, type ShareEntityParams, type ShareType, type SocialResponse, SocialService, type SocialServiceOptions, type SpaceEntity, type SpaceFile, type SpaceFolder, SsoService, type SsoServiceOptions, type SsoUserProfile, type Subject, type TagCategoryItem, type TagCategoryListParams, type TagTreeAncestorsParams, type TagTreeMetadata, type TagtreesType, type ThumbnailStatus, type TimelineResponse, type TimelineSearchBody, type TokenResponse, type UpdateCustomPostParams, type UpdateLinkParams, type UpdateTagCategoryParams, type UpdateTagTreeItemParams, type UpdateWorkspaceParams, type UploadFileParams, type UploadImageBase64Params, type UploadMultipleFilesParams, type UserGroup, type UserPlan, type UserPostInfo, type UserUsageReport, type VerifyResponse, type Workspace, type WorkspaceMember, createPodSdk, PodSdk as default, encodeBase64, generatePodSignatureHeader, resolvePodUrls };
|