/* generated using openapi-typescript-codegen -- do not edit */ /* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ import type { _TagAttachRequest } from '../models/_TagAttachRequest'; import type { Activity } from '../models/Activity'; import type { Deal } from '../models/Deal'; import type { DealLostRequest } from '../models/DealLostRequest'; import type { DealMoveStageRequest } from '../models/DealMoveStageRequest'; import type { DealWonRequest } from '../models/DealWonRequest'; import type { LeadSource } from '../models/LeadSource'; import type { Organization } from '../models/Organization'; import type { PaginatedActivityList } from '../models/PaginatedActivityList'; import type { PaginatedDealList } from '../models/PaginatedDealList'; import type { PaginatedLeadSourceList } from '../models/PaginatedLeadSourceList'; import type { PaginatedOrganizationList } from '../models/PaginatedOrganizationList'; import type { PaginatedPersonList } from '../models/PaginatedPersonList'; import type { PaginatedPipelineList } from '../models/PaginatedPipelineList'; import type { PaginatedPipelineStageList } from '../models/PaginatedPipelineStageList'; import type { PaginatedTagList } from '../models/PaginatedTagList'; import type { PatchedActivity } from '../models/PatchedActivity'; import type { PatchedDeal } from '../models/PatchedDeal'; import type { PatchedLeadSource } from '../models/PatchedLeadSource'; import type { PatchedOrganization } from '../models/PatchedOrganization'; import type { PatchedPerson } from '../models/PatchedPerson'; import type { PatchedPipeline } from '../models/PatchedPipeline'; import type { PatchedPipelineStage } from '../models/PatchedPipelineStage'; import type { PatchedTag } from '../models/PatchedTag'; import type { Person } from '../models/Person'; import type { PersonInviteRequest } from '../models/PersonInviteRequest'; import type { PersonInviteResponse } from '../models/PersonInviteResponse'; import type { PersonLinkUserRequest } from '../models/PersonLinkUserRequest'; import type { PersonMergeRequest } from '../models/PersonMergeRequest'; import type { PersonMergeResponse } from '../models/PersonMergeResponse'; import type { Pipeline } from '../models/Pipeline'; import type { PipelineStage } from '../models/PipelineStage'; import type { Tag } from '../models/Tag'; import type { CancelablePromise } from '../core/CancelablePromise'; import { OpenAPI } from '../core/OpenAPI'; import { request as __request } from '../core/request'; export class CrmService { /** * List activities * Returns a paginated list of Activities in your Platform. Supports filtering by `type`, `is_done`, `owner`, `deal`, `person`, schedule-from ranges, and `metadata__has_key`. * * **Required permission:** `Ibl.CRM/Activities/list`. * @returns PaginatedActivityList * @throws ApiError */ public static crmActivitiesList({ deal, isDone, metadataHasKey, owner, page, pageSize, person, scheduleFromGte, scheduleFromLte, type, }: { deal?: number, isDone?: boolean, metadataHasKey?: string, owner?: number, /** * A page number within the paginated result set. */ page?: number, /** * Number of results to return per page. */ pageSize?: number, person?: string, scheduleFromGte?: string, scheduleFromLte?: string, /** * Interaction kind. * * * `call` - Call * * `meeting` - Meeting * * `email` - Email * * `note` - Note * * `task` - Task * * `lunch` - Lunch * * `deadline` - Deadline */ type?: 'call' | 'deadline' | 'email' | 'lunch' | 'meeting' | 'note' | 'task', }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/crm/activities/', query: { 'deal': deal, 'is_done': isDone, 'metadata__has_key': metadataHasKey, 'owner': owner, 'page': page, 'page_size': pageSize, 'person': person, 'schedule_from__gte': scheduleFromGte, 'schedule_from__lte': scheduleFromLte, 'type': type, }, errors: { 401: `Authentication required.`, 403: `Missing required permission \`Ibl.CRM/Activities/list\`.`, }, }); } /** * Create an activity * Creates an Activity. Either `deal` or `person` must be supplied; both must belong to your Platform. * * **Required permission:** `Ibl.CRM/Activities/action`. * @returns Activity * @throws ApiError */ public static crmActivitiesCreate({ requestBody, }: { requestBody: Activity, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/crm/activities/', body: requestBody, mediaType: 'application/json', errors: { 400: `Validation error.`, 403: `Missing required permission \`Ibl.CRM/Activities/action\`.`, }, }); } /** * Retrieve an activity * Returns a single Activity by id. * * **Required permission:** `Ibl.CRM/Activities/read`. * @returns Activity * @throws ApiError */ public static crmActivitiesRetrieve({ id, }: { /** * A unique integer value identifying this activity. */ id: number, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/crm/activities/{id}/', path: { 'id': id, }, errors: { 403: `Missing required permission \`Ibl.CRM/Activities/read\`.`, 404: `Activity not found.`, }, }); } /** * Replace an activity * Replaces all editable fields on the Activity. * * **Required permission:** `Ibl.CRM/Activities/write`. * @returns Activity * @throws ApiError */ public static crmActivitiesUpdate({ id, requestBody, }: { /** * A unique integer value identifying this activity. */ id: number, requestBody: Activity, }): CancelablePromise { return __request(OpenAPI, { method: 'PUT', url: '/api/crm/activities/{id}/', path: { 'id': id, }, body: requestBody, mediaType: 'application/json', errors: { 400: `Validation error.`, 403: `Missing required permission \`Ibl.CRM/Activities/write\`.`, 404: `Activity not found.`, }, }); } /** * Update an activity * Updates only the supplied fields on the Activity. * * **Required permission:** `Ibl.CRM/Activities/write`. * @returns Activity * @throws ApiError */ public static crmActivitiesPartialUpdate({ id, requestBody, }: { /** * A unique integer value identifying this activity. */ id: number, requestBody?: PatchedActivity, }): CancelablePromise { return __request(OpenAPI, { method: 'PATCH', url: '/api/crm/activities/{id}/', path: { 'id': id, }, body: requestBody, mediaType: 'application/json', errors: { 400: `Validation error.`, 403: `Missing required permission \`Ibl.CRM/Activities/write\`.`, 404: `Activity not found.`, }, }); } /** * Delete an activity * Deletes the Activity. * * **Required permission:** `Ibl.CRM/Activities/delete`. * @returns void * @throws ApiError */ public static crmActivitiesDestroy({ id, }: { /** * A unique integer value identifying this activity. */ id: number, }): CancelablePromise { return __request(OpenAPI, { method: 'DELETE', url: '/api/crm/activities/{id}/', path: { 'id': id, }, errors: { 403: `Missing required permission \`Ibl.CRM/Activities/delete\`.`, 404: `Activity not found.`, }, }); } /** * Mark an activity as done * Flips `is_done=True` and stamps `done_at` if it isn't already set. Idempotent — calling on an already-done Activity preserves the original `done_at`. * * **Required permission:** `Ibl.CRM/Activities/write`. * @returns Activity * @throws ApiError */ public static crmActivitiesDoneCreate({ id, }: { /** * A unique integer value identifying this activity. */ id: number, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/crm/activities/{id}/done/', path: { 'id': id, }, errors: { 403: `Missing required permission \`Ibl.CRM/Activities/write\`.`, 404: `Activity not found.`, }, }); } /** * List deals * Returns a paginated list of Deals in your Platform. Supports filtering by `status`, `pipeline`, `stage`, `owner`, `source`, `person`, `organization`, expected-close-date and created-at ranges, and `metadata__has_key`. * * **Required permission:** `Ibl.CRM/Deals/list`. * @returns PaginatedDealList * @throws ApiError */ public static crmDealsList({ createdAtGte, createdAtLte, expectedCloseDateGte, expectedCloseDateLte, metadataHasKey, organization, owner, page, pageSize, person, pipeline, source, stage, status, tags, }: { createdAtGte?: string, createdAtLte?: string, expectedCloseDateGte?: string, expectedCloseDateLte?: string, metadataHasKey?: string, organization?: string, owner?: number, /** * A page number within the paginated result set. */ page?: number, /** * Number of results to return per page. */ pageSize?: number, person?: string, pipeline?: number, source?: number, stage?: number, /** * Service-managed (read-only in serializer). Derived from the destination stage's is_won/is_lost. * * * `open` - Open * * `won` - Won * * `lost` - Lost */ status?: 'lost' | 'open' | 'won', tags?: string, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/crm/deals/', query: { 'created_at__gte': createdAtGte, 'created_at__lte': createdAtLte, 'expected_close_date__gte': expectedCloseDateGte, 'expected_close_date__lte': expectedCloseDateLte, 'metadata__has_key': metadataHasKey, 'organization': organization, 'owner': owner, 'page': page, 'page_size': pageSize, 'person': person, 'pipeline': pipeline, 'source': source, 'stage': stage, 'status': status, 'tags': tags, }, errors: { 401: `Authentication required.`, 403: `Missing required permission \`Ibl.CRM/Deals/list\`.`, }, }); } /** * Create a deal * Creates a new Deal. All FK targets (`person`, `organization`, `pipeline`, `stage`, `source`) must belong to your Platform; `stage` must belong to `pipeline`. `status` and `closed_at` are service-managed — passing them returns `400`. * * **Required permission:** `Ibl.CRM/Deals/action`. * @returns Deal * @throws ApiError */ public static crmDealsCreate({ requestBody, }: { requestBody: Deal, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/crm/deals/', body: requestBody, mediaType: 'application/json', errors: { 400: `Validation error.`, 403: `Missing required permission \`Ibl.CRM/Deals/action\`.`, }, }); } /** * Retrieve a deal * Returns a single Deal by id. * * **Required permission:** `Ibl.CRM/Deals/read`. * @returns Deal * @throws ApiError */ public static crmDealsRetrieve({ id, }: { /** * A unique integer value identifying this deal. */ id: number, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/crm/deals/{id}/', path: { 'id': id, }, errors: { 403: `Missing required permission \`Ibl.CRM/Deals/read\`.`, 404: `Deal not found.`, }, }); } /** * Replace a deal * Replaces all editable fields on the Deal. * * **Required permission:** `Ibl.CRM/Deals/write`. * @returns Deal * @throws ApiError */ public static crmDealsUpdate({ id, requestBody, }: { /** * A unique integer value identifying this deal. */ id: number, requestBody: Deal, }): CancelablePromise { return __request(OpenAPI, { method: 'PUT', url: '/api/crm/deals/{id}/', path: { 'id': id, }, body: requestBody, mediaType: 'application/json', errors: { 400: `Validation error.`, 403: `Missing required permission \`Ibl.CRM/Deals/write\`.`, 404: `Deal not found.`, }, }); } /** * Update a deal * Updates only the supplied fields on the Deal. Direct writes to `status` or `closed_at` are rejected with `400` — use `POST /deals/{id}/move-stage/`, `won/`, or `lost/`. * * **Required permission:** `Ibl.CRM/Deals/write`. * @returns Deal * @throws ApiError */ public static crmDealsPartialUpdate({ id, requestBody, }: { /** * A unique integer value identifying this deal. */ id: number, requestBody?: PatchedDeal, }): CancelablePromise { return __request(OpenAPI, { method: 'PATCH', url: '/api/crm/deals/{id}/', path: { 'id': id, }, body: requestBody, mediaType: 'application/json', errors: { 400: `Validation error.`, 403: `Missing required permission \`Ibl.CRM/Deals/write\`.`, 404: `Deal not found.`, }, }); } /** * Delete a deal * Deletes the Deal. * * **Required permission:** `Ibl.CRM/Deals/delete`. * @returns void * @throws ApiError */ public static crmDealsDestroy({ id, }: { /** * A unique integer value identifying this deal. */ id: number, }): CancelablePromise { return __request(OpenAPI, { method: 'DELETE', url: '/api/crm/deals/{id}/', path: { 'id': id, }, errors: { 403: `Missing required permission \`Ibl.CRM/Deals/delete\`.`, 404: `Deal not found.`, }, }); } /** * Mark a deal as lost * Moves the Deal into a closed-lost stage and persists `lost_reason`. If `stage_code` is omitted, the first `is_lost=True` stage in the Deal's pipeline (by sort order) is used. * * **Required permission:** `Ibl.CRM/Deals/write`. * @returns Deal * @throws ApiError */ public static crmDealsLostCreate({ id, requestBody, }: { /** * A unique integer value identifying this deal. */ id: number, requestBody: DealLostRequest, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/crm/deals/{id}/lost/', path: { 'id': id, }, body: requestBody, mediaType: 'application/json', errors: { 400: `Missing \`lost_reason\`, no \`is_lost\` stage configured, or the supplied stage_code is not flagged is_lost=True.`, 403: `Missing required permission \`Ibl.CRM/Deals/write\`.`, 404: `Deal not found.`, }, }); } /** * Move a deal to a different stage * Moves the Deal to the stage identified by `stage_id` or `stage_code`. The target stage must belong to this Deal's pipeline. Records an audit Activity and emits `deal_stage_changed`. `Deal.status` is recomputed from the new stage's `is_won` / `is_lost` flags. * * **Required permission:** `Ibl.CRM/Deals/write`. * @returns Deal * @throws ApiError */ public static crmDealsMoveStageCreate({ id, requestBody, }: { /** * A unique integer value identifying this deal. */ id: number, requestBody?: DealMoveStageRequest, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/crm/deals/{id}/move-stage/', path: { 'id': id, }, body: requestBody, mediaType: 'application/json', errors: { 400: `Validation error (e.g. stage not in pipeline).`, 403: `Missing required permission \`Ibl.CRM/Deals/write\`.`, 404: `Deal or stage not found.`, }, }); } /** * Attach a tag to this record * Attaches an existing Tag to this record. Both the Tag and the record must belong to your Platform. Returns `409 Conflict` with the existing `assignment_id` if the tag is already attached. * * **Required permission:** `Ibl.CRM/Tags/write`. * @returns any No response body * @throws ApiError */ public static crmDealsTagsCreate({ id, requestBody, }: { /** * A unique integer value identifying this deal. */ id: number, requestBody: _TagAttachRequest, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/crm/deals/{id}/tags/', path: { 'id': id, }, body: requestBody, mediaType: 'application/json', errors: { 400: `No response body`, 403: `No response body`, 404: `No response body`, 409: `No response body`, }, }); } /** * Detach a tag from this record * Removes the Tag with id `tag_id` from this record. Returns `404` if the tag was not attached. * * **Required permission:** `Ibl.CRM/Tags/write`. * @returns void * @throws ApiError */ public static crmDealsTagsDestroy({ id, tagId, }: { /** * A unique integer value identifying this deal. */ id: number, tagId: string, }): CancelablePromise { return __request(OpenAPI, { method: 'DELETE', url: '/api/crm/deals/{id}/tags/{tag_id}/', path: { 'id': id, 'tag_id': tagId, }, errors: { 403: `No response body`, 404: `No response body`, }, }); } /** * Mark a deal as won * Moves the Deal into a closed-won stage and sets `status='won'`. If `stage_code` is omitted, the first `is_won=True` stage in the Deal's pipeline (by sort order) is used. * * **Required permission:** `Ibl.CRM/Deals/write`. * @returns Deal * @throws ApiError */ public static crmDealsWonCreate({ id, requestBody, }: { /** * A unique integer value identifying this deal. */ id: number, requestBody?: DealWonRequest, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/crm/deals/{id}/won/', path: { 'id': id, }, body: requestBody, mediaType: 'application/json', errors: { 400: `No \`is_won\` stage configured, or the supplied stage_code is not flagged is_won=True.`, 403: `Missing required permission \`Ibl.CRM/Deals/write\`.`, 404: `Deal not found.`, }, }); } /** * List lead sources * Returns a paginated list of LeadSources in your Platform. * * **Required permission:** `Ibl.CRM/Pipelines/list`. * @returns PaginatedLeadSourceList * @throws ApiError */ public static crmLeadSourcesList({ code, name, page, pageSize, }: { code?: string, name?: string, /** * A page number within the paginated result set. */ page?: number, /** * Number of results to return per page. */ pageSize?: number, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/crm/lead-sources/', query: { 'code': code, 'name': name, 'page': page, 'page_size': pageSize, }, errors: { 401: `Authentication required.`, 403: `Missing required permission \`Ibl.CRM/Pipelines/list\`.`, }, }); } /** * Create a lead source * Creates a new LeadSource in your Platform. `code` must be unique. * * **Required permission:** `Ibl.CRM/Pipelines/action`. * @returns LeadSource * @throws ApiError */ public static crmLeadSourcesCreate({ requestBody, }: { requestBody: LeadSource, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/crm/lead-sources/', body: requestBody, mediaType: 'application/json', errors: { 400: `Validation error.`, 403: `Missing required permission \`Ibl.CRM/Pipelines/action\`.`, }, }); } /** * Retrieve a lead source * Returns a single LeadSource by id. * * **Required permission:** `Ibl.CRM/Pipelines/read`. * @returns LeadSource * @throws ApiError */ public static crmLeadSourcesRetrieve({ id, }: { /** * A unique integer value identifying this lead source. */ id: number, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/crm/lead-sources/{id}/', path: { 'id': id, }, errors: { 403: `Missing required permission \`Ibl.CRM/Pipelines/read\`.`, 404: `LeadSource not found.`, }, }); } /** * Replace a lead source * Replaces all editable fields on the LeadSource. * * **Required permission:** `Ibl.CRM/Pipelines/write`. * @returns LeadSource * @throws ApiError */ public static crmLeadSourcesUpdate({ id, requestBody, }: { /** * A unique integer value identifying this lead source. */ id: number, requestBody: LeadSource, }): CancelablePromise { return __request(OpenAPI, { method: 'PUT', url: '/api/crm/lead-sources/{id}/', path: { 'id': id, }, body: requestBody, mediaType: 'application/json', errors: { 400: `Validation error.`, 403: `Missing required permission \`Ibl.CRM/Pipelines/write\`.`, 404: `LeadSource not found.`, }, }); } /** * Update a lead source * Updates only the supplied fields on the LeadSource. * * **Required permission:** `Ibl.CRM/Pipelines/write`. * @returns LeadSource * @throws ApiError */ public static crmLeadSourcesPartialUpdate({ id, requestBody, }: { /** * A unique integer value identifying this lead source. */ id: number, requestBody?: PatchedLeadSource, }): CancelablePromise { return __request(OpenAPI, { method: 'PATCH', url: '/api/crm/lead-sources/{id}/', path: { 'id': id, }, body: requestBody, mediaType: 'application/json', errors: { 400: `Validation error.`, 403: `Missing required permission \`Ibl.CRM/Pipelines/write\`.`, 404: `LeadSource not found.`, }, }); } /** * Delete a lead source * Deletes the LeadSource. Any Deals referencing it have their `source` cleared. * * **Required permission:** `Ibl.CRM/Pipelines/delete`. * @returns void * @throws ApiError */ public static crmLeadSourcesDestroy({ id, }: { /** * A unique integer value identifying this lead source. */ id: number, }): CancelablePromise { return __request(OpenAPI, { method: 'DELETE', url: '/api/crm/lead-sources/{id}/', path: { 'id': id, }, errors: { 403: `Missing required permission \`Ibl.CRM/Pipelines/delete\`.`, 404: `LeadSource not found.`, }, }); } /** * List organizations * Returns a paginated list of organizations in your Platform. Supports filtering by `owner` and by `name` (case-insensitive substring match). * * **Required permission:** `Ibl.CRM/Organizations/list`. * @returns PaginatedOrganizationList * @throws ApiError */ public static crmOrganizationsList({ name, owner, page, pageSize, tags, }: { name?: string, owner?: number, /** * A page number within the paginated result set. */ page?: number, /** * Number of results to return per page. */ pageSize?: number, tags?: string, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/crm/organizations/', query: { 'name': name, 'owner': owner, 'page': page, 'page_size': pageSize, 'tags': tags, }, errors: { 401: `Authentication required.`, 403: `Missing required permission \`Ibl.CRM/Organizations/list\`.`, }, }); } /** * Create an organization * Creates a new organization in your Platform. The Platform is inferred from your credentials. `name` must be unique within your Platform. * * **Required permission:** `Ibl.CRM/Organizations/action`. * @returns Organization * @throws ApiError */ public static crmOrganizationsCreate({ requestBody, }: { requestBody: Organization, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/crm/organizations/', body: requestBody, mediaType: 'application/json', errors: { 400: `Validation error (for example, duplicate name).`, 403: `Missing required permission \`Ibl.CRM/Organizations/action\`.`, }, }); } /** * Retrieve an organization * Returns a single organization by id. * * **Required permission:** `Ibl.CRM/Organizations/read`. * @returns Organization * @throws ApiError */ public static crmOrganizationsRetrieve({ id, }: { id: string, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/crm/organizations/{id}/', path: { 'id': id, }, errors: { 403: `Missing required permission \`Ibl.CRM/Organizations/read\`.`, 404: `Organization not found.`, }, }); } /** * Replace an organization * Replaces all editable fields on the organization. * * **Required permission:** `Ibl.CRM/Organizations/write`. * @returns Organization * @throws ApiError */ public static crmOrganizationsUpdate({ id, requestBody, }: { id: string, requestBody: Organization, }): CancelablePromise { return __request(OpenAPI, { method: 'PUT', url: '/api/crm/organizations/{id}/', path: { 'id': id, }, body: requestBody, mediaType: 'application/json', errors: { 400: `Validation error.`, 403: `Missing required permission \`Ibl.CRM/Organizations/write\`.`, 404: `Organization not found.`, }, }); } /** * Update an organization * Updates only the supplied fields on the organization. * * **Required permission:** `Ibl.CRM/Organizations/write`. * @returns Organization * @throws ApiError */ public static crmOrganizationsPartialUpdate({ id, requestBody, }: { id: string, requestBody?: PatchedOrganization, }): CancelablePromise { return __request(OpenAPI, { method: 'PATCH', url: '/api/crm/organizations/{id}/', path: { 'id': id, }, body: requestBody, mediaType: 'application/json', errors: { 400: `Validation error.`, 403: `Missing required permission \`Ibl.CRM/Organizations/write\`.`, 404: `Organization not found.`, }, }); } /** * Delete an organization * Deletes the organization. Any persons linked to it are kept; their organization reference is cleared. * * **Required permission:** `Ibl.CRM/Organizations/delete`. * @returns void * @throws ApiError */ public static crmOrganizationsDestroy({ id, }: { id: string, }): CancelablePromise { return __request(OpenAPI, { method: 'DELETE', url: '/api/crm/organizations/{id}/', path: { 'id': id, }, errors: { 403: `Missing required permission \`Ibl.CRM/Organizations/delete\`.`, 404: `Organization not found.`, }, }); } /** * Attach a tag to this record * Attaches an existing Tag to this record. Both the Tag and the record must belong to your Platform. Returns `409 Conflict` with the existing `assignment_id` if the tag is already attached. * * **Required permission:** `Ibl.CRM/Tags/write`. * @returns any No response body * @throws ApiError */ public static crmOrganizationsTagsCreate({ id, requestBody, }: { id: string, requestBody: _TagAttachRequest, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/crm/organizations/{id}/tags/', path: { 'id': id, }, body: requestBody, mediaType: 'application/json', errors: { 400: `No response body`, 403: `No response body`, 404: `No response body`, 409: `No response body`, }, }); } /** * Detach a tag from this record * Removes the Tag with id `tag_id` from this record. Returns `404` if the tag was not attached. * * **Required permission:** `Ibl.CRM/Tags/write`. * @returns void * @throws ApiError */ public static crmOrganizationsTagsDestroy({ id, tagId, }: { id: string, tagId: string, }): CancelablePromise { return __request(OpenAPI, { method: 'DELETE', url: '/api/crm/organizations/{id}/tags/{tag_id}/', path: { 'id': id, 'tag_id': tagId, }, errors: { 403: `No response body`, 404: `No response body`, }, }); } /** * List persons * Returns a paginated list of persons in your Platform. Supports filtering by `lifecycle_stage`, `owner`, `organization`, `created_at__gte`/`created_at__lte`, and `metadata__has_key`. * * **Required permission:** `Ibl.CRM/Persons/list`. * @returns PaginatedPersonList * @throws ApiError */ public static crmPersonsList({ createdAtGte, createdAtLte, lifecycleStage, metadataHasKey, organization, owner, page, pageSize, tags, }: { createdAtGte?: string, createdAtLte?: string, /** * Funnel position. Transitions are unrestricted — any stage may move to any other. * * * `lead` - Lead * * `qualified` - Qualified * * `opportunity` - Opportunity * * `customer` - Customer * * `churned` - Churned */ lifecycleStage?: 'churned' | 'customer' | 'lead' | 'opportunity' | 'qualified', metadataHasKey?: string, organization?: string, owner?: number, /** * A page number within the paginated result set. */ page?: number, /** * Number of results to return per page. */ pageSize?: number, tags?: string, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/crm/persons/', query: { 'created_at__gte': createdAtGte, 'created_at__lte': createdAtLte, 'lifecycle_stage': lifecycleStage, 'metadata__has_key': metadataHasKey, 'organization': organization, 'owner': owner, 'page': page, 'page_size': pageSize, 'tags': tags, }, errors: { 401: `Authentication required.`, 403: `Missing required permission \`Ibl.CRM/Persons/list\`.`, }, }); } /** * Create a person * Creates a new person in your Platform. The Platform is inferred from your credentials. If `organization` is supplied, it must reference an organization in your Platform. * * **Required permission:** `Ibl.CRM/Persons/action`. * @returns Person * @throws ApiError */ public static crmPersonsCreate({ requestBody, }: { requestBody: Person, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/crm/persons/', body: requestBody, mediaType: 'application/json', errors: { 400: `Validation error.`, 403: `Missing required permission \`Ibl.CRM/Persons/action\`.`, }, }); } /** * Retrieve a person * Returns a single person by id. * * **Required permission:** `Ibl.CRM/Persons/read`. * @returns Person * @throws ApiError */ public static crmPersonsRetrieve({ id, }: { id: string, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/crm/persons/{id}/', path: { 'id': id, }, errors: { 403: `Missing required permission \`Ibl.CRM/Persons/read\`.`, 404: `Person not found.`, }, }); } /** * Replace a person * Replaces all editable fields on the person. * * **Required permission:** `Ibl.CRM/Persons/write`. * @returns Person * @throws ApiError */ public static crmPersonsUpdate({ id, requestBody, }: { id: string, requestBody: Person, }): CancelablePromise { return __request(OpenAPI, { method: 'PUT', url: '/api/crm/persons/{id}/', path: { 'id': id, }, body: requestBody, mediaType: 'application/json', errors: { 400: `Validation error.`, 403: `Missing required permission \`Ibl.CRM/Persons/write\`.`, 404: `Person not found.`, }, }); } /** * Update a person * Updates only the supplied fields on the person. * * **Required permission:** `Ibl.CRM/Persons/write`. * @returns Person * @throws ApiError */ public static crmPersonsPartialUpdate({ id, requestBody, }: { id: string, requestBody?: PatchedPerson, }): CancelablePromise { return __request(OpenAPI, { method: 'PATCH', url: '/api/crm/persons/{id}/', path: { 'id': id, }, body: requestBody, mediaType: 'application/json', errors: { 400: `Validation error.`, 403: `Missing required permission \`Ibl.CRM/Persons/write\`.`, 404: `Person not found.`, }, }); } /** * Delete a person * Deletes the person. * * **Required permission:** `Ibl.CRM/Persons/delete`. * @returns void * @throws ApiError */ public static crmPersonsDestroy({ id, }: { id: string, }): CancelablePromise { return __request(OpenAPI, { method: 'DELETE', url: '/api/crm/persons/{id}/', path: { 'id': id, }, errors: { 403: `Missing required permission \`Ibl.CRM/Persons/delete\`.`, 404: `Person not found.`, }, }); } /** * Invite a person to the platform * Sends a platform invitation to the person's `primary_email`. On acceptance, the invitee joins your Platform with the privileges configured in the request body. * * Returns `409 Conflict` if an active invitation already exists for this email in your Platform, and `422 Unprocessable Entity` if the person is already linked to a platform user. * * **Required permission:** `Ibl.CRM/Invite/action`. * @returns PersonInviteResponse * @throws ApiError */ public static crmPersonsInviteCreate({ id, requestBody, }: { id: string, requestBody?: PersonInviteRequest, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/crm/persons/{id}/invite/', path: { 'id': id, }, body: requestBody, mediaType: 'application/json', errors: { 400: `Person has no \`primary_email\`; cannot invite.`, 403: `Missing required permission \`Ibl.CRM/Invite/action\`.`, 404: `Person not found.`, 422: `Person is already linked to a platform user.`, }, }); } /** * Bind a person to an existing platform user * Links this person to an existing platform user. The target user must already be a member of your Platform — if they are not, send them an invitation via `POST /persons/{id}/invite/` instead. * * This call is idempotent: linking a person that is already bound to the same user is a no-op. Re-linking a person that is already bound to a *different* user is refused; the existing binding is preserved and the unchanged person is returned. * * **Required permission:** `Ibl.CRM/Persons/write`. * @returns Person * @throws ApiError */ public static crmPersonsLinkUserCreate({ id, requestBody, }: { id: string, requestBody: PersonLinkUserRequest, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/crm/persons/{id}/link-user/', path: { 'id': id, }, body: requestBody, mediaType: 'application/json', errors: { 400: `Validation error.`, 403: `Missing required permission \`Ibl.CRM/Persons/write\`, or the target user is not a member of your Platform.`, 404: `Person or user not found.`, }, }); } /** * Attach a tag to this record * Attaches an existing Tag to this record. Both the Tag and the record must belong to your Platform. Returns `409 Conflict` with the existing `assignment_id` if the tag is already attached. * * **Required permission:** `Ibl.CRM/Tags/write`. * @returns any No response body * @throws ApiError */ public static crmPersonsTagsCreate({ id, requestBody, }: { id: string, requestBody: _TagAttachRequest, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/crm/persons/{id}/tags/', path: { 'id': id, }, body: requestBody, mediaType: 'application/json', errors: { 400: `No response body`, 403: `No response body`, 404: `No response body`, 409: `No response body`, }, }); } /** * Detach a tag from this record * Removes the Tag with id `tag_id` from this record. Returns `404` if the tag was not attached. * * **Required permission:** `Ibl.CRM/Tags/write`. * @returns void * @throws ApiError */ public static crmPersonsTagsDestroy({ id, tagId, }: { id: string, tagId: string, }): CancelablePromise { return __request(OpenAPI, { method: 'DELETE', url: '/api/crm/persons/{id}/tags/{tag_id}/', path: { 'id': id, 'tag_id': tagId, }, errors: { 403: `No response body`, 404: `No response body`, }, }); } /** * Merge duplicate persons into a primary * Marks each person in `duplicate_ids` as inactive and reports how many related records (deals, activities, tags) were re-parented onto `primary_id`. * * All ids — both the primary and every duplicate — must belong to your Platform. `primary_id` may not appear in `duplicate_ids`. * * **Required permission:** `Ibl.CRM/Persons/write`. * @returns PersonMergeResponse * @throws ApiError */ public static crmPersonsMergeCreate({ requestBody, }: { requestBody: PersonMergeRequest, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/crm/persons/merge/', body: requestBody, mediaType: 'application/json', errors: { 400: `Validation error: the primary appears in duplicates, or one or more ids belong to another Platform.`, 403: `Missing required permission \`Ibl.CRM/Persons/write\`.`, 404: `Primary person not found.`, }, }); } /** * List pipelines * Returns a paginated list of Pipelines in your Platform. Each Pipeline includes its ordered `stages` inline. * * **Required permission:** `Ibl.CRM/Pipelines/list`. * @returns PaginatedPipelineList * @throws ApiError */ public static crmPipelinesList({ code, isDefault, name, page, pageSize, }: { code?: string, isDefault?: boolean, name?: string, /** * A page number within the paginated result set. */ page?: number, /** * Number of results to return per page. */ pageSize?: number, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/crm/pipelines/', query: { 'code': code, 'is_default': isDefault, 'name': name, 'page': page, 'page_size': pageSize, }, errors: { 401: `Authentication required.`, 403: `Missing required permission \`Ibl.CRM/Pipelines/list\`.`, }, }); } /** * Create a pipeline * Creates a new Pipeline. `code` must be unique within your Platform. Promoting another Pipeline to `is_default=true` while one already exists will fail — unset the existing default first. * * **Required permission:** `Ibl.CRM/Pipelines/action`. * @returns Pipeline * @throws ApiError */ public static crmPipelinesCreate({ requestBody, }: { requestBody: Pipeline, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/crm/pipelines/', body: requestBody, mediaType: 'application/json', errors: { 400: `Validation error.`, 403: `Missing required permission \`Ibl.CRM/Pipelines/action\`.`, }, }); } /** * List stages for a pipeline * Returns the ordered list of PipelineStages for the given Pipeline. * * **Required permission:** `Ibl.CRM/Pipelines/list`. * @returns PaginatedPipelineStageList * @throws ApiError */ public static crmPipelinesStagesList({ pipelinePk, code, isLost, isWon, page, pageSize, }: { pipelinePk: number, code?: string, isLost?: boolean, isWon?: boolean, /** * A page number within the paginated result set. */ page?: number, /** * Number of results to return per page. */ pageSize?: number, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/crm/pipelines/{pipeline_pk}/stages/', path: { 'pipeline_pk': pipelinePk, }, query: { 'code': code, 'is_lost': isLost, 'is_won': isWon, 'page': page, 'page_size': pageSize, }, errors: { 403: `Missing required permission \`Ibl.CRM/Pipelines/list\`.`, 404: `Pipeline not found.`, }, }); } /** * Create a stage * Creates a new PipelineStage in the URL Pipeline. `code` must be unique within that Pipeline. At most one of `is_won` / `is_lost` may be true. * * **Required permission:** `Ibl.CRM/Pipelines/action`. * @returns PipelineStage * @throws ApiError */ public static crmPipelinesStagesCreate({ pipelinePk, requestBody, }: { pipelinePk: number, requestBody: PipelineStage, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/crm/pipelines/{pipeline_pk}/stages/', path: { 'pipeline_pk': pipelinePk, }, body: requestBody, mediaType: 'application/json', errors: { 400: `Validation error.`, 403: `Missing required permission \`Ibl.CRM/Pipelines/action\`.`, 404: `Pipeline not found.`, }, }); } /** * Retrieve a stage * Returns a single PipelineStage by id (must belong to the URL Pipeline). * * **Required permission:** `Ibl.CRM/Pipelines/read`. * @returns PipelineStage * @throws ApiError */ public static crmPipelinesStagesRetrieve({ id, pipelinePk, }: { id: number, pipelinePk: number, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/crm/pipelines/{pipeline_pk}/stages/{id}/', path: { 'id': id, 'pipeline_pk': pipelinePk, }, errors: { 403: `Missing required permission \`Ibl.CRM/Pipelines/read\`.`, 404: `Stage not found in this Pipeline.`, }, }); } /** * Replace a stage * Replaces all editable fields on the PipelineStage. * * **Required permission:** `Ibl.CRM/Pipelines/write`. * @returns PipelineStage * @throws ApiError */ public static crmPipelinesStagesUpdate({ id, pipelinePk, requestBody, }: { id: number, pipelinePk: number, requestBody: PipelineStage, }): CancelablePromise { return __request(OpenAPI, { method: 'PUT', url: '/api/crm/pipelines/{pipeline_pk}/stages/{id}/', path: { 'id': id, 'pipeline_pk': pipelinePk, }, body: requestBody, mediaType: 'application/json', errors: { 400: `Validation error.`, 403: `Missing required permission \`Ibl.CRM/Pipelines/write\`.`, 404: `Stage not found in this Pipeline.`, }, }); } /** * Update a stage * Updates only the supplied fields on the PipelineStage. * * **Required permission:** `Ibl.CRM/Pipelines/write`. * @returns PipelineStage * @throws ApiError */ public static crmPipelinesStagesPartialUpdate({ id, pipelinePk, requestBody, }: { id: number, pipelinePk: number, requestBody?: PatchedPipelineStage, }): CancelablePromise { return __request(OpenAPI, { method: 'PATCH', url: '/api/crm/pipelines/{pipeline_pk}/stages/{id}/', path: { 'id': id, 'pipeline_pk': pipelinePk, }, body: requestBody, mediaType: 'application/json', errors: { 400: `Validation error.`, 403: `Missing required permission \`Ibl.CRM/Pipelines/write\`.`, 404: `Stage not found in this Pipeline.`, }, }); } /** * Delete a stage * Deletes the PipelineStage. Fails with `409 Conflict` if any Deal still references it (FK is PROTECTed). * * **Required permission:** `Ibl.CRM/Pipelines/delete`. * @returns void * @throws ApiError */ public static crmPipelinesStagesDestroy({ id, pipelinePk, }: { id: number, pipelinePk: number, }): CancelablePromise { return __request(OpenAPI, { method: 'DELETE', url: '/api/crm/pipelines/{pipeline_pk}/stages/{id}/', path: { 'id': id, 'pipeline_pk': pipelinePk, }, errors: { 403: `Missing required permission \`Ibl.CRM/Pipelines/delete\`.`, 404: `Stage not found in this Pipeline.`, 409: `Stage still has Deals attached.`, }, }); } /** * Retrieve a pipeline * Returns a single Pipeline by id, including its ordered `stages`. * * **Required permission:** `Ibl.CRM/Pipelines/read`. * @returns Pipeline * @throws ApiError */ public static crmPipelinesRetrieve({ id, }: { /** * A unique integer value identifying this pipeline. */ id: number, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/crm/pipelines/{id}/', path: { 'id': id, }, errors: { 403: `Missing required permission \`Ibl.CRM/Pipelines/read\`.`, 404: `Pipeline not found.`, }, }); } /** * Replace a pipeline * Replaces all editable fields on the Pipeline. * * **Required permission:** `Ibl.CRM/Pipelines/write`. * @returns Pipeline * @throws ApiError */ public static crmPipelinesUpdate({ id, requestBody, }: { /** * A unique integer value identifying this pipeline. */ id: number, requestBody: Pipeline, }): CancelablePromise { return __request(OpenAPI, { method: 'PUT', url: '/api/crm/pipelines/{id}/', path: { 'id': id, }, body: requestBody, mediaType: 'application/json', errors: { 400: `Validation error.`, 403: `Missing required permission \`Ibl.CRM/Pipelines/write\`.`, 404: `Pipeline not found.`, }, }); } /** * Update a pipeline * Updates only the supplied fields on the Pipeline. * * **Required permission:** `Ibl.CRM/Pipelines/write`. * @returns Pipeline * @throws ApiError */ public static crmPipelinesPartialUpdate({ id, requestBody, }: { /** * A unique integer value identifying this pipeline. */ id: number, requestBody?: PatchedPipeline, }): CancelablePromise { return __request(OpenAPI, { method: 'PATCH', url: '/api/crm/pipelines/{id}/', path: { 'id': id, }, body: requestBody, mediaType: 'application/json', errors: { 400: `Validation error.`, 403: `Missing required permission \`Ibl.CRM/Pipelines/write\`.`, 404: `Pipeline not found.`, }, }); } /** * Delete a pipeline * Deletes the Pipeline. Fails with `409 Conflict` if any Deal still references it (FK is PROTECTed). * * **Required permission:** `Ibl.CRM/Pipelines/delete`. * @returns void * @throws ApiError */ public static crmPipelinesDestroy({ id, }: { /** * A unique integer value identifying this pipeline. */ id: number, }): CancelablePromise { return __request(OpenAPI, { method: 'DELETE', url: '/api/crm/pipelines/{id}/', path: { 'id': id, }, errors: { 403: `Missing required permission \`Ibl.CRM/Pipelines/delete\`.`, 404: `Pipeline not found.`, 409: `Pipeline still has Deals attached.`, }, }); } /** * List tags * Returns a paginated list of Tags in your Platform. Supports filtering by `name` (case-insensitive substring) and `created_at__gte`/`created_at__lte` ISO timestamp ranges. * * **Required permission:** `Ibl.CRM/Tags/list`. * @returns PaginatedTagList * @throws ApiError */ public static crmTagsList({ createdAtGte, createdAtLte, name, page, pageSize, }: { createdAtGte?: string, createdAtLte?: string, name?: string, /** * A page number within the paginated result set. */ page?: number, /** * Number of results to return per page. */ pageSize?: number, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/crm/tags/', query: { 'created_at__gte': createdAtGte, 'created_at__lte': createdAtLte, 'name': name, 'page': page, 'page_size': pageSize, }, errors: { 401: `Authentication required.`, 403: `Missing required permission \`Ibl.CRM/Tags/list\`.`, }, }); } /** * Create a tag * Creates a new Tag in your Platform. `name` must be unique within your Platform; supply `color` as a `#RRGGBB` hex string (defaults to `#888888`). * * **Required permission:** `Ibl.CRM/Tags/action`. * @returns Tag * @throws ApiError */ public static crmTagsCreate({ requestBody, }: { requestBody: Tag, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/crm/tags/', body: requestBody, mediaType: 'application/json', errors: { 400: `Validation error (duplicate name, bad color, etc.).`, 403: `Missing required permission \`Ibl.CRM/Tags/action\`.`, }, }); } /** * Retrieve a tag * Returns a single Tag by id. * * **Required permission:** `Ibl.CRM/Tags/read`. * @returns Tag * @throws ApiError */ public static crmTagsRetrieve({ id, }: { /** * A unique integer value identifying this tag. */ id: number, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/crm/tags/{id}/', path: { 'id': id, }, errors: { 403: `Missing required permission \`Ibl.CRM/Tags/read\`.`, 404: `Tag not found.`, }, }); } /** * Replace a tag * Replaces all editable fields on the Tag. * * **Required permission:** `Ibl.CRM/Tags/write`. * @returns Tag * @throws ApiError */ public static crmTagsUpdate({ id, requestBody, }: { /** * A unique integer value identifying this tag. */ id: number, requestBody: Tag, }): CancelablePromise { return __request(OpenAPI, { method: 'PUT', url: '/api/crm/tags/{id}/', path: { 'id': id, }, body: requestBody, mediaType: 'application/json', errors: { 400: `Validation error.`, 403: `Missing required permission \`Ibl.CRM/Tags/write\`.`, 404: `Tag not found.`, }, }); } /** * Update a tag * Updates only the supplied fields on the Tag (typically `name` or `color`). * * **Required permission:** `Ibl.CRM/Tags/write`. * @returns Tag * @throws ApiError */ public static crmTagsPartialUpdate({ id, requestBody, }: { /** * A unique integer value identifying this tag. */ id: number, requestBody?: PatchedTag, }): CancelablePromise { return __request(OpenAPI, { method: 'PATCH', url: '/api/crm/tags/{id}/', path: { 'id': id, }, body: requestBody, mediaType: 'application/json', errors: { 400: `Validation error.`, 403: `Missing required permission \`Ibl.CRM/Tags/write\`.`, 404: `Tag not found.`, }, }); } /** * Delete a tag * Deletes the Tag. All attachments to Persons, Organizations, and Deals are removed atomically via cascade. * * **Required permission:** `Ibl.CRM/Tags/delete`. * @returns void * @throws ApiError */ public static crmTagsDestroy({ id, }: { /** * A unique integer value identifying this tag. */ id: number, }): CancelablePromise { return __request(OpenAPI, { method: 'DELETE', url: '/api/crm/tags/{id}/', path: { 'id': id, }, errors: { 403: `Missing required permission \`Ibl.CRM/Tags/delete\`.`, 404: `Tag not found.`, }, }); } }