planvortex 0.10.0 → 0.11.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 +2 -2
- package/dist/{index-DWBSCYR7.d.cts → index-B1pa7Ct0.d.cts} +324 -5
- package/dist/{index-DWBSCYR7.d.ts → index-B1pa7Ct0.d.ts} +324 -5
- package/dist/index.cjs +60 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +178 -123
- package/dist/index.d.ts +178 -123
- package/dist/index.js +60 -1
- 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
|
@@ -205,6 +205,8 @@ interface paths {
|
|
|
205
205
|
*
|
|
206
206
|
* **The user's email must be verified** (`ERROR_CODE_546`). This is the only route in `/apps` that asks for it: an app is a key to the whole public API, and this is what stops a throwaway address from minting them in bulk. Reading, updating and deleting an app you already own do not check it.
|
|
207
207
|
*
|
|
208
|
+
* **The identifier has a format** (error 533): lowercase letters, numbers, `.`, `-` and `_`, starting with a letter or a number, 3 to 64 characters. Pick it carefully — it cannot be changed later (error 547).
|
|
209
|
+
*
|
|
208
210
|
* Every URL is validated: a bad entry in `allowed_domains` answers 531, in `redirect_urls` 532, and a bad `webhook_url` answers 535.
|
|
209
211
|
*
|
|
210
212
|
* **The secret is not in the response.** Read it with `GET /clients/{id_client}/apps/{id_app}/secret`.
|
|
@@ -240,6 +242,8 @@ interface paths {
|
|
|
240
242
|
*
|
|
241
243
|
* **It replaces every field with what the body carries.** `name`, `keycloak_client_idenfifier`, `allowed_domains`, `redirect_urls` and `webhook_url` are all written as sent, so omitting one erases it — sending an update without `webhook_url` turns the webhook off. Read the app first and send it back whole.
|
|
242
244
|
*
|
|
245
|
+
* **`keycloak_client_idenfifier` is the one field that is NOT overwritten.** Sending a different one answers `ERROR_CODE_547` and nothing is written: it is the `client_id` your integration authenticates with, and renaming it would lock out everything already asking for tokens with the old one. Send it unchanged, or leave it out. If you need a different identifier, create another app.
|
|
246
|
+
*
|
|
243
247
|
* **An app token works here.** This is the one part of `/apps` that does: an app can read and update its own record, but it cannot list, create, delete, or read the secret. **No plan is required**: apps are on all four plans, the free one included.
|
|
244
248
|
*/
|
|
245
249
|
put: operations["updateClientApp"];
|
|
@@ -275,7 +279,19 @@ interface paths {
|
|
|
275
279
|
*/
|
|
276
280
|
get: operations["getClientAppSecret"];
|
|
277
281
|
put?: never;
|
|
278
|
-
|
|
282
|
+
/**
|
|
283
|
+
* Regenerate the app's secret
|
|
284
|
+
* @description Rotates the `client_secret` and returns the new one.
|
|
285
|
+
*
|
|
286
|
+
* **The previous secret stops working the moment this answers** — there is no grace period and no overlap. Anything still holding it gets `invalid_client` from `POST /oauth/token` on its very next call, so roll it out before you rotate, not after.
|
|
287
|
+
*
|
|
288
|
+
* **It also changes how your webhooks are signed.** `x-hub-signature` and `x-hub-signature-256` are HMACs of the body computed with this same secret, so a receiver that verifies the signature will start rejecting legitimate deliveries until it is updated too.
|
|
289
|
+
*
|
|
290
|
+
* The new value comes back only here. If you lose it, read it again with `GET /clients/{id_client}/apps/{id_app}/secret` — it is not stored anywhere on our side except Keycloak.
|
|
291
|
+
*
|
|
292
|
+
* **Needs a USER token, not an app token** (`ERROR_CODE_512`), and the `client_app:update` permission — reading the secret changes nothing, this invalidates what was there.
|
|
293
|
+
*/
|
|
294
|
+
post: operations["regenerateClientAppSecret"];
|
|
279
295
|
delete?: never;
|
|
280
296
|
options?: never;
|
|
281
297
|
head?: never;
|
|
@@ -496,6 +512,34 @@ interface paths {
|
|
|
496
512
|
patch?: never;
|
|
497
513
|
trace?: never;
|
|
498
514
|
};
|
|
515
|
+
"/clients/{id_client}/organizations/{id_organization}/ai_plans/results": {
|
|
516
|
+
parameters: {
|
|
517
|
+
query?: never;
|
|
518
|
+
header?: never;
|
|
519
|
+
path?: never;
|
|
520
|
+
cookie?: never;
|
|
521
|
+
};
|
|
522
|
+
/**
|
|
523
|
+
* Compare the results of AI plans
|
|
524
|
+
* @description What each AI plan achieved with what it published, the aggregate per template and the total — the data behind «which plan worked best?». Requires **both** `ai_plans:read` and `publication_stats:read`: it shows plans and it shows publication metrics.
|
|
525
|
+
*
|
|
526
|
+
* **The range filters on the plan's week** (`week_start`), not on when it was created: a plan created today for next week has published nothing and has no results yet.
|
|
527
|
+
*
|
|
528
|
+
* **Only plans that published something are listed** — with `social_network`, something on those networks. A plan whose posts are all still scheduled would be a row of blanks. Archived plans are included; cancelled ones are not.
|
|
529
|
+
*
|
|
530
|
+
* **The default order is interactions per measured publication**, and only plans with at least 3 measured publications (or all of them, if they published fewer) compete in it; the rest come after. See `AiPlanResult` for why it is that number and not the total or the engagement rate.
|
|
531
|
+
*
|
|
532
|
+
* Covers **this organization only**, not its children — it is the sibling of `GET .../ai_plans` and talks about the same plans. The dashboard's `ai_plan_results` block does include children.
|
|
533
|
+
*/
|
|
534
|
+
get: operations["getAiPlanResultsService"];
|
|
535
|
+
put?: never;
|
|
536
|
+
post?: never;
|
|
537
|
+
delete?: never;
|
|
538
|
+
options?: never;
|
|
539
|
+
head?: never;
|
|
540
|
+
patch?: never;
|
|
541
|
+
trace?: never;
|
|
542
|
+
};
|
|
499
543
|
"/clients/{id_client}/roles": {
|
|
500
544
|
parameters: {
|
|
501
545
|
query?: never;
|
|
@@ -1467,7 +1511,7 @@ interface paths {
|
|
|
1467
1511
|
};
|
|
1468
1512
|
/**
|
|
1469
1513
|
* The whole home screen in one call
|
|
1470
|
-
* @description Composes every block of the home screen in a single round trip: operational health, publications, publication metrics, account metrics, plan use, AI plans and unread messages.
|
|
1514
|
+
* @description Composes every block of the home screen in a single round trip: operational health, publications, publication metrics, account metrics, plan use, AI plans, the best AI plans and unread messages.
|
|
1471
1515
|
*
|
|
1472
1516
|
* **A block the caller cannot read is omitted, not refused.** The endpoint only demands the minimum permission — reading the organization — and then checks each block on its own: somebody who can only see publications still gets their home instead of a 403. `available_blocks` says which blocks were allowed, so an absent block for lack of permission and an absent block for lack of data can be drawn differently.
|
|
1473
1517
|
*
|
|
@@ -2654,6 +2698,101 @@ interface components {
|
|
|
2654
2698
|
value_proposition?: string;
|
|
2655
2699
|
website?: string;
|
|
2656
2700
|
};
|
|
2701
|
+
/**
|
|
2702
|
+
* @description What ONE AI plan achieved with what it published.
|
|
2703
|
+
*
|
|
2704
|
+
* **Where the numbers come from.** A plan keeps its publications, and each publication keeps the last known value of its metrics (the same ones `GET /organizations/{id}/publications/stats` returns). This adds those up — nothing here is measured twice or asked to the network again.
|
|
2705
|
+
*
|
|
2706
|
+
* **Only the publications that went out and were measured count** (`publications.measured`). A post scheduled for tomorrow, one that failed or one published an hour ago that nobody has measured yet does not lower the average: it is simply not in it.
|
|
2707
|
+
*
|
|
2708
|
+
* **A missing metric is not a zero**, as everywhere else: if no publication of the plan reports `reach`, the plan has no `reach` key.
|
|
2709
|
+
*/
|
|
2710
|
+
AiPlanResult: {
|
|
2711
|
+
/** @description Accounts the plan was generated for. */
|
|
2712
|
+
accounts: number;
|
|
2713
|
+
/**
|
|
2714
|
+
* Format: date-time
|
|
2715
|
+
* @description Archived plans are included: archiving is visibility only, and what they published is still published.
|
|
2716
|
+
*/
|
|
2717
|
+
archived_date?: string;
|
|
2718
|
+
/** Format: date-time */
|
|
2719
|
+
creation_date: string;
|
|
2720
|
+
/** @description AI credits per interaction: what each interaction cost. Lower is better. Absent with no interactions, with no credits spent (your own AI key) and **whenever `social_network` is filtered** — the cost belongs to the whole plan, and dividing it by one network's interactions would overprice every one of them. */
|
|
2721
|
+
credits_per_engagement?: number;
|
|
2722
|
+
/** @description AI credits the plan cost, for the whole plan. */
|
|
2723
|
+
credits_spent: number;
|
|
2724
|
+
/** @description Interactions per measured publication — **the number plans are ranked by**. The total rewards size (seven accounts for seven days beat one account even if each post does half as well), and the engagement rate divides by reach on some networks and by followers on others, which makes two plans on different networks incomparable. Absent when nothing is measured yet. */
|
|
2725
|
+
engagement_per_publication?: number;
|
|
2726
|
+
/** @description `engagement_per_publication` divided by `expected_engagement_per_publication`: **1 means like your average, 2 twice as much, 0.5 half**. This is the number that says whether a plan is *good*, not just first — the ranking still orders by `engagement_per_publication`, so the first plan can be below 1. Absent with nothing measured or no average to compare with. */
|
|
2727
|
+
engagement_vs_average?: number;
|
|
2728
|
+
/**
|
|
2729
|
+
* @description What **your usual posts** would get with the same mix of networks: the organization's average interactions per measured post on each network, weighted by how many measured posts the plan has there. Two measured posts on Instagram (average 5) and two on LinkedIn (average 1) expect (2·5 + 2·1) / 4 = 3.
|
|
2730
|
+
*
|
|
2731
|
+
* The average covers **every** measured post of the organization in the range, AI ones included, on the same networks. Weighting by network is what keeps a LinkedIn-only plan from always reading as below average just because LinkedIn moves less than Instagram.
|
|
2732
|
+
*/
|
|
2733
|
+
expected_engagement_per_publication?: number;
|
|
2734
|
+
id_ai_plan: string;
|
|
2735
|
+
/** @description The organization the plan belongs to. In the dashboard block it can be a **child** of the organization you asked about, and a plan is only reachable by id through its own organization. */
|
|
2736
|
+
id_organization: string;
|
|
2737
|
+
/** Format: date-time */
|
|
2738
|
+
last_publish_date?: string;
|
|
2739
|
+
/** @description Its numbers are still moving: something is still scheduled, or its last publication is less than 7 days old. Comparing it with a plan from last month is unfair to the new one — say so rather than hiding it. */
|
|
2740
|
+
maturing: boolean;
|
|
2741
|
+
metrics: components["schemas"]["NormalizedMetrics"];
|
|
2742
|
+
prompt: string;
|
|
2743
|
+
publications: {
|
|
2744
|
+
/** @description Failed to publish. */
|
|
2745
|
+
failed: number;
|
|
2746
|
+
/** @description Published **and** with metrics collected: the only ones the averages use. */
|
|
2747
|
+
measured: number;
|
|
2748
|
+
/** @description Went out to the network. */
|
|
2749
|
+
published: number;
|
|
2750
|
+
/** @description Scheduled, or being published right now. */
|
|
2751
|
+
scheduled: number;
|
|
2752
|
+
/** @description Publications of the plan that still exist. Deleted ones do not count. */
|
|
2753
|
+
total: number;
|
|
2754
|
+
};
|
|
2755
|
+
/** @description Whether the plan competes in the ranking: it needs at least **3 measured publications**, or all of them if it published fewer. With a single measurement, one lucky post would put its plan first. */
|
|
2756
|
+
ranked: boolean;
|
|
2757
|
+
/** @description Networks the plan published on. With the `social_network` filter, only the filtered ones. */
|
|
2758
|
+
social_networks: components["schemas"]["SocialNetwork"][];
|
|
2759
|
+
/**
|
|
2760
|
+
* @description Only these two can have results. A `generated` plan was never validated, but someone may have published some of its drafts by hand.
|
|
2761
|
+
* @enum {string}
|
|
2762
|
+
*/
|
|
2763
|
+
state: "generated" | "validated";
|
|
2764
|
+
/**
|
|
2765
|
+
* @description What the plan was generated from. A plan created before templates existed reads `standard`.
|
|
2766
|
+
* @enum {string}
|
|
2767
|
+
*/
|
|
2768
|
+
template: "standard" | "from_images" | "from_text" | "from_catalog" | "campaign";
|
|
2769
|
+
/**
|
|
2770
|
+
* Format: date-time
|
|
2771
|
+
* @description The week the plan publishes in. **This is what the range filters on**, not the creation date.
|
|
2772
|
+
*/
|
|
2773
|
+
week_start: string;
|
|
2774
|
+
};
|
|
2775
|
+
/** @description The aggregate of a set of plans: all of them, or those of one template. */
|
|
2776
|
+
AiPlanResultsGroup: {
|
|
2777
|
+
/** @description Credits per interaction, counting **only the plans that already have something measured**: a plan validated yesterday brings its whole cost and no interactions, and would make the group look expensive for arriving late. Absent with the `social_network` filter. */
|
|
2778
|
+
credits_per_engagement?: number;
|
|
2779
|
+
/** @description Credits of every plan in the group. */
|
|
2780
|
+
credits_spent: number;
|
|
2781
|
+
/** @description A **weighted** average: every interaction of the group divided by every measured publication of the group — not the average of each plan's average, which would let a one-post plan weigh as much as a forty-post one. */
|
|
2782
|
+
engagement_per_publication?: number;
|
|
2783
|
+
/** @description The group's interactions per post over what was expected, computed over the **same** plans on both sides — a plan with no reference cannot add its interactions to one side only. */
|
|
2784
|
+
engagement_vs_average?: number;
|
|
2785
|
+
/** @description What your usual posts would get with the group's mix of networks, weighted like its average. Only plans that have a reference count. */
|
|
2786
|
+
expected_engagement_per_publication?: number;
|
|
2787
|
+
metrics: components["schemas"]["NormalizedMetrics"];
|
|
2788
|
+
plans: number;
|
|
2789
|
+
publications: {
|
|
2790
|
+
measured: number;
|
|
2791
|
+
published: number;
|
|
2792
|
+
};
|
|
2793
|
+
/** @description How many of them compete in the ranking (see `AiPlanResult.ranked`). */
|
|
2794
|
+
ranked_plans: number;
|
|
2795
|
+
};
|
|
2657
2796
|
AiPlansAiPlan: {
|
|
2658
2797
|
/** @example 66d04a6a427f4c43b9d97f54 */
|
|
2659
2798
|
_id: string;
|
|
@@ -2841,6 +2980,32 @@ interface components {
|
|
|
2841
2980
|
*/
|
|
2842
2981
|
week_start?: string;
|
|
2843
2982
|
};
|
|
2983
|
+
AiPlansAiPlanResults: {
|
|
2984
|
+
/** @description The page of plans, in `sort` order. */
|
|
2985
|
+
ai_plans: components["schemas"]["AiPlanResult"][];
|
|
2986
|
+
/** @description One entry per template that has plans in the range, best `engagement_per_publication` first. This is the answer to «which kind of plan works for me?». */
|
|
2987
|
+
by_template: components["schemas"]["AiPlansAiPlanResultsTemplateGroup"][];
|
|
2988
|
+
/** @description The range that was actually used. The plans in it are those whose **week** starts inside it. */
|
|
2989
|
+
range: {
|
|
2990
|
+
/** Format: date-time */
|
|
2991
|
+
from_date: string;
|
|
2992
|
+
/** Format: date-time */
|
|
2993
|
+
previous_from_date?: string;
|
|
2994
|
+
/** Format: date-time */
|
|
2995
|
+
previous_to_date?: string;
|
|
2996
|
+
/** Format: date-time */
|
|
2997
|
+
to_date: string;
|
|
2998
|
+
};
|
|
2999
|
+
/** @description The order that was applied. */
|
|
3000
|
+
sort: string;
|
|
3001
|
+
/** @description Plans with results in the range (and filters), across every page. */
|
|
3002
|
+
total: number;
|
|
3003
|
+
totals: components["schemas"]["AiPlanResultsGroup"];
|
|
3004
|
+
};
|
|
3005
|
+
AiPlansAiPlanResultsTemplateGroup: components["schemas"]["AiPlanResultsGroup"] & {
|
|
3006
|
+
/** @enum {string} */
|
|
3007
|
+
template: "standard" | "from_images" | "from_text" | "from_catalog" | "campaign";
|
|
3008
|
+
};
|
|
2844
3009
|
/** @description The plan source as it was STORED: a snapshot taken when the plan was created, not a live reference. It is what makes a retry reproduce the same plan even if the article went offline or the product left the catalogue — same reason as `organization_context`. */
|
|
2845
3010
|
AiPlansAiPlanSource: {
|
|
2846
3011
|
/** @description `campaign`. The event and its date, already normalised to the start of ITS day in the plan timezone. */
|
|
@@ -2935,7 +3100,7 @@ interface components {
|
|
|
2935
3100
|
id_client: string;
|
|
2936
3101
|
/** @description The user who created the app, when it was created from the panel. */
|
|
2937
3102
|
id_user?: string;
|
|
2938
|
-
/** @description The app's `client_id`. */
|
|
3103
|
+
/** @description The app's `client_id`. Fixed for the life of the app: it cannot be changed once created (error 547). */
|
|
2939
3104
|
keycloak_client_idenfifier: string;
|
|
2940
3105
|
name: string;
|
|
2941
3106
|
redirect_urls: string[];
|
|
@@ -2951,7 +3116,14 @@ interface components {
|
|
|
2951
3116
|
AppsClientAppInput: {
|
|
2952
3117
|
/** @description Origins allowed to call the API with this app's identity. Every entry has to be a valid URL (error 531). */
|
|
2953
3118
|
allowed_domains?: string[];
|
|
2954
|
-
/**
|
|
3119
|
+
/**
|
|
3120
|
+
* @description The app's `client_id`, which is what you send to `POST /oauth/token`.
|
|
3121
|
+
*
|
|
3122
|
+
* **Format is enforced** (error 533): lowercase letters, numbers, `.`, `-` and `_`, starting with a letter or a number, between 3 and 64 characters — `shop-integration`, not `Shop Integration`. Keycloak itself accepts anything, so an identifier with a space in it used to create an app that could never get a token.
|
|
3123
|
+
*
|
|
3124
|
+
* It also has to be unique across PlanVortex (error 534), and **it cannot be changed once the app exists** (error 547): it is what your integration authenticates with, so renaming it would lock out everything already using the old one. Send it unchanged on an update, or leave it out. The spelling of the field is historical and kept for compatibility.
|
|
3125
|
+
* @example shop-integration
|
|
3126
|
+
*/
|
|
2955
3127
|
keycloak_client_idenfifier: string;
|
|
2956
3128
|
/** @description A name for the app. Cannot be blank (error 525). */
|
|
2957
3129
|
name: string;
|
|
@@ -3472,6 +3644,23 @@ interface components {
|
|
|
3472
3644
|
previous_total: components["schemas"]["NormalizedMetrics"];
|
|
3473
3645
|
total: components["schemas"]["NormalizedMetrics"];
|
|
3474
3646
|
};
|
|
3647
|
+
/**
|
|
3648
|
+
* @description The best AI plans of the range, by interactions per measured publication — the short version of `GET /clients/{id}/organizations/{id}/ai_plans/results`, with the same rules: the range filters on the plan's **week**, and only plans with at least 3 measured publications compete.
|
|
3649
|
+
*
|
|
3650
|
+
* Unlike that endpoint it covers the organization **and its children**, like the rest of this screen, so each plan carries its `id_organization`.
|
|
3651
|
+
*/
|
|
3652
|
+
ai_plan_results?: {
|
|
3653
|
+
/** @description Interactions per measured publication across every plan of the range. */
|
|
3654
|
+
engagement_per_publication?: number;
|
|
3655
|
+
/** @description Interactions per post of every plan of the range over what your usual posts would get on the same networks. 1 means like your average. */
|
|
3656
|
+
engagement_vs_average?: number;
|
|
3657
|
+
/** @description Plans with results in the range. */
|
|
3658
|
+
plans: number;
|
|
3659
|
+
/** @description How many of those compete in the ranking. `plans > 0` with `ranked_plans: 0` means there are results, just not enough measured yet. */
|
|
3660
|
+
ranked_plans: number;
|
|
3661
|
+
/** @description Up to three plans, best first. Only ranked ones. */
|
|
3662
|
+
top: components["schemas"]["AiPlanResult"][];
|
|
3663
|
+
};
|
|
3475
3664
|
ai_plans?: {
|
|
3476
3665
|
by_state: {
|
|
3477
3666
|
state?: string;
|
|
@@ -3489,6 +3678,8 @@ interface components {
|
|
|
3489
3678
|
/** @description Which blocks the caller was allowed to see. A `false` here is a permission (or plan) answer; a block that is `true` but empty means there is no data. */
|
|
3490
3679
|
available_blocks: {
|
|
3491
3680
|
account_metrics: boolean;
|
|
3681
|
+
/** @description Needs both `ai_plans:read` and `publication_stats:read`: the block shows plans and their publications' metrics. */
|
|
3682
|
+
ai_plan_results: boolean;
|
|
3492
3683
|
ai_plans: boolean;
|
|
3493
3684
|
health: boolean;
|
|
3494
3685
|
messages: boolean;
|
|
@@ -4548,12 +4739,16 @@ interface components {
|
|
|
4548
4739
|
};
|
|
4549
4740
|
};
|
|
4550
4741
|
parameters: {
|
|
4742
|
+
/** @description Start of the range, ISO 8601. Defaults to 30 days before `to_date`. A range longer than 366 days answers error 1003. */
|
|
4743
|
+
AiPlansfromDate: string;
|
|
4551
4744
|
/** @description AI plan identifier */
|
|
4552
4745
|
AiPlansidAiPlan: string;
|
|
4553
4746
|
/** @description Client identifier */
|
|
4554
4747
|
AiPlansidClient: string;
|
|
4555
4748
|
/** @description Organization identifier */
|
|
4556
4749
|
AiPlansidOrganization: string;
|
|
4750
|
+
/** @description End of the range, ISO 8601. Defaults to now. */
|
|
4751
|
+
AiPlanstoDate: string;
|
|
4557
4752
|
/** @description App identifier */
|
|
4558
4753
|
AppsidApp: string;
|
|
4559
4754
|
/** @description Client identifier */
|
|
@@ -5219,6 +5414,34 @@ interface operations {
|
|
|
5219
5414
|
400: components["responses"]["AppsError"];
|
|
5220
5415
|
};
|
|
5221
5416
|
};
|
|
5417
|
+
regenerateClientAppSecret: {
|
|
5418
|
+
parameters: {
|
|
5419
|
+
query?: never;
|
|
5420
|
+
header?: never;
|
|
5421
|
+
path: {
|
|
5422
|
+
/** @description App identifier */
|
|
5423
|
+
id_app: components["parameters"]["AppsidApp"];
|
|
5424
|
+
/** @description Client identifier */
|
|
5425
|
+
id_client: components["parameters"]["AppsidClient"];
|
|
5426
|
+
};
|
|
5427
|
+
cookie?: never;
|
|
5428
|
+
};
|
|
5429
|
+
requestBody?: never;
|
|
5430
|
+
responses: {
|
|
5431
|
+
/** @description The new secret */
|
|
5432
|
+
200: {
|
|
5433
|
+
headers: {
|
|
5434
|
+
[name: string]: unknown;
|
|
5435
|
+
};
|
|
5436
|
+
content: {
|
|
5437
|
+
"application/json": {
|
|
5438
|
+
secret: string;
|
|
5439
|
+
};
|
|
5440
|
+
};
|
|
5441
|
+
};
|
|
5442
|
+
400: components["responses"]["AppsError"];
|
|
5443
|
+
};
|
|
5444
|
+
};
|
|
5222
5445
|
getClientOrganizations: {
|
|
5223
5446
|
parameters: {
|
|
5224
5447
|
query?: {
|
|
@@ -5939,6 +6162,73 @@ interface operations {
|
|
|
5939
6162
|
};
|
|
5940
6163
|
};
|
|
5941
6164
|
};
|
|
6165
|
+
getAiPlanResultsService: {
|
|
6166
|
+
parameters: {
|
|
6167
|
+
query?: {
|
|
6168
|
+
/** @description Start of the range, ISO 8601. Defaults to 30 days before `to_date`. A range longer than 366 days answers error 1003. */
|
|
6169
|
+
from_date?: components["parameters"]["AiPlansfromDate"];
|
|
6170
|
+
/** @description Plans per page. At most 100. */
|
|
6171
|
+
limit?: number;
|
|
6172
|
+
/** @description Number of plans to skip (pagination) */
|
|
6173
|
+
offset?: number;
|
|
6174
|
+
/** @description Recompute every plan with **only** its publications on these networks, which is what makes plans on different networks comparable. Repeat the parameter for several. `credits_per_engagement` disappears with this filter. */
|
|
6175
|
+
social_network?: components["schemas"]["SocialNetwork"][];
|
|
6176
|
+
/** @description Order of the plans. Each one has its natural direction — `credits_per_engagement` cheapest first, `week_start` newest first, everything else highest first — and plans without that value go last. */
|
|
6177
|
+
sort?: "engagement_per_publication" | "engagement" | "impressions" | "reach" | "credits_per_engagement" | "credits_spent" | "week_start";
|
|
6178
|
+
/** @description Only plans generated from this template. An unknown one answers error 2111. */
|
|
6179
|
+
template?: "standard" | "from_images" | "from_text" | "from_catalog" | "campaign";
|
|
6180
|
+
/** @description End of the range, ISO 8601. Defaults to now. */
|
|
6181
|
+
to_date?: components["parameters"]["AiPlanstoDate"];
|
|
6182
|
+
};
|
|
6183
|
+
header?: never;
|
|
6184
|
+
path: {
|
|
6185
|
+
/** @description Client identifier */
|
|
6186
|
+
id_client: components["parameters"]["AiPlansidClient"];
|
|
6187
|
+
/** @description Organization identifier */
|
|
6188
|
+
id_organization: components["parameters"]["AiPlansidOrganization"];
|
|
6189
|
+
};
|
|
6190
|
+
cookie?: never;
|
|
6191
|
+
};
|
|
6192
|
+
requestBody?: never;
|
|
6193
|
+
responses: {
|
|
6194
|
+
/** @description Successful operation */
|
|
6195
|
+
200: {
|
|
6196
|
+
headers: {
|
|
6197
|
+
[name: string]: unknown;
|
|
6198
|
+
};
|
|
6199
|
+
content: {
|
|
6200
|
+
"application/json": components["schemas"]["AiPlansAiPlanResults"];
|
|
6201
|
+
};
|
|
6202
|
+
};
|
|
6203
|
+
/**
|
|
6204
|
+
* @description The request failed. The body carries the PlanVortex error code in `code`:
|
|
6205
|
+
*
|
|
6206
|
+
* | Code | Meaning |
|
|
6207
|
+
* | --- | --- |
|
|
6208
|
+
* | `1000` | Invalid `from_date`, or an unknown `sort` or `social_network` (`data.allowed` lists the valid values) |
|
|
6209
|
+
* | `1001` | Invalid `to_date` |
|
|
6210
|
+
* | `1003` | Range longer than 366 days |
|
|
6211
|
+
* | `2111` | Unknown `template` |
|
|
6212
|
+
* | `1101` | Invalid organization |
|
|
6213
|
+
* | `521` | Invalid client. The identifier is invalid or doesn't exist |
|
|
6214
|
+
*/
|
|
6215
|
+
400: {
|
|
6216
|
+
headers: {
|
|
6217
|
+
[name: string]: unknown;
|
|
6218
|
+
};
|
|
6219
|
+
content: {
|
|
6220
|
+
"application/json": components["schemas"]["Error"];
|
|
6221
|
+
};
|
|
6222
|
+
};
|
|
6223
|
+
/** @description Unhandled error by the server */
|
|
6224
|
+
500: {
|
|
6225
|
+
headers: {
|
|
6226
|
+
[name: string]: unknown;
|
|
6227
|
+
};
|
|
6228
|
+
content?: never;
|
|
6229
|
+
};
|
|
6230
|
+
};
|
|
6231
|
+
};
|
|
5942
6232
|
getClientRoles: {
|
|
5943
6233
|
parameters: {
|
|
5944
6234
|
query?: {
|
|
@@ -11673,6 +11963,35 @@ type AiPlanNotice = Schemas["AiPlansAiPlanNotice"];
|
|
|
11673
11963
|
type AiPlanCostEstimate = Schemas["AiPlansAiPlanCostEstimate"];
|
|
11674
11964
|
/** Lo que devuelve encolar un plan: el plan en `pending` y lo que se calculo que costaria. */
|
|
11675
11965
|
type AiPlanCreateResult = Schemas["AiPlansAiPlanCreateResponse"];
|
|
11966
|
+
/**
|
|
11967
|
+
* Lo que rindio UN plan con lo que publico.
|
|
11968
|
+
*
|
|
11969
|
+
* **Las medias solo cuentan las publicaciones medidas** (`publications.measured`): una programada,
|
|
11970
|
+
* una fallida o una recien publicada que nadie ha medido no bajan nada, simplemente no estan.
|
|
11971
|
+
*
|
|
11972
|
+
* `engagement_per_publication` es la cifra por la que se ordena, y **solo compite el plan con
|
|
11973
|
+
* `ranked: true`** —al menos 3 publicaciones medidas, o todas si publico menos—. `maturing: true`
|
|
11974
|
+
* dice que sus numeros todavia se mueven: comparar ese plan con uno del mes pasado es injusto con el
|
|
11975
|
+
* nuevo. Y una metrica ausente en `metrics` es que ninguna publicacion del plan la da, no un cero.
|
|
11976
|
+
*
|
|
11977
|
+
* **Ser el primero no es ser bueno**, y para eso esta `engagement_vs_average`: la media del plan entre
|
|
11978
|
+
* lo que habrian sacado tus publicaciones habituales con sus mismas redes (1 = como tu media, 2 = el
|
|
11979
|
+
* doble). El ranking sigue ordenando por `engagement_per_publication`, asi que el primero puede estar
|
|
11980
|
+
* por debajo de 1 —un plan de LinkedIn saca menos por publicacion que uno de Instagram y aun asi puede
|
|
11981
|
+
* doblar lo suyo—.
|
|
11982
|
+
*/
|
|
11983
|
+
type AiPlanResult = Schemas["AiPlanResult"];
|
|
11984
|
+
/**
|
|
11985
|
+
* El agregado de un conjunto de planes. `engagement_per_publication` es una media PONDERADA —todas
|
|
11986
|
+
* las interacciones entre todas las publicaciones medidas—, no la media de las medias.
|
|
11987
|
+
*/
|
|
11988
|
+
type AiPlanResultsGroup = Schemas["AiPlanResultsGroup"];
|
|
11989
|
+
/** El agregado de los planes de UNA plantilla: la respuesta a «¿que tipo de plan me funciona?». */
|
|
11990
|
+
type AiPlanResultsTemplateGroup = Schemas["AiPlansAiPlanResultsTemplateGroup"];
|
|
11991
|
+
/** Lo que devuelve {@link AiPlansResource.results}: el total, el desglose por plantilla y la pagina. */
|
|
11992
|
+
type AiPlanResults = Schemas["AiPlansAiPlanResults"];
|
|
11993
|
+
/** Por que se pueden ordenar los resultados. Cada criterio lleva su direccion natural. */
|
|
11994
|
+
type AiPlanResultsSort = NonNullable<NonNullable<Operations["getAiPlanResultsService"]["parameters"]["query"]>["sort"]>;
|
|
11676
11995
|
/** Una app de cliente: las credenciales con las que una integracion se autentica. */
|
|
11677
11996
|
type ClientApp = Schemas["AppsClientApp"];
|
|
11678
11997
|
/** Lo que se manda para crear o actualizar una app. Al actualizar, REEMPLAZA los cinco campos. */
|
|
@@ -12223,4 +12542,4 @@ interface PlanVortexWebhooksOptions {
|
|
|
12223
12542
|
*/
|
|
12224
12543
|
declare function planvortexWebhooks(options: PlanVortexWebhooksOptions): (request: WebhookRequestLike, response: WebhookResponseLike, next: (error?: unknown) => void) => void;
|
|
12225
12544
|
|
|
12226
|
-
export { type
|
|
12545
|
+
export { type PlanData as $, type Account as A, type ContactExtraData as B, type ConnectLink as C, type Dashboard as D, type EnableResult as E, type Contact as F, type ContactCreate as G, type ContactUpdate as H, type IntegrationProviderName as I, type IntegrationProvider as J, type Integration as K, type IntegrationConnectRequest as L, type MetricName as M, type IntegrationUpdate as N, type IntegrationPickerConfig as O, type Paginated as P, type MessageTemplate as Q, type Conversation as R, type SocialNetwork as S, type TopPublicationsResult as T, type ConversationTotals as U, type Message as V, type MessageInput as W, type Client as X, type Organization as Y, type AiSettings as Z, type ClientWithOrganizations as _, type ConnectResult as a, PlanVortexAuthenticationError as a$, type PlanUseData as a0, type ConnectToken as a1, type AiContext as a2, type SocialCredentialsInput as a3, type Product as a4, type ProductInput as a5, type ProductCatalog as a6, type ProductCatalogInput as a7, type PublicationInput as a8, type PublicationState as a9, type CommentChange as aA, type ContactChannel as aB, ContactError as aC, type DashboardAiPlanRef as aD, type DashboardPublicationRef as aE, type DashboardRange as aF, type EngagementBase as aG, FileError as aH, type FileFormat as aI, type FileProperties as aJ, type FileType as aK, IntegrationError as aL, type IntegrationErrorChange as aM, type MessageChange as aN, type MessageOptions as aO, type MessageType as aP, MessagingError as aQ, type MetricRow as aR, NO_ERROR_CODE as aS, type components as aT, type operations as aU, type paths as aV, type webhooks as aW, type OpenEnum as aX, OrganizationError as aY, PLANVORTEX_ERROR_RANGES as aZ, PlanLimitError as a_, type PublicationStats as aa, type PublicationStatsHistory as ab, type Upload as ac, AccountError as ad, type AccountMetricRow as ae, type AccountStateChange as af, type AccountWebhookChangeBase as ag, type AccountWithError as ah, type AiPlanCostEstimate as ai, AiPlanError as aj, type AiPlanNotice as ak, type AiPlanOptions as al, type AiPlanOptionsInput as am, type AiPlanResult as an, type AiPlanResultsGroup as ao, type AiPlanResultsTemplateGroup as ap, type AiPlanSource as aq, type AiPlanSourceImageInput as ar, type AiPlanSourceInput as as, type AiPlanSourceProduct as at, type AiPlanState as au, type ApiErrorBody as av, type AspectRatios as aw, AuthError as ax, type ClientPlan as ay, type CommentAuthor as az, type AccountMetrics as b, PlanVortexConfigError as b0, PlanVortexConnectionError as b1, PlanVortexError as b2, type PlanVortexErrorOptions as b3, type PlanVortexErrorRange as b4, type PlannerTemplateField as b5, type PlannerTemplateFieldType as b6, ProductError as b7, PublicationError as b8, type PublicationErrorDetail as b9, messageDirection as bA, messageFileIds as bB, messageFiles as bC, publication as bD, publicationId as bE, type HandleWebhookRequestOptions as bF, type PlanVortexWebhooksOptions as bG, type RawWebhookBody as bH, type VerifyWebhookSignatureOptions as bI, WEBHOOK_EVENTS as bJ, WEBHOOK_SIGNATURE_HEADERS as bK, WebhookBodyError as bL, type WebhookHeaders as bM, type WebhookRequestLike as bN, type WebhookResponseLike as bO, WebhookSignatureError as bP, handleWebhookRequest as bQ, isAccountStateChange as bR, isCommentChange as bS, isIntegrationErrorChange as bT, isMessageChange as bU, parseWebhookPayload as bV, planvortexWebhooks as bW, verifyWebhookSignature as bX, type PublicationMetrics as ba, type PublicationStatsPoint as bb, type PublicationType as bc, type PublicationsSummary as bd, type RssConfig as be, type SocialAuthorizationMethod as bf, type SocialCredentials as bg, type SocialIdentifier as bh, type SocialIdentifierInput as bi, type SocialLimitsMap as bj, TOKEN_ERROR_CODES as bk, type TopPublication as bl, type UnknownWebhookChange as bm, UserError as bn, type WebhookAlgorithm as bo, type WebhookChange as bp, type WebhookEvent as bq, type WithAccount as br, type WithPublication as bs, account as bt, accountId as bu, errorFamilyForCode as bv, isPlanVortexError as bw, isTokenError as bx, messageContact as by, messageContactId as bz, type PersistentMenu as c, type DashboardMetricsResult as d, type PublicationsSummaryResult as e, type PublicationsStatsResult as f, type PlanUse as g, type Publication as h, type AiPlanResultsSort as i, type PlannerTemplateName as j, type AiPlanCreateRequest as k, type AiPlanCreateResult as l, type AiPlan as m, type AiPlanResults as n, type ClientApp as o, type ClientAppInput as p, type SocialCapabilities as q, type CommentActions as r, type SocialLimits as s, type PublicationLimits as t, type AspectRatiosByNetwork as u, type PlannerTemplate as v, type CommentNetwork as w, type Comment as x, type CommentThread as y, type CommentReplyResult as z };
|
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.11.0";
|
|
8
8
|
|
|
9
9
|
// src/core/errors.ts
|
|
10
10
|
var PLANVORTEX_ERROR_RANGES = [
|
|
@@ -890,6 +890,48 @@ var AiPlansResource = class extends Resource {
|
|
|
890
890
|
options
|
|
891
891
|
);
|
|
892
892
|
}
|
|
893
|
+
/**
|
|
894
|
+
* Qué rindió cada plan con lo que publicó, el agregado por plantilla y el total: la respuesta a
|
|
895
|
+
* «¿qué plan funcionó mejor?». Pide `ai_plans:read` **y** `publication_stats:read`.
|
|
896
|
+
*
|
|
897
|
+
* Lo que sorprende:
|
|
898
|
+
*
|
|
899
|
+
* - **El rango filtra por la SEMANA del plan** (`week_start`), no por cuándo se creó: un plan
|
|
900
|
+
* creado hoy para la semana que viene todavía no ha publicado nada.
|
|
901
|
+
* - **Sólo salen los planes que han publicado algo.** Los archivados sí —archivar es sólo
|
|
902
|
+
* visibilidad—; los cancelados no.
|
|
903
|
+
* - **El orden por defecto es interacciones por publicación medida**, no el total: el total
|
|
904
|
+
* premia al plan de siete cuentas aunque cada post rinda la mitad. Y sólo compiten los planes
|
|
905
|
+
* con `ranked: true`; los demás van detrás.
|
|
906
|
+
* - **Cubre ESTA organización, no sus hijas**, al revés que el bloque `ai_plan_results` de
|
|
907
|
+
* {@link DashboardResource.summary}.
|
|
908
|
+
*
|
|
909
|
+
* No envuelve la respuesta en un `Paginated`: además de la página trae `totals` y `by_template`,
|
|
910
|
+
* que no dependen de ella.
|
|
911
|
+
*
|
|
912
|
+
* ```ts
|
|
913
|
+
* const { by_template, ai_plans } = await pv.aiPlans.results(clientId, orgId, {
|
|
914
|
+
* from_date: "2026-06-01T00:00:00Z",
|
|
915
|
+
* social_network: ["instagram"],
|
|
916
|
+
* });
|
|
917
|
+
* const mejor = ai_plans.find((plan) => plan.ranked);
|
|
918
|
+
* ```
|
|
919
|
+
*/
|
|
920
|
+
async results(idClient, idOrganization, options = {}) {
|
|
921
|
+
return this.httpGet(
|
|
922
|
+
`${this.path(idClient, idOrganization)}/results`,
|
|
923
|
+
{
|
|
924
|
+
from_date: options.from_date,
|
|
925
|
+
to_date: options.to_date,
|
|
926
|
+
sort: options.sort,
|
|
927
|
+
template: options.template,
|
|
928
|
+
social_network: options.social_network,
|
|
929
|
+
limit: options.limit,
|
|
930
|
+
offset: options.offset
|
|
931
|
+
},
|
|
932
|
+
options
|
|
933
|
+
);
|
|
934
|
+
}
|
|
893
935
|
/** Los planes de la organización, encadenando páginas. */
|
|
894
936
|
iterate(idClient, idOrganization, options = {}) {
|
|
895
937
|
return iteratePages(
|
|
@@ -1063,6 +1105,23 @@ var AppsResource = class extends Resource {
|
|
|
1063
1105
|
);
|
|
1064
1106
|
return response.secret;
|
|
1065
1107
|
}
|
|
1108
|
+
/**
|
|
1109
|
+
* Rota el `client_secret` y devuelve el nuevo. **Exige token de usuario** (512) y
|
|
1110
|
+
* `client_app:update`.
|
|
1111
|
+
*
|
|
1112
|
+
* **El secreto anterior deja de valer en cuanto esto contesta**, sin periodo de gracia: lo que
|
|
1113
|
+
* siga usándolo recibe `invalid_client` en su siguiente petición de token. Y **cambia también la
|
|
1114
|
+
* firma de los webhooks**, que es un HMAC con este mismo secreto: un receptor que la verifique
|
|
1115
|
+
* rechazará las entregas legítimas hasta que se actualice. Repártelo antes de rotar, no después.
|
|
1116
|
+
*/
|
|
1117
|
+
async rotateSecret(idClient, idApp, options = {}) {
|
|
1118
|
+
const response = await this.httpPost(
|
|
1119
|
+
`${this.one(idClient, idApp)}/secret`,
|
|
1120
|
+
void 0,
|
|
1121
|
+
options
|
|
1122
|
+
);
|
|
1123
|
+
return response.secret;
|
|
1124
|
+
}
|
|
1066
1125
|
path(idClient) {
|
|
1067
1126
|
return `/clients/${requireId(idClient, "idClient")}/apps`;
|
|
1068
1127
|
}
|