Class ClientsResource

Hierarchy

  • Resource
    • ClientsResource

Constructors

Methods

  • Crea una organización raíz. Lo que se le asigne se descuenta de lo que el cliente tiene.

    Parameters

    Returns Promise<
        {
            _id: string;
            actual_asigned?: {
                accounts: number;
                ai_credits?: number;
                artificial_inteligence?: boolean;
                integrations: number;
                publications: number;
                space: number;
                stats?: boolean;
                twitter_credits?: number;
                users: number;
                whatsapp?: boolean;
            };
            actual_plan?: {
                accounts: number;
                ai_credits?: number;
                artificial_inteligence?: boolean;
                integrations: number;
                publications: number;
                space: number;
                stats?: boolean;
                twitter_credits?: number;
                users: number;
                whatsapp?: boolean;
            };
            actual_use?: {
                accounts: number;
                ai_credits?: number;
                artificial_inteligence?: boolean;
                integrations: number;
                publications: number;
                space: number;
                stats?: boolean;
                twitter_credits?: number;
                users: number;
                whatsapp?: boolean;
            };
            ai_context?: {
                audience?: string;
                avoid?: string;
                blog_url?: string;
                brand_name?: string;
                default_tone?: string;
                description?: string;
                keywords?: string[];
                notes?: string;
                products?: string;
                sector?: string;
                shop_url?: string;
                social_urls?: string[];
                value_proposition?: string;
                website?: string;
            };
            creation_date: string;
            id_client: string;
            name: string;
            parent_organization?: string;
            social_credentials?: {
                discord?: {
                    application_name?: string;
                    client_id?: string;
                    has_bot_token?: boolean;
                    has_client_secret?: boolean;
                    verified_date?: string;
                };
            };
            stats_settings?: { auto_refresh_twitter: boolean };
        },
    >

  • Borra una organización raíz con todo lo que tiene dentro: sus organizaciones hijas, sus cuentas, sus publicaciones, sus ficheros y sus comentarios. No se deshace.

    Parameters

    Returns Promise<void>

  • La ficha de un cliente.

    Parameters

    Returns Promise<
        {
            _id: string;
            actual_asigned?: {
                accounts: number;
                ai_credits?: number;
                artificial_inteligence?: boolean;
                integrations: number;
                publications: number;
                space: number;
                stats?: boolean;
                twitter_credits?: number;
                users: number;
                whatsapp?: boolean;
            };
            actual_plan: {
                current_period_end?: string;
                current_period_start?: string;
                enabled: boolean;
                isEnabled: boolean;
                plan_data: {
                    accounts: number;
                    ai_credits?: number;
                    artificial_inteligence?: boolean;
                    integrations: number;
                    publications: number;
                    space: number;
                    stats?: boolean;
                    twitter_credits?: number;
                    users: number;
                    whatsapp?: boolean;
                };
                plan_identifier: "basic"
                | "free"
                | "pro"
                | "custom";
                require_action?: boolean;
                status: string;
                stripe_customer_id?: string;
            };
            actual_use?: {
                accounts: number;
                ai_credits?: number;
                artificial_inteligence?: boolean;
                integrations: number;
                publications: number;
                space: number;
                stats?: boolean;
                twitter_credits?: number;
                users: number;
                whatsapp?: boolean;
            };
            ai_settings?: {
                image?: | null
                | {
                    api_key?: string;
                    has_api_key?: boolean;
                    model: string;
                    provider: "openrouter"
                    | "openai"
                    | "google"
                    | "anthropic";
                };
                orchestrator?: | null
                | {
                    api_key?: string;
                    has_api_key?: boolean;
                    model: string;
                    provider: "openrouter"
                    | "openai"
                    | "google"
                    | "anthropic";
                };
                text?: | null
                | {
                    api_key?: string;
                    has_api_key?: boolean;
                    model: string;
                    provider: "openrouter"
                    | "openai"
                    | "google"
                    | "anthropic";
                };
            };
            client_type?: "personal"
            | "company";
            creation_date: string;
            name: string;
            trial_tested?: boolean;
        },
    >

  • Los clientes, página a página, sin tener que llevar el offset a mano.

    Parameters

    Returns AsyncGenerator<
        {
            _id: string;
            actual_asigned?: {
                accounts: number;
                ai_credits?: number;
                artificial_inteligence?: boolean;
                integrations: number;
                publications: number;
                space: number;
                stats?: boolean;
                twitter_credits?: number;
                users: number;
                whatsapp?: boolean;
            };
            actual_plan: {
                current_period_end?: string;
                current_period_start?: string;
                enabled: boolean;
                isEnabled: boolean;
                plan_data: {
                    accounts: number;
                    ai_credits?: number;
                    artificial_inteligence?: boolean;
                    integrations: number;
                    publications: number;
                    space: number;
                    stats?: boolean;
                    twitter_credits?: number;
                    users: number;
                    whatsapp?: boolean;
                };
                plan_identifier: "basic"
                | "free"
                | "pro"
                | "custom";
                require_action?: boolean;
                status: string;
                stripe_customer_id?: string;
            };
            actual_use?: {
                accounts: number;
                ai_credits?: number;
                artificial_inteligence?: boolean;
                integrations: number;
                publications: number;
                space: number;
                stats?: boolean;
                twitter_credits?: number;
                users: number;
                whatsapp?: boolean;
            };
            ai_settings?: {
                image?: | null
                | {
                    api_key?: string;
                    has_api_key?: boolean;
                    model: string;
                    provider: "openrouter"
                    | "openai"
                    | "google"
                    | "anthropic";
                };
                orchestrator?: | null
                | {
                    api_key?: string;
                    has_api_key?: boolean;
                    model: string;
                    provider: "openrouter"
                    | "openai"
                    | "google"
                    | "anthropic";
                };
                text?: | null
                | {
                    api_key?: string;
                    has_api_key?: boolean;
                    model: string;
                    provider: "openrouter"
                    | "openai"
                    | "google"
                    | "anthropic";
                };
            };
            client_type?: "personal"
            | "company";
            creation_date: string;
            name: string;
            trial_tested?: boolean;
        },
    >

  • Las organizaciones raíz de un cliente, encadenando páginas.

    Parameters

    Returns AsyncGenerator<
        {
            _id: string;
            actual_asigned?: {
                accounts: number;
                ai_credits?: number;
                artificial_inteligence?: boolean;
                integrations: number;
                publications: number;
                space: number;
                stats?: boolean;
                twitter_credits?: number;
                users: number;
                whatsapp?: boolean;
            };
            actual_plan?: {
                accounts: number;
                ai_credits?: number;
                artificial_inteligence?: boolean;
                integrations: number;
                publications: number;
                space: number;
                stats?: boolean;
                twitter_credits?: number;
                users: number;
                whatsapp?: boolean;
            };
            actual_use?: {
                accounts: number;
                ai_credits?: number;
                artificial_inteligence?: boolean;
                integrations: number;
                publications: number;
                space: number;
                stats?: boolean;
                twitter_credits?: number;
                users: number;
                whatsapp?: boolean;
            };
            ai_context?: {
                audience?: string;
                avoid?: string;
                blog_url?: string;
                brand_name?: string;
                default_tone?: string;
                description?: string;
                keywords?: string[];
                notes?: string;
                products?: string;
                sector?: string;
                shop_url?: string;
                social_urls?: string[];
                value_proposition?: string;
                website?: string;
            };
            creation_date: string;
            id_client: string;
            name: string;
            parent_organization?: string;
            social_credentials?: {
                discord?: {
                    application_name?: string;
                    client_id?: string;
                    has_bot_token?: boolean;
                    has_client_secret?: boolean;
                    verified_date?: string;
                };
            };
            stats_settings?: { auto_refresh_twitter: boolean };
        },
    >

  • Los clientes que puede ver quien llama. Con credenciales de app, el suyo.

    Parameters

    Returns Promise<
        Paginated<
            {
                _id: string;
                actual_asigned?: {
                    accounts: number;
                    ai_credits?: number;
                    artificial_inteligence?: boolean;
                    integrations: number;
                    publications: number;
                    space: number;
                    stats?: boolean;
                    twitter_credits?: number;
                    users: number;
                    whatsapp?: boolean;
                };
                actual_plan: {
                    current_period_end?: string;
                    current_period_start?: string;
                    enabled: boolean;
                    isEnabled: boolean;
                    plan_data: {
                        accounts: number;
                        ai_credits?: number;
                        artificial_inteligence?: boolean;
                        integrations: number;
                        publications: number;
                        space: number;
                        stats?: boolean;
                        twitter_credits?: number;
                        users: number;
                        whatsapp?: boolean;
                    };
                    plan_identifier: "basic"
                    | "free"
                    | "pro"
                    | "custom";
                    require_action?: boolean;
                    status: string;
                    stripe_customer_id?: string;
                };
                actual_use?: {
                    accounts: number;
                    ai_credits?: number;
                    artificial_inteligence?: boolean;
                    integrations: number;
                    publications: number;
                    space: number;
                    stats?: boolean;
                    twitter_credits?: number;
                    users: number;
                    whatsapp?: boolean;
                };
                ai_settings?: {
                    image?: | null
                    | {
                        api_key?: string;
                        has_api_key?: boolean;
                        model: string;
                        provider: "openrouter"
                        | "openai"
                        | "google"
                        | "anthropic";
                    };
                    orchestrator?: | null
                    | {
                        api_key?: string;
                        has_api_key?: boolean;
                        model: string;
                        provider: "openrouter"
                        | "openai"
                        | "google"
                        | "anthropic";
                    };
                    text?: | null
                    | {
                        api_key?: string;
                        has_api_key?: boolean;
                        model: string;
                        provider: "openrouter"
                        | "openai"
                        | "google"
                        | "anthropic";
                    };
                };
                client_type?: "personal"
                | "company";
                creation_date: string;
                name: string;
                trial_tested?: boolean;
            },
        >,
    >

  • Las organizaciones RAÍZ de un cliente. Las hijas cuelgan de cada una.

    Parameters

    Returns Promise<
        Paginated<
            {
                _id: string;
                actual_asigned?: {
                    accounts: number;
                    ai_credits?: number;
                    artificial_inteligence?: boolean;
                    integrations: number;
                    publications: number;
                    space: number;
                    stats?: boolean;
                    twitter_credits?: number;
                    users: number;
                    whatsapp?: boolean;
                };
                actual_plan?: {
                    accounts: number;
                    ai_credits?: number;
                    artificial_inteligence?: boolean;
                    integrations: number;
                    publications: number;
                    space: number;
                    stats?: boolean;
                    twitter_credits?: number;
                    users: number;
                    whatsapp?: boolean;
                };
                actual_use?: {
                    accounts: number;
                    ai_credits?: number;
                    artificial_inteligence?: boolean;
                    integrations: number;
                    publications: number;
                    space: number;
                    stats?: boolean;
                    twitter_credits?: number;
                    users: number;
                    whatsapp?: boolean;
                };
                ai_context?: {
                    audience?: string;
                    avoid?: string;
                    blog_url?: string;
                    brand_name?: string;
                    default_tone?: string;
                    description?: string;
                    keywords?: string[];
                    notes?: string;
                    products?: string;
                    sector?: string;
                    shop_url?: string;
                    social_urls?: string[];
                    value_proposition?: string;
                    website?: string;
                };
                creation_date: string;
                id_client: string;
                name: string;
                parent_organization?: string;
                social_credentials?: {
                    discord?: {
                        application_name?: string;
                        client_id?: string;
                        has_bot_token?: boolean;
                        has_client_secret?: boolean;
                        verified_date?: string;
                    };
                };
                stats_settings?: { auto_refresh_twitter: boolean };
            },
        >,
    >

  • Cambia lo poco que de un cliente se puede cambiar: hoy, su nombre.

    Parameters

    Returns Promise<
        {
            _id: string;
            actual_asigned?: {
                accounts: number;
                ai_credits?: number;
                artificial_inteligence?: boolean;
                integrations: number;
                publications: number;
                space: number;
                stats?: boolean;
                twitter_credits?: number;
                users: number;
                whatsapp?: boolean;
            };
            actual_plan: {
                current_period_end?: string;
                current_period_start?: string;
                enabled: boolean;
                isEnabled: boolean;
                plan_data: {
                    accounts: number;
                    ai_credits?: number;
                    artificial_inteligence?: boolean;
                    integrations: number;
                    publications: number;
                    space: number;
                    stats?: boolean;
                    twitter_credits?: number;
                    users: number;
                    whatsapp?: boolean;
                };
                plan_identifier: "basic"
                | "free"
                | "pro"
                | "custom";
                require_action?: boolean;
                status: string;
                stripe_customer_id?: string;
            };
            actual_use?: {
                accounts: number;
                ai_credits?: number;
                artificial_inteligence?: boolean;
                integrations: number;
                publications: number;
                space: number;
                stats?: boolean;
                twitter_credits?: number;
                users: number;
                whatsapp?: boolean;
            };
            ai_settings?: {
                image?: | null
                | {
                    api_key?: string;
                    has_api_key?: boolean;
                    model: string;
                    provider: "openrouter"
                    | "openai"
                    | "google"
                    | "anthropic";
                };
                orchestrator?: | null
                | {
                    api_key?: string;
                    has_api_key?: boolean;
                    model: string;
                    provider: "openrouter"
                    | "openai"
                    | "google"
                    | "anthropic";
                };
                text?: | null
                | {
                    api_key?: string;
                    has_api_key?: boolean;
                    model: string;
                    provider: "openrouter"
                    | "openai"
                    | "google"
                    | "anthropic";
                };
            };
            client_type?: "personal"
            | "company";
            creation_date: string;
            name: string;
            trial_tested?: boolean;
        },
    >

  • Configura los proveedores de IA del cliente (BYOK), ámbito por ámbito.

    Un ámbito puesto a null BORRA su configuración y devuelve ese ámbito a los créditos de PlanVortex; con proveedor propio, generar no cuesta créditos porque el cliente paga a su proveedor. orchestrator y text exigen un proveedor de texto e image uno de imagen.

    Se manda la clave y no vuelve nunca: la respuesta es el cliente, sin secretos.

    Parameters

    • idClient: string
    • body: {
          image?:
              | null
              | {
                  api_key?: string;
                  has_api_key?: boolean;
                  model: string;
                  provider: "openrouter"
                  | "openai"
                  | "google"
                  | "anthropic";
              };
          orchestrator?: | null
          | {
              api_key?: string;
              has_api_key?: boolean;
              model: string;
              provider: "openrouter"
              | "openai"
              | "google"
              | "anthropic";
          };
          text?: | null
          | {
              api_key?: string;
              has_api_key?: boolean;
              model: string;
              provider: "openrouter"
              | "openai"
              | "google"
              | "anthropic";
          };
      }
      • Optionalimage?:
            | null
            | {
                api_key?: string;
                has_api_key?: boolean;
                model: string;
                provider: "openrouter"
                | "openai"
                | "google"
                | "anthropic";
            }

        Configuration of the image scope. null clears it and returns the scope to PlanVortex credits.

      • Optionalorchestrator?:
            | null
            | {
                api_key?: string;
                has_api_key?: boolean;
                model: string;
                provider: "openrouter"
                | "openai"
                | "google"
                | "anthropic";
            }

        Configuration of the orchestrator scope. null clears it and returns the scope to PlanVortex credits.

      • Optionaltext?:
            | null
            | {
                api_key?: string;
                has_api_key?: boolean;
                model: string;
                provider: "openrouter"
                | "openai"
                | "google"
                | "anthropic";
            }

        Configuration of the text scope. null clears it and returns the scope to PlanVortex credits.

    • options: RequestOptions = {}

    Returns Promise<
        {
            _id: string;
            actual_asigned?: {
                accounts: number;
                ai_credits?: number;
                artificial_inteligence?: boolean;
                integrations: number;
                publications: number;
                space: number;
                stats?: boolean;
                twitter_credits?: number;
                users: number;
                whatsapp?: boolean;
            };
            actual_plan: {
                current_period_end?: string;
                current_period_start?: string;
                enabled: boolean;
                isEnabled: boolean;
                plan_data: {
                    accounts: number;
                    ai_credits?: number;
                    artificial_inteligence?: boolean;
                    integrations: number;
                    publications: number;
                    space: number;
                    stats?: boolean;
                    twitter_credits?: number;
                    users: number;
                    whatsapp?: boolean;
                };
                plan_identifier: "basic"
                | "free"
                | "pro"
                | "custom";
                require_action?: boolean;
                status: string;
                stripe_customer_id?: string;
            };
            actual_use?: {
                accounts: number;
                ai_credits?: number;
                artificial_inteligence?: boolean;
                integrations: number;
                publications: number;
                space: number;
                stats?: boolean;
                twitter_credits?: number;
                users: number;
                whatsapp?: boolean;
            };
            ai_settings?: {
                image?: | null
                | {
                    api_key?: string;
                    has_api_key?: boolean;
                    model: string;
                    provider: "openrouter"
                    | "openai"
                    | "google"
                    | "anthropic";
                };
                orchestrator?: | null
                | {
                    api_key?: string;
                    has_api_key?: boolean;
                    model: string;
                    provider: "openrouter"
                    | "openai"
                    | "google"
                    | "anthropic";
                };
                text?: | null
                | {
                    api_key?: string;
                    has_api_key?: boolean;
                    model: string;
                    provider: "openrouter"
                    | "openai"
                    | "google"
                    | "anthropic";
                };
            };
            client_type?: "personal"
            | "company";
            creation_date: string;
            name: string;
            trial_tested?: boolean;
        },
    >

  • Cambia una organización raíz: su nombre o el cupo que tiene asignado.

    Parameters

    Returns Promise<
        {
            _id: string;
            actual_asigned?: {
                accounts: number;
                ai_credits?: number;
                artificial_inteligence?: boolean;
                integrations: number;
                publications: number;
                space: number;
                stats?: boolean;
                twitter_credits?: number;
                users: number;
                whatsapp?: boolean;
            };
            actual_plan?: {
                accounts: number;
                ai_credits?: number;
                artificial_inteligence?: boolean;
                integrations: number;
                publications: number;
                space: number;
                stats?: boolean;
                twitter_credits?: number;
                users: number;
                whatsapp?: boolean;
            };
            actual_use?: {
                accounts: number;
                ai_credits?: number;
                artificial_inteligence?: boolean;
                integrations: number;
                publications: number;
                space: number;
                stats?: boolean;
                twitter_credits?: number;
                users: number;
                whatsapp?: boolean;
            };
            ai_context?: {
                audience?: string;
                avoid?: string;
                blog_url?: string;
                brand_name?: string;
                default_tone?: string;
                description?: string;
                keywords?: string[];
                notes?: string;
                products?: string;
                sector?: string;
                shop_url?: string;
                social_urls?: string[];
                value_proposition?: string;
                website?: string;
            };
            creation_date: string;
            id_client: string;
            name: string;
            parent_organization?: string;
            social_credentials?: {
                discord?: {
                    application_name?: string;
                    client_id?: string;
                    has_bot_token?: boolean;
                    has_client_secret?: boolean;
                    verified_date?: string;
                };
            };
            stats_settings?: { auto_refresh_twitter: boolean };
        },
    >

  • Los clientes que puede ver quien llama, con sus organizaciones raíz dentro, en una sola llamada.

    Es el atajo del arranque: con list y organizations hacen falta 1 + N peticiones para pintar el selector de organización. Aquí cada cliente trae su array organizations y su propio total.

    Parameters

    Returns Promise<
        Paginated<
            {
                _id: string;
                actual_asigned?: {
                    accounts: number;
                    ai_credits?: number;
                    artificial_inteligence?: boolean;
                    integrations: number;
                    publications: number;
                    space: number;
                    stats?: boolean;
                    twitter_credits?: number;
                    users: number;
                    whatsapp?: boolean;
                };
                actual_plan: {
                    current_period_end?: string;
                    current_period_start?: string;
                    enabled: boolean;
                    isEnabled: boolean;
                    plan_data: {
                        accounts: number;
                        ai_credits?: number;
                        artificial_inteligence?: boolean;
                        integrations: number;
                        publications: number;
                        space: number;
                        stats?: boolean;
                        twitter_credits?: number;
                        users: number;
                        whatsapp?: boolean;
                    };
                    plan_identifier: "basic"
                    | "free"
                    | "pro"
                    | "custom";
                    require_action?: boolean;
                    status: string;
                    stripe_customer_id?: string;
                };
                actual_use?: {
                    accounts: number;
                    ai_credits?: number;
                    artificial_inteligence?: boolean;
                    integrations: number;
                    publications: number;
                    space: number;
                    stats?: boolean;
                    twitter_credits?: number;
                    users: number;
                    whatsapp?: boolean;
                };
                ai_settings?: {
                    image?: | null
                    | {
                        api_key?: string;
                        has_api_key?: boolean;
                        model: string;
                        provider: "openrouter"
                        | "openai"
                        | "google"
                        | "anthropic";
                    };
                    orchestrator?: | null
                    | {
                        api_key?: string;
                        has_api_key?: boolean;
                        model: string;
                        provider: "openrouter"
                        | "openai"
                        | "google"
                        | "anthropic";
                    };
                    text?: | null
                    | {
                        api_key?: string;
                        has_api_key?: boolean;
                        model: string;
                        provider: "openrouter"
                        | "openai"
                        | "google"
                        | "anthropic";
                    };
                };
                client_type?: "personal"
                | "company";
                creation_date: string;
                name: string;
                trial_tested?: boolean;
            } & {
                organizations: {
                    _id: string;
                    actual_asigned?: {
                        accounts: number;
                        ai_credits?: number;
                        artificial_inteligence?: boolean;
                        integrations: number;
                        publications: number;
                        space: number;
                        stats?: boolean;
                        twitter_credits?: number;
                        users: number;
                        whatsapp?: boolean;
                    };
                    actual_plan?: {
                        accounts: number;
                        ai_credits?: number;
                        artificial_inteligence?: boolean;
                        integrations: number;
                        publications: number;
                        space: number;
                        stats?: boolean;
                        twitter_credits?: number;
                        users: number;
                        whatsapp?: boolean;
                    };
                    actual_use?: {
                        accounts: number;
                        ai_credits?: number;
                        artificial_inteligence?: boolean;
                        integrations: number;
                        publications: number;
                        space: number;
                        stats?: boolean;
                        twitter_credits?: number;
                        users: number;
                        whatsapp?: boolean;
                    };
                    ai_context?: {
                        audience?: string;
                        avoid?: string;
                        blog_url?: string;
                        brand_name?: string;
                        default_tone?: string;
                        description?: string;
                        keywords?: string[];
                        notes?: string;
                        products?: string;
                        sector?: string;
                        shop_url?: string;
                        social_urls?: string[];
                        value_proposition?: string;
                        website?: string;
                    };
                    creation_date: string;
                    id_client: string;
                    name: string;
                    parent_organization?: string;
                    social_credentials?: {
                        discord?: {
                            application_name?: (...)
                            | (...);
                            client_id?: (...) | (...);
                            has_bot_token?: (...) | (...) | (...);
                            has_client_secret?: (...) | (...) | (...);
                            verified_date?: (...) | (...);
                        };
                    };
                    stats_settings?: { auto_refresh_twitter: boolean };
                }[];
                total: number;
            },
        >,
    >