planvortex 0.17.0 → 0.18.1

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 CHANGED
@@ -105,7 +105,7 @@ for await (const publication of pv.publications.iterate(orgId, { state: ["ready"
105
105
  | `pv.catalog` | `socialNetworks`, `socialLimits`, `socialCapabilities`, `socialCommentActions`, `allowedAspectRatios`, `publicationLimits`, `allowedSocialPublications`, `allowedSocialMessages`, `plannerTemplates` — all cached in memory per client |
106
106
  | `pv.clients` | `list`, `iterate`, `get`, `update`, `updateAiSettings`, `withOrganizations`, `organizations`, `iterateOrganizations`, `createOrganization`, `updateOrganization`, `deleteOrganization` |
107
107
  | `pv.organizations` | `get`, `update`, `remove`, `children`, `iterateChildren`, `createChild`, `limits`, `use`, `createConnectToken`, `updateAiContext`, `updateSocialCredentials`, `deleteSocialCredentials` |
108
- | `pv.accounts` | `list`, `iterate`, `get`, `update`, `remove`, `metrics`, `metricList`, `destinations`, `destination`, `getPersistentMenu`, `setPersistentMenu`, `connectLinks`, `connect`, `enable` |
108
+ | `pv.accounts` | `list`, `iterate`, `get`, `update`, `remove`, `metrics`, `metricList`, `destinations`, `destination`, `publishSettings`, `getPersistentMenu`, `setPersistentMenu`, `connectLinks`, `connect`, `enable` |
109
109
  | `pv.uploads` | `create`, `list`, `iterate`, `get`, `update`, `remove`, `import` |
110
110
  | `pv.publications` | `create`, `get`, `list`, `iterate`, `listByAccount`, `update`, `updateByAccount`, `remove`, `retry`, `metrics`, `stats`, `listOnNetwork` |
111
111
  | `pv.comments` | `list`, `iterate`, `unreadCount`, `thread`, `threadByAccount`, `replies`, `reply`, `update`, `markRead`, `remove`, `actions` |
@@ -426,6 +426,7 @@ if you would rather branch on `error.family`.
426
426
  | 2000-2099 | Products | `ProductError` |
427
427
  | 2100-2199 | AI plans | `AiPlanError` |
428
428
  | 2200-2299 | Integrations | `IntegrationError` |
429
+ | 2500-2599 | Publication fields: visibility, made for kids, TikTok settings (only 2508 is thrown) | `PublicationError` |
429
430
  | 2600-2699 | Comments: an account with no inbox (a LinkedIn personal profile) | `PublicationError` |
430
431
 
431
432
  A code outside every range — the catalogue grows — arrives as the base `PlanVortexError` with its
@@ -476,6 +477,17 @@ JSON: the bytes differ and the signature never matches. Either let `planvortexWe
476
477
  stream, or put `express.raw({ type: "application/json" })` in front of that one route. A global
477
478
  `express.json()` is what breaks it, and it breaks it silently.
478
479
 
480
+ ## Guides
481
+
482
+ Longer write-ups on planvortex.com:
483
+
484
+ - [Publishing to social media from Node.js without building one integration per network](https://planvortex.com/en/resources/publish-social-media-node-js)
485
+ - [Meta access token expired? Why it lasts 60 days and how to refresh it](https://planvortex.com/en/resources/meta-access-token-expiry)
486
+ - [Character limits across social APIs: .length lies, and it lies both ways](https://planvortex.com/en/resources/social-media-character-limits)
487
+ - [How much does it cost to post on X with the API in 2026](https://planvortex.com/en/resources/x-api-pricing-2026)
488
+ - [Is the LinkedIn API free? Pricing and posting access in 2026](https://planvortex.com/en/resources/linkedin-api-pricing-access)
489
+ - [All articles](https://planvortex.com/en/resources)
490
+
479
491
  ## Development
480
492
 
481
493
  ```bash
@@ -32,6 +32,10 @@ var PLANVORTEX_ERROR_RANGES = [
32
32
  //Los COMENTARIOS siguen aquí porque sus 945-948 se llenaron, y van con ellos a `publication`:
33
33
  //el 2600 (esta cuenta no tiene bandeja, un perfil personal de LinkedIn) es la versión por
34
34
  //cuenta del 945, y separarlos daría dos clases para el mismo «aquí no hay comentarios».
35
+ //Los campos de publicación que no cabían en los 9xx (2500-2507: visibilidad, niños, y lo que
36
+ //exige la auditoría de TikTok). Casi todos viajan en `publication_errors`, pero el 2508 se
37
+ //LANZA: `accounts.publishSettings()` en una red que no los tiene.
38
+ { from: 2500, to: 2599, family: "publication" },
35
39
  { from: 2600, to: 2699, family: "publication" }
36
40
  ];
37
41
  var NO_ERROR_CODE = 0;
@@ -153,5 +157,5 @@ function isTokenError(error) {
153
157
  }
154
158
 
155
159
  export { AccountError, AiPlanError, AuthError, ContactError, FileError, IntegrationError, MessagingError, NO_ERROR_CODE, OrganizationError, PLANVORTEX_ERROR_RANGES, PlanLimitError, PlanVortexAuthenticationError, PlanVortexConfigError, PlanVortexConnectionError, PlanVortexError, ProductError, PublicationError, TOKEN_ERROR_CODES, UserError, createErrorFromResponse, errorFamilyForCode, isPlanVortexError, isTokenError };
156
- //# sourceMappingURL=chunk-CXCJAVXQ.js.map
157
- //# sourceMappingURL=chunk-CXCJAVXQ.js.map
160
+ //# sourceMappingURL=chunk-ZHS7FY3T.js.map
161
+ //# sourceMappingURL=chunk-ZHS7FY3T.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/errors.ts"],"names":[],"mappings":";AAuBO,IAAM,uBAAA,GAA2D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMpE,EAAE,IAAA,EAAM,GAAA,EAAK,EAAA,EAAI,GAAA,EAAK,QAAQ,MAAA,EAAO;AAAA,EACrC,EAAE,IAAA,EAAM,GAAA,EAAK,EAAA,EAAI,GAAA,EAAK,QAAQ,MAAA,EAAO;AAAA;AAAA;AAAA,EAGrC,EAAE,IAAA,EAAM,GAAA,EAAK,EAAA,EAAI,GAAA,EAAK,QAAQ,SAAA,EAAU;AAAA,EACxC,EAAE,IAAA,EAAM,GAAA,EAAK,EAAA,EAAI,GAAA,EAAK,QAAQ,MAAA,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMrC,EAAE,IAAA,EAAM,GAAA,EAAK,EAAA,EAAI,GAAA,EAAK,QAAQ,aAAA,EAAc;AAAA,EAC5C,EAAE,IAAA,EAAM,GAAA,EAAM,EAAA,EAAI,IAAA,EAAM,QAAQ,SAAA,EAAU;AAAA,EAC1C,EAAE,IAAA,EAAM,IAAA,EAAM,EAAA,EAAI,IAAA,EAAM,QAAQ,cAAA,EAAe;AAAA,EAC/C,EAAE,IAAA,EAAM,IAAA,EAAM,EAAA,EAAI,IAAA,EAAM,QAAQ,MA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AM,IAAA,KAAS,IAAA,GAC1C,KAAA,CAAM,IAAA,GACP,EAAE,IAAA,EAAM,MAAM,IAAA;AAAK,GAChC,CAAA;AACL;AAGO,SAAS,kBAAkB,KAAA,EAA0C;AACxE,EAAA,OAAO,KAAA,YAAiB,eAAA;AAC5B;AAOO,SAAS,aAAa,KAAA,EAAyB;AAClD,EAAA,OAAO,kBAAkB,KAAK,CAAA,IAAK,iBAAA,CAAkB,QAAA,CAAS,MAAM,IAAI,CAAA;AAC5E","file":"chunk-ZHS7FY3T.js","sourcesContent":["/**\n * El catálogo de errores de PlanVortex, por rangos, y las clases que salen de él.\n *\n * LA REGLA, y no es negociable: **los errores se clasifican por `body.code`, nunca por el status\n * HTTP.** Todo error de dominio viaja con un 400 — un token caducado, una cuenta desconectada, el\n * cupo del plan agotado y un texto demasiado largo son los cuatro un 400. Sólo el 520 (permisos)\n * sale 401 y un fallo inesperado sale 500. Un `if (response.status === 401) refreshToken()` sería\n * un bug silencioso: los códigos de token, 501 y 522, viajan dentro de un 400.\n *\n * El catálogo del servidor crece cada mes, así que un código fuera de estos rangos NO es un error\n * del cliente: cae en la clase base con su `code` y su `message` intactos. Nunca se traga y nunca\n * se renombra.\n */\n\nexport type PlanVortexErrorRange = {\n /** Primer código del rango, incluido */\n from: number;\n /** Último código del rango, incluido */\n to: number;\n /** Qué familia de problemas es */\n family: string;\n};\n\nexport const PLANVORTEX_ERROR_RANGES: readonly PlanVortexErrorRange[] = [\n //Hasta 548, no 544: la API publica se abrio a todos los planes y trajo dos codigos nuevos\n //—545 (ritmo por plan, que sale 429) y 546 (correo sin verificar al crear una app)—, y las\n //apps dos mas —547 (el identificador de una app no se cambia) y 548 (fallo al rotar el\n //secreto, que es justo lo que estreno `apps.rotateSecret`)—. Y hasta 554 desde que el selector\n //de cuentas puede ponerlo el integrador (549-554: el modo y su sesion de conexion).\n { from: 500, to: 554, family: \"auth\" },\n { from: 601, to: 612, family: \"user\" },\n //716: la sesion de Bluesky la esta renovando otro proceso. Es temporal, y fuera de familia no\n //habia forma de saber que la respuesta es reintentar.\n { from: 700, to: 716, family: \"account\" },\n { from: 800, to: 810, family: \"file\" },\n //El techo sube con el catalogo del servidor, y subir tarde no da un error: da un consejo\n //equivocado. Los codigos de Bluesky, Discord, Telegram y Threads (961-977) y los dos frenos\n //de ritmo de la fase de publicaciones ilimitadas (978, 979) nacieron por encima de 960 y\n //caian fuera de toda familia. Slack estreno el 980-986, que es el mismo caso otra vez, y\n //Pinterest el 987-996 — la tercera vez.\n { from: 900, to: 996, family: \"publication\" },\n { from: 1000, to: 1003, family: \"general\" },\n { from: 1100, to: 1111, family: \"organization\" },\n { from: 1200, to: 1207, family: \"role\" },\n //1308 es el tope de APPS del plan, que nacio al quitar el candado de precio de la API.\n { from: 1300, to: 1308, family: \"plan_limit\" },\n { from: 1400, to: 1408, family: \"plan_limit\" },\n { from: 1500, to: 1512, family: \"messaging\" },\n { from: 1600, to: 1601, family: \"contact\" },\n { from: 1900, to: 1906, family: \"payment\" },\n { from: 2000, to: 2099, family: \"product\" },\n { from: 2100, to: 2199, family: \"ai_plan\" },\n { from: 2200, to: 2299, family: \"integration\" },\n //Los COMENTARIOS siguen aquí porque sus 945-948 se llenaron, y van con ellos a `publication`:\n //el 2600 (esta cuenta no tiene bandeja, un perfil personal de LinkedIn) es la versión por\n //cuenta del 945, y separarlos daría dos clases para el mismo «aquí no hay comentarios».\n //Los campos de publicación que no cabían en los 9xx (2500-2507: visibilidad, niños, y lo que\n //exige la auditoría de TikTok). Casi todos viajan en `publication_errors`, pero el 2508 se\n //LANZA: `accounts.publishSettings()` en una red que no los tiene.\n { from: 2500, to: 2599, family: \"publication\" },\n { from: 2600, to: 2699, family: \"publication\" },\n] as const;\n\n/**\n * El `code` que lleva un error que **no** trae código del servidor: un fallo de red, un timeout, un\n * 502 de un proxy con cuerpo HTML, o el propio constructor quejándose de la configuración.\n *\n * El servidor no emite nunca el 0, así que sirve de centinela sin pisar el catálogo. Cuál de esos\n * casos es se distingue por `family`: `connection`, `http`, `oauth`, `config` o `webhook`.\n */\nexport const NO_ERROR_CODE = 0;\n\n/**\n * Los dos códigos que significan \"tu token ya no sirve\". Los dos llegan **dentro de un 400**, que es\n * justo por lo que existe esta constante: quien mire el status no los va a encontrar.\n *\n * El 520 (permisos) NO está aquí a propósito: sale 401, pero pedir un token nuevo no lo arregla — a\n * la app le faltan permisos, y con un token recién emitido le seguirán faltando.\n */\nexport const TOKEN_ERROR_CODES: readonly number[] = [501, 522];\n\n/** Opciones de construcción de un error. Todas opcionales: un error siempre se puede construir. */\nexport interface PlanVortexErrorOptions {\n /** El `data` del cuerpo — lo que el servidor adjuntó con `.withData({...})`. `{}` si no vino nada. */\n data?: Record<string, unknown>;\n /** Status HTTP. `undefined` cuando la petición no llegó a tener respuesta. */\n status?: number;\n /** `x-request-id` de la respuesta, si el despliegue lo pone delante. */\n requestId?: string;\n /** Segundos de la cabecera `Retry-After`, cuando la hay. */\n retryAfter?: number;\n /** El error original (un `TypeError` de `fetch`, por ejemplo). */\n cause?: unknown;\n /**\n * Familia, sólo para los errores que NO salen del catálogo: `connection`, `http`, `oauth`,\n * `config` y `webhook`. Los de dominio la deducen de su `code` y no la pasan nunca.\n */\n family?: string;\n}\n\n/**\n * La base de todo lo que lanza esta librería.\n *\n * Un `catch (e) { if (e instanceof PlanVortexError) }` los coge todos: los de dominio, los de red y\n * los de configuración. Para afinar están las subclases y el `code`.\n */\nexport class PlanVortexError extends Error {\n /** El `code` del cuerpo, tal cual. {@link NO_ERROR_CODE} si el error no viene del catálogo. */\n readonly code: number;\n /** La familia del rango: `auth`, `publication`, `plan_limit`... Ver {@link PLANVORTEX_ERROR_RANGES}. */\n readonly family: string;\n /** El `data` del cuerpo. */\n readonly data: Record<string, unknown>;\n /** Status HTTP, o `undefined` si nunca hubo respuesta. */\n readonly status: number | undefined;\n /** `x-request-id`, si el despliegue lo pone. Hoy el servidor no lo emite; un proxy delante sí. */\n readonly requestId: string | undefined;\n /** Segundos que pidió esperar la cabecera `Retry-After`, si llegó. */\n readonly retryAfter: number | undefined;\n\n constructor(code: number, message: string, options: PlanVortexErrorOptions = {}) {\n super(message, options.cause === undefined ? undefined : { cause: options.cause });\n this.name = new.target.name;\n this.code = code;\n this.family = options.family ?? errorFamilyForCode(code) ?? \"unknown\";\n this.data = options.data ?? {};\n this.status = options.status;\n this.requestId = options.requestId;\n this.retryAfter = options.retryAfter;\n }\n}\n\n/** 500-554 — tokens, apps de cliente, permisos, sesiones de conexion. Incluye el 501 y el 522, los de token caducado. */\nexport class AuthError extends PlanVortexError {}\n/** 601-612 — el usuario final. */\nexport class UserError extends PlanVortexError {}\n/** 700-716 — cuentas sociales: desconectada, sin permisos en la red, sin refrescar. */\nexport class AccountError extends PlanVortexError {}\n/** 800-810 — ficheros: formato no admitido, demasiado grande, conversión fallida. */\nexport class FileError extends PlanVortexError {}\n/** 900-996 — publicaciones, incluidos los límites por red (caracteres, imágenes, duración), los\n * dos frenos de ritmo —978 (demasiado rápido en esta cuenta) y 979 (tope diario de esa red)—, los\n * de Slack (980-986), que empiezan por el más común: 980, la app no está en el canal, y los de\n * Pinterest (987-996), que empiezan igual: 987, la publicación no dice en qué tablero va. Y uno\n * de ellos no es un fallo: el 991 es Pinterest frenando a la aplicación, sale 429 con\n * `Retry-After` y la respuesta es esperar. */\nexport class PublicationError extends PlanVortexError {}\n/** 1100-1111 — organizaciones, y el token temporal atado a una sola de ellas (1101). */\nexport class OrganizationError extends PlanVortexError {}\n/**\n * 1300-1308 y 1400-1408 — el cupo del plan, del cliente o de la organización.\n *\n * Es el error que un integrador **sí** quiere distinguir: no se arregla reintentando, se arregla\n * cambiando de plan. Por eso los dos rangos comparten clase.\n */\nexport class PlanLimitError extends PlanVortexError {}\n/** 1500-1512 — conversaciones, mensajes y plantillas. Exige plan de pago. */\nexport class MessagingError extends PlanVortexError {}\n/** 1600-1601 — contactos. */\nexport class ContactError extends PlanVortexError {}\n/** 2000-2099 — catálogos y productos (sólo Facebook e Instagram). */\nexport class ProductError extends PlanVortexError {}\n/** 2100-2199 — planes de publicaciones generados con IA. */\nexport class AiPlanError extends PlanVortexError {}\n/** 2200-2299 — integraciones: Google Drive, RSS. */\nexport class IntegrationError extends PlanVortexError {}\n\n/**\n * La petición no llegó a tener respuesta: DNS, conexión rechazada, socket cortado o timeout.\n *\n * No lleva código del catálogo porque el servidor nunca llegó a opinar.\n */\nexport class PlanVortexConnectionError extends PlanVortexError {\n /** `true` si lo que se agotó fue nuestro propio timeout, no la red. */\n readonly timeout: boolean;\n\n constructor(message: string, options: PlanVortexErrorOptions & { timeout?: boolean } = {}) {\n super(NO_ERROR_CODE, message, { ...options, family: \"connection\" });\n this.timeout = options.timeout ?? false;\n }\n}\n\n/**\n * `POST /oauth/token` rechazó las credenciales.\n *\n * Es el ÚNICO sitio del API con forma de error distinta: `{error, error_description}` de OAuth2, no\n * el `{code, message, data}` de todo lo demás. Y por eso el `code` es {@link NO_ERROR_CODE}: el\n * servidor tiene códigos para esto (538-541) pero **no los manda en el cuerpo**, así que ponerlos\n * aquí sería inventarse algo que nadie dijo. Lo que sí viaja es `oauthError`.\n */\nexport class PlanVortexAuthenticationError extends PlanVortexError {\n /** `invalid_client`, `invalid_request`, `unsupported_grant_type`, `slow_down` o `server_error`. */\n readonly oauthError: string;\n\n constructor(oauthError: string, description: string, options: PlanVortexErrorOptions = {}) {\n super(NO_ERROR_CODE, description, { ...options, family: \"oauth\" });\n this.oauthError = oauthError;\n }\n}\n\n/**\n * La librería está mal configurada y no ha llegado a salir de casa: sin credenciales, o instanciada\n * en un navegador (§ trampa 9 del roadmap).\n */\nexport class PlanVortexConfigError extends PlanVortexError {\n constructor(message: string) {\n super(NO_ERROR_CODE, message, { family: \"config\" });\n }\n}\n\n/** La familia a la que pertenece un código, o `undefined` si cae fuera del catálogo conocido. */\nexport function errorFamilyForCode(code: number): string | undefined {\n return PLANVORTEX_ERROR_RANGES.find((range) => code >= range.from && code <= range.to)?.family;\n}\n\n/**\n * Familia -> clase. Las que faltan —`general`, `role`, `payment` y cualquier rango nuevo— caen a\n * propósito en la clase base: existen en el servidor pero no son superficie de integración, y darles\n * clase propia sería prometer un `instanceof` que luego habría que mantener.\n */\nconst FAMILY_CLASSES: Record<string, typeof PlanVortexError> = {\n auth: AuthError,\n user: UserError,\n account: AccountError,\n file: FileError,\n publication: PublicationError,\n organization: OrganizationError,\n plan_limit: PlanLimitError,\n messaging: MessagingError,\n contact: ContactError,\n product: ProductError,\n ai_plan: AiPlanError,\n integration: IntegrationError,\n};\n\n/** El cuerpo de error del API: `{code, message, data}`. */\nexport interface ApiErrorBody {\n code: number;\n message?: string;\n data?: Record<string, unknown>;\n}\n\nfunction isApiErrorBody(body: unknown): body is ApiErrorBody {\n return typeof body === \"object\" && body !== null && typeof (body as ApiErrorBody).code === \"number\";\n}\n\n/**\n * Convierte una respuesta de error en la clase que le toca.\n *\n * Un cuerpo sin `code` —un 502 de un proxy, la página HTML de un balanceador— no es un error de\n * dominio: sale como clase base con `family: \"http\"` y el cuerpo entero en `data`, que es además lo\n * que necesita `auth.ts` para reconocer el `{error, error_description}` de OAuth2.\n */\nexport function createErrorFromResponse(input: {\n body: unknown;\n status: number;\n requestId?: string | undefined;\n retryAfter?: number | undefined;\n}): PlanVortexError {\n const options: PlanVortexErrorOptions = {\n status: input.status,\n ...(input.requestId === undefined ? {} : { requestId: input.requestId }),\n ...(input.retryAfter === undefined ? {} : { retryAfter: input.retryAfter }),\n };\n\n if (isApiErrorBody(input.body)) {\n const family = errorFamilyForCode(input.body.code);\n const ErrorClass = (family === undefined ? undefined : FAMILY_CLASSES[family]) ?? PlanVortexError;\n return new ErrorClass(input.body.code, input.body.message ?? \"PlanVortex error\", {\n ...options,\n data: input.body.data ?? {},\n });\n }\n\n return new PlanVortexError(NO_ERROR_CODE, `HTTP ${input.status}`, {\n ...options,\n family: \"http\",\n data:\n typeof input.body === \"object\" && input.body !== null\n ? (input.body as Record<string, unknown>)\n : { body: input.body },\n });\n}\n\n/** ¿Es un error de esta librería? Útil en un `catch` donde no apetece importar la clase. */\nexport function isPlanVortexError(error: unknown): error is PlanVortexError {\n return error instanceof PlanVortexError;\n}\n\n/**\n * ¿Dice este error que el token ya no sirve? (los códigos 501 y 522, los dos dentro de un 400).\n *\n * Es lo que dispara el único reintento con token nuevo del cliente.\n */\nexport function isTokenError(error: unknown): boolean {\n return isPlanVortexError(error) && TOKEN_ERROR_CODES.includes(error.code);\n}\n"]}
@@ -1253,6 +1253,37 @@ interface paths {
1253
1253
  patch?: never;
1254
1254
  trace?: never;
1255
1255
  };
1256
+ "/organizations/{id_organization}/accounts/{id_account}/publish_settings": {
1257
+ parameters: {
1258
+ query?: never;
1259
+ header?: never;
1260
+ path?: never;
1261
+ cookie?: never;
1262
+ };
1263
+ /**
1264
+ * Read what this account allows when publishing
1265
+ * @description What the network says, **right now**, about publishing on this account. Today only TikTok: the networks that answer `publish_settings: true` in `GET /social_capabilities`. Anywhere else this answers error 2508.
1266
+ *
1267
+ * TikTok's content sharing guidelines ask any app that posts to TikTok to show the user, before posting:
1268
+ *
1269
+ * - which account the post goes to (`creator.nickname`);
1270
+ * - a privacy choice limited to `visibility_options`, with **no default**;
1271
+ * - the interactions the creator switched off in the app (`interactions.*.disabled`), greyed out;
1272
+ * - and to check the video length against `max_video_duration_sec`.
1273
+ *
1274
+ * Read it every time your compose screen opens: an account can go from public to private, or reach its daily limit, between one post and the next. `can_post: false` means TikTok will not take a post from this account now (`reason` carries its code): tell the user to try later instead of sending it.
1275
+ *
1276
+ * If TikTok does not answer, this is error 919 with TikTok's detail in `data`, never an empty list: an empty `visibility_options` would read as "this account cannot post at all".
1277
+ */
1278
+ get: operations["getAccountPublishSettings"];
1279
+ put?: never;
1280
+ post?: never;
1281
+ delete?: never;
1282
+ options?: never;
1283
+ head?: never;
1284
+ patch?: never;
1285
+ trace?: never;
1286
+ };
1256
1287
  "/organizations/{id_organization}/accounts/{id_account}/publish/{id_publication}": {
1257
1288
  parameters: {
1258
1289
  query?: never;
@@ -2560,6 +2591,8 @@ interface paths {
2560
2591
  *
2561
2592
  * **Three of the keys are about publishing, not about reading.** `destinations` says the network publishes into places inside the account and every publication has to name one — a Pinterest board, read with `GET /organizations/{id_organization}/accounts/{id_account}/destinations`. `link` says a publication carries a destination link of its own, separate from its text. Both are `false` everywhere but `pinterest` today. `reply_control` says a publication can choose who can reply to it, and is `true` only on `threads`. The three are the reason to ask this matrix instead of keeping a list of your own: a composer with its own copy of which network has which field is exactly what drifted with the character limits.
2562
2593
  *
2594
+ * **Four more are what TikTok's content sharing guidelines ask a composer to show**, and are `true` only on `tiktok` today: `visibility` (on TikTok, with no default), `interactions`, `commercial_content`, and `publish_settings`, which says the options each account allows must be read from `GET /organizations/{id_organization}/accounts/{id_account}/publish_settings` instead of a fixed list.
2595
+ *
2563
2596
  * 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.
2564
2597
  *
2565
2598
  * Only needs authentication.
@@ -3823,8 +3856,12 @@ interface components {
3823
3856
  /** @description The coarse gates of one network */
3824
3857
  CommentsSocialCapabilities: {
3825
3858
  comments: boolean;
3859
+ /** @description The publication can declare that it is **commercial content** (`commercial_content`: your brand, branded content). On a network that answers `false` the field is deleted on save, so do not offer it. Today only `tiktok`. */
3860
+ commercial_content: boolean;
3826
3861
  /** @description The network publishes into **places inside the account**, and every publication has to name one: a Pinterest board. When this is `true`, read `GET /organizations/{id_organization}/accounts/{id_account}/destinations` and send one back in `destination` — a publication created without it lands in state `withErrors` with `publication_errors[].code = 987`. Today only `pinterest`. */
3827
3862
  destinations: boolean;
3863
+ /** @description The publication can say **what the audience can do** with it (`interactions`: comment, Duet, Stitch). On a network that answers `false` the field is deleted on save, so do not offer it. Today only `tiktok`. */
3864
+ interactions: boolean;
3828
3865
  /** @description The publication carries a **destination link of its own** (`link`), separate from its text: where a pin takes whoever clicks it. On a network that answers `false` the field is deleted on save, so do not offer it. Today only `pinterest`. */
3829
3866
  link: boolean;
3830
3867
  /** @description The publication can say whether it is **made for kids** (`made_for_kids`, COPPA). On a network that answers `false` the field is deleted on save, so do not offer it. Today only `youtube`. */
@@ -3833,9 +3870,11 @@ interface components {
3833
3870
  persistent_menu: boolean;
3834
3871
  products: boolean;
3835
3872
  publications: boolean;
3873
+ /** @description What each **account** allows when publishing is read from the network: `GET /organizations/{id_organization}/accounts/{id_account}/publish_settings` (privacy options, interactions the creator switched off, longest video, whether it can post now). Offer the `visibility` values from there, not a fixed list. Today only `tiktok`. */
3874
+ publish_settings: boolean;
3836
3875
  /** @description The publication can say **who can reply** to it (`reply_control`): anyone, the account's followers, the profiles it follows or the profiles mentioned in the text. It is set when the publication goes out and cannot be changed afterwards. On a network that answers `false` the field is deleted on save, so do not offer it. Today only `threads`. */
3837
3876
  reply_control: boolean;
3838
- /** @description The publication can say **who can see it** when it goes out (`visibility`): public, unlisted or private. On a network that answers `false` the field is deleted on save, so do not offer it. Today only `youtube`. */
3877
+ /** @description The publication can say **who can see it** when it goes out (`visibility`). On a network that answers `false` the field is deleted on save, so do not offer it. Today `youtube` (public, unlisted, private) and `tiktok` (public, friends, followers, private; which ones each account allows comes from `publish_settings`). */
3839
3878
  visibility: boolean;
3840
3879
  webhooks: boolean;
3841
3880
  };
@@ -4197,7 +4236,7 @@ interface components {
4197
4236
  * The catalogue grows with the product, so treat an unknown `code` as a generic failure instead of rejecting it.
4198
4237
  */
4199
4238
  Error: {
4200
- /** @description PlanVortex error code. Ranges: 500-554 auth, tokens, client apps and connect sessions · 601-612 user · 700-716 social accounts · 800-810 files · 900-996 publications · 1000-1003 general · 1100-1111 organizations · 1200-1207 roles · 1300-1308 client plan · 1400-1408 organization plan · 1500-1512 messaging · 1600-1601 contacts · 1900-1906 payments · 2000-2099 products · 2100-2199 AI plans · 2200-2299 integrations · 2600-2699 comments, the ones that no longer fit in 945-948. */
4239
+ /** @description PlanVortex error code. Ranges: 500-554 auth, tokens, client apps and connect sessions · 601-612 user · 700-716 social accounts · 800-810 files · 900-996 publications · 1000-1003 general · 1100-1111 organizations · 1200-1207 roles · 1300-1308 client plan · 1400-1408 organization plan · 1500-1512 messaging · 1600-1601 contacts · 1900-1906 payments · 2000-2099 products · 2100-2199 AI plans · 2200-2299 integrations · 2500-2599 publication fields, the ones that no longer fit in 900-996 (visibility, made for kids, TikTok's interactions and commercial content) · 2600-2699 comments, the ones that no longer fit in 945-948. */
4201
4240
  code: number;
4202
4241
  /** @description Extra context attached to the error, when there is any. */
4203
4242
  data?: {
@@ -4756,6 +4795,12 @@ interface components {
4756
4795
  Publication: {
4757
4796
  _id: string;
4758
4797
  ai_generated?: components["schemas"]["PublicationAiGenerated"];
4798
+ /**
4799
+ * @description Whether the publication is **commercial content** (`your_brand`, `branded_content`), on the networks that answer `commercial_content: true` in `GET /social_capabilities` (today `tiktok`). Absent means it is not.
4800
+ *
4801
+ * **On every other network the field is deleted on save**, like `reply_control`.
4802
+ */
4803
+ commercial_content?: components["schemas"]["PublicationCommercialContent"];
4759
4804
  /** Format: date-time */
4760
4805
  creation_date: string;
4761
4806
  /** @description Where inside the account this publication goes. Only present on the networks that answer `destinations: true` in `GET /social_capabilities`. */
@@ -4786,6 +4831,12 @@ interface components {
4786
4831
  /** @description The integration this publication came from — an RSS feed, for instance. Set when it is created and never changed afterwards. */
4787
4832
  id_integration?: string;
4788
4833
  id_organization: string;
4834
+ /**
4835
+ * @description **What the audience can do with the publication** (comment, Duet, Stitch), on the networks that answer `interactions: true` in `GET /social_capabilities` (today `tiktok`). `true` allows it; a missing key is the network's default (allowed).
4836
+ *
4837
+ * **On every other network the field is deleted on save**, like `reply_control`.
4838
+ */
4839
+ interactions?: components["schemas"]["PublicationInteractions"];
4789
4840
  /**
4790
4841
  * @description **The destination link**: where the publication takes whoever clicks it. Not to be confused with `url`, which is the link to the publication *on the network* and only exists once it is published.
4791
4842
  *
@@ -4866,12 +4917,14 @@ interface components {
4866
4917
  /** @description Link to the publication on the network, when there is one. A **private** Telegram channel has no public URL, so it comes back empty even though the post went out. */
4867
4918
  url?: string;
4868
4919
  /**
4869
- * @description **Who can see the publication** when it goes out, on the networks that answer `visibility: true` in `GET /social_capabilities` (today `youtube`). Absent means `public`. It is set when the publication goes out.
4920
+ * @description **Who can see the publication** when it goes out, on the networks that answer `visibility: true` in `GET /social_capabilities` (today `youtube` and `tiktok`). Absent means `public`. It is set when the publication goes out.
4921
+ *
4922
+ * `unlisted` exists only on YouTube; `friends` and `followers` only on TikTok.
4870
4923
  *
4871
4924
  * **On every other network the field is deleted on save**, like `reply_control`.
4872
4925
  * @enum {string}
4873
4926
  */
4874
- visibility?: "public" | "unlisted" | "private";
4927
+ visibility?: "public" | "unlisted" | "friends" | "followers" | "private";
4875
4928
  };
4876
4929
  /**
4877
4930
  * @description Which part of a publication was generated by AI. **Absent means nothing was.**
@@ -4884,6 +4937,13 @@ interface components {
4884
4937
  /** @description The text was written by the AI planner. Set when the draft is created and never changed afterwards, not even if the text is rewritten: it says where the text came from, not who reviewed it. */
4885
4938
  text: boolean;
4886
4939
  };
4940
+ /** @description Whether a publication is commercial content. Both `false` is the same as omitting it. */
4941
+ PublicationCommercialContent: {
4942
+ /** @description It is a paid partnership promoting a third party. TikTok labels it "Paid partnership", and it cannot be private. */
4943
+ branded_content?: boolean;
4944
+ /** @description It promotes the creator or their own business. TikTok labels it "Promotional content". */
4945
+ your_brand?: boolean;
4946
+ };
4887
4947
  /**
4888
4948
  * @description **Where inside the account** a publication goes, on the networks where choosing the account is not yet choosing the destination. Today that is `pinterest` alone, where it is the board the pin is saved to.
4889
4949
  *
@@ -4905,6 +4965,15 @@ interface components {
4905
4965
  /** @description The section's label, for display. Decides nothing. */
4906
4966
  section_name?: string;
4907
4967
  };
4968
+ /** @description What the audience can do with a publication. `true` allows it; a missing key is the network's default. */
4969
+ PublicationInteractions: {
4970
+ /** @description The audience can comment. */
4971
+ comments?: boolean;
4972
+ /** @description The audience can make a Duet with the video. Ignored on a photo post. */
4973
+ duet?: boolean;
4974
+ /** @description The audience can make a Stitch with the video. Ignored on a photo post. */
4975
+ stitch?: boolean;
4976
+ };
4908
4977
  /**
4909
4978
  * @description Present only while the network is still **processing** what was sent, and PlanVortex is waiting to publish it. Today that happens on Instagram alone, when Meta takes longer than the ~30 seconds the request waits to process the media. In practice, that means videos.
4910
4979
  *
@@ -4950,6 +5019,16 @@ interface components {
4950
5019
  };
4951
5020
  /** @description Body accepted when creating or updating a publication. Only these properties are read; anything else in the payload is ignored. */
4952
5021
  PublicationsPublicationInput: {
5022
+ /**
5023
+ * @description Whether the publication is **commercial content**. Only on the networks that answer `commercial_content: true` in `GET /social_capabilities` (today `tiktok`), and **deleted** on every other one. Absent, or both `false`, means it is not.
5024
+ *
5025
+ * TikTok's guidelines ask for a disclosure switch that is **off by default** and, when it is on, for at least one of the two boxes before the post can go out. Send the object only when the user switched it on.
5026
+ *
5027
+ * A paid partnership (`branded_content: true`) **cannot be private**: with `visibility` `private` or `followers` the publication is created in state `withErrors` with `publication_errors[].code = 2504`. Any other key, or a value that is not a JSON boolean, is code 2503.
5028
+ *
5029
+ * On an update: omit it to keep what was there, send `null` or `""` to remove it.
5030
+ */
5031
+ commercial_content?: components["schemas"]["PublicationCommercialContent"];
4953
5032
  /**
4954
5033
  * @description Where inside the account the publication goes. **Required on the networks that answer `destinations: true` in `GET /social_capabilities`** — today `pinterest`, where it is the board — and **deleted** on every other one.
4955
5034
  *
@@ -4966,6 +5045,18 @@ interface components {
4966
5045
  * **On Pinterest a pin is an image or a video, never text alone** (code 922 with neither), and it is of one kind only: two to five images make a carousel — outside that range, code 990 — images and videos are not mixed and there is no more than one video (code 916). The weight ceilings are two orders of magnitude apart, so `max_file_size_mb.pinterest` is the **image** one (~20 MB) while a video is allowed far more; over either, code 996 with `data.max_mb`.
4967
5046
  */
4968
5047
  files?: string[];
5048
+ /**
5049
+ * @description **What the audience can do with the publication**: comment and, on a video, Duet and Stitch. Only on the networks that answer `interactions: true` in `GET /social_capabilities` (today `tiktok`), and **deleted** on every other one.
5050
+ *
5051
+ * `true` allows it, `false` turns it off. A missing key, or the whole field missing, leaves the network's default, which on TikTok is allowed.
5052
+ *
5053
+ * TikTok's content sharing guidelines require this to be **the user's choice**, with **nothing ticked in advance**: if your software publishes on behalf of someone, show the three boxes unticked and send what they tick. Whatever the creator has switched off in their TikTok privacy settings is sent switched off, whatever this says (`interactions.*.disabled` in `GET /organizations/{id_organization}/accounts/{id_account}/publish_settings`).
5054
+ *
5055
+ * A key other than these three, or a value that is not a JSON boolean, does not fail the request: the publication is still created, in state `withErrors` with `publication_errors[].code = 2502`.
5056
+ *
5057
+ * On an update: omit it to keep what was there, send `null` or `""` to go back to the network's default.
5058
+ */
5059
+ interactions?: components["schemas"]["PublicationInteractions"];
4969
5060
  /**
4970
5061
  * @description **The destination link**: where the publication takes whoever clicks it. Only on the networks that answer `link: true` in `GET /social_capabilities` — today `pinterest`, where it is the whole point of a pin — and **deleted** on every other one. It is not `url`, which is the link to the publication on the network once published.
4971
5062
  *
@@ -5039,20 +5130,24 @@ interface components {
5039
5130
  */
5040
5131
  title?: string;
5041
5132
  /**
5042
- * @description **Who can see the publication** when it goes out. Only on the networks that answer `visibility: true` in `GET /social_capabilities` (today `youtube`), and **deleted** on every other one.
5133
+ * @description **Who can see the publication** when it goes out. Only on the networks that answer `visibility: true` in `GET /social_capabilities` (today `youtube` and `tiktok`), and **deleted** on every other one.
5043
5134
  *
5044
5135
  * - `public`: anyone. It is what applies when the field is omitted.
5045
- * - `unlisted`: only people with the link. It does not show on the channel or in search.
5046
- * - `private`: only the channel owner and the people they invite from YouTube Studio.
5136
+ * - `unlisted` (YouTube only): only people with the link. It does not show on the channel or in search.
5137
+ * - `friends` (TikTok only): followers the account follows back.
5138
+ * - `followers` (TikTok only, private accounts): the account's followers.
5139
+ * - `private`: only the owner (on YouTube, also the people they invite from YouTube Studio).
5140
+ *
5141
+ * Both networks require this to be **the user's choice**: if your software publishes on behalf of someone, ask them. On TikTok your interface must have **no default**, and the options to offer are the ones this account allows right now, from `GET /organizations/{id_organization}/accounts/{id_account}/publish_settings`. If, by the time the publication goes out, the account no longer allows the chosen one (it went from public to private), it is not swapped for another: the publication ends in `withErrors` with `publication_errors[].code = 2505`. Omitting it on TikTok keeps the old behaviour (public if the account allows it, otherwise the first value it allows), which is fine for a script but not for a screen a person uses.
5047
5142
  *
5048
- * YouTube's policies require this to be **the user's choice**: if your software publishes on behalf of someone, ask them. A value the network does not accept does not fail the request: the publication is still created, in state `withErrors` with `publication_errors[].code = 2500`, whose `data` carries the `allowed` values. It is checked when the publication is **created**, so a scheduled video does not fail at 3 a.m. over a value that was already wrong.
5143
+ * A value the network does not accept does not fail the request: the publication is still created, in state `withErrors` with `publication_errors[].code = 2500`, whose `data` carries the `allowed` values. It is checked when the publication is **created**, so a scheduled video does not fail at 3 a.m. over a value that was already wrong.
5049
5144
  *
5050
5145
  * If YouTube does not leave the video with the visibility that was asked for, the publication still ends up `sended` (the video is on the channel) and carries a warning in `publication_warnings` with `code = 2400`.
5051
5146
  *
5052
5147
  * On an update: omit it to keep what was there, send `null` or `""` to go back to `public`.
5053
5148
  * @enum {string}
5054
5149
  */
5055
- visibility?: "public" | "unlisted" | "private";
5150
+ visibility?: "public" | "unlisted" | "friends" | "followers" | "private";
5056
5151
  };
5057
5152
  PublicationsPublicationList: {
5058
5153
  publications: components["schemas"]["Publication"][];
@@ -5142,6 +5237,34 @@ interface components {
5142
5237
  engagement_base?: "reach" | "impressions" | "followers";
5143
5238
  metrics: components["schemas"]["NormalizedMetrics"];
5144
5239
  };
5240
+ /** @description What the network says, right now, about publishing on one account. Values are in the publication's vocabulary: what you read here is what you send back. */
5241
+ PublicationsPublishSettings: {
5242
+ /** @description `false` means the network will not take a post from this account now. Ask the user to try later instead of sending it: it would end in `withErrors` with `publication_errors[].code = 2507`. */
5243
+ can_post: boolean;
5244
+ /** @description Who the post goes to. TikTok's guidelines ask to show the creator's nickname on the compose screen. */
5245
+ creator?: {
5246
+ /** @description Expires after about two hours: do not store it. */
5247
+ avatar_url?: string;
5248
+ nickname?: string;
5249
+ username?: string;
5250
+ };
5251
+ /** @description One entry per interaction. `disabled: true` means the creator switched it off in their TikTok privacy settings: show it greyed out. It is sent switched off whatever the publication says. */
5252
+ interactions: {
5253
+ comments?: components["schemas"]["PublicationsPublishSettingsInteraction"];
5254
+ duet?: components["schemas"]["PublicationsPublishSettingsInteraction"];
5255
+ stitch?: components["schemas"]["PublicationsPublishSettingsInteraction"];
5256
+ };
5257
+ /** @description The longest video this account can post, in seconds. A longer one ends in `withErrors` with `publication_errors[].code = 2506`, before anything is uploaded. */
5258
+ max_video_duration_sec?: number;
5259
+ /** @description When `can_post` is `false`, the network's code: `spam_risk_too_many_posts` (daily limit of the creator), `spam_risk_user_banned_from_posting`, `reached_active_user_cap`. */
5260
+ reason?: string;
5261
+ social_network: components["schemas"]["SocialNetwork"];
5262
+ /** @description The `visibility` values this account allows now. A public account gets `public`, `friends` and `private`; a private one gets `followers` instead of `public`. Offer these and nothing else, with no default. */
5263
+ visibility_options: ("public" | "friends" | "followers" | "private")[];
5264
+ };
5265
+ PublicationsPublishSettingsInteraction: {
5266
+ disabled: boolean;
5267
+ };
5145
5268
  /**
5146
5269
  * @description Raw, per-network metrics for a publication. Only the fields that belong to the publication's own social network are returned.
5147
5270
  *
@@ -8920,6 +9043,89 @@ interface operations {
8920
9043
  };
8921
9044
  };
8922
9045
  };
9046
+ getAccountPublishSettings: {
9047
+ parameters: {
9048
+ query?: never;
9049
+ header?: never;
9050
+ path: {
9051
+ /** @description Connected account identifier */
9052
+ id_account: string;
9053
+ /** @description Organization identifier */
9054
+ id_organization: string;
9055
+ };
9056
+ cookie?: never;
9057
+ };
9058
+ requestBody?: never;
9059
+ responses: {
9060
+ /** @description What the account allows now */
9061
+ 200: {
9062
+ headers: {
9063
+ [name: string]: unknown;
9064
+ };
9065
+ content: {
9066
+ /**
9067
+ * @example {
9068
+ * "publish_settings": {
9069
+ * "social_network": "tiktok",
9070
+ * "creator": {
9071
+ * "username": "nordwindcafe",
9072
+ * "nickname": "Nordwind Café",
9073
+ * "avatar_url": "https://p16-sign.tiktokcdn.com/…/avatar.jpeg"
9074
+ * },
9075
+ * "visibility_options": [
9076
+ * "public",
9077
+ * "friends",
9078
+ * "private"
9079
+ * ],
9080
+ * "interactions": {
9081
+ * "comments": {
9082
+ * "disabled": false
9083
+ * },
9084
+ * "duet": {
9085
+ * "disabled": false
9086
+ * },
9087
+ * "stitch": {
9088
+ * "disabled": true
9089
+ * }
9090
+ * },
9091
+ * "max_video_duration_sec": 600,
9092
+ * "can_post": true
9093
+ * }
9094
+ * }
9095
+ */
9096
+ "application/json": {
9097
+ publish_settings: components["schemas"]["PublicationsPublishSettings"];
9098
+ };
9099
+ };
9100
+ };
9101
+ /**
9102
+ * @description The request failed. The body carries the PlanVortex error code in `code`:
9103
+ *
9104
+ * | Code | Meaning |
9105
+ * | --- | --- |
9106
+ * | `2508` | This network has no publish settings to read. `data` carries `social_network` |
9107
+ * | `919` | The network did not answer. `data` carries its detail |
9108
+ * | `701` | Account not found in this organization |
9109
+ * | `700` | Account not connected, missing authorization tokens |
9110
+ * | `1101` | Invalid organization |
9111
+ */
9112
+ 400: {
9113
+ headers: {
9114
+ [name: string]: unknown;
9115
+ };
9116
+ content: {
9117
+ "application/json": components["schemas"]["Error"];
9118
+ };
9119
+ };
9120
+ /** @description Unhandled error by the server */
9121
+ 500: {
9122
+ headers: {
9123
+ [name: string]: unknown;
9124
+ };
9125
+ content?: never;
9126
+ };
9127
+ };
9128
+ };
8923
9129
  updatePublicationByAccount: {
8924
9130
  parameters: {
8925
9131
  query?: never;
@@ -12121,7 +12327,10 @@ interface operations {
12121
12327
  * "link": false,
12122
12328
  * "reply_control": false,
12123
12329
  * "visibility": false,
12124
- * "made_for_kids": false
12330
+ * "made_for_kids": false,
12331
+ * "interactions": false,
12332
+ * "commercial_content": false,
12333
+ * "publish_settings": false
12125
12334
  * },
12126
12335
  * "google_business": {
12127
12336
  * "publications": false,
@@ -12134,7 +12343,10 @@ interface operations {
12134
12343
  * "link": false,
12135
12344
  * "reply_control": false,
12136
12345
  * "visibility": false,
12137
- * "made_for_kids": false
12346
+ * "made_for_kids": false,
12347
+ * "interactions": false,
12348
+ * "commercial_content": false,
12349
+ * "publish_settings": false
12138
12350
  * },
12139
12351
  * "pinterest": {
12140
12352
  * "publications": true,
@@ -12147,7 +12359,10 @@ interface operations {
12147
12359
  * "link": true,
12148
12360
  * "reply_control": false,
12149
12361
  * "visibility": false,
12150
- * "made_for_kids": false
12362
+ * "made_for_kids": false,
12363
+ * "interactions": false,
12364
+ * "commercial_content": false,
12365
+ * "publish_settings": false
12151
12366
  * },
12152
12367
  * "threads": {
12153
12368
  * "publications": true,
@@ -12160,7 +12375,10 @@ interface operations {
12160
12375
  * "link": false,
12161
12376
  * "reply_control": true,
12162
12377
  * "visibility": false,
12163
- * "made_for_kids": false
12378
+ * "made_for_kids": false,
12379
+ * "interactions": false,
12380
+ * "commercial_content": false,
12381
+ * "publish_settings": false
12164
12382
  * }
12165
12383
  * }
12166
12384
  */
@@ -12650,6 +12868,13 @@ type Destination = Schemas["PublicationsDestination"];
12650
12868
  * etiquetas para pintar "Recetas > Postres": el servidor no las comprueba.
12651
12869
  */
12652
12870
  type PublicationDestination = Schemas["PublicationDestination"];
12871
+ /**
12872
+ * Lo que una cuenta admite AL PUBLICAR, leído de la red en el momento: lo que devuelve
12873
+ * `accounts.publishSettings()`. Hoy sólo TikTok, cuya guía de contenido pide enseñarlo antes de
12874
+ * publicar. Los valores van en el vocabulario de la publicación: `visibility_options` es lo que
12875
+ * se manda luego en `visibility`.
12876
+ */
12877
+ type PublishSettings = Schemas["PublicationsPublishSettings"];
12653
12878
  /**
12654
12879
  * El token temporal con el que UNA PERSONA conecta una cuenta social, y la URL a la que mandarla.
12655
12880
  *
@@ -13855,4 +14080,4 @@ interface PlanVortexWebhooksOptions {
13855
14080
  */
13856
14081
  declare function planvortexWebhooks(options: PlanVortexWebhooksOptions): (request: WebhookRequestLike, response: WebhookResponseLike, next: (error?: unknown) => void) => void;
13857
14082
 
13858
- export { type Organization as $, type Account as A, type CommentThread as B, type ConnectLink as C, type Destination as D, type EnableResult as E, type CommentReplyResult as F, type ContactExtraData as G, type Contact as H, type ContactCreate as I, type ContactUpdate as J, type IntegrationProviderName as K, type IntegrationProvider as L, type MetricName as M, type Integration as N, type IntegrationConnectRequest as O, type Paginated as P, type IntegrationUpdate as Q, type IntegrationPickerConfig as R, type SocialNetwork as S, type TopPublicationsResult as T, type IntegrationCatalogPage as U, type MessageTemplate as V, type Conversation as W, type ConversationTotals as X, type Message as Y, type MessageInput as Z, type Client as _, type ConnectResult as a, type MetricRow as a$, type AiSettings as a0, type ClientWithOrganizations as a1, type AccountSelection as a2, type PlanData as a3, type PlanUseData as a4, type ConnectToken as a5, type AiContext as a6, type SocialCredentialsInput as a7, type Product as a8, type ProductInput as a9, type AiPlanState as aA, type ApiErrorBody as aB, type AspectRatios as aC, AuthError as aD, type ClientPlan as aE, type CommentAuthor as aF, type CommentChange as aG, type ConnectSessionAccount as aH, type ContactChannel as aI, ContactError as aJ, type DashboardAiPlanRef as aK, type DashboardPublicationRef as aL, type DashboardRange as aM, type EngagementBase as aN, FileError as aO, type FileFormat as aP, type FileProperties as aQ, type FileType as aR, type IntegrationCatalogProduct as aS, type IntegrationConfig as aT, IntegrationError as aU, type IntegrationErrorChange as aV, type IntegrationFormField as aW, type MessageChange as aX, type MessageOptions as aY, type MessageType as aZ, MessagingError as a_, type ProductCatalog as aa, type ProductCatalogInput as ab, type PublicationInput as ac, type PublicationState as ad, type PublicationStats as ae, type PublicationStatsHistory as af, type Upload as ag, AccountError as ah, type AccountMetricRow as ai, type AccountStateChange as aj, type AccountWebhookChangeBase as ak, type AccountWithError as al, type AiImageOrigin as am, type AiPlanCostEstimate as an, type AiPlanDestination as ao, AiPlanError as ap, type AiPlanNotice as aq, type AiPlanOptions as ar, type AiPlanOptionsInput as as, type AiPlanResult as at, type AiPlanResultsGroup as au, type AiPlanResultsTemplateGroup as av, type AiPlanSource as aw, type AiPlanSourceImageInput as ax, type AiPlanSourceInput as ay, type AiPlanSourceProduct as az, type ConnectSession as b, type WebhookHeaders as b$, NO_ERROR_CODE as b0, type components as b1, type operations as b2, type paths as b3, type webhooks as b4, type OpenEnum as b5, OrganizationError as b6, PLANVORTEX_ERROR_RANGES as b7, PlanLimitError as b8, PlanVortexAuthenticationError as b9, UserError as bA, type WebhookAlgorithm as bB, type WebhookChange as bC, type WebhookEvent as bD, type WithAccount as bE, type WithPublication as bF, type WooCommerceConnectRequest as bG, account as bH, accountId as bI, errorFamilyForCode as bJ, isPlanVortexError as bK, isTokenError as bL, messageContact as bM, messageContactId as bN, messageDirection as bO, messageFileIds as bP, messageFiles as bQ, publication as bR, publicationId as bS, type AiPlanChange as bT, type HandleWebhookRequestOptions as bU, type PlanVortexWebhooksOptions as bV, type RawWebhookBody as bW, type VerifyWebhookSignatureOptions as bX, WEBHOOK_EVENTS as bY, WEBHOOK_SIGNATURE_HEADERS as bZ, WebhookBodyError as b_, PlanVortexConfigError as ba, PlanVortexConnectionError as bb, PlanVortexError as bc, type PlanVortexErrorOptions as bd, type PlanVortexErrorRange as be, type PlannerTemplateField as bf, type PlannerTemplateFieldType as bg, ProductError as bh, type PublicationAiGenerated as bi, type PublicationDestination as bj, PublicationError as bk, type PublicationErrorDetail as bl, type PublicationMetrics as bm, type PublicationPending as bn, type PublicationStatsPoint as bo, type PublicationType as bp, type PublicationsSummary as bq, type RssConfig as br, type SocialAuthorizationMethod as bs, type SocialCredentials as bt, type SocialIdentifier as bu, type SocialIdentifierInput as bv, type SocialLimitsMap as bw, TOKEN_ERROR_CODES as bx, type TopPublication as by, type UnknownWebhookChange as bz, type AccountMetrics as c, type WebhookRequestLike as c0, type WebhookResponseLike as c1, WebhookSignatureError as c2, handleWebhookRequest as c3, isAccountStateChange as c4, isAiPlanChange as c5, isCommentChange as c6, isIntegrationErrorChange as c7, isMessageChange as c8, parseWebhookPayload as c9, planvortexWebhooks as ca, verifyWebhookSignature as cb, type PersistentMenu as d, type Dashboard as e, type DashboardMetricsResult as f, type PublicationsSummaryResult as g, type PublicationsStatsResult as h, type PlanUse as i, type Publication as j, type AiPlanResultsSort as k, type PlannerTemplateName as l, type AiPlanCreateRequest as m, type AiPlanCreateResult as n, type AiPlan as o, type AiPlanResults as p, type ClientApp as q, type ClientAppInput as r, type SocialCapabilities as s, type CommentActions as t, type SocialLimits as u, type PublicationLimits as v, type AspectRatiosByNetwork as w, type PlannerTemplate as x, type CommentNetwork as y, type Comment as z };
14083
+ export { type Client as $, type Account as A, type Comment as B, type ConnectLink as C, type Destination as D, type EnableResult as E, type CommentThread as F, type CommentReplyResult as G, type ContactExtraData as H, type Contact as I, type ContactCreate as J, type ContactUpdate as K, type IntegrationProviderName as L, type MetricName as M, type IntegrationProvider as N, type Integration as O, type Paginated as P, type IntegrationConnectRequest as Q, type IntegrationUpdate as R, type SocialNetwork as S, type TopPublicationsResult as T, type IntegrationPickerConfig as U, type IntegrationCatalogPage as V, type MessageTemplate as W, type Conversation as X, type ConversationTotals as Y, type Message as Z, type MessageInput as _, type ConnectResult as a, MessagingError as a$, type Organization as a0, type AiSettings as a1, type ClientWithOrganizations as a2, type AccountSelection as a3, type PlanData as a4, type PlanUseData as a5, type ConnectToken as a6, type AiContext as a7, type SocialCredentialsInput as a8, type Product as a9, type AiPlanSourceProduct as aA, type AiPlanState as aB, type ApiErrorBody as aC, type AspectRatios as aD, AuthError as aE, type ClientPlan as aF, type CommentAuthor as aG, type CommentChange as aH, type ConnectSessionAccount as aI, type ContactChannel as aJ, ContactError as aK, type DashboardAiPlanRef as aL, type DashboardPublicationRef as aM, type DashboardRange as aN, type EngagementBase as aO, FileError as aP, type FileFormat as aQ, type FileProperties as aR, type FileType as aS, type IntegrationCatalogProduct as aT, type IntegrationConfig as aU, IntegrationError as aV, type IntegrationErrorChange as aW, type IntegrationFormField as aX, type MessageChange as aY, type MessageOptions as aZ, type MessageType as a_, type ProductInput as aa, type ProductCatalog as ab, type ProductCatalogInput as ac, type PublicationInput as ad, type PublicationState as ae, type PublicationStats as af, type PublicationStatsHistory as ag, type Upload as ah, AccountError as ai, type AccountMetricRow as aj, type AccountStateChange as ak, type AccountWebhookChangeBase as al, type AccountWithError as am, type AiImageOrigin as an, type AiPlanCostEstimate as ao, type AiPlanDestination as ap, AiPlanError as aq, type AiPlanNotice as ar, type AiPlanOptions as as, type AiPlanOptionsInput as at, type AiPlanResult as au, type AiPlanResultsGroup as av, type AiPlanResultsTemplateGroup as aw, type AiPlanSource as ax, type AiPlanSourceImageInput as ay, type AiPlanSourceInput as az, type ConnectSession as b, WebhookBodyError as b$, type MetricRow as b0, NO_ERROR_CODE as b1, type components as b2, type operations as b3, type paths as b4, type webhooks as b5, type OpenEnum as b6, OrganizationError as b7, PLANVORTEX_ERROR_RANGES as b8, PlanLimitError as b9, type UnknownWebhookChange as bA, UserError as bB, type WebhookAlgorithm as bC, type WebhookChange as bD, type WebhookEvent as bE, type WithAccount as bF, type WithPublication as bG, type WooCommerceConnectRequest as bH, account as bI, accountId as bJ, errorFamilyForCode as bK, isPlanVortexError as bL, isTokenError as bM, messageContact as bN, messageContactId as bO, messageDirection as bP, messageFileIds as bQ, messageFiles as bR, publication as bS, publicationId as bT, type AiPlanChange as bU, type HandleWebhookRequestOptions as bV, type PlanVortexWebhooksOptions as bW, type RawWebhookBody as bX, type VerifyWebhookSignatureOptions as bY, WEBHOOK_EVENTS as bZ, WEBHOOK_SIGNATURE_HEADERS as b_, PlanVortexAuthenticationError as ba, PlanVortexConfigError as bb, PlanVortexConnectionError as bc, PlanVortexError as bd, type PlanVortexErrorOptions as be, type PlanVortexErrorRange as bf, type PlannerTemplateField as bg, type PlannerTemplateFieldType as bh, ProductError as bi, type PublicationAiGenerated as bj, type PublicationDestination as bk, PublicationError as bl, type PublicationErrorDetail as bm, type PublicationMetrics as bn, type PublicationPending as bo, type PublicationStatsPoint as bp, type PublicationType as bq, type PublicationsSummary as br, type RssConfig as bs, type SocialAuthorizationMethod as bt, type SocialCredentials as bu, type SocialIdentifier as bv, type SocialIdentifierInput as bw, type SocialLimitsMap as bx, TOKEN_ERROR_CODES as by, type TopPublication as bz, type AccountMetrics as c, type WebhookHeaders as c0, type WebhookRequestLike as c1, type WebhookResponseLike as c2, WebhookSignatureError as c3, handleWebhookRequest as c4, isAccountStateChange as c5, isAiPlanChange as c6, isCommentChange as c7, isIntegrationErrorChange as c8, isMessageChange as c9, parseWebhookPayload as ca, planvortexWebhooks as cb, verifyWebhookSignature as cc, type PublishSettings as d, type PersistentMenu as e, type Dashboard as f, type DashboardMetricsResult as g, type PublicationsSummaryResult as h, type PublicationsStatsResult as i, type PlanUse as j, type Publication as k, type AiPlanResultsSort as l, type PlannerTemplateName as m, type AiPlanCreateRequest as n, type AiPlanCreateResult as o, type AiPlan as p, type AiPlanResults as q, type ClientApp as r, type ClientAppInput as s, type SocialCapabilities as t, type CommentActions as u, type SocialLimits as v, type PublicationLimits as w, type AspectRatiosByNetwork as x, type PlannerTemplate as y, type CommentNetwork as z };