planvortex 0.5.0 → 0.7.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-BX1Kvdqd.d.cts} +177 -12
- package/dist/{index-CnTr9naC.d.ts → index-BX1Kvdqd.d.ts} +177 -12
- package/dist/index.cjs +55 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +54 -13
- package/dist/index.d.ts +54 -13
- package/dist/index.js +55 -8
- 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
|
@@ -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;
|
|
@@ -1183,7 +1231,7 @@ interface paths {
|
|
|
1183
1231
|
* The inbox: first-level comments across the whole organization
|
|
1184
1232
|
* @description Served from PlanVortex's database, so it costs nothing and calls no social network. It is a **snapshot**: `collected_date` says when each row was last read. Open a thread to see what the network says right now.
|
|
1185
1233
|
*
|
|
1186
|
-
* Ordered by `creation_date` descending — the date on the network, not the date we collected it — so rows from
|
|
1234
|
+
* Ordered by `creation_date` descending — the date on the network, not the date we collected it — so rows from ten networks interleave correctly.
|
|
1187
1235
|
*
|
|
1188
1236
|
* **On `telegram` the inbox starts the day the channel was connected.** The Bot API has no way to read the past: a bot only learns what happens while it is inside, so nothing written before the connection exists here and never will. Say so in your UI — an inbox that opens empty on a busy channel reads like a failure.
|
|
1189
1237
|
*
|
|
@@ -1310,7 +1358,7 @@ interface paths {
|
|
|
1310
1358
|
*
|
|
1311
1359
|
* **An app cannot call this.** Connecting a social account is an OAuth flow with a person in front of it, so this endpoint only accepts a user token or a temporal connect token; with app credentials it answers error 519. The way an integration does it is to issue a temporal connect token with `GET /organizations/{id_organization}/temporal_connect_token` and hand it to its end user.
|
|
1312
1360
|
*
|
|
1313
|
-
* **Read `authorization`, not `link`.**
|
|
1361
|
+
* **Read `authorization`, not `link`.** Ten of the twelve networks are `redirect` and you send the person to `link`. Two are not, and neither of them fails visibly if you treat it as one:
|
|
1314
1362
|
*
|
|
1315
1363
|
* • **WhatsApp is not a URL at all.** Its sign-up is Meta's Embedded Signup, a popup you raise with the Facebook JavaScript SDK, so its `link` is an empty string and everything you need to open that popup travels in `authorization`. A client that loops over the list and redirects to `link` sends its user to its own page.
|
|
1316
1364
|
* • **Telegram has a link and still is not a redirect.** It opens a chat with the PlanVortex bot, and nobody comes back from it: the account is born minutes later, from the bot being added to a channel, and it is announced over the WebSocket. Open it in another tab and keep listening; redirect to it and there is nobody left to tell.
|
|
@@ -2300,7 +2348,7 @@ interface paths {
|
|
|
2300
2348
|
*
|
|
2301
2349
|
* `comments` is the coarse gate — whether the network has comments at all. Which *actions* it allows on one is a finer question and lives in `GET /social_comment_actions`, because the shape here is `{[capability]: boolean}` and nesting an object inside would break it.
|
|
2302
2350
|
*
|
|
2303
|
-
* Today
|
|
2351
|
+
* Today ten networks answer `comments: true`: Facebook, Instagram, Threads, LinkedIn, X, YouTube, Google Business, Bluesky, Discord and Telegram. TikTok and WhatsApp answer `false`, for reasons of theirs and not ours.
|
|
2304
2352
|
*
|
|
2305
2353
|
* A `true` here is about the **network**, not about one account of it: a Telegram channel with no linked discussion group answers 965 on its comments even though the network has them.
|
|
2306
2354
|
*
|
|
@@ -2339,6 +2387,7 @@ interface paths {
|
|
|
2339
2387
|
* | `bluesky` | yes | yes — through the post's `threadgate` | yes | **no** — the reply lives in somebody else's repository |
|
|
2340
2388
|
* | `discord` | yes | **no** — Discord has no hide, only delete | yes | yes |
|
|
2341
2389
|
* | `telegram` | yes | **no** — Telegram has no hide either | yes | yes — with the bot as an admin of the discussion group, otherwise error 969 |
|
|
2390
|
+
* | `threads` | yes | yes | yes | **no** — deleting somebody else's reply is not a permission you lack, it is a call that does not exist in the API |
|
|
2342
2391
|
* | `tiktok`, `whatsapp` | no | no | no | no |
|
|
2343
2392
|
*
|
|
2344
2393
|
* Only needs authentication.
|
|
@@ -2532,7 +2581,7 @@ interface components {
|
|
|
2532
2581
|
/**
|
|
2533
2582
|
* @description **How** an account of this network is authorized, which is not always "send the user to this URL".
|
|
2534
2583
|
*
|
|
2535
|
-
*
|
|
2584
|
+
* Ten of the twelve networks are `redirect`: open `link` and the network sends the person back to PlanVortex with a code. Two are not:
|
|
2536
2585
|
*
|
|
2537
2586
|
* • **WhatsApp.** Its sign-up is Meta's *Embedded Signup*: a popup raised by the Facebook JavaScript SDK from your own page, which returns — over `postMessage` — session data (`waba_id`, `phone_number_id`) that no query string carries. Its `link` is therefore an empty string.
|
|
2538
2587
|
* • **Telegram.** There is no OAuth here: no consent screen, no `code`, no account token. `link` opens a private chat with the PlanVortex bot, the person then adds that bot to their channel, and **the account is created from that event**, not from any request of yours. Which means the connection cannot be finished by calling `GET /organizations/{id_organization}/account-connect/telegram` — see that endpoint.
|
|
@@ -2604,6 +2653,15 @@ interface components {
|
|
|
2604
2653
|
_id: string;
|
|
2605
2654
|
/** @description Accounts the plan was generated for. */
|
|
2606
2655
|
accounts: string[];
|
|
2656
|
+
/**
|
|
2657
|
+
* Format: date-time
|
|
2658
|
+
* @description When the plan was archived. Absent means it is active, which is how every plan created before archiving existed comes back.
|
|
2659
|
+
*
|
|
2660
|
+
* 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.
|
|
2661
|
+
*
|
|
2662
|
+
* Archiving is visibility only: it takes the plan out of the default listing and touches no publication. Anything it had scheduled keeps publishing.
|
|
2663
|
+
*/
|
|
2664
|
+
archived_date?: string;
|
|
2607
2665
|
/** @description Generation attempts consumed (transient failures are retried, max 2). */
|
|
2608
2666
|
attempts: number;
|
|
2609
2667
|
/** Format: date-time */
|
|
@@ -2983,7 +3041,7 @@ interface components {
|
|
|
2983
3041
|
};
|
|
2984
3042
|
CatalogSocialLimits: {
|
|
2985
3043
|
/**
|
|
2986
|
-
* @description Maximum length of a publication's text. Bluesky
|
|
3044
|
+
* @description Maximum length of a publication's text. **Bluesky and Threads count GRAPHEMES**, everyone else counts characters — Telegram included, where `String.length` is exactly the right unit. The difference is not academic: an emoji is one grapheme and two `String.length` units, so counting a Threads post with `.length` rejects at 250 emojis what the network publishes happily at 500.
|
|
2987
3045
|
*
|
|
2988
3046
|
* On Telegram there are **two numbers for the same field**: `telegram` (4.096) while the publication is text only, and `telegram_media` (1.024) the moment it carries an image or a video, because then the text is a media caption and not a message. Switch the counter when the file is attached, not when publish is pressed.
|
|
2989
3047
|
*/
|
|
@@ -3227,7 +3285,7 @@ interface components {
|
|
|
3227
3285
|
* @description A network that has comments. Treat it as an open list: a new one is added before your integration hears about it.
|
|
3228
3286
|
* @enum {string}
|
|
3229
3287
|
*/
|
|
3230
|
-
CommentsCommentNetworkName: "facebook" | "instagram" | "twitter" | "linkedin" | "youtube" | "google_business" | "bluesky" | "discord" | "telegram";
|
|
3288
|
+
CommentsCommentNetworkName: "facebook" | "instagram" | "twitter" | "linkedin" | "youtube" | "google_business" | "bluesky" | "discord" | "telegram" | "threads";
|
|
3231
3289
|
/** @description A live read: asked of the network and reconciled with what was stored. */
|
|
3232
3290
|
CommentsCommentThread: {
|
|
3233
3291
|
comments: components["schemas"]["CommentsComment"][];
|
|
@@ -4130,7 +4188,7 @@ interface components {
|
|
|
4130
4188
|
* Not every connectable network publishes — a local business listing receives reviews, not posts — so this list is shorter than the one in `GET /social_networks`. Ask `GET /allowed_social_publications` rather than hardcoding it, because it grows.
|
|
4131
4189
|
* @enum {string}
|
|
4132
4190
|
*/
|
|
4133
|
-
social_network?: "facebook" | "instagram" | "twitter" | "linkedin" | "tiktok" | "whatsapp" | "youtube" | "bluesky" | "discord" | "telegram";
|
|
4191
|
+
social_network?: "facebook" | "instagram" | "twitter" | "linkedin" | "tiktok" | "whatsapp" | "youtube" | "bluesky" | "discord" | "telegram" | "threads";
|
|
4134
4192
|
/**
|
|
4135
4193
|
* @description Send `draft` to store the publication without publishing it. If omitted, the state is resolved automatically: `ready` when everything validates, `withErrors` otherwise. Forcing `sended` marks it as published without actually sending it.
|
|
4136
4194
|
* @enum {string}
|
|
@@ -4242,6 +4300,8 @@ interface components {
|
|
|
4242
4300
|
*
|
|
4243
4301
|
* On `bluesky` there are no impressions and no reach either — only the public counters — so engagement is computed over followers.
|
|
4244
4302
|
*
|
|
4303
|
+
* On `threads` there are six, and the one that matters is `views`: it is the only one of the four newest networks with something like impressions, so its engagement rate is computed over a real base and not over followers. Sharing arrives split in three — `reposts`, `quotes` and `shares` (outside Threads) — and the three are added into one figure, the same criterion as on X; the breakdown stays in `raw`. A reply is what every other network calls a comment.
|
|
4304
|
+
*
|
|
4245
4305
|
* On `telegram` there are two as well, and **neither of them is asked for**: the Bot API has no method that returns a message's metrics, so `reactions` arrives on its own through the bot and `comments` is counted in PlanVortex's own inbox. There are no impressions, no reach, no views and no forwards to be had anywhere in it, so engagement is computed over followers.
|
|
4246
4306
|
*/
|
|
4247
4307
|
PublicationStats: {
|
|
@@ -4327,7 +4387,7 @@ interface components {
|
|
|
4327
4387
|
* **This list grows.** Treat it as an open enumeration: a client that rejects an unknown value breaks the day a network is added, which happens several times a year. Not every network does everything — ask `GET /social_capabilities`.
|
|
4328
4388
|
* @enum {string}
|
|
4329
4389
|
*/
|
|
4330
|
-
SocialNetwork: "facebook" | "instagram" | "linkedin" | "tiktok" | "twitter" | "whatsapp" | "youtube" | "google_business" | "bluesky" | "discord" | "telegram";
|
|
4390
|
+
SocialNetwork: "facebook" | "instagram" | "linkedin" | "tiktok" | "twitter" | "whatsapp" | "youtube" | "google_business" | "bluesky" | "discord" | "telegram" | "threads";
|
|
4331
4391
|
/** @description Statistics collection settings. Only `auto_refresh_twitter` is read; any other key is ignored. */
|
|
4332
4392
|
StatsSettings: {
|
|
4333
4393
|
/**
|
|
@@ -5357,6 +5417,8 @@ interface operations {
|
|
|
5357
5417
|
getAiPlans: {
|
|
5358
5418
|
parameters: {
|
|
5359
5419
|
query?: {
|
|
5420
|
+
/** @description `true` returns the archived plans instead of the active ones. Anything other than the literal string `true` is read as false. */
|
|
5421
|
+
archived?: boolean;
|
|
5360
5422
|
/** @description Maximum number of records to return (pagination) */
|
|
5361
5423
|
limit?: number;
|
|
5362
5424
|
/** @description Number of records to skip (pagination) */
|
|
@@ -5576,6 +5638,57 @@ interface operations {
|
|
|
5576
5638
|
};
|
|
5577
5639
|
};
|
|
5578
5640
|
};
|
|
5641
|
+
archiveAiPlan: {
|
|
5642
|
+
parameters: {
|
|
5643
|
+
query?: never;
|
|
5644
|
+
header?: never;
|
|
5645
|
+
path: {
|
|
5646
|
+
/** @description AI plan identifier */
|
|
5647
|
+
id_ai_plan: components["parameters"]["AiPlansidAiPlan"];
|
|
5648
|
+
/** @description Client identifier */
|
|
5649
|
+
id_client: components["parameters"]["AiPlansidClient"];
|
|
5650
|
+
/** @description Organization identifier */
|
|
5651
|
+
id_organization: components["parameters"]["AiPlansidOrganization"];
|
|
5652
|
+
};
|
|
5653
|
+
cookie?: never;
|
|
5654
|
+
};
|
|
5655
|
+
requestBody?: never;
|
|
5656
|
+
responses: {
|
|
5657
|
+
/** @description Successful operation. Returns the plan with `archived_date` set. */
|
|
5658
|
+
200: {
|
|
5659
|
+
headers: {
|
|
5660
|
+
[name: string]: unknown;
|
|
5661
|
+
};
|
|
5662
|
+
content: {
|
|
5663
|
+
"application/json": components["schemas"]["AiPlansAiPlanOne"];
|
|
5664
|
+
};
|
|
5665
|
+
};
|
|
5666
|
+
/**
|
|
5667
|
+
* @description The request failed. The body carries the PlanVortex error code in `code`:
|
|
5668
|
+
*
|
|
5669
|
+
* | Code | Meaning |
|
|
5670
|
+
* | --- | --- |
|
|
5671
|
+
* | `1101` | Invalid organization |
|
|
5672
|
+
* | `2100` | AI plan doesn't exist. The identifier is invalid or doesn't exist. |
|
|
5673
|
+
* | `521` | Invalid client. The identifier is invalid or doesn't exist |
|
|
5674
|
+
*/
|
|
5675
|
+
400: {
|
|
5676
|
+
headers: {
|
|
5677
|
+
[name: string]: unknown;
|
|
5678
|
+
};
|
|
5679
|
+
content: {
|
|
5680
|
+
"application/json": components["schemas"]["Error"];
|
|
5681
|
+
};
|
|
5682
|
+
};
|
|
5683
|
+
/** @description Unhandled error by the server */
|
|
5684
|
+
500: {
|
|
5685
|
+
headers: {
|
|
5686
|
+
[name: string]: unknown;
|
|
5687
|
+
};
|
|
5688
|
+
content?: never;
|
|
5689
|
+
};
|
|
5690
|
+
};
|
|
5691
|
+
};
|
|
5579
5692
|
regenerateAiPlanPublication: {
|
|
5580
5693
|
parameters: {
|
|
5581
5694
|
query?: never;
|
|
@@ -5698,6 +5811,57 @@ interface operations {
|
|
|
5698
5811
|
};
|
|
5699
5812
|
};
|
|
5700
5813
|
};
|
|
5814
|
+
unarchiveAiPlan: {
|
|
5815
|
+
parameters: {
|
|
5816
|
+
query?: never;
|
|
5817
|
+
header?: never;
|
|
5818
|
+
path: {
|
|
5819
|
+
/** @description AI plan identifier */
|
|
5820
|
+
id_ai_plan: components["parameters"]["AiPlansidAiPlan"];
|
|
5821
|
+
/** @description Client identifier */
|
|
5822
|
+
id_client: components["parameters"]["AiPlansidClient"];
|
|
5823
|
+
/** @description Organization identifier */
|
|
5824
|
+
id_organization: components["parameters"]["AiPlansidOrganization"];
|
|
5825
|
+
};
|
|
5826
|
+
cookie?: never;
|
|
5827
|
+
};
|
|
5828
|
+
requestBody?: never;
|
|
5829
|
+
responses: {
|
|
5830
|
+
/** @description Successful operation. Returns the plan without `archived_date`. */
|
|
5831
|
+
200: {
|
|
5832
|
+
headers: {
|
|
5833
|
+
[name: string]: unknown;
|
|
5834
|
+
};
|
|
5835
|
+
content: {
|
|
5836
|
+
"application/json": components["schemas"]["AiPlansAiPlanOne"];
|
|
5837
|
+
};
|
|
5838
|
+
};
|
|
5839
|
+
/**
|
|
5840
|
+
* @description The request failed. The body carries the PlanVortex error code in `code`:
|
|
5841
|
+
*
|
|
5842
|
+
* | Code | Meaning |
|
|
5843
|
+
* | --- | --- |
|
|
5844
|
+
* | `1101` | Invalid organization |
|
|
5845
|
+
* | `2100` | AI plan doesn't exist. The identifier is invalid or doesn't exist. |
|
|
5846
|
+
* | `521` | Invalid client. The identifier is invalid or doesn't exist |
|
|
5847
|
+
*/
|
|
5848
|
+
400: {
|
|
5849
|
+
headers: {
|
|
5850
|
+
[name: string]: unknown;
|
|
5851
|
+
};
|
|
5852
|
+
content: {
|
|
5853
|
+
"application/json": components["schemas"]["Error"];
|
|
5854
|
+
};
|
|
5855
|
+
};
|
|
5856
|
+
/** @description Unhandled error by the server */
|
|
5857
|
+
500: {
|
|
5858
|
+
headers: {
|
|
5859
|
+
[name: string]: unknown;
|
|
5860
|
+
};
|
|
5861
|
+
content?: never;
|
|
5862
|
+
};
|
|
5863
|
+
};
|
|
5864
|
+
};
|
|
5701
5865
|
validateAiPlan: {
|
|
5702
5866
|
parameters: {
|
|
5703
5867
|
query?: never;
|
|
@@ -10726,7 +10890,8 @@ interface operations {
|
|
|
10726
10890
|
* "google_business",
|
|
10727
10891
|
* "bluesky",
|
|
10728
10892
|
* "discord",
|
|
10729
|
-
* "telegram"
|
|
10893
|
+
* "telegram",
|
|
10894
|
+
* "threads"
|
|
10730
10895
|
* ]
|
|
10731
10896
|
*/
|
|
10732
10897
|
"application/json": components["schemas"]["SocialNetwork"][];
|
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.7.0";
|
|
8
8
|
|
|
9
9
|
// src/core/errors.ts
|
|
10
10
|
var PLANVORTEX_ERROR_RANGES = [
|
|
@@ -609,7 +609,7 @@ var AccountsResource = class extends Resource {
|
|
|
609
609
|
* no un fallo: es lo que pasa con Discord en una organización que todavía no ha guardado sus
|
|
610
610
|
* propias credenciales de bot.
|
|
611
611
|
*
|
|
612
|
-
* **MIRA `authorization`, NO si `link` está vacío.**
|
|
612
|
+
* **MIRA `authorization`, NO si `link` está vacío.** Diez de las doce redes son `redirect` y se
|
|
613
613
|
* manda a la persona a `link`. Las otras dos no, y ninguna de las dos falla de forma visible si
|
|
614
614
|
* se recorre la lista redirigiendo a `link`:
|
|
615
615
|
*
|
|
@@ -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(
|