planvortex 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/{chunk-4EPTOW4H.js → chunk-CXCJAVXQ.js} +7 -3
- package/dist/chunk-CXCJAVXQ.js.map +1 -0
- package/dist/{index-DnfzM7vS.d.cts → index-DgRGeYRl.d.cts} +104 -6
- package/dist/{index-DnfzM7vS.d.ts → index-DgRGeYRl.d.ts} +104 -6
- package/dist/index.cjs +6 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -4
- package/dist/index.d.ts +12 -4
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/webhooks/index.cjs +5 -1
- package/dist/webhooks/index.cjs.map +1 -1
- package/dist/webhooks/index.d.cts +1 -1
- package/dist/webhooks/index.d.ts +1 -1
- package/dist/webhooks/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-4EPTOW4H.js.map +0 -1
package/README.md
CHANGED
|
@@ -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
|
+
| 2600-2699 | Comments: an account with no inbox (a LinkedIn personal profile) | `PublicationError` |
|
|
429
430
|
|
|
430
431
|
A code outside every range — the catalogue grows — arrives as the base `PlanVortexError` with its
|
|
431
432
|
`code` and `message` untouched, never swallowed and never renamed. And when the failure never got a
|
|
@@ -28,7 +28,11 @@ var PLANVORTEX_ERROR_RANGES = [
|
|
|
28
28
|
{ from: 1900, to: 1906, family: "payment" },
|
|
29
29
|
{ from: 2e3, to: 2099, family: "product" },
|
|
30
30
|
{ from: 2100, to: 2199, family: "ai_plan" },
|
|
31
|
-
{ from: 2200, to: 2299, family: "integration" }
|
|
31
|
+
{ from: 2200, to: 2299, family: "integration" },
|
|
32
|
+
//Los COMENTARIOS siguen aquí porque sus 945-948 se llenaron, y van con ellos a `publication`:
|
|
33
|
+
//el 2600 (esta cuenta no tiene bandeja, un perfil personal de LinkedIn) es la versión por
|
|
34
|
+
//cuenta del 945, y separarlos daría dos clases para el mismo «aquí no hay comentarios».
|
|
35
|
+
{ from: 2600, to: 2699, family: "publication" }
|
|
32
36
|
];
|
|
33
37
|
var NO_ERROR_CODE = 0;
|
|
34
38
|
var TOKEN_ERROR_CODES = [501, 522];
|
|
@@ -149,5 +153,5 @@ function isTokenError(error) {
|
|
|
149
153
|
}
|
|
150
154
|
|
|
151
155
|
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 };
|
|
152
|
-
//# sourceMappingURL=chunk-
|
|
153
|
-
//# sourceMappingURL=chunk-
|
|
156
|
+
//# sourceMappingURL=chunk-CXCJAVXQ.js.map
|
|
157
|
+
//# sourceMappingURL=chunk-CXCJAVXQ.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,E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AAA,CAAM,IAAA,CAAK,IAAA,IAAQ;AAAC,KAC7B,CAAA;AAAA,EACL;AAEA,EAAA,OAAO,IAAI,eAAA,CAAgB,aAAA,EAAe,CAAA,KAAA,EAAQ,KAAA,CAAM,MAAM,CAAA,CAAA,EAAI;AAAA,IAC9D,GAAG,OAAA;AAAA,IACH,MAAA,EAAQ,MAAA;AAAA,IACR,IAAA,EACI,OAAO,KAAA,CAAM,IAAA,KAAS,QAAA,IAAY,KAAA,CAAM,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-CXCJAVXQ.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 { 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"]}
|
|
@@ -2722,6 +2722,8 @@ interface components {
|
|
|
2722
2722
|
*
|
|
2723
2723
|
* On `discord`, on `telegram` and on `slack` an account is a **channel**, not a profile: publishing to two Discord channels of the same server — or to two Telegram channels of the same brand, or to `#anuncios` and `#general` of the same Slack workspace — costs two accounts of the plan.
|
|
2724
2724
|
*
|
|
2725
|
+
* On `linkedin` one authorization brings two kinds of account: the **personal profile** of whoever authorizes and each **page** they manage. Both publish and both have statistics, but only pages have a comment inbox: LinkedIn does not let any app read the comments on a member's posts, so on a profile every comment endpoint returns error `2600`. `extra_data.is_personal_profile` tells them apart.
|
|
2726
|
+
*
|
|
2725
2727
|
* `error_code` other than `0` means the connection is broken — an expired token, a permission taken away — and the account has to be connected again. On `telegram` nothing expires, because there is no account token: what breaks the connection is the bot being removed from the channel or losing its permission to post there (error 968). On `slack` the bot token does not expire either: what breaks it is the app being removed from the channel (error 980) or the channel being archived or deleted (error 985).
|
|
2726
2728
|
*/
|
|
2727
2729
|
Account: {
|
|
@@ -2730,6 +2732,13 @@ interface components {
|
|
|
2730
2732
|
creation_date: string;
|
|
2731
2733
|
/** @description `0` is a healthy account. Anything else is a PlanVortex error code explaining why the connection stopped working; the account keeps its data but cannot be used until it is reconnected. */
|
|
2732
2734
|
error_code: number;
|
|
2735
|
+
/** @description What only makes sense on this account's network. Only the keys documented here are part of the contract: anything else in the object can change without notice. */
|
|
2736
|
+
extra_data?: {
|
|
2737
|
+
/** @description `linkedin` only. `true` on the personal profile of whoever authorized, `false` on a page. A profile publishes and has statistics but no comment inbox (error `2600`). Pages connected before personal profiles existed do not carry it, so treat absent as a page. */
|
|
2738
|
+
is_personal_profile?: boolean;
|
|
2739
|
+
} & {
|
|
2740
|
+
[key: string]: unknown;
|
|
2741
|
+
};
|
|
2733
2742
|
/** @description Followers the network reports. Absent on an account that has never been measured. On `telegram` and on `slack` it is the channel's member count, and it is the **only** audience figure either network publishes: there are no views, no impressions and no reach anywhere in the Bot API nor in the Slack Web API. */
|
|
2734
2743
|
followers_count?: number;
|
|
2735
2744
|
/** @description The client the organization hangs from. Denormalized here for the plan checks. */
|
|
@@ -3813,12 +3822,16 @@ interface components {
|
|
|
3813
3822
|
destinations: boolean;
|
|
3814
3823
|
/** @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`. */
|
|
3815
3824
|
link: boolean;
|
|
3825
|
+
/** @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`. */
|
|
3826
|
+
made_for_kids: boolean;
|
|
3816
3827
|
messages: boolean;
|
|
3817
3828
|
persistent_menu: boolean;
|
|
3818
3829
|
products: boolean;
|
|
3819
3830
|
publications: boolean;
|
|
3820
3831
|
/** @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`. */
|
|
3821
3832
|
reply_control: boolean;
|
|
3833
|
+
/** @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`. */
|
|
3834
|
+
visibility: boolean;
|
|
3822
3835
|
webhooks: boolean;
|
|
3823
3836
|
};
|
|
3824
3837
|
/**
|
|
@@ -4065,6 +4078,20 @@ interface components {
|
|
|
4065
4078
|
};
|
|
4066
4079
|
message: string;
|
|
4067
4080
|
}[];
|
|
4081
|
+
/**
|
|
4082
|
+
* @description What still has to be done **by hand on the network** for a publication that DID go out. Same shape as `publication_errors`, and an empty array when there is nothing to do.
|
|
4083
|
+
*
|
|
4084
|
+
* It is a separate field because these are not failures: the publication stays in state `sended` and must **not** be retried, because retrying would publish it twice. Like `publication_errors`, it belongs to the last attempt.
|
|
4085
|
+
*
|
|
4086
|
+
* Today there is one code. **2400** (YouTube): YouTube accepted the upload but did not make the video public, so YouTube Studio shows it as a draft or private until someone sets its audience and visibility there. The upload does not fail when this happens; PlanVortex reads the video back right after uploading it to find out. `data` carries `requested_privacy_status`, `privacy_status` (what YouTube actually left), `upload_status`, `made_for_kids` and `studio_url`, the YouTube Studio page where it is finished.
|
|
4087
|
+
*/
|
|
4088
|
+
publication_warnings?: {
|
|
4089
|
+
code: number;
|
|
4090
|
+
data?: {
|
|
4091
|
+
[key: string]: unknown;
|
|
4092
|
+
};
|
|
4093
|
+
message: string;
|
|
4094
|
+
}[];
|
|
4068
4095
|
/** Format: date-time */
|
|
4069
4096
|
publish_date?: string;
|
|
4070
4097
|
social_network: components["schemas"]["SocialNetwork"];
|
|
@@ -4165,7 +4192,7 @@ interface components {
|
|
|
4165
4192
|
* The catalogue grows with the product, so treat an unknown `code` as a generic failure instead of rejecting it.
|
|
4166
4193
|
*/
|
|
4167
4194
|
Error: {
|
|
4168
|
-
/** @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. */
|
|
4195
|
+
/** @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. */
|
|
4169
4196
|
code: number;
|
|
4170
4197
|
/** @description Extra context attached to the error, when there is any. */
|
|
4171
4198
|
data?: {
|
|
@@ -4762,6 +4789,12 @@ interface components {
|
|
|
4762
4789
|
* **On every other network the field is deleted on save**, like `destination`.
|
|
4763
4790
|
*/
|
|
4764
4791
|
link?: string;
|
|
4792
|
+
/**
|
|
4793
|
+
* @description Whether the video is **made for kids** (COPPA), on the networks that answer `made_for_kids: true` in `GET /social_capabilities` (today `youtube`). Absent means `false`.
|
|
4794
|
+
*
|
|
4795
|
+
* **On every other network the field is deleted on save**, like `reply_control`.
|
|
4796
|
+
*/
|
|
4797
|
+
made_for_kids?: boolean;
|
|
4765
4798
|
/** @description Last known measurement, in the common vocabulary. Absent until it is measured. */
|
|
4766
4799
|
metrics?: components["schemas"]["NormalizedMetrics"];
|
|
4767
4800
|
/** @description Internal name. Never shown on the social network. */
|
|
@@ -4785,6 +4818,20 @@ interface components {
|
|
|
4785
4818
|
}[];
|
|
4786
4819
|
/** @enum {string} */
|
|
4787
4820
|
publication_type: "profile" | "page" | "group" | "reels" | "stories" | "message";
|
|
4821
|
+
/**
|
|
4822
|
+
* @description What still has to be done **by hand on the network** for a publication that DID go out. Same shape as `publication_errors`, and an empty array when there is nothing to do.
|
|
4823
|
+
*
|
|
4824
|
+
* It is a separate field because these are not failures: the publication stays in state `sended` and must **not** be retried, because retrying would publish it twice. Like `publication_errors`, it belongs to the last attempt.
|
|
4825
|
+
*
|
|
4826
|
+
* Today there is one code. **2400** (YouTube): YouTube accepted the upload but did not make the video public, so YouTube Studio shows it as a draft or private until someone sets its audience and visibility there. The upload does not fail when this happens; PlanVortex reads the video back right after uploading it to find out. `data` carries `requested_privacy_status`, `privacy_status` (what YouTube actually left), `upload_status`, `made_for_kids` and `studio_url`, the YouTube Studio page where it is finished.
|
|
4827
|
+
*/
|
|
4828
|
+
publication_warnings?: {
|
|
4829
|
+
code: number;
|
|
4830
|
+
data?: {
|
|
4831
|
+
[key: string]: unknown;
|
|
4832
|
+
};
|
|
4833
|
+
message: string;
|
|
4834
|
+
}[];
|
|
4788
4835
|
/** Format: date-time */
|
|
4789
4836
|
publish_date?: string;
|
|
4790
4837
|
/**
|
|
@@ -4813,6 +4860,13 @@ interface components {
|
|
|
4813
4860
|
title?: string;
|
|
4814
4861
|
/** @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. */
|
|
4815
4862
|
url?: string;
|
|
4863
|
+
/**
|
|
4864
|
+
* @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.
|
|
4865
|
+
*
|
|
4866
|
+
* **On every other network the field is deleted on save**, like `reply_control`.
|
|
4867
|
+
* @enum {string}
|
|
4868
|
+
*/
|
|
4869
|
+
visibility?: "public" | "unlisted" | "private";
|
|
4816
4870
|
};
|
|
4817
4871
|
/**
|
|
4818
4872
|
* @description Which part of a publication was generated by AI. **Absent means nothing was.**
|
|
@@ -4915,6 +4969,16 @@ interface components {
|
|
|
4915
4969
|
* On an update: omit it to keep what was there, send `null` or `""` to remove it.
|
|
4916
4970
|
*/
|
|
4917
4971
|
link?: string;
|
|
4972
|
+
/**
|
|
4973
|
+
* @description Whether the video is **made for kids**. Only on the networks that answer `made_for_kids: true` in `GET /social_capabilities` (today `youtube`), and **deleted** on every other one. Absent means `false`.
|
|
4974
|
+
*
|
|
4975
|
+
* The law (COPPA) and YouTube's policies require a video directed at children to be uploaded with `true`, and it is the **user's** call: if your software publishes on behalf of someone, ask them. YouTube then turns off features such as comments and personalised ads on that video.
|
|
4976
|
+
*
|
|
4977
|
+
* It must be a JSON boolean. Anything else (`"yes"`, `"no"`, `1`) is not guessed: the publication is still created, in state `withErrors` with `publication_errors[].code = 2501`.
|
|
4978
|
+
*
|
|
4979
|
+
* On an update: omit it to keep what was there, send `null` or `""` to go back to `false`.
|
|
4980
|
+
*/
|
|
4981
|
+
made_for_kids?: boolean;
|
|
4918
4982
|
/** @description Internal name for the publication. Useful for grouping; never shown on the social network. */
|
|
4919
4983
|
name?: string;
|
|
4920
4984
|
/**
|
|
@@ -4969,6 +5033,21 @@ interface components {
|
|
|
4969
5033
|
* **On Pinterest it is the pin's title**, optional and at most 100 characters; over it the publication is created in state `withErrors` with `publication_errors[].code = 995` and `data.field = "title"`.
|
|
4970
5034
|
*/
|
|
4971
5035
|
title?: string;
|
|
5036
|
+
/**
|
|
5037
|
+
* @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.
|
|
5038
|
+
*
|
|
5039
|
+
* - `public`: anyone. It is what applies when the field is omitted.
|
|
5040
|
+
* - `unlisted`: only people with the link. It does not show on the channel or in search.
|
|
5041
|
+
* - `private`: only the channel owner and the people they invite from YouTube Studio.
|
|
5042
|
+
*
|
|
5043
|
+
* 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.
|
|
5044
|
+
*
|
|
5045
|
+
* 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`.
|
|
5046
|
+
*
|
|
5047
|
+
* On an update: omit it to keep what was there, send `null` or `""` to go back to `public`.
|
|
5048
|
+
* @enum {string}
|
|
5049
|
+
*/
|
|
5050
|
+
visibility?: "public" | "unlisted" | "private";
|
|
4972
5051
|
};
|
|
4973
5052
|
PublicationsPublicationList: {
|
|
4974
5053
|
publications: components["schemas"]["Publication"][];
|
|
@@ -5254,6 +5333,7 @@ interface components {
|
|
|
5254
5333
|
* | `970` | Telegram is rate limiting the bot and the wait was longer than PlanVortex is willing to hold the request for. Carries `retry_after_seconds` in `data`: retry after it. |
|
|
5255
5334
|
* | `1101` | Invalid organization. |
|
|
5256
5335
|
* | `1501` | The comment's account could not be resolved. |
|
|
5336
|
+
* | `2600` | The network has comments but **this account** has none: a LinkedIn personal profile. LinkedIn does not let any app read a member's comments, so only pages have an inbox. Carries `social_network` and `id_account` in `data`. |
|
|
5257
5337
|
*/
|
|
5258
5338
|
CommentsCommentError: {
|
|
5259
5339
|
headers: {
|
|
@@ -7616,7 +7696,11 @@ interface operations {
|
|
|
7616
7696
|
query?: {
|
|
7617
7697
|
/** @description Only these accounts, by identifier. Repeat the parameter for more than one. */
|
|
7618
7698
|
accounts?: string[];
|
|
7619
|
-
/**
|
|
7699
|
+
/**
|
|
7700
|
+
* @description Only accounts whose network can do this. It is the same matrix `GET /social_capabilities` publishes, applied server-side: the way to ask for 'the accounts I can publish with' without keeping your own table of which network does what.
|
|
7701
|
+
*
|
|
7702
|
+
* `comments` also looks at each account, not only at its network: a LinkedIn **personal profile** is left out, because only LinkedIn pages have a comment inbox. `total` counts the same way.
|
|
7703
|
+
*/
|
|
7620
7704
|
capability?: "publications" | "messages" | "products" | "webhooks" | "persistent_menu" | "comments";
|
|
7621
7705
|
/** @description The limit of records will be retrieved (pagination) */
|
|
7622
7706
|
limit?: number;
|
|
@@ -12030,7 +12114,9 @@ interface operations {
|
|
|
12030
12114
|
* "comments": true,
|
|
12031
12115
|
* "destinations": false,
|
|
12032
12116
|
* "link": false,
|
|
12033
|
-
* "reply_control": false
|
|
12117
|
+
* "reply_control": false,
|
|
12118
|
+
* "visibility": false,
|
|
12119
|
+
* "made_for_kids": false
|
|
12034
12120
|
* },
|
|
12035
12121
|
* "google_business": {
|
|
12036
12122
|
* "publications": false,
|
|
@@ -12041,7 +12127,9 @@ interface operations {
|
|
|
12041
12127
|
* "comments": true,
|
|
12042
12128
|
* "destinations": false,
|
|
12043
12129
|
* "link": false,
|
|
12044
|
-
* "reply_control": false
|
|
12130
|
+
* "reply_control": false,
|
|
12131
|
+
* "visibility": false,
|
|
12132
|
+
* "made_for_kids": false
|
|
12045
12133
|
* },
|
|
12046
12134
|
* "pinterest": {
|
|
12047
12135
|
* "publications": true,
|
|
@@ -12052,7 +12140,9 @@ interface operations {
|
|
|
12052
12140
|
* "comments": false,
|
|
12053
12141
|
* "destinations": true,
|
|
12054
12142
|
* "link": true,
|
|
12055
|
-
* "reply_control": false
|
|
12143
|
+
* "reply_control": false,
|
|
12144
|
+
* "visibility": false,
|
|
12145
|
+
* "made_for_kids": false
|
|
12056
12146
|
* },
|
|
12057
12147
|
* "threads": {
|
|
12058
12148
|
* "publications": true,
|
|
@@ -12063,7 +12153,9 @@ interface operations {
|
|
|
12063
12153
|
* "comments": true,
|
|
12064
12154
|
* "destinations": false,
|
|
12065
12155
|
* "link": false,
|
|
12066
|
-
* "reply_control": true
|
|
12156
|
+
* "reply_control": true,
|
|
12157
|
+
* "visibility": false,
|
|
12158
|
+
* "made_for_kids": false
|
|
12067
12159
|
* }
|
|
12068
12160
|
* }
|
|
12069
12161
|
*/
|
|
@@ -12512,6 +12604,12 @@ type ClientWithOrganizations = Operations["getClientsWithOrganizations"]["respon
|
|
|
12512
12604
|
*
|
|
12513
12605
|
* Y un canal de Telegram **privado** no trae `username`: solo los publicos tienen `@nombre`, que es
|
|
12514
12606
|
* tambien por lo que sus publicaciones vuelven sin `url`.
|
|
12607
|
+
*
|
|
12608
|
+
* En LinkedIn una misma autorizacion trae dos clases de cuenta: el **perfil personal** de quien
|
|
12609
|
+
* autoriza y cada **pagina** que administra. Las dos publican y tienen estadisticas, pero solo las
|
|
12610
|
+
* paginas tienen bandeja de comentarios: LinkedIn no deja a ninguna app leer los comentarios de un
|
|
12611
|
+
* perfil, y ahi todo `comments.*` devuelve el error 2600. Se distinguen por
|
|
12612
|
+
* `extra_data.is_personal_profile`; ausente es pagina (las conectadas antes de que hubiera perfiles).
|
|
12515
12613
|
*/
|
|
12516
12614
|
type Account = Override<Schemas["Account"], {
|
|
12517
12615
|
social_network: SocialNetwork;
|
|
@@ -2722,6 +2722,8 @@ interface components {
|
|
|
2722
2722
|
*
|
|
2723
2723
|
* On `discord`, on `telegram` and on `slack` an account is a **channel**, not a profile: publishing to two Discord channels of the same server — or to two Telegram channels of the same brand, or to `#anuncios` and `#general` of the same Slack workspace — costs two accounts of the plan.
|
|
2724
2724
|
*
|
|
2725
|
+
* On `linkedin` one authorization brings two kinds of account: the **personal profile** of whoever authorizes and each **page** they manage. Both publish and both have statistics, but only pages have a comment inbox: LinkedIn does not let any app read the comments on a member's posts, so on a profile every comment endpoint returns error `2600`. `extra_data.is_personal_profile` tells them apart.
|
|
2726
|
+
*
|
|
2725
2727
|
* `error_code` other than `0` means the connection is broken — an expired token, a permission taken away — and the account has to be connected again. On `telegram` nothing expires, because there is no account token: what breaks the connection is the bot being removed from the channel or losing its permission to post there (error 968). On `slack` the bot token does not expire either: what breaks it is the app being removed from the channel (error 980) or the channel being archived or deleted (error 985).
|
|
2726
2728
|
*/
|
|
2727
2729
|
Account: {
|
|
@@ -2730,6 +2732,13 @@ interface components {
|
|
|
2730
2732
|
creation_date: string;
|
|
2731
2733
|
/** @description `0` is a healthy account. Anything else is a PlanVortex error code explaining why the connection stopped working; the account keeps its data but cannot be used until it is reconnected. */
|
|
2732
2734
|
error_code: number;
|
|
2735
|
+
/** @description What only makes sense on this account's network. Only the keys documented here are part of the contract: anything else in the object can change without notice. */
|
|
2736
|
+
extra_data?: {
|
|
2737
|
+
/** @description `linkedin` only. `true` on the personal profile of whoever authorized, `false` on a page. A profile publishes and has statistics but no comment inbox (error `2600`). Pages connected before personal profiles existed do not carry it, so treat absent as a page. */
|
|
2738
|
+
is_personal_profile?: boolean;
|
|
2739
|
+
} & {
|
|
2740
|
+
[key: string]: unknown;
|
|
2741
|
+
};
|
|
2733
2742
|
/** @description Followers the network reports. Absent on an account that has never been measured. On `telegram` and on `slack` it is the channel's member count, and it is the **only** audience figure either network publishes: there are no views, no impressions and no reach anywhere in the Bot API nor in the Slack Web API. */
|
|
2734
2743
|
followers_count?: number;
|
|
2735
2744
|
/** @description The client the organization hangs from. Denormalized here for the plan checks. */
|
|
@@ -3813,12 +3822,16 @@ interface components {
|
|
|
3813
3822
|
destinations: boolean;
|
|
3814
3823
|
/** @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`. */
|
|
3815
3824
|
link: boolean;
|
|
3825
|
+
/** @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`. */
|
|
3826
|
+
made_for_kids: boolean;
|
|
3816
3827
|
messages: boolean;
|
|
3817
3828
|
persistent_menu: boolean;
|
|
3818
3829
|
products: boolean;
|
|
3819
3830
|
publications: boolean;
|
|
3820
3831
|
/** @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`. */
|
|
3821
3832
|
reply_control: boolean;
|
|
3833
|
+
/** @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`. */
|
|
3834
|
+
visibility: boolean;
|
|
3822
3835
|
webhooks: boolean;
|
|
3823
3836
|
};
|
|
3824
3837
|
/**
|
|
@@ -4065,6 +4078,20 @@ interface components {
|
|
|
4065
4078
|
};
|
|
4066
4079
|
message: string;
|
|
4067
4080
|
}[];
|
|
4081
|
+
/**
|
|
4082
|
+
* @description What still has to be done **by hand on the network** for a publication that DID go out. Same shape as `publication_errors`, and an empty array when there is nothing to do.
|
|
4083
|
+
*
|
|
4084
|
+
* It is a separate field because these are not failures: the publication stays in state `sended` and must **not** be retried, because retrying would publish it twice. Like `publication_errors`, it belongs to the last attempt.
|
|
4085
|
+
*
|
|
4086
|
+
* Today there is one code. **2400** (YouTube): YouTube accepted the upload but did not make the video public, so YouTube Studio shows it as a draft or private until someone sets its audience and visibility there. The upload does not fail when this happens; PlanVortex reads the video back right after uploading it to find out. `data` carries `requested_privacy_status`, `privacy_status` (what YouTube actually left), `upload_status`, `made_for_kids` and `studio_url`, the YouTube Studio page where it is finished.
|
|
4087
|
+
*/
|
|
4088
|
+
publication_warnings?: {
|
|
4089
|
+
code: number;
|
|
4090
|
+
data?: {
|
|
4091
|
+
[key: string]: unknown;
|
|
4092
|
+
};
|
|
4093
|
+
message: string;
|
|
4094
|
+
}[];
|
|
4068
4095
|
/** Format: date-time */
|
|
4069
4096
|
publish_date?: string;
|
|
4070
4097
|
social_network: components["schemas"]["SocialNetwork"];
|
|
@@ -4165,7 +4192,7 @@ interface components {
|
|
|
4165
4192
|
* The catalogue grows with the product, so treat an unknown `code` as a generic failure instead of rejecting it.
|
|
4166
4193
|
*/
|
|
4167
4194
|
Error: {
|
|
4168
|
-
/** @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. */
|
|
4195
|
+
/** @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. */
|
|
4169
4196
|
code: number;
|
|
4170
4197
|
/** @description Extra context attached to the error, when there is any. */
|
|
4171
4198
|
data?: {
|
|
@@ -4762,6 +4789,12 @@ interface components {
|
|
|
4762
4789
|
* **On every other network the field is deleted on save**, like `destination`.
|
|
4763
4790
|
*/
|
|
4764
4791
|
link?: string;
|
|
4792
|
+
/**
|
|
4793
|
+
* @description Whether the video is **made for kids** (COPPA), on the networks that answer `made_for_kids: true` in `GET /social_capabilities` (today `youtube`). Absent means `false`.
|
|
4794
|
+
*
|
|
4795
|
+
* **On every other network the field is deleted on save**, like `reply_control`.
|
|
4796
|
+
*/
|
|
4797
|
+
made_for_kids?: boolean;
|
|
4765
4798
|
/** @description Last known measurement, in the common vocabulary. Absent until it is measured. */
|
|
4766
4799
|
metrics?: components["schemas"]["NormalizedMetrics"];
|
|
4767
4800
|
/** @description Internal name. Never shown on the social network. */
|
|
@@ -4785,6 +4818,20 @@ interface components {
|
|
|
4785
4818
|
}[];
|
|
4786
4819
|
/** @enum {string} */
|
|
4787
4820
|
publication_type: "profile" | "page" | "group" | "reels" | "stories" | "message";
|
|
4821
|
+
/**
|
|
4822
|
+
* @description What still has to be done **by hand on the network** for a publication that DID go out. Same shape as `publication_errors`, and an empty array when there is nothing to do.
|
|
4823
|
+
*
|
|
4824
|
+
* It is a separate field because these are not failures: the publication stays in state `sended` and must **not** be retried, because retrying would publish it twice. Like `publication_errors`, it belongs to the last attempt.
|
|
4825
|
+
*
|
|
4826
|
+
* Today there is one code. **2400** (YouTube): YouTube accepted the upload but did not make the video public, so YouTube Studio shows it as a draft or private until someone sets its audience and visibility there. The upload does not fail when this happens; PlanVortex reads the video back right after uploading it to find out. `data` carries `requested_privacy_status`, `privacy_status` (what YouTube actually left), `upload_status`, `made_for_kids` and `studio_url`, the YouTube Studio page where it is finished.
|
|
4827
|
+
*/
|
|
4828
|
+
publication_warnings?: {
|
|
4829
|
+
code: number;
|
|
4830
|
+
data?: {
|
|
4831
|
+
[key: string]: unknown;
|
|
4832
|
+
};
|
|
4833
|
+
message: string;
|
|
4834
|
+
}[];
|
|
4788
4835
|
/** Format: date-time */
|
|
4789
4836
|
publish_date?: string;
|
|
4790
4837
|
/**
|
|
@@ -4813,6 +4860,13 @@ interface components {
|
|
|
4813
4860
|
title?: string;
|
|
4814
4861
|
/** @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. */
|
|
4815
4862
|
url?: string;
|
|
4863
|
+
/**
|
|
4864
|
+
* @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.
|
|
4865
|
+
*
|
|
4866
|
+
* **On every other network the field is deleted on save**, like `reply_control`.
|
|
4867
|
+
* @enum {string}
|
|
4868
|
+
*/
|
|
4869
|
+
visibility?: "public" | "unlisted" | "private";
|
|
4816
4870
|
};
|
|
4817
4871
|
/**
|
|
4818
4872
|
* @description Which part of a publication was generated by AI. **Absent means nothing was.**
|
|
@@ -4915,6 +4969,16 @@ interface components {
|
|
|
4915
4969
|
* On an update: omit it to keep what was there, send `null` or `""` to remove it.
|
|
4916
4970
|
*/
|
|
4917
4971
|
link?: string;
|
|
4972
|
+
/**
|
|
4973
|
+
* @description Whether the video is **made for kids**. Only on the networks that answer `made_for_kids: true` in `GET /social_capabilities` (today `youtube`), and **deleted** on every other one. Absent means `false`.
|
|
4974
|
+
*
|
|
4975
|
+
* The law (COPPA) and YouTube's policies require a video directed at children to be uploaded with `true`, and it is the **user's** call: if your software publishes on behalf of someone, ask them. YouTube then turns off features such as comments and personalised ads on that video.
|
|
4976
|
+
*
|
|
4977
|
+
* It must be a JSON boolean. Anything else (`"yes"`, `"no"`, `1`) is not guessed: the publication is still created, in state `withErrors` with `publication_errors[].code = 2501`.
|
|
4978
|
+
*
|
|
4979
|
+
* On an update: omit it to keep what was there, send `null` or `""` to go back to `false`.
|
|
4980
|
+
*/
|
|
4981
|
+
made_for_kids?: boolean;
|
|
4918
4982
|
/** @description Internal name for the publication. Useful for grouping; never shown on the social network. */
|
|
4919
4983
|
name?: string;
|
|
4920
4984
|
/**
|
|
@@ -4969,6 +5033,21 @@ interface components {
|
|
|
4969
5033
|
* **On Pinterest it is the pin's title**, optional and at most 100 characters; over it the publication is created in state `withErrors` with `publication_errors[].code = 995` and `data.field = "title"`.
|
|
4970
5034
|
*/
|
|
4971
5035
|
title?: string;
|
|
5036
|
+
/**
|
|
5037
|
+
* @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.
|
|
5038
|
+
*
|
|
5039
|
+
* - `public`: anyone. It is what applies when the field is omitted.
|
|
5040
|
+
* - `unlisted`: only people with the link. It does not show on the channel or in search.
|
|
5041
|
+
* - `private`: only the channel owner and the people they invite from YouTube Studio.
|
|
5042
|
+
*
|
|
5043
|
+
* 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.
|
|
5044
|
+
*
|
|
5045
|
+
* 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`.
|
|
5046
|
+
*
|
|
5047
|
+
* On an update: omit it to keep what was there, send `null` or `""` to go back to `public`.
|
|
5048
|
+
* @enum {string}
|
|
5049
|
+
*/
|
|
5050
|
+
visibility?: "public" | "unlisted" | "private";
|
|
4972
5051
|
};
|
|
4973
5052
|
PublicationsPublicationList: {
|
|
4974
5053
|
publications: components["schemas"]["Publication"][];
|
|
@@ -5254,6 +5333,7 @@ interface components {
|
|
|
5254
5333
|
* | `970` | Telegram is rate limiting the bot and the wait was longer than PlanVortex is willing to hold the request for. Carries `retry_after_seconds` in `data`: retry after it. |
|
|
5255
5334
|
* | `1101` | Invalid organization. |
|
|
5256
5335
|
* | `1501` | The comment's account could not be resolved. |
|
|
5336
|
+
* | `2600` | The network has comments but **this account** has none: a LinkedIn personal profile. LinkedIn does not let any app read a member's comments, so only pages have an inbox. Carries `social_network` and `id_account` in `data`. |
|
|
5257
5337
|
*/
|
|
5258
5338
|
CommentsCommentError: {
|
|
5259
5339
|
headers: {
|
|
@@ -7616,7 +7696,11 @@ interface operations {
|
|
|
7616
7696
|
query?: {
|
|
7617
7697
|
/** @description Only these accounts, by identifier. Repeat the parameter for more than one. */
|
|
7618
7698
|
accounts?: string[];
|
|
7619
|
-
/**
|
|
7699
|
+
/**
|
|
7700
|
+
* @description Only accounts whose network can do this. It is the same matrix `GET /social_capabilities` publishes, applied server-side: the way to ask for 'the accounts I can publish with' without keeping your own table of which network does what.
|
|
7701
|
+
*
|
|
7702
|
+
* `comments` also looks at each account, not only at its network: a LinkedIn **personal profile** is left out, because only LinkedIn pages have a comment inbox. `total` counts the same way.
|
|
7703
|
+
*/
|
|
7620
7704
|
capability?: "publications" | "messages" | "products" | "webhooks" | "persistent_menu" | "comments";
|
|
7621
7705
|
/** @description The limit of records will be retrieved (pagination) */
|
|
7622
7706
|
limit?: number;
|
|
@@ -12030,7 +12114,9 @@ interface operations {
|
|
|
12030
12114
|
* "comments": true,
|
|
12031
12115
|
* "destinations": false,
|
|
12032
12116
|
* "link": false,
|
|
12033
|
-
* "reply_control": false
|
|
12117
|
+
* "reply_control": false,
|
|
12118
|
+
* "visibility": false,
|
|
12119
|
+
* "made_for_kids": false
|
|
12034
12120
|
* },
|
|
12035
12121
|
* "google_business": {
|
|
12036
12122
|
* "publications": false,
|
|
@@ -12041,7 +12127,9 @@ interface operations {
|
|
|
12041
12127
|
* "comments": true,
|
|
12042
12128
|
* "destinations": false,
|
|
12043
12129
|
* "link": false,
|
|
12044
|
-
* "reply_control": false
|
|
12130
|
+
* "reply_control": false,
|
|
12131
|
+
* "visibility": false,
|
|
12132
|
+
* "made_for_kids": false
|
|
12045
12133
|
* },
|
|
12046
12134
|
* "pinterest": {
|
|
12047
12135
|
* "publications": true,
|
|
@@ -12052,7 +12140,9 @@ interface operations {
|
|
|
12052
12140
|
* "comments": false,
|
|
12053
12141
|
* "destinations": true,
|
|
12054
12142
|
* "link": true,
|
|
12055
|
-
* "reply_control": false
|
|
12143
|
+
* "reply_control": false,
|
|
12144
|
+
* "visibility": false,
|
|
12145
|
+
* "made_for_kids": false
|
|
12056
12146
|
* },
|
|
12057
12147
|
* "threads": {
|
|
12058
12148
|
* "publications": true,
|
|
@@ -12063,7 +12153,9 @@ interface operations {
|
|
|
12063
12153
|
* "comments": true,
|
|
12064
12154
|
* "destinations": false,
|
|
12065
12155
|
* "link": false,
|
|
12066
|
-
* "reply_control": true
|
|
12156
|
+
* "reply_control": true,
|
|
12157
|
+
* "visibility": false,
|
|
12158
|
+
* "made_for_kids": false
|
|
12067
12159
|
* }
|
|
12068
12160
|
* }
|
|
12069
12161
|
*/
|
|
@@ -12512,6 +12604,12 @@ type ClientWithOrganizations = Operations["getClientsWithOrganizations"]["respon
|
|
|
12512
12604
|
*
|
|
12513
12605
|
* Y un canal de Telegram **privado** no trae `username`: solo los publicos tienen `@nombre`, que es
|
|
12514
12606
|
* tambien por lo que sus publicaciones vuelven sin `url`.
|
|
12607
|
+
*
|
|
12608
|
+
* En LinkedIn una misma autorizacion trae dos clases de cuenta: el **perfil personal** de quien
|
|
12609
|
+
* autoriza y cada **pagina** que administra. Las dos publican y tienen estadisticas, pero solo las
|
|
12610
|
+
* paginas tienen bandeja de comentarios: LinkedIn no deja a ninguna app leer los comentarios de un
|
|
12611
|
+
* perfil, y ahi todo `comments.*` devuelve el error 2600. Se distinguen por
|
|
12612
|
+
* `extra_data.is_personal_profile`; ausente es pagina (las conectadas antes de que hubiera perfiles).
|
|
12515
12613
|
*/
|
|
12516
12614
|
type Account = Override<Schemas["Account"], {
|
|
12517
12615
|
social_network: SocialNetwork;
|
package/dist/index.cjs
CHANGED
|
@@ -4,7 +4,7 @@ var path = require('path');
|
|
|
4
4
|
|
|
5
5
|
// src/version.ts
|
|
6
6
|
var PLANVORTEX_API_URL = "https://api.planvortex.com/v1.0.0";
|
|
7
|
-
var VERSION = "0.
|
|
7
|
+
var VERSION = "0.16.0";
|
|
8
8
|
|
|
9
9
|
// src/core/errors.ts
|
|
10
10
|
var PLANVORTEX_ERROR_RANGES = [
|
|
@@ -36,7 +36,11 @@ var PLANVORTEX_ERROR_RANGES = [
|
|
|
36
36
|
{ from: 1900, to: 1906, family: "payment" },
|
|
37
37
|
{ from: 2e3, to: 2099, family: "product" },
|
|
38
38
|
{ from: 2100, to: 2199, family: "ai_plan" },
|
|
39
|
-
{ from: 2200, to: 2299, family: "integration" }
|
|
39
|
+
{ from: 2200, to: 2299, family: "integration" },
|
|
40
|
+
//Los COMENTARIOS siguen aquí porque sus 945-948 se llenaron, y van con ellos a `publication`:
|
|
41
|
+
//el 2600 (esta cuenta no tiene bandeja, un perfil personal de LinkedIn) es la versión por
|
|
42
|
+
//cuenta del 945, y separarlos daría dos clases para el mismo «aquí no hay comentarios».
|
|
43
|
+
{ from: 2600, to: 2699, family: "publication" }
|
|
40
44
|
];
|
|
41
45
|
var NO_ERROR_CODE = 0;
|
|
42
46
|
var TOKEN_ERROR_CODES = [501, 522];
|