planvortex 0.5.0 → 0.6.0
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 +1 -1
- package/dist/{index-CnTr9naC.d.cts → index-B7gbjlNe.d.cts} +164 -3
- package/dist/{index-CnTr9naC.d.ts → index-B7gbjlNe.d.ts} +164 -3
- package/dist/index.cjs +54 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +53 -12
- package/dist/index.d.ts +53 -12
- package/dist/index.js +54 -7
- package/dist/index.js.map +1 -1
- package/dist/webhooks/index.d.cts +1 -1
- package/dist/webhooks/index.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -113,7 +113,7 @@ for await (const publication of pv.publications.iterate(orgId, { state: ["ready"
|
|
|
113
113
|
| `pv.contacts` | `list`, `iterate`, `get`, `create`, `update`, `merge`, `remove`, `removeAll` |
|
|
114
114
|
| `pv.products` | `list`, `iterate`, `get`, `create`, `catalogs`, `createCatalog` |
|
|
115
115
|
| `pv.integrations` | `providers`, `list`, `iterate`, `get`, `connectLink`, `connect`, `reconnect`, `update`, `remove`, `pickerConfig` |
|
|
116
|
-
| `pv.aiPlans` | `create`, `get`, `list`, `iterate`, `validate`, `retry`, `regenerate`, `remove`
|
|
116
|
+
| `pv.aiPlans` | `create`, `get`, `list`, `iterate`, `validate`, `retry`, `regenerate`, `archive`, `unarchive`, `remove` |
|
|
117
117
|
| `pv.dashboard` | `summary`, `metrics`, `publications`, `topPublications`, `publicationStats`, `use` |
|
|
118
118
|
| `pv.apps` | `list`, `get`, `create`, `update`, `remove`, `secret` — **needs a user token**, not app credentials |
|
|
119
119
|
|
|
@@ -341,7 +341,9 @@ interface paths {
|
|
|
341
341
|
* List AI publication plans
|
|
342
342
|
* @description Return the organization's AI plans ordered by creation date (desc), paginated. Requires the ai_plans:read permission.
|
|
343
343
|
*
|
|
344
|
-
* **
|
|
344
|
+
* **Active plans by default, archived ones with `archived=true`** — never both at once. Archiving is visibility only (see `POST .../archive`): the plan leaves this listing and keeps every publication it had.
|
|
345
|
+
*
|
|
346
|
+
* **Cancelled plans are not listed either.** Deleting a plan sets it to `cancelled` rather than removing it, and this listing filters those out — so a plan you deleted simply stops appearing, while `GET` by id still returns it.
|
|
345
347
|
*
|
|
346
348
|
* Without `limit` the whole list comes back.
|
|
347
349
|
*/
|
|
@@ -373,8 +375,12 @@ interface paths {
|
|
|
373
375
|
put?: never;
|
|
374
376
|
post?: never;
|
|
375
377
|
/**
|
|
376
|
-
*
|
|
377
|
-
* @description
|
|
378
|
+
* Delete an AI publication plan and its pending publications
|
|
379
|
+
* @description Delete the plan **and every publication of it that has not gone out yet**: the generated drafts and, if the plan was already validated, whatever was still scheduled. Two states are deliberately left alone: `sended`, because it is already live on the network and deleting it here would only lose its history while the post stays up, and `publishing`, which the publishing job holds at that very moment.
|
|
380
|
+
*
|
|
381
|
+
* AI credits already spent on generation are NOT refunded (same criterion as X: if the provider charged, we charge). A plan being generated cannot be deleted (state `generating`, error 2102): wait for the job to finish.
|
|
382
|
+
*
|
|
383
|
+
* To keep the plan and its publications and only take it out of the listing, archive it instead (`POST .../archive`). Requires the ai_plans:delete permission.
|
|
378
384
|
*/
|
|
379
385
|
delete: operations["deleteAiPlan"];
|
|
380
386
|
options?: never;
|
|
@@ -382,6 +388,28 @@ interface paths {
|
|
|
382
388
|
patch?: never;
|
|
383
389
|
trace?: never;
|
|
384
390
|
};
|
|
391
|
+
"/clients/{id_client}/organizations/{id_organization}/ai_plans/{id_ai_plan}/archive": {
|
|
392
|
+
parameters: {
|
|
393
|
+
query?: never;
|
|
394
|
+
header?: never;
|
|
395
|
+
path?: never;
|
|
396
|
+
cookie?: never;
|
|
397
|
+
};
|
|
398
|
+
get?: never;
|
|
399
|
+
put?: never;
|
|
400
|
+
/**
|
|
401
|
+
* Archive an AI publication plan
|
|
402
|
+
* @description Take the plan out of the default listing and move it to the archived one (`GET .../ai_plans?archived=true`). It is **visibility only**: no publication is touched — anything scheduled keeps publishing — no credits are refunded, and nothing is cancelled. It is reversible with `POST .../unarchive` and valid in **any state**, `generating` included, because it does not interrupt the generation job.
|
|
403
|
+
*
|
|
404
|
+
* Archiving an already archived plan just refreshes `archived_date`. Requires the ai_plans:update permission.
|
|
405
|
+
*/
|
|
406
|
+
post: operations["archiveAiPlan"];
|
|
407
|
+
delete?: never;
|
|
408
|
+
options?: never;
|
|
409
|
+
head?: never;
|
|
410
|
+
patch?: never;
|
|
411
|
+
trace?: never;
|
|
412
|
+
};
|
|
385
413
|
"/clients/{id_client}/organizations/{id_organization}/ai_plans/{id_ai_plan}/publications/{id_publication}/regenerate": {
|
|
386
414
|
parameters: {
|
|
387
415
|
query?: never;
|
|
@@ -428,6 +456,26 @@ interface paths {
|
|
|
428
456
|
patch?: never;
|
|
429
457
|
trace?: never;
|
|
430
458
|
};
|
|
459
|
+
"/clients/{id_client}/organizations/{id_organization}/ai_plans/{id_ai_plan}/unarchive": {
|
|
460
|
+
parameters: {
|
|
461
|
+
query?: never;
|
|
462
|
+
header?: never;
|
|
463
|
+
path?: never;
|
|
464
|
+
cookie?: never;
|
|
465
|
+
};
|
|
466
|
+
get?: never;
|
|
467
|
+
put?: never;
|
|
468
|
+
/**
|
|
469
|
+
* Unarchive an AI publication plan
|
|
470
|
+
* @description Return the plan to the default listing: `archived_date` is cleared. Unarchiving a plan that was not archived does nothing and answers 200. Requires the ai_plans:update permission.
|
|
471
|
+
*/
|
|
472
|
+
post: operations["unarchiveAiPlan"];
|
|
473
|
+
delete?: never;
|
|
474
|
+
options?: never;
|
|
475
|
+
head?: never;
|
|
476
|
+
patch?: never;
|
|
477
|
+
trace?: never;
|
|
478
|
+
};
|
|
431
479
|
"/clients/{id_client}/organizations/{id_organization}/ai_plans/{id_ai_plan}/validate": {
|
|
432
480
|
parameters: {
|
|
433
481
|
query?: never;
|
|
@@ -2604,6 +2652,15 @@ interface components {
|
|
|
2604
2652
|
_id: string;
|
|
2605
2653
|
/** @description Accounts the plan was generated for. */
|
|
2606
2654
|
accounts: string[];
|
|
2655
|
+
/**
|
|
2656
|
+
* Format: date-time
|
|
2657
|
+
* @description When the plan was archived. Absent means it is active, which is how every plan created before archiving existed comes back.
|
|
2658
|
+
*
|
|
2659
|
+
* It is a field of its own and NOT a value of `state` on purpose: `state` is the generation lifecycle and archiving is orthogonal to it — a `validated` plan that already published gets archived just like a `failed` one. Inside the enum you would have to decide which state it returns to when unarchived, and that question has no answer.
|
|
2660
|
+
*
|
|
2661
|
+
* Archiving is visibility only: it takes the plan out of the default listing and touches no publication. Anything it had scheduled keeps publishing.
|
|
2662
|
+
*/
|
|
2663
|
+
archived_date?: string;
|
|
2607
2664
|
/** @description Generation attempts consumed (transient failures are retried, max 2). */
|
|
2608
2665
|
attempts: number;
|
|
2609
2666
|
/** Format: date-time */
|
|
@@ -5357,6 +5414,8 @@ interface operations {
|
|
|
5357
5414
|
getAiPlans: {
|
|
5358
5415
|
parameters: {
|
|
5359
5416
|
query?: {
|
|
5417
|
+
/** @description `true` returns the archived plans instead of the active ones. Anything other than the literal string `true` is read as false. */
|
|
5418
|
+
archived?: boolean;
|
|
5360
5419
|
/** @description Maximum number of records to return (pagination) */
|
|
5361
5420
|
limit?: number;
|
|
5362
5421
|
/** @description Number of records to skip (pagination) */
|
|
@@ -5576,6 +5635,57 @@ interface operations {
|
|
|
5576
5635
|
};
|
|
5577
5636
|
};
|
|
5578
5637
|
};
|
|
5638
|
+
archiveAiPlan: {
|
|
5639
|
+
parameters: {
|
|
5640
|
+
query?: never;
|
|
5641
|
+
header?: never;
|
|
5642
|
+
path: {
|
|
5643
|
+
/** @description AI plan identifier */
|
|
5644
|
+
id_ai_plan: components["parameters"]["AiPlansidAiPlan"];
|
|
5645
|
+
/** @description Client identifier */
|
|
5646
|
+
id_client: components["parameters"]["AiPlansidClient"];
|
|
5647
|
+
/** @description Organization identifier */
|
|
5648
|
+
id_organization: components["parameters"]["AiPlansidOrganization"];
|
|
5649
|
+
};
|
|
5650
|
+
cookie?: never;
|
|
5651
|
+
};
|
|
5652
|
+
requestBody?: never;
|
|
5653
|
+
responses: {
|
|
5654
|
+
/** @description Successful operation. Returns the plan with `archived_date` set. */
|
|
5655
|
+
200: {
|
|
5656
|
+
headers: {
|
|
5657
|
+
[name: string]: unknown;
|
|
5658
|
+
};
|
|
5659
|
+
content: {
|
|
5660
|
+
"application/json": components["schemas"]["AiPlansAiPlanOne"];
|
|
5661
|
+
};
|
|
5662
|
+
};
|
|
5663
|
+
/**
|
|
5664
|
+
* @description The request failed. The body carries the PlanVortex error code in `code`:
|
|
5665
|
+
*
|
|
5666
|
+
* | Code | Meaning |
|
|
5667
|
+
* | --- | --- |
|
|
5668
|
+
* | `1101` | Invalid organization |
|
|
5669
|
+
* | `2100` | AI plan doesn't exist. The identifier is invalid or doesn't exist. |
|
|
5670
|
+
* | `521` | Invalid client. The identifier is invalid or doesn't exist |
|
|
5671
|
+
*/
|
|
5672
|
+
400: {
|
|
5673
|
+
headers: {
|
|
5674
|
+
[name: string]: unknown;
|
|
5675
|
+
};
|
|
5676
|
+
content: {
|
|
5677
|
+
"application/json": components["schemas"]["Error"];
|
|
5678
|
+
};
|
|
5679
|
+
};
|
|
5680
|
+
/** @description Unhandled error by the server */
|
|
5681
|
+
500: {
|
|
5682
|
+
headers: {
|
|
5683
|
+
[name: string]: unknown;
|
|
5684
|
+
};
|
|
5685
|
+
content?: never;
|
|
5686
|
+
};
|
|
5687
|
+
};
|
|
5688
|
+
};
|
|
5579
5689
|
regenerateAiPlanPublication: {
|
|
5580
5690
|
parameters: {
|
|
5581
5691
|
query?: never;
|
|
@@ -5698,6 +5808,57 @@ interface operations {
|
|
|
5698
5808
|
};
|
|
5699
5809
|
};
|
|
5700
5810
|
};
|
|
5811
|
+
unarchiveAiPlan: {
|
|
5812
|
+
parameters: {
|
|
5813
|
+
query?: never;
|
|
5814
|
+
header?: never;
|
|
5815
|
+
path: {
|
|
5816
|
+
/** @description AI plan identifier */
|
|
5817
|
+
id_ai_plan: components["parameters"]["AiPlansidAiPlan"];
|
|
5818
|
+
/** @description Client identifier */
|
|
5819
|
+
id_client: components["parameters"]["AiPlansidClient"];
|
|
5820
|
+
/** @description Organization identifier */
|
|
5821
|
+
id_organization: components["parameters"]["AiPlansidOrganization"];
|
|
5822
|
+
};
|
|
5823
|
+
cookie?: never;
|
|
5824
|
+
};
|
|
5825
|
+
requestBody?: never;
|
|
5826
|
+
responses: {
|
|
5827
|
+
/** @description Successful operation. Returns the plan without `archived_date`. */
|
|
5828
|
+
200: {
|
|
5829
|
+
headers: {
|
|
5830
|
+
[name: string]: unknown;
|
|
5831
|
+
};
|
|
5832
|
+
content: {
|
|
5833
|
+
"application/json": components["schemas"]["AiPlansAiPlanOne"];
|
|
5834
|
+
};
|
|
5835
|
+
};
|
|
5836
|
+
/**
|
|
5837
|
+
* @description The request failed. The body carries the PlanVortex error code in `code`:
|
|
5838
|
+
*
|
|
5839
|
+
* | Code | Meaning |
|
|
5840
|
+
* | --- | --- |
|
|
5841
|
+
* | `1101` | Invalid organization |
|
|
5842
|
+
* | `2100` | AI plan doesn't exist. The identifier is invalid or doesn't exist. |
|
|
5843
|
+
* | `521` | Invalid client. The identifier is invalid or doesn't exist |
|
|
5844
|
+
*/
|
|
5845
|
+
400: {
|
|
5846
|
+
headers: {
|
|
5847
|
+
[name: string]: unknown;
|
|
5848
|
+
};
|
|
5849
|
+
content: {
|
|
5850
|
+
"application/json": components["schemas"]["Error"];
|
|
5851
|
+
};
|
|
5852
|
+
};
|
|
5853
|
+
/** @description Unhandled error by the server */
|
|
5854
|
+
500: {
|
|
5855
|
+
headers: {
|
|
5856
|
+
[name: string]: unknown;
|
|
5857
|
+
};
|
|
5858
|
+
content?: never;
|
|
5859
|
+
};
|
|
5860
|
+
};
|
|
5861
|
+
};
|
|
5701
5862
|
validateAiPlan: {
|
|
5702
5863
|
parameters: {
|
|
5703
5864
|
query?: never;
|
|
@@ -341,7 +341,9 @@ interface paths {
|
|
|
341
341
|
* List AI publication plans
|
|
342
342
|
* @description Return the organization's AI plans ordered by creation date (desc), paginated. Requires the ai_plans:read permission.
|
|
343
343
|
*
|
|
344
|
-
* **
|
|
344
|
+
* **Active plans by default, archived ones with `archived=true`** — never both at once. Archiving is visibility only (see `POST .../archive`): the plan leaves this listing and keeps every publication it had.
|
|
345
|
+
*
|
|
346
|
+
* **Cancelled plans are not listed either.** Deleting a plan sets it to `cancelled` rather than removing it, and this listing filters those out — so a plan you deleted simply stops appearing, while `GET` by id still returns it.
|
|
345
347
|
*
|
|
346
348
|
* Without `limit` the whole list comes back.
|
|
347
349
|
*/
|
|
@@ -373,8 +375,12 @@ interface paths {
|
|
|
373
375
|
put?: never;
|
|
374
376
|
post?: never;
|
|
375
377
|
/**
|
|
376
|
-
*
|
|
377
|
-
* @description
|
|
378
|
+
* Delete an AI publication plan and its pending publications
|
|
379
|
+
* @description Delete the plan **and every publication of it that has not gone out yet**: the generated drafts and, if the plan was already validated, whatever was still scheduled. Two states are deliberately left alone: `sended`, because it is already live on the network and deleting it here would only lose its history while the post stays up, and `publishing`, which the publishing job holds at that very moment.
|
|
380
|
+
*
|
|
381
|
+
* AI credits already spent on generation are NOT refunded (same criterion as X: if the provider charged, we charge). A plan being generated cannot be deleted (state `generating`, error 2102): wait for the job to finish.
|
|
382
|
+
*
|
|
383
|
+
* To keep the plan and its publications and only take it out of the listing, archive it instead (`POST .../archive`). Requires the ai_plans:delete permission.
|
|
378
384
|
*/
|
|
379
385
|
delete: operations["deleteAiPlan"];
|
|
380
386
|
options?: never;
|
|
@@ -382,6 +388,28 @@ interface paths {
|
|
|
382
388
|
patch?: never;
|
|
383
389
|
trace?: never;
|
|
384
390
|
};
|
|
391
|
+
"/clients/{id_client}/organizations/{id_organization}/ai_plans/{id_ai_plan}/archive": {
|
|
392
|
+
parameters: {
|
|
393
|
+
query?: never;
|
|
394
|
+
header?: never;
|
|
395
|
+
path?: never;
|
|
396
|
+
cookie?: never;
|
|
397
|
+
};
|
|
398
|
+
get?: never;
|
|
399
|
+
put?: never;
|
|
400
|
+
/**
|
|
401
|
+
* Archive an AI publication plan
|
|
402
|
+
* @description Take the plan out of the default listing and move it to the archived one (`GET .../ai_plans?archived=true`). It is **visibility only**: no publication is touched — anything scheduled keeps publishing — no credits are refunded, and nothing is cancelled. It is reversible with `POST .../unarchive` and valid in **any state**, `generating` included, because it does not interrupt the generation job.
|
|
403
|
+
*
|
|
404
|
+
* Archiving an already archived plan just refreshes `archived_date`. Requires the ai_plans:update permission.
|
|
405
|
+
*/
|
|
406
|
+
post: operations["archiveAiPlan"];
|
|
407
|
+
delete?: never;
|
|
408
|
+
options?: never;
|
|
409
|
+
head?: never;
|
|
410
|
+
patch?: never;
|
|
411
|
+
trace?: never;
|
|
412
|
+
};
|
|
385
413
|
"/clients/{id_client}/organizations/{id_organization}/ai_plans/{id_ai_plan}/publications/{id_publication}/regenerate": {
|
|
386
414
|
parameters: {
|
|
387
415
|
query?: never;
|
|
@@ -428,6 +456,26 @@ interface paths {
|
|
|
428
456
|
patch?: never;
|
|
429
457
|
trace?: never;
|
|
430
458
|
};
|
|
459
|
+
"/clients/{id_client}/organizations/{id_organization}/ai_plans/{id_ai_plan}/unarchive": {
|
|
460
|
+
parameters: {
|
|
461
|
+
query?: never;
|
|
462
|
+
header?: never;
|
|
463
|
+
path?: never;
|
|
464
|
+
cookie?: never;
|
|
465
|
+
};
|
|
466
|
+
get?: never;
|
|
467
|
+
put?: never;
|
|
468
|
+
/**
|
|
469
|
+
* Unarchive an AI publication plan
|
|
470
|
+
* @description Return the plan to the default listing: `archived_date` is cleared. Unarchiving a plan that was not archived does nothing and answers 200. Requires the ai_plans:update permission.
|
|
471
|
+
*/
|
|
472
|
+
post: operations["unarchiveAiPlan"];
|
|
473
|
+
delete?: never;
|
|
474
|
+
options?: never;
|
|
475
|
+
head?: never;
|
|
476
|
+
patch?: never;
|
|
477
|
+
trace?: never;
|
|
478
|
+
};
|
|
431
479
|
"/clients/{id_client}/organizations/{id_organization}/ai_plans/{id_ai_plan}/validate": {
|
|
432
480
|
parameters: {
|
|
433
481
|
query?: never;
|
|
@@ -2604,6 +2652,15 @@ interface components {
|
|
|
2604
2652
|
_id: string;
|
|
2605
2653
|
/** @description Accounts the plan was generated for. */
|
|
2606
2654
|
accounts: string[];
|
|
2655
|
+
/**
|
|
2656
|
+
* Format: date-time
|
|
2657
|
+
* @description When the plan was archived. Absent means it is active, which is how every plan created before archiving existed comes back.
|
|
2658
|
+
*
|
|
2659
|
+
* It is a field of its own and NOT a value of `state` on purpose: `state` is the generation lifecycle and archiving is orthogonal to it — a `validated` plan that already published gets archived just like a `failed` one. Inside the enum you would have to decide which state it returns to when unarchived, and that question has no answer.
|
|
2660
|
+
*
|
|
2661
|
+
* Archiving is visibility only: it takes the plan out of the default listing and touches no publication. Anything it had scheduled keeps publishing.
|
|
2662
|
+
*/
|
|
2663
|
+
archived_date?: string;
|
|
2607
2664
|
/** @description Generation attempts consumed (transient failures are retried, max 2). */
|
|
2608
2665
|
attempts: number;
|
|
2609
2666
|
/** Format: date-time */
|
|
@@ -5357,6 +5414,8 @@ interface operations {
|
|
|
5357
5414
|
getAiPlans: {
|
|
5358
5415
|
parameters: {
|
|
5359
5416
|
query?: {
|
|
5417
|
+
/** @description `true` returns the archived plans instead of the active ones. Anything other than the literal string `true` is read as false. */
|
|
5418
|
+
archived?: boolean;
|
|
5360
5419
|
/** @description Maximum number of records to return (pagination) */
|
|
5361
5420
|
limit?: number;
|
|
5362
5421
|
/** @description Number of records to skip (pagination) */
|
|
@@ -5576,6 +5635,57 @@ interface operations {
|
|
|
5576
5635
|
};
|
|
5577
5636
|
};
|
|
5578
5637
|
};
|
|
5638
|
+
archiveAiPlan: {
|
|
5639
|
+
parameters: {
|
|
5640
|
+
query?: never;
|
|
5641
|
+
header?: never;
|
|
5642
|
+
path: {
|
|
5643
|
+
/** @description AI plan identifier */
|
|
5644
|
+
id_ai_plan: components["parameters"]["AiPlansidAiPlan"];
|
|
5645
|
+
/** @description Client identifier */
|
|
5646
|
+
id_client: components["parameters"]["AiPlansidClient"];
|
|
5647
|
+
/** @description Organization identifier */
|
|
5648
|
+
id_organization: components["parameters"]["AiPlansidOrganization"];
|
|
5649
|
+
};
|
|
5650
|
+
cookie?: never;
|
|
5651
|
+
};
|
|
5652
|
+
requestBody?: never;
|
|
5653
|
+
responses: {
|
|
5654
|
+
/** @description Successful operation. Returns the plan with `archived_date` set. */
|
|
5655
|
+
200: {
|
|
5656
|
+
headers: {
|
|
5657
|
+
[name: string]: unknown;
|
|
5658
|
+
};
|
|
5659
|
+
content: {
|
|
5660
|
+
"application/json": components["schemas"]["AiPlansAiPlanOne"];
|
|
5661
|
+
};
|
|
5662
|
+
};
|
|
5663
|
+
/**
|
|
5664
|
+
* @description The request failed. The body carries the PlanVortex error code in `code`:
|
|
5665
|
+
*
|
|
5666
|
+
* | Code | Meaning |
|
|
5667
|
+
* | --- | --- |
|
|
5668
|
+
* | `1101` | Invalid organization |
|
|
5669
|
+
* | `2100` | AI plan doesn't exist. The identifier is invalid or doesn't exist. |
|
|
5670
|
+
* | `521` | Invalid client. The identifier is invalid or doesn't exist |
|
|
5671
|
+
*/
|
|
5672
|
+
400: {
|
|
5673
|
+
headers: {
|
|
5674
|
+
[name: string]: unknown;
|
|
5675
|
+
};
|
|
5676
|
+
content: {
|
|
5677
|
+
"application/json": components["schemas"]["Error"];
|
|
5678
|
+
};
|
|
5679
|
+
};
|
|
5680
|
+
/** @description Unhandled error by the server */
|
|
5681
|
+
500: {
|
|
5682
|
+
headers: {
|
|
5683
|
+
[name: string]: unknown;
|
|
5684
|
+
};
|
|
5685
|
+
content?: never;
|
|
5686
|
+
};
|
|
5687
|
+
};
|
|
5688
|
+
};
|
|
5579
5689
|
regenerateAiPlanPublication: {
|
|
5580
5690
|
parameters: {
|
|
5581
5691
|
query?: never;
|
|
@@ -5698,6 +5808,57 @@ interface operations {
|
|
|
5698
5808
|
};
|
|
5699
5809
|
};
|
|
5700
5810
|
};
|
|
5811
|
+
unarchiveAiPlan: {
|
|
5812
|
+
parameters: {
|
|
5813
|
+
query?: never;
|
|
5814
|
+
header?: never;
|
|
5815
|
+
path: {
|
|
5816
|
+
/** @description AI plan identifier */
|
|
5817
|
+
id_ai_plan: components["parameters"]["AiPlansidAiPlan"];
|
|
5818
|
+
/** @description Client identifier */
|
|
5819
|
+
id_client: components["parameters"]["AiPlansidClient"];
|
|
5820
|
+
/** @description Organization identifier */
|
|
5821
|
+
id_organization: components["parameters"]["AiPlansidOrganization"];
|
|
5822
|
+
};
|
|
5823
|
+
cookie?: never;
|
|
5824
|
+
};
|
|
5825
|
+
requestBody?: never;
|
|
5826
|
+
responses: {
|
|
5827
|
+
/** @description Successful operation. Returns the plan without `archived_date`. */
|
|
5828
|
+
200: {
|
|
5829
|
+
headers: {
|
|
5830
|
+
[name: string]: unknown;
|
|
5831
|
+
};
|
|
5832
|
+
content: {
|
|
5833
|
+
"application/json": components["schemas"]["AiPlansAiPlanOne"];
|
|
5834
|
+
};
|
|
5835
|
+
};
|
|
5836
|
+
/**
|
|
5837
|
+
* @description The request failed. The body carries the PlanVortex error code in `code`:
|
|
5838
|
+
*
|
|
5839
|
+
* | Code | Meaning |
|
|
5840
|
+
* | --- | --- |
|
|
5841
|
+
* | `1101` | Invalid organization |
|
|
5842
|
+
* | `2100` | AI plan doesn't exist. The identifier is invalid or doesn't exist. |
|
|
5843
|
+
* | `521` | Invalid client. The identifier is invalid or doesn't exist |
|
|
5844
|
+
*/
|
|
5845
|
+
400: {
|
|
5846
|
+
headers: {
|
|
5847
|
+
[name: string]: unknown;
|
|
5848
|
+
};
|
|
5849
|
+
content: {
|
|
5850
|
+
"application/json": components["schemas"]["Error"];
|
|
5851
|
+
};
|
|
5852
|
+
};
|
|
5853
|
+
/** @description Unhandled error by the server */
|
|
5854
|
+
500: {
|
|
5855
|
+
headers: {
|
|
5856
|
+
[name: string]: unknown;
|
|
5857
|
+
};
|
|
5858
|
+
content?: never;
|
|
5859
|
+
};
|
|
5860
|
+
};
|
|
5861
|
+
};
|
|
5701
5862
|
validateAiPlan: {
|
|
5702
5863
|
parameters: {
|
|
5703
5864
|
query?: never;
|
package/dist/index.cjs
CHANGED
|
@@ -4,7 +4,7 @@ var path = require('path');
|
|
|
4
4
|
|
|
5
5
|
// src/version.ts
|
|
6
6
|
var PLANVORTEX_API_URL = "https://api.planvortex.com/v1.0.0";
|
|
7
|
-
var VERSION = "0.
|
|
7
|
+
var VERSION = "0.6.0";
|
|
8
8
|
|
|
9
9
|
// src/core/errors.ts
|
|
10
10
|
var PLANVORTEX_ERROR_RANGES = [
|
|
@@ -851,16 +851,28 @@ var AiPlansResource = class extends Resource {
|
|
|
851
851
|
);
|
|
852
852
|
}
|
|
853
853
|
/**
|
|
854
|
-
* Los planes de la organización, del más reciente al más antiguo.
|
|
854
|
+
* Los planes ACTIVOS de la organización, del más reciente al más antiguo.
|
|
855
855
|
*
|
|
856
|
-
* **Los cancelados no salen
|
|
857
|
-
* enteras: para eso está {@link get}.
|
|
856
|
+
* **Los cancelados no salen** —ni los archivados, que se piden con `archived: true`— y aquí
|
|
857
|
+
* `publications` son identificadores, no las publicaciones enteras: para eso está {@link get}.
|
|
858
|
+
* Sin `limit` vuelven todos.
|
|
859
|
+
*
|
|
860
|
+
* ```ts
|
|
861
|
+
* const activos = await pv.aiPlans.list(clientId, orgId);
|
|
862
|
+
* const guardados = await pv.aiPlans.list(clientId, orgId, { archived: true });
|
|
863
|
+
* ```
|
|
858
864
|
*/
|
|
859
865
|
async list(idClient, idOrganization, options = {}) {
|
|
860
866
|
return this.getList(
|
|
861
867
|
this.path(idClient, idOrganization),
|
|
862
868
|
"ai_plans",
|
|
863
|
-
{
|
|
869
|
+
{
|
|
870
|
+
offset: options.offset,
|
|
871
|
+
limit: options.limit,
|
|
872
|
+
//El servidor sólo entiende el literal "true"; un `false` explícito pediría lo
|
|
873
|
+
//mismo que no mandar nada, así que se omite en vez de viajar como ruido
|
|
874
|
+
archived: options.archived ? true : void 0
|
|
875
|
+
},
|
|
864
876
|
options
|
|
865
877
|
);
|
|
866
878
|
}
|
|
@@ -920,8 +932,43 @@ var AiPlansResource = class extends Resource {
|
|
|
920
932
|
);
|
|
921
933
|
}
|
|
922
934
|
/**
|
|
923
|
-
*
|
|
924
|
-
*
|
|
935
|
+
* Archiva el plan: sale del listado y pasa al de archivados (`list(..., { archived: true })`).
|
|
936
|
+
*
|
|
937
|
+
* Es **sólo visibilidad**. No toca ninguna publicación —lo que estuviera programado sigue
|
|
938
|
+
* publicándose—, no devuelve créditos y no cancela nada, así que vale en CUALQUIER estado,
|
|
939
|
+
* `generating` incluido: no interrumpe al job. Se deshace con {@link unarchive}.
|
|
940
|
+
*
|
|
941
|
+
* Es lo que se busca casi siempre que uno piensa en "quitar" un plan: {@link remove} se lleva
|
|
942
|
+
* por delante las publicaciones que aún no han salido, y esto no.
|
|
943
|
+
*/
|
|
944
|
+
async archive(idClient, idOrganization, idAiPlan, options = {}) {
|
|
945
|
+
return this.postOne(
|
|
946
|
+
`${this.one(idClient, idOrganization, idAiPlan)}/archive`,
|
|
947
|
+
"ai_plan",
|
|
948
|
+
void 0,
|
|
949
|
+
options
|
|
950
|
+
);
|
|
951
|
+
}
|
|
952
|
+
/** Devuelve el plan al listado activo. Sobre un plan que no estaba archivado no hace nada. */
|
|
953
|
+
async unarchive(idClient, idOrganization, idAiPlan, options = {}) {
|
|
954
|
+
return this.postOne(
|
|
955
|
+
`${this.one(idClient, idOrganization, idAiPlan)}/unarchive`,
|
|
956
|
+
"ai_plan",
|
|
957
|
+
void 0,
|
|
958
|
+
options
|
|
959
|
+
);
|
|
960
|
+
}
|
|
961
|
+
/**
|
|
962
|
+
* Borra el plan **y sus publicaciones que aún no han salido**: las drafts generadas y, si ya se
|
|
963
|
+
* había validado, las que quedaran programadas. Las ya publicadas se quedan —borrarlas aquí no
|
|
964
|
+
* las quitaría de la red, sólo perdería su historial— y la que se está publicando en ese
|
|
965
|
+
* instante tampoco se toca.
|
|
966
|
+
*
|
|
967
|
+
* El plan en sí no se borra del todo: pasa a `cancelled`, desaparece de {@link list} y
|
|
968
|
+
* {@link get} lo sigue devolviendo. Los créditos gastados no se devuelven y un plan
|
|
969
|
+
* `generating` no se puede borrar (2102): hay que esperar a que el job termine.
|
|
970
|
+
*
|
|
971
|
+
* Si lo que se quiere es dejar de verlo sin perder nada, {@link archive}.
|
|
925
972
|
*/
|
|
926
973
|
async remove(idClient, idOrganization, idAiPlan, options = {}) {
|
|
927
974
|
await this.httpDelete(
|