import type { RequestOptions } from "../base-client"; import { RequestBuilder } from "../request-builder"; /** Attributes accepted when creating a CRM contact. */ export type CreateCrmContactAttributes = { workspace_id: string; first_name?: string; last_name?: string; prefix?: string; suffix?: string; middle_name?: string; email?: string; phone?: string; title?: string; date_of_birth?: string; sex?: "male" | "female" | "other"; timezone?: string; locale?: string; lifecycle_stage?: string; source?: string; owner_id?: string | null; external_owner_id?: string; avatar_url?: string; properties?: Record; tags?: string[]; portal_user_id?: string; }; /** Attributes accepted when updating a CRM contact (PATCH semantics). */ export type UpdateCrmContactAttributes = { first_name?: string; last_name?: string; prefix?: string; suffix?: string; middle_name?: string; email?: string; phone?: string; title?: string; date_of_birth?: string; sex?: "male" | "female" | "other"; timezone?: string; locale?: string; lifecycle_stage?: string; owner_id?: string | null; external_owner_id?: string; avatar_url?: string; properties?: Record; tags?: string[]; portal_user_id?: string; }; /** Attributes accepted when creating a CRM address. */ export type CreateCrmAddressAttributes = { workspace_id: string; entity_type: "contact" | "company"; entity_id: string; label?: "home" | "work" | "billing" | "shipping" | "headquarters" | "branch" | "other"; is_primary?: boolean; line1?: string; line2?: string; city?: string; state?: string; postal_code?: string; country?: string; latitude?: number; longitude?: number; }; /** Attributes accepted when updating a CRM address. */ export type UpdateCrmAddressAttributes = { label?: "home" | "work" | "billing" | "shipping" | "headquarters" | "branch" | "other"; is_primary?: boolean; line1?: string; line2?: string; city?: string; state?: string; postal_code?: string; country?: string; latitude?: number; longitude?: number; }; /** Attributes accepted when creating a CRM phone number. */ export type CreateCrmPhoneNumberAttributes = { workspace_id: string; entity_type: "contact" | "company"; entity_id: string; number: string; label?: "mobile" | "work" | "home" | "fax" | "main" | "other"; is_primary?: boolean; country_code?: string; extension?: string; }; /** Attributes accepted when updating a CRM phone number. */ export type UpdateCrmPhoneNumberAttributes = { number?: string; label?: "mobile" | "work" | "home" | "fax" | "main" | "other"; is_primary?: boolean; country_code?: string; extension?: string; }; /** Attributes accepted when creating a CRM email address. */ export type CreateCrmEmailAddressAttributes = { workspace_id: string; entity_type: "contact" | "company"; entity_id: string; email: string; label?: "work" | "personal" | "billing" | "support" | "other"; is_primary?: boolean; is_verified?: boolean; }; /** Attributes accepted when updating a CRM email address. */ export type UpdateCrmEmailAddressAttributes = { email?: string; label?: "work" | "personal" | "billing" | "support" | "other"; is_primary?: boolean; is_verified?: boolean; }; /** Attributes accepted when creating a CRM social profile. */ export type CreateCrmSocialProfileAttributes = { workspace_id: string; entity_type: "contact" | "company"; entity_id: string; platform: "linkedin" | "twitter" | "facebook" | "instagram" | "github" | "youtube" | "tiktok" | "other"; handle?: string; url?: string; }; /** Attributes accepted when updating a CRM social profile. */ export type UpdateCrmSocialProfileAttributes = { handle?: string; url?: string; }; /** Attributes accepted when creating a CRM website. */ export type CreateCrmWebsiteAttributes = { workspace_id: string; entity_type: "contact" | "company"; entity_id: string; url: string; label?: "main" | "careers" | "blog" | "docs" | "portfolio" | "other"; is_primary?: boolean; }; /** Attributes accepted when updating a CRM website. */ export type UpdateCrmWebsiteAttributes = { url?: string; label?: "main" | "careers" | "blog" | "docs" | "portfolio" | "other"; is_primary?: boolean; }; /** Attributes accepted when creating a CRM company. */ export type CreateCrmCompanyAttributes = { workspace_id: string; name: string; domain?: string; industry?: string; employee_count?: number; annual_revenue?: number; location?: string; description?: string; type?: "public" | "private" | "nonprofit" | "government" | "partnership" | "other"; founded_date?: string; tax_id?: string; owner_id?: string | null; external_owner_id?: string; lifecycle_stage?: string; }; /** Attributes accepted when updating a CRM company (PATCH semantics). */ export type UpdateCrmCompanyAttributes = { name?: string; domain?: string; industry?: string; employee_count?: number; annual_revenue?: number; location?: string; description?: string; type?: "public" | "private" | "nonprofit" | "government" | "partnership" | "other"; founded_date?: string; tax_id?: string; owner_id?: string | null; external_owner_id?: string; lifecycle_stage?: string; }; /** Attributes accepted when creating a CRM deal. */ export type CreateCrmDealAttributes = { workspace_id: string; name: string; amount?: number; currency?: string; close_date?: string; probability?: number; source?: string; status?: string; lost_reason?: string; properties?: Record; owner_id?: string | null; external_owner_id?: string; pipeline_id?: string; pipeline_stage_id?: string; company_id?: string; application_id?: string; }; /** Attributes accepted when updating a CRM deal (PATCH semantics). */ export type UpdateCrmDealAttributes = { name?: string; amount?: number; currency?: string; close_date?: string; probability?: number; status?: string; lost_reason?: string; properties?: Record; owner_id?: string | null; external_owner_id?: string; pipeline_id?: string; pipeline_stage_id?: string; company_id?: string; ai_risk_score?: number; ai_forecast_category?: string; ai_next_action?: string; }; /** Attributes accepted when moving a deal to a different pipeline stage. */ export type MoveDealStageAttributes = { stage_id: string; }; /** Attributes accepted when creating a CRM activity. */ export type CreateCrmActivityAttributes = { workspace_id: string; type: string; subject?: string; body?: string; occurred_at?: string; duration_seconds?: number; direction?: string; source?: string; source_ref?: string; sentiment?: string; properties?: Record; content_hash?: string; ai_summary?: string; application_id?: string; }; /** Attributes accepted when updating a CRM activity (PATCH semantics). */ export type UpdateCrmActivityAttributes = { subject?: string; body?: string; sentiment?: string; properties?: Record; ai_summary?: string; ai_action_items?: string[]; }; /** Attributes accepted when creating a CRM pipeline. */ export type CreateCrmPipelineAttributes = { workspace_id: string; name: string; }; /** Attributes accepted when updating a CRM pipeline (PATCH semantics). */ export type UpdateCrmPipelineAttributes = { name?: string; }; /** Attributes accepted when creating a pipeline stage. */ export type CreateCrmPipelineStageAttributes = { pipeline_id: string; name: string; order?: number; }; /** Attributes accepted when updating a pipeline stage (PATCH semantics). */ export type UpdateCrmPipelineStageAttributes = { name?: string; order?: number; }; /** Attributes accepted when creating a relationship. */ export type CreateCrmRelationshipAttributes = { relationship_type_id: string; from_entity_type: string; from_entity_id: string; to_entity_type: string; to_entity_id: string; }; /** Attributes accepted when creating a relationship type. */ export type CreateCrmRelationshipTypeAttributes = { label: string; inverse_label?: string; from_entity_type: string; to_entity_type: string; }; /** Attributes accepted when updating a relationship type (PATCH semantics). */ export type UpdateCrmRelationshipTypeAttributes = { label?: string; inverse_label?: string; }; /** Attributes accepted when creating a custom entity. */ export type CreateCrmCustomEntityAttributes = { workspace_id: string; entity_type: string; properties?: Record; owner_id?: string | null; external_owner_id?: string; }; /** Attributes accepted when updating a custom entity (PATCH semantics). */ export type UpdateCrmCustomEntityAttributes = { properties?: Record; owner_id?: string | null; external_owner_id?: string; }; /** Attributes accepted when creating a deal product. */ export type CreateCrmDealProductAttributes = { deal_id: string; product_id: string; workspace_id: string; quantity?: number; unit_price?: number; properties?: Record; }; /** Attributes accepted when creating a data export job. */ export type CreateCrmDataExportAttributes = { workspace_id: string; entity_type: "contact" | "custom_entity" | "activity"; entity_subtype?: string; format: "json" | "csv"; include?: string[]; filters?: Array<{ field: string; op: string; value?: unknown; }>; }; /** Attributes accepted when creating a custom entity type. */ export type CreateCrmCustomEntityTypeAttributes = { application_id: string; name: string; slug: string; icon?: string; field_definitions?: Record[]; relationships_config?: Record; pipelineable?: boolean; searchable?: boolean; include_alias?: string; }; /** Attributes accepted when updating a custom entity type (PATCH semantics). */ export type UpdateCrmCustomEntityTypeAttributes = { name?: string; icon?: string; field_definitions?: Record[]; relationships_config?: Record; pipelineable?: boolean; searchable?: boolean; include_alias?: string; }; /** Attributes accepted when creating a custom field definition. */ export type CreateCrmCustomFieldDefinitionAttributes = { application_id: string; entity_type: string; name: string; label?: string; field_type: string; required?: boolean; default_value?: unknown; options?: unknown[]; validation_rules?: Record; searchable?: boolean; filterable?: boolean; sort_order?: number; }; /** Attributes accepted when updating a custom field definition (PATCH semantics). */ export type UpdateCrmCustomFieldDefinitionAttributes = { label?: string; required?: boolean; default_value?: unknown; options?: unknown[]; validation_rules?: Record; searchable?: boolean; filterable?: boolean; sort_order?: number; }; /** Attributes accepted when creating a channel capture config. */ export type CreateCrmChannelCaptureConfigAttributes = { workspace_id: string; application_id: string; enabled?: boolean; channel_types?: string[]; auto_create_contacts?: boolean; pii_scan_enabled?: boolean; content_retention_days?: number; }; /** Attributes accepted when updating a channel capture config (PATCH semantics). */ export type UpdateCrmChannelCaptureConfigAttributes = { enabled?: boolean; channel_types?: string[]; auto_create_contacts?: boolean; pii_scan_enabled?: boolean; content_retention_days?: number; }; /** Attributes accepted when creating a sync config. */ export type CreateCrmSyncConfigAttributes = { workspace_id: string; application_id: string; connector_instance_id: string; enabled?: boolean; auto_create_contacts?: boolean; pii_scan_enabled?: boolean; entity_type_filters?: string[]; }; /** Attributes accepted when updating a sync config (PATCH semantics). */ export type UpdateCrmSyncConfigAttributes = { enabled?: boolean; auto_create_contacts?: boolean; pii_scan_enabled?: boolean; entity_type_filters?: string[]; }; /** Parameters for finding paths between two CRM entities via the relationship graph. */ export type CrmGraphPathsParams = { from_type: string; from_id: string; to_type: string; to_id: string; max_hops?: number; relationship_types?: string; fresh?: boolean; }; /** Parameters for getting entities related to a given entity within N hops. */ export type CrmGraphRelatedParams = { entity_type: string; entity_id: string; max_depth?: number; relationship_types?: string; fresh?: boolean; }; /** Parameters for computing relationship strength between two entities. */ export type CrmGraphStrengthParams = { from_type: string; from_id: string; to_type: string; to_id: string; fresh?: boolean; }; /** Parameters for merging two CRM entities (contacts or companies). */ export type CrmMergeParams = { workspace_id: string; primary_id: string; secondary_id: string; }; /** Parameters for hybrid CRM search. */ export type CrmSearchParams = { workspace_id: string; q: string; types?: string; mode?: "hybrid" | "lexical" | "semantic"; }; /** * CRM management namespace — contacts, companies, deals, pipelines, and ISV configuration. * * Covers the full CRM lifecycle: manage contacts and companies, track deals through * pipelines, log activities, configure custom entity types and fields, and set up * channel capture and sync configurations. */ export declare function createCrmNamespace(rb: RequestBuilder): { /** * Fetch a single contact by their unique ID. * * @param id - The unique identifier of the contact to retrieve. * @param options - Optional request-level overrides. * @returns A promise that resolves to the matching contact resource. */ get: (id: string, options?: RequestOptions) => Promise; /** * List contacts in a workspace. * * @param workspaceId - The workspace whose contacts should be listed. * @param options - Optional pagination controls and request-level overrides. * @returns A promise that resolves to a JSON:API list of contact resources. */ listByWorkspace: (workspaceId: string, options?: RequestOptions) => Promise; /** * List archived contacts in a workspace. * * @param workspaceId - The workspace whose archived contacts should be listed. * @param options - Optional pagination controls and request-level overrides. * @returns A promise that resolves to a JSON:API list of archived contact resources. */ listArchived: (workspaceId: string, options?: RequestOptions) => Promise; /** * Create a new contact in the CRM. * * @param attributes - Contact attributes. Must include `workspace_id`. Common * optional fields are `first_name`, `last_name`, `email`, `phone`, and * `lifecycle_stage`. * @param options - Optional request-level overrides. * @returns A promise that resolves to the newly created contact resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * const contact = await admin.crm.create({ * workspace_id: 'ws_xyz789', * first_name: 'Jane', * email: 'jane@example.com', * }); * ``` */ create: (attributes: CreateCrmContactAttributes, options?: RequestOptions) => Promise; /** * Update an existing contact's attributes (PATCH semantics — only fields * present in `attributes` are changed). * * @param id - The unique identifier of the contact to update. * @param attributes - Key/value map of attributes to change. * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated contact resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.update('con_abc123', { * lifecycle_stage: 'customer', * tags: ['vip'], * }); * ``` */ update: (id: string, attributes: UpdateCrmContactAttributes, options?: RequestOptions) => Promise; /** * Archive (soft-delete) a contact. The contact is hidden from default * listings but can be restored via {@link unarchive}. * * @param id - The unique identifier of the contact to archive. * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated contact resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.archive('con_abc123'); * ``` */ archive: (id: string, options?: RequestOptions) => Promise; /** * Restore an archived contact. * * @param id - The unique identifier of the archived contact to restore. * @param workspaceId - The workspace that owns the contact, required to * scope the restore. * @param options - Optional request-level overrides. * @returns A promise that resolves to the restored contact resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.unarchive('con_abc123', 'ws_xyz789'); * ``` */ unarchive: (id: string, workspaceId: string, options?: RequestOptions) => Promise; /** * Permanently delete a contact. This is an irreversible hard delete; for * recoverable removal use {@link archive} instead. * * @param id - The unique identifier of the contact to delete. * @param options - Optional request-level overrides. * @returns A promise that resolves to `true` on successful deletion. */ delete: (id: string, options?: RequestOptions) => Promise; companies: { /** * Fetch a single company by its unique ID. * * @param id - The unique identifier of the company. * @param options - Optional request-level overrides. * @returns A promise that resolves to the matching company resource. */ get: (id: string, options?: RequestOptions) => Promise; /** * List companies in a workspace. * * @param workspaceId - The workspace whose companies should be listed. * @param options - Optional pagination controls and request-level overrides. * @returns A promise that resolves to a JSON:API list of company resources. */ listByWorkspace: (workspaceId: string, options?: RequestOptions) => Promise; /** * Create a new company. * * @param attributes - Company attributes. Must include `workspace_id` and * `name`. Common optional fields are `domain`, `industry`, and `type`. * @param options - Optional request-level overrides. * @returns A promise that resolves to the newly created company resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.companies.create({ * workspace_id: 'ws_xyz789', * name: 'Acme Corp', * domain: 'acme.com', * }); * ``` */ create: (attributes: CreateCrmCompanyAttributes, options?: RequestOptions) => Promise; /** * Update an existing company (PATCH semantics). * * @param id - The unique identifier of the company to update. * @param attributes - Key/value map of attributes to change. * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated company resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.companies.update('co_abc123', { * employee_count: 500, * }); * ``` */ update: (id: string, attributes: UpdateCrmCompanyAttributes, options?: RequestOptions) => Promise; /** * Permanently delete a company. * * @param id - The unique identifier of the company to delete. * @param options - Optional request-level overrides. * @returns A promise that resolves to `true` on successful deletion. */ delete: (id: string, options?: RequestOptions) => Promise; }; deals: { /** * Fetch a single deal by its unique ID. * * @param id - The unique identifier of the deal. * @param options - Optional request-level overrides. * @returns A promise that resolves to the matching deal resource. */ get: (id: string, options?: RequestOptions) => Promise; /** * List deals in a workspace. * * @param workspaceId - The workspace whose deals should be listed. * @param options - Optional pagination controls and request-level overrides. * @returns A promise that resolves to a JSON:API list of deal resources. */ listByWorkspace: (workspaceId: string, options?: RequestOptions) => Promise; /** * Create a new deal. * * @param attributes - Deal attributes. Must include `workspace_id` and * `name`. Common optional fields are `amount`, `pipeline_id`, and * `pipeline_stage_id`. * @param options - Optional request-level overrides. * @returns A promise that resolves to the newly created deal resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.deals.create({ * workspace_id: 'ws_xyz789', * name: 'Enterprise Deal', * amount: 50000, * pipeline_id: 'pip_abc123', * }); * ``` */ create: (attributes: CreateCrmDealAttributes, options?: RequestOptions) => Promise; /** * Update an existing deal (PATCH semantics). * * @param id - The unique identifier of the deal to update. * @param attributes - Key/value map of attributes to change. * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated deal resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.deals.update('deal_abc123', { * amount: 75000, * status: 'won', * }); * ``` */ update: (id: string, attributes: UpdateCrmDealAttributes, options?: RequestOptions) => Promise; /** * Move a deal to a different pipeline stage. * * @param id - The unique identifier of the deal to move. * @param attributes - Move parameters. `stage_id` is the destination * pipeline stage. * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated deal resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.deals.moveStage('deal_abc123', { * stage_id: 'stg_xyz789', * }); * ``` */ moveStage: (id: string, attributes: MoveDealStageAttributes, options?: RequestOptions) => Promise; /** * Permanently delete a deal. * * @param id - The unique identifier of the deal to delete. * @param options - Optional request-level overrides. * @returns A promise that resolves to `true` on successful deletion. */ delete: (id: string, options?: RequestOptions) => Promise; }; activities: { /** * Fetch a single activity by its unique ID. * * @param id - The unique identifier of the activity. * @param options - Optional request-level overrides. * @returns A promise that resolves to the matching activity resource. */ get: (id: string, options?: RequestOptions) => Promise; /** * List activities in a workspace. * * @param workspaceId - The workspace whose activities should be listed. * @param options - Optional pagination controls and request-level overrides. * @returns A promise that resolves to a JSON:API list of activity resources. */ listByWorkspace: (workspaceId: string, options?: RequestOptions) => Promise; /** * Create a new activity (call, email, meeting, etc.) on the timeline. * * @param attributes - Activity attributes. Must include `workspace_id` * and `type`. * @param options - Optional request-level overrides. * @returns A promise that resolves to the newly created activity resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.activities.create({ * workspace_id: 'ws_xyz789', * type: 'call', * subject: 'Discovery call', * }); * ``` */ create: (attributes: CreateCrmActivityAttributes, options?: RequestOptions) => Promise; /** * Update an existing activity (PATCH semantics). * * @param id - The unique identifier of the activity to update. * @param attributes - Key/value map of attributes to change. * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated activity resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.activities.update('act_abc123', { * ai_summary: 'Client interested in enterprise plan', * }); * ``` */ update: (id: string, attributes: UpdateCrmActivityAttributes, options?: RequestOptions) => Promise; /** * Permanently delete an activity. * * @param id - The unique identifier of the activity to delete. * @param options - Optional request-level overrides. * @returns A promise that resolves to `true` on successful deletion. */ delete: (id: string, options?: RequestOptions) => Promise; }; pipelines: { /** * Fetch a single pipeline by its unique ID. * * @param id - The unique identifier of the pipeline. * @param options - Optional request-level overrides. * @returns A promise that resolves to the matching pipeline resource. */ get: (id: string, options?: RequestOptions) => Promise; /** * List pipelines in a workspace. * * @param workspaceId - The workspace whose pipelines should be listed. * @param options - Optional pagination controls and request-level overrides. * @returns A promise that resolves to a JSON:API list of pipeline resources. */ listByWorkspace: (workspaceId: string, options?: RequestOptions) => Promise; /** * Create a new pipeline. * * @param attributes - Pipeline attributes. Must include `workspace_id` * and `name`. * @param options - Optional request-level overrides. * @returns A promise that resolves to the newly created pipeline resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.pipelines.create({ * workspace_id: 'ws_xyz789', * name: 'Sales Pipeline', * }); * ``` */ create: (attributes: CreateCrmPipelineAttributes, options?: RequestOptions) => Promise; /** * Update an existing pipeline (PATCH semantics). * * @param id - The unique identifier of the pipeline to update. * @param attributes - Key/value map of attributes to change. * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated pipeline resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.pipelines.update('pip_abc123', { * name: 'Enterprise Sales', * }); * ``` */ update: (id: string, attributes: UpdateCrmPipelineAttributes, options?: RequestOptions) => Promise; /** * Permanently delete a pipeline. * * @param id - The unique identifier of the pipeline to delete. * @param options - Optional request-level overrides. * @returns A promise that resolves to `true` on successful deletion. */ delete: (id: string, options?: RequestOptions) => Promise; }; pipelineStages: { /** * Fetch a single pipeline stage by its unique ID. * * @param id - The unique identifier of the stage. * @param options - Optional request-level overrides. * @returns A promise that resolves to the matching stage resource. */ get: (id: string, options?: RequestOptions) => Promise; /** * List stages for a specific pipeline, ordered by their `order` field. * * @param pipelineId - The pipeline whose stages should be listed. * @param options - Optional request-level overrides. * @returns A promise that resolves to a JSON:API list of stage resources. */ listByPipeline: (pipelineId: string, options?: RequestOptions) => Promise; /** * Create a new pipeline stage. * * @param attributes - Stage attributes. Must include `pipeline_id` and * `name`. * @param options - Optional request-level overrides. * @returns A promise that resolves to the newly created stage resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.pipelineStages.create({ * pipeline_id: 'pip_abc123', * name: 'Qualification', * order: 1, * }); * ``` */ create: (attributes: CreateCrmPipelineStageAttributes, options?: RequestOptions) => Promise; /** * Update an existing pipeline stage (PATCH semantics). * * @param id - The unique identifier of the stage to update. * @param attributes - Key/value map of attributes to change. * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated stage resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.pipelineStages.update('stg_abc123', { * name: 'Negotiation', * order: 3, * }); * ``` */ update: (id: string, attributes: UpdateCrmPipelineStageAttributes, options?: RequestOptions) => Promise; /** * Permanently delete a pipeline stage. * * @param id - The unique identifier of the stage to delete. * @param options - Optional request-level overrides. * @returns A promise that resolves to `true` on successful deletion. */ delete: (id: string, options?: RequestOptions) => Promise; }; relationships: { /** * Fetch a single relationship by its unique ID. * * @param id - The unique identifier of the relationship. * @param options - Optional request-level overrides. * @returns A promise that resolves to the matching relationship resource. */ get: (id: string, options?: RequestOptions) => Promise; /** * List relationships in a workspace. * * @param workspaceId - The workspace whose relationships should be listed. * @param options - Optional pagination controls and request-level overrides. * @returns A promise that resolves to a JSON:API list of relationship resources. */ listByWorkspace: (workspaceId: string, options?: RequestOptions) => Promise; /** * Create a directed relationship between two CRM entities. * * @param attributes - Relationship attributes including * `relationship_type_id`, `from_entity_type`, `from_entity_id`, * `to_entity_type`, and `to_entity_id`. * @param options - Optional request-level overrides. * @returns A promise that resolves to the newly created relationship resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.relationships.create({ * relationship_type_id: 'rt_abc123', * from_entity_type: 'company', * from_entity_id: 'co_xyz789', * to_entity_type: 'contact', * to_entity_id: 'con_abc123', * }); * ``` */ create: (attributes: CreateCrmRelationshipAttributes, options?: RequestOptions) => Promise; /** * Permanently delete a relationship. * * @param id - The unique identifier of the relationship to delete. * @param options - Optional request-level overrides. * @returns A promise that resolves to `true` on successful deletion. */ delete: (id: string, options?: RequestOptions) => Promise; }; relationshipTypes: { /** * Fetch a single relationship type by its unique ID. * * @param id - The unique identifier of the relationship type. * @param options - Optional request-level overrides. * @returns A promise that resolves to the matching relationship-type resource. */ get: (id: string, options?: RequestOptions) => Promise; /** * List all relationship types. * * @param options - Optional pagination controls and request-level overrides. * @returns A promise that resolves to a JSON:API list of relationship-type resources. */ list: (options?: RequestOptions) => Promise; /** * Create a new relationship type. * * @param attributes - Relationship-type attributes including `label`, * `from_entity_type`, and `to_entity_type`. Optionally provide an * `inverse_label` for the reverse direction. * @param options - Optional request-level overrides. * @returns A promise that resolves to the newly created relationship-type resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.relationshipTypes.create({ * label: 'employs', * inverse_label: 'employed_by', * from_entity_type: 'company', * to_entity_type: 'contact', * }); * ``` */ create: (attributes: CreateCrmRelationshipTypeAttributes, options?: RequestOptions) => Promise; /** * Update an existing relationship type (PATCH semantics). * * @param id - The unique identifier of the relationship type to update. * @param attributes - Key/value map of attributes to change. * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated relationship-type resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.relationshipTypes.update('rt_abc123', { * label: 'hires', * }); * ``` */ update: (id: string, attributes: UpdateCrmRelationshipTypeAttributes, options?: RequestOptions) => Promise; /** * Permanently delete a relationship type. * * @param id - The unique identifier of the relationship type to delete. * @param options - Optional request-level overrides. * @returns A promise that resolves to `true` on successful deletion. */ delete: (id: string, options?: RequestOptions) => Promise; }; customEntities: { /** * Fetch a single custom entity by its unique ID. * * @param id - The unique identifier of the custom entity. * @param options - Optional request-level overrides. * @returns A promise that resolves to the matching custom-entity resource. */ get: (id: string, options?: RequestOptions) => Promise; /** * List custom entities in a workspace. * * @param workspaceId - The workspace whose custom entities should be listed. * @param options - Optional pagination controls and request-level overrides. * @returns A promise that resolves to a JSON:API list of custom-entity resources. */ listByWorkspace: (workspaceId: string, options?: RequestOptions) => Promise; /** * Create a new custom entity instance. * * @param attributes - Custom-entity attributes. Must include * `workspace_id` and `entity_type` (the slug of a registered custom * entity type). * @param options - Optional request-level overrides. * @returns A promise that resolves to the newly created custom-entity resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.customEntities.create({ * workspace_id: 'ws_xyz789', * entity_type: 'vehicle', * properties: { make: 'Toyota', model: 'Camry' }, * }); * ``` */ create: (attributes: CreateCrmCustomEntityAttributes, options?: RequestOptions) => Promise; /** * Update an existing custom entity (PATCH semantics). * * @param id - The unique identifier of the custom entity to update. * @param attributes - Key/value map of attributes to change. * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated custom-entity resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.customEntities.update('ce_abc123', { * properties: { mileage: 15000 }, * }); * ``` */ update: (id: string, attributes: UpdateCrmCustomEntityAttributes, options?: RequestOptions) => Promise; /** * Permanently delete a custom entity. * * @param id - The unique identifier of the custom entity to delete. * @param options - Optional request-level overrides. * @returns A promise that resolves to `true` on successful deletion. */ delete: (id: string, options?: RequestOptions) => Promise; /** * List historical versions for a custom entity. * * @param entityId - The custom entity whose versions should be listed. * @param options - Optional pagination controls and request-level overrides. * @returns A promise that resolves to a JSON:API list of version resources. */ listVersions: (entityId: string, options?: RequestOptions) => Promise; /** * Get a specific historical version of a custom entity. * * @param entityId - The custom entity whose version should be retrieved. * @param versionId - The version identifier. * @param options - Optional request-level overrides. * @returns A promise that resolves to the matching version resource. */ getVersion: (entityId: string, versionId: string, options?: RequestOptions) => Promise; }; dealProducts: { /** * List deal products (line items associating deals with products). * * @param options - Optional pagination controls and request-level overrides. * @returns A promise that resolves to a JSON:API list of deal-product resources. */ list: (options?: RequestOptions) => Promise; /** * Fetch a single deal product by its unique ID. * * @param id - The unique identifier of the deal product. * @param options - Optional request-level overrides. * @returns A promise that resolves to the matching deal-product resource. */ get: (id: string, options?: RequestOptions) => Promise; /** * Create a new deal product line item. * * @param attributes - Deal-product attributes. Must include `deal_id`, * `product_id`, and `workspace_id`. * @param options - Optional request-level overrides. * @returns A promise that resolves to the newly created deal-product resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.dealProducts.create({ * deal_id: 'deal_abc123', * product_id: 'prod_xyz789', * workspace_id: 'ws_xyz789', * quantity: 5, * unit_price: 9999, * }); * ``` */ create: (attributes: CreateCrmDealProductAttributes, options?: RequestOptions) => Promise; /** * Permanently delete a deal product line item. * * @param id - The unique identifier of the deal product to delete. * @param options - Optional request-level overrides. * @returns A promise that resolves to `true` on successful deletion. */ delete: (id: string, options?: RequestOptions) => Promise; }; exports: { /** * Fetch a single data export job by its unique ID. * * @param id - The unique identifier of the export job. * @param options - Optional request-level overrides. * @returns A promise that resolves to the matching export-job resource. */ get: (id: string, options?: RequestOptions) => Promise; /** * List data export jobs in a workspace. * * @param workspaceId - The workspace whose export jobs should be listed. * @param options - Optional pagination controls and request-level overrides. * @returns A promise that resolves to a JSON:API list of export-job resources. */ listByWorkspace: (workspaceId: string, options?: RequestOptions) => Promise; /** * Create a new data export job. The job is processed asynchronously and * a pre-signed download URL is generated when complete. * * @param attributes - Export attributes including `workspace_id`, * `entity_type`, and `format`. * @param options - Optional request-level overrides. * @returns A promise that resolves to the newly created export-job resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.exports.create({ * workspace_id: 'ws_xyz789', * entity_type: 'contact', * format: 'csv', * include: ['first_name', 'last_name', 'email'], * }); * ``` */ create: (attributes: CreateCrmDataExportAttributes, options?: RequestOptions) => Promise; /** * Refresh the pre-signed download URL for a completed export job. Use * when the original URL has expired but the underlying export file is * still available. * * @param id - The unique identifier of the export job. * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated export-job resource * with a fresh download URL. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.exports.refreshUrl('exp_abc123'); * ``` */ refreshUrl: (id: string, options?: RequestOptions) => Promise; }; entityTypes: { /** * Fetch a single ISV custom entity type by its unique ID. * * @param id - The unique identifier of the entity type. * @param options - Optional request-level overrides. * @returns A promise that resolves to the matching entity-type resource. */ get: (id: string, options?: RequestOptions) => Promise; /** * List custom entity types registered for an application. * * @param applicationId - The application whose entity types should be listed. * @param options - Optional pagination controls and request-level overrides. * @returns A promise that resolves to a JSON:API list of entity-type resources. */ listByApplication: (applicationId: string, options?: RequestOptions) => Promise; /** * Register a new custom entity type for an application. * * @param attributes - Entity-type attributes. Must include * `application_id`, `name`, and `slug`. * @param options - Optional request-level overrides. * @returns A promise that resolves to the newly created entity-type resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.entityTypes.create({ * application_id: 'app_abc123', * name: 'Vehicle', * slug: 'vehicle', * pipelineable: true, * }); * ``` */ create: (attributes: CreateCrmCustomEntityTypeAttributes, options?: RequestOptions) => Promise; /** * Update an existing custom entity type (PATCH semantics). * * @param id - The unique identifier of the entity type to update. * @param attributes - Key/value map of attributes to change. * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated entity-type resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.entityTypes.update('et_abc123', { * pipelineable: false, * }); * ``` */ update: (id: string, attributes: UpdateCrmCustomEntityTypeAttributes, options?: RequestOptions) => Promise; /** * Permanently delete a custom entity type. All instances of the type * become orphaned; consider archiving instances first. * * @param id - The unique identifier of the entity type to delete. * @param options - Optional request-level overrides. * @returns A promise that resolves to `true` on successful deletion. */ delete: (id: string, options?: RequestOptions) => Promise; }; fieldDefinitions: { /** * Fetch a single field definition by its unique ID. * * @param id - The unique identifier of the field definition. * @param options - Optional request-level overrides. * @returns A promise that resolves to the matching field-definition resource. */ get: (id: string, options?: RequestOptions) => Promise; /** * List field definitions registered for an entity type. * * @param entityType - The entity type slug whose field definitions * should be listed (e.g. `'contact'`, `'company'`, or a custom slug). * @param options - Optional pagination controls and request-level overrides. * @returns A promise that resolves to a JSON:API list of field-definition resources. */ listByEntityType: (entityType: string, options?: RequestOptions) => Promise; /** * Create a new custom field definition for an entity type. * * @param attributes - Field-definition attributes. Must include * `application_id`, `entity_type`, `name`, and `field_type`. * @param options - Optional request-level overrides. * @returns A promise that resolves to the newly created field-definition resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.fieldDefinitions.create({ * application_id: 'app_abc123', * entity_type: 'contact', * name: 'loyalty_tier', * field_type: 'select', * options: ['bronze', 'silver', 'gold'], * }); * ``` */ create: (attributes: CreateCrmCustomFieldDefinitionAttributes, options?: RequestOptions) => Promise; /** * Update an existing field definition (PATCH semantics). * * @param id - The unique identifier of the field definition to update. * @param attributes - Key/value map of attributes to change. * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated field-definition resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.fieldDefinitions.update('fd_abc123', { * required: true, * sort_order: 5, * }); * ``` */ update: (id: string, attributes: UpdateCrmCustomFieldDefinitionAttributes, options?: RequestOptions) => Promise; /** * Permanently delete a field definition. * * @param id - The unique identifier of the field definition to delete. * @param options - Optional request-level overrides. * @returns A promise that resolves to `true` on successful deletion. */ delete: (id: string, options?: RequestOptions) => Promise; }; channelCaptureConfig: { /** * Fetch a channel capture configuration by its unique ID. * * @param id - The unique identifier of the configuration. * @param options - Optional request-level overrides. * @returns A promise that resolves to the matching configuration resource. */ get: (id: string, options?: RequestOptions) => Promise; /** * Create or upsert a channel capture configuration. Controls whether * incoming channel messages are captured into the CRM and how PII is * scanned and retained. * * @param attributes - Capture-config attributes. Must include * `workspace_id` and `application_id`. * @param options - Optional request-level overrides. * @returns A promise that resolves to the newly created configuration resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.channelCaptureConfig.create({ * workspace_id: 'ws_xyz789', * application_id: 'app_abc123', * enabled: true, * channel_types: ['whatsapp', 'email'], * }); * ``` */ create: (attributes: CreateCrmChannelCaptureConfigAttributes, options?: RequestOptions) => Promise; /** * Update an existing channel capture configuration (PATCH semantics). * * @param id - The unique identifier of the configuration to update. * @param attributes - Key/value map of attributes to change. * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated configuration resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.channelCaptureConfig.update('ccc_abc123', { * enabled: false, * }); * ``` */ update: (id: string, attributes: UpdateCrmChannelCaptureConfigAttributes, options?: RequestOptions) => Promise; }; syncConfigs: { /** * List CRM sync configurations in a workspace. * * @param workspaceId - The workspace whose sync configs should be listed. * @param options - Optional pagination controls and request-level overrides. * @returns A promise that resolves to a JSON:API list of sync-config resources. */ listByWorkspace: (workspaceId: string, options?: RequestOptions) => Promise; /** * Create a new sync configuration linking a connector instance to the CRM. * * @param attributes - Sync-config attributes. Must include * `workspace_id`, `application_id`, and `connector_instance_id`. * @param options - Optional request-level overrides. * @returns A promise that resolves to the newly created sync-config resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.syncConfigs.create({ * workspace_id: 'ws_xyz789', * application_id: 'app_abc123', * connector_instance_id: 'ci_xyz789', * enabled: true, * }); * ``` */ create: (attributes: CreateCrmSyncConfigAttributes, options?: RequestOptions) => Promise; /** * Update an existing sync configuration (PATCH semantics). * * @param id - The unique identifier of the sync config to update. * @param attributes - Key/value map of attributes to change. * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated sync-config resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.syncConfigs.update('sc_abc123', { * enabled: false, * }); * ``` */ update: (id: string, attributes: UpdateCrmSyncConfigAttributes, options?: RequestOptions) => Promise; /** * Permanently delete a sync configuration. * * @param id - The unique identifier of the sync config to delete. * @param options - Optional request-level overrides. * @returns A promise that resolves to `true` on successful deletion. */ delete: (id: string, options?: RequestOptions) => Promise; }; /** * Addresses — physical/mailing addresses for contacts and companies. */ addresses: { /** * Fetch a single address by its unique ID. * * @param id - The unique identifier of the address. * @param options - Optional request-level overrides. * @returns A promise that resolves to the matching address resource. */ get: (id: string, options?: RequestOptions) => Promise; /** * Create a new address attached to a contact or company. * * @param attributes - Address attributes. Must include `workspace_id`, * `entity_type`, and `entity_id`. * @param options - Optional request-level overrides. * @returns A promise that resolves to the newly created address resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.addresses.create({ * workspace_id: 'ws_xyz789', * entity_type: 'contact', * entity_id: 'con_abc123', * line1: '123 Main St', * city: 'Springfield', * }); * ``` */ create: (attributes: CreateCrmAddressAttributes, options?: RequestOptions) => Promise; /** * Update an existing address (PATCH semantics). * * @param id - The unique identifier of the address to update. * @param attributes - Key/value map of attributes to change. * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated address resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.addresses.update('addr_abc123', { * city: 'Chicago', * state: 'IL', * }); * ``` */ update: (id: string, attributes: UpdateCrmAddressAttributes, options?: RequestOptions) => Promise; /** * Permanently delete an address. * * @param id - The unique identifier of the address to delete. * @param options - Optional request-level overrides. * @returns A promise that resolves to `true` on successful deletion. */ delete: (id: string, options?: RequestOptions) => Promise; /** * Mark an address as the primary for its parent entity. The previously * primary address (if any) is automatically demoted. * * @param id - The unique identifier of the address to mark primary. * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated address resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.addresses.setPrimary('addr_abc123'); * ``` */ setPrimary: (id: string, options?: RequestOptions) => Promise; /** * List addresses attached to a specific contact or company. * * @param entityType - Either `'contact'` or `'company'`. * @param entityId - The unique identifier of the parent entity. * @param options - Optional pagination controls and request-level overrides. * @returns A promise that resolves to a JSON:API list of address resources. */ listByEntity: (entityType: "contact" | "company", entityId: string, options?: RequestOptions) => Promise; }; /** * Phone numbers — phone numbers for contacts and companies. */ phoneNumbers: { /** * Fetch a single phone number by its unique ID. * * @param id - The unique identifier of the phone number. * @param options - Optional request-level overrides. * @returns A promise that resolves to the matching phone-number resource. */ get: (id: string, options?: RequestOptions) => Promise; /** * Create a new phone number attached to a contact or company. * * @param attributes - Phone-number attributes. Must include * `workspace_id`, `entity_type`, `entity_id`, and `number`. * @param options - Optional request-level overrides. * @returns A promise that resolves to the newly created phone-number resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.phoneNumbers.create({ * workspace_id: 'ws_xyz789', * entity_type: 'contact', * entity_id: 'con_abc123', * number: '+15551234567', * label: 'mobile', * }); * ``` */ create: (attributes: CreateCrmPhoneNumberAttributes, options?: RequestOptions) => Promise; /** * Update an existing phone number (PATCH semantics). * * @param id - The unique identifier of the phone number to update. * @param attributes - Key/value map of attributes to change. * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated phone-number resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.phoneNumbers.update('ph_abc123', { * number: '+15559876543', * }); * ``` */ update: (id: string, attributes: UpdateCrmPhoneNumberAttributes, options?: RequestOptions) => Promise; /** * Permanently delete a phone number. * * @param id - The unique identifier of the phone number to delete. * @param options - Optional request-level overrides. * @returns A promise that resolves to `true` on successful deletion. */ delete: (id: string, options?: RequestOptions) => Promise; /** * Mark a phone number as the primary for its parent entity. The * previously primary phone (if any) is automatically demoted. * * @param id - The unique identifier of the phone number to mark primary. * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated phone-number resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.phoneNumbers.setPrimary('ph_abc123'); * ``` */ setPrimary: (id: string, options?: RequestOptions) => Promise; /** * List phone numbers attached to a specific contact or company. * * @param entityType - Either `'contact'` or `'company'`. * @param entityId - The unique identifier of the parent entity. * @param options - Optional pagination controls and request-level overrides. * @returns A promise that resolves to a JSON:API list of phone-number resources. */ listByEntity: (entityType: "contact" | "company", entityId: string, options?: RequestOptions) => Promise; }; /** * Email addresses — email addresses for contacts and companies. */ emailAddresses: { /** * Fetch a single email address by its unique ID. * * @param id - The unique identifier of the email address. * @param options - Optional request-level overrides. * @returns A promise that resolves to the matching email-address resource. */ get: (id: string, options?: RequestOptions) => Promise; /** * Create a new email address attached to a contact or company. * * @param attributes - Email-address attributes. Must include * `workspace_id`, `entity_type`, `entity_id`, and `email`. * @param options - Optional request-level overrides. * @returns A promise that resolves to the newly created email-address resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.emailAddresses.create({ * workspace_id: 'ws_xyz789', * entity_type: 'contact', * entity_id: 'con_abc123', * email: 'jane@example.com', * label: 'work', * }); * ``` */ create: (attributes: CreateCrmEmailAddressAttributes, options?: RequestOptions) => Promise; /** * Update an existing email address (PATCH semantics). * * @param id - The unique identifier of the email address to update. * @param attributes - Key/value map of attributes to change. * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated email-address resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.emailAddresses.update('em_abc123', { * is_verified: true, * }); * ``` */ update: (id: string, attributes: UpdateCrmEmailAddressAttributes, options?: RequestOptions) => Promise; /** * Permanently delete an email address. * * @param id - The unique identifier of the email address to delete. * @param options - Optional request-level overrides. * @returns A promise that resolves to `true` on successful deletion. */ delete: (id: string, options?: RequestOptions) => Promise; /** * Mark an email address as the primary for its parent entity. The * previously primary email (if any) is automatically demoted. * * @param id - The unique identifier of the email address to mark primary. * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated email-address resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.emailAddresses.setPrimary('em_abc123'); * ``` */ setPrimary: (id: string, options?: RequestOptions) => Promise; /** * List email addresses attached to a specific contact or company. * * @param entityType - Either `'contact'` or `'company'`. * @param entityId - The unique identifier of the parent entity. * @param options - Optional pagination controls and request-level overrides. * @returns A promise that resolves to a JSON:API list of email-address resources. */ listByEntity: (entityType: "contact" | "company", entityId: string, options?: RequestOptions) => Promise; }; /** * Social profiles — social media profiles for contacts and companies. */ socialProfiles: { /** * Fetch a single social profile by its unique ID. * * @param id - The unique identifier of the social profile. * @param options - Optional request-level overrides. * @returns A promise that resolves to the matching social-profile resource. */ get: (id: string, options?: RequestOptions) => Promise; /** * Create a new social profile attached to a contact or company. * * @param attributes - Social-profile attributes. Must include * `workspace_id`, `entity_type`, `entity_id`, and `platform`. * @param options - Optional request-level overrides. * @returns A promise that resolves to the newly created social-profile resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.socialProfiles.create({ * workspace_id: 'ws_xyz789', * entity_type: 'contact', * entity_id: 'con_abc123', * platform: 'linkedin', * url: 'https://linkedin.com/in/janedoe', * }); * ``` */ create: (attributes: CreateCrmSocialProfileAttributes, options?: RequestOptions) => Promise; /** * Update an existing social profile (PATCH semantics). * * @param id - The unique identifier of the social profile to update. * @param attributes - Key/value map of attributes to change. * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated social-profile resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.socialProfiles.update('sp_abc123', { * handle: '@janedoe', * }); * ``` */ update: (id: string, attributes: UpdateCrmSocialProfileAttributes, options?: RequestOptions) => Promise; /** * Permanently delete a social profile. * * @param id - The unique identifier of the social profile to delete. * @param options - Optional request-level overrides. * @returns A promise that resolves to `true` on successful deletion. */ delete: (id: string, options?: RequestOptions) => Promise; /** * List social profiles attached to a specific contact or company. * * @param entityType - Either `'contact'` or `'company'`. * @param entityId - The unique identifier of the parent entity. * @param options - Optional pagination controls and request-level overrides. * @returns A promise that resolves to a JSON:API list of social-profile resources. */ listByEntity: (entityType: "contact" | "company", entityId: string, options?: RequestOptions) => Promise; }; /** * Websites — website URLs for contacts and companies. */ websites: { /** * Fetch a single website by its unique ID. * * @param id - The unique identifier of the website. * @param options - Optional request-level overrides. * @returns A promise that resolves to the matching website resource. */ get: (id: string, options?: RequestOptions) => Promise; /** * Create a new website attached to a contact or company. * * @param attributes - Website attributes. Must include `workspace_id`, * `entity_type`, `entity_id`, and `url`. * @param options - Optional request-level overrides. * @returns A promise that resolves to the newly created website resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.websites.create({ * workspace_id: 'ws_xyz789', * entity_type: 'company', * entity_id: 'co_abc123', * url: 'https://acme.com', * label: 'main', * }); * ``` */ create: (attributes: CreateCrmWebsiteAttributes, options?: RequestOptions) => Promise; /** * Update an existing website (PATCH semantics). * * @param id - The unique identifier of the website to update. * @param attributes - Key/value map of attributes to change. * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated website resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.websites.update('web_abc123', { * url: 'https://www.acme.com', * }); * ``` */ update: (id: string, attributes: UpdateCrmWebsiteAttributes, options?: RequestOptions) => Promise; /** * Permanently delete a website. * * @param id - The unique identifier of the website to delete. * @param options - Optional request-level overrides. * @returns A promise that resolves to `true` on successful deletion. */ delete: (id: string, options?: RequestOptions) => Promise; /** * Mark a website as the primary for its parent entity. The previously * primary website (if any) is automatically demoted. * * @param id - The unique identifier of the website to mark primary. * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated website resource. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.websites.setPrimary('web_abc123'); * ``` */ setPrimary: (id: string, options?: RequestOptions) => Promise; /** * List websites attached to a specific contact or company. * * @param entityType - Either `'contact'` or `'company'`. * @param entityId - The unique identifier of the parent entity. * @param options - Optional pagination controls and request-level overrides. * @returns A promise that resolves to a JSON:API list of website resources. */ listByEntity: (entityType: "contact" | "company", entityId: string, options?: RequestOptions) => Promise; }; /** * Graph traversal sub-namespace for querying the CRM relationship graph. */ graph: { /** * Find paths between two CRM entities via the relationship graph. * * @param params - Path-search parameters including endpoints and an * optional `max_hops` limit. * @param options - Optional request-level overrides. * @returns A promise that resolves to the path-search response. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.graph.paths({ * from_type: 'contact', * from_id: 'con_abc123', * to_type: 'company', * to_id: 'co_xyz789', * max_hops: 3, * }); * ``` */ paths(params: CrmGraphPathsParams, options?: RequestOptions): Promise; /** * List entities related to a given entity within N hops in the graph. * * @param params - Traversal parameters including the seed entity and an * optional `max_depth`. * @param options - Optional request-level overrides. * @returns A promise that resolves to the related-entities response. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.graph.related({ * entity_type: 'contact', * entity_id: 'con_abc123', * max_depth: 2, * }); * ``` */ related(params: CrmGraphRelatedParams, options?: RequestOptions): Promise; /** * Compute the relationship-strength score between two entities. * * @param params - The endpoint pair to score. * @param options - Optional request-level overrides. * @returns A promise that resolves to the strength-score response. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.graph.strength({ * from_type: 'contact', * from_id: 'con_abc123', * to_type: 'company', * to_id: 'co_xyz789', * }); * ``` */ strength(params: CrmGraphStrengthParams, options?: RequestOptions): Promise; }; /** * AI augmentation sub-namespace for CRM intelligence features. */ ai: { /** * List staged AI entity extractions awaiting human review. * * @param workspaceId - The workspace whose staged extractions should be listed. * @param options - Optional `entity_type` / `status` filters and * request-level overrides. * @returns A promise that resolves to the list of staged extractions. */ stagedExtractions(workspaceId: string, options?: { entity_type?: string; status?: string; } & RequestOptions): Promise; /** * Approve a staged extraction. Approval materialises the staged record * as a real CRM entity. * * @param id - The unique identifier of the staged extraction to approve. * @param options - Optional request-level overrides. * @returns A promise that resolves to the approval response. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.ai.approveExtraction('ext_abc123'); * ``` */ approveExtraction(id: string, options?: RequestOptions): Promise; /** * Reject a staged extraction. The staged record is marked rejected and * no entity is created. * * @param id - The unique identifier of the staged extraction to reject. * @param options - Optional request-level overrides. * @returns A promise that resolves to the rejection response. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.ai.rejectExtraction('ext_abc123'); * ``` */ rejectExtraction(id: string, options?: RequestOptions): Promise; /** * List duplicate-entity candidates detected in a workspace. * * @param workspaceId - The workspace to scan for duplicates. * @param options - Optional `entity_type` / `status` filters and * request-level overrides. * @returns A promise that resolves to the list of duplicate candidates. */ duplicates(workspaceId: string, options?: { entity_type?: string; status?: string; } & RequestOptions): Promise; /** * Merge two contacts into one — the primary absorbs the secondary's * relationships, activities, and identity records, and the secondary is * deleted. * * @param params - Merge parameters identifying the workspace, primary, * and secondary contact IDs. * @param options - Optional request-level overrides. * @returns A promise that resolves to the merge response. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.ai.mergeContacts({ * workspace_id: 'ws_xyz789', * primary_id: 'con_keep', * secondary_id: 'con_dupe', * }); * ``` */ mergeContacts(params: CrmMergeParams, options?: RequestOptions): Promise; /** * Merge two companies into one — the primary absorbs the secondary's * relationships, contacts, and identity records, and the secondary is * deleted. * * @param params - Merge parameters identifying the workspace, primary, * and secondary company IDs. * @param options - Optional request-level overrides. * @returns A promise that resolves to the merge response. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.ai.mergeCompanies({ * workspace_id: 'ws_xyz789', * primary_id: 'co_keep', * secondary_id: 'co_dupe', * }); * ``` */ mergeCompanies(params: CrmMergeParams, options?: RequestOptions): Promise; /** * Hybrid CRM search combining lexical and semantic ranking. * * @param params - Search parameters including the workspace, query * string, and optional `types` and `mode`. * @param options - Optional request-level overrides. * @returns A promise that resolves to the search results. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.ai.search({ * workspace_id: 'ws_xyz789', * q: 'acme', * mode: 'hybrid', * }); * ``` */ search(params: CrmSearchParams, options?: RequestOptions): Promise; /** * Run AI deal forecasting for a workspace. Recomputes risk and forecast * categories across all open deals. * * @param workspaceId - The workspace whose deals should be forecast. * @param options - Optional request-level overrides. * @returns A promise that resolves to the forecast response. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * await admin.crm.ai.forecast('ws_xyz789'); * ``` */ forecast(workspaceId: string, options?: RequestOptions): Promise; }; /** * Bulk transfer ownership of CRM entities to a new owner. * The caller must have access to the specified workspace — requests for * inaccessible workspaces will return empty results. * @param resourceType - One of: contacts, deals, companies, custom-entities * @param params - Transfer parameters * @param params.workspace_id - Workspace ID (must be accessible to the caller) * @param params.resource_ids - Array of entity IDs to transfer (max 100) * @param params.owner_id - New owner user ID, or null to unassign * @param options - Optional request options (headers, abort signal, etc.) * @returns Transfer result with count of transferred entities * @example * ```typescript * const result = await admin.crm.bulkTransferOwnership('contacts', { * workspace_id: 'ws_123', * resource_ids: ['id1', 'id2'], * owner_id: 'user_456', * }); * ``` */ bulkTransferOwnership: (resourceType: "contacts" | "deals" | "companies" | "custom-entities", params: { workspace_id: string; resource_ids: string[]; owner_id?: string | null; }, options?: RequestOptions) => Promise<{ transferred: number; owner_id: string | null; failed?: number; }>; }; //# sourceMappingURL=crm.d.ts.map