Properties

searchIterator: ((params: Omit<SearchOrganizationsRequest, keyof PagedRequest> & Omit<PagedRequest, "page_token">) => AsyncGenerator<Unwrapped<FN, PAYLOAD_KEY>>) = ...

Returns an async iterator that yields all organization entries matching the given search terms Each yielded array contains up to the number specified in SearchOrganizationsRequest.page_size of organizations. Use this method if you want to process the organizations in a streaming fashion.

Please note: the yielded organizations array may be empty on the last page.

let page = 0
for await (const entries of affinity.organizations.searchIterator({
term: 'Ltd',
page_size: 10
})) {
console.log(`Page ${++page} of entries:`, entries)
}

Methods

  • Deletes an organization with a specified organization_id.

    Parameters

    Returns Promise<boolean>

    true if the deletion was successful

    const success = await affinity.organizations.delete({
    organization_id: 12345
    })
    console.log(success ? 'Organization deleted': 'Organization not deleted')
  • Fetches an array of all the global fields that exist on organizations.

    Returns Promise<EntityField[]>

    An array of the fields that exist on all organizations for your team.

    const organizationFields = await affinity.organizations.getFields()
    console.log(organizationFields)
  • Updates an existing organization with organization_id with the supplied parameters.

    Parameters

    Returns Promise<SimpleOrganizationResponse>

    The organization resource that was just updated.

    const updatedOrganization = await affinity.organizations.update({
    organization_id: 12345,
    name: 'Acme Corp.',
    person_ids: [38706, 89734]
    })
    console.log(updatedOrganization)