Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
// This file is auto-generated by @hey-api/openapi-ts
import type { Client, ClientMeta, Options as Options2, RequestResult, TDataShape } from './client';
import { client } from './client.gen';
import type { AddEntityPropertyOptionData, AddEntityPropertyOptionErrors, AddEntityPropertyOptionResponses, AddPropertyOptionData, AddPropertyOptionErrors, AddPropertyOptionResponses, BulkUpdateEntitiesPropertyOptionsData, BulkUpdateEntitiesPropertyOptionsErrors, BulkUpdateEntitiesPropertyOptionsResponses, BulkUpdateEntityPropertyOptionsData, BulkUpdateEntityPropertyOptionsErrors, BulkUpdateEntityPropertyOptionsResponses, CreatePropertyDefinitionData, CreatePropertyDefinitionErrors, CreatePropertyDefinitionResponses, DeleteEntityPropertyData, DeleteEntityPropertyErrors, DeleteEntityPropertyResponses, DeletePropertyDefinitionData, DeletePropertyDefinitionErrors, DeletePropertyDefinitionResponses, DeletePropertyOptionData, DeletePropertyOptionErrors, DeletePropertyOptionResponses, EnsureTagSetData, EnsureTagSetErrors, EnsureTagSetResponses, GetBulkEntityPropertiesData, GetBulkEntityPropertiesErrors, GetBulkEntityPropertiesResponses, GetEntityPropertiesData, GetEntityPropertiesErrors, GetEntityPropertiesResponses, GetPropertyDefinitionData, GetPropertyDefinitionErrors, GetPropertyDefinitionResponses, GetPropertyOptionsData, GetPropertyOptionsErrors, GetPropertyOptionsResponses, ListPropertiesData, ListPropertiesErrors, ListPropertiesResponses, ListTagsData, ListTagsErrors, ListTagsResponses, MergeTagData, MergeTagErrors, MergeTagResponses, PromoteTagData, PromoteTagErrors, PromoteTagResponses, RemoveEntityPropertyOptionData, RemoveEntityPropertyOptionErrors, RemoveEntityPropertyOptionResponses, SetEntityPropertyData, SetEntityPropertyErrors, SetEntityPropertyResponses, UpdatePropertyOptionData, UpdatePropertyOptionErrors, UpdatePropertyOptionResponses } from './types.gen';
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options2<TData, ThrowOnError, TResponse> & {
/**
* You can provide a client instance returned by `createClient()` instead of
* individual options. This might be also useful if you want to implement a
* custom client.
*/
client?: Client;
/**
* You can pass arbitrary values through the `meta` object. This can be
* used to access values that aren't defined as part of the SDK function.
*/
meta?: keyof ClientMeta extends never ? Record<string, unknown> : ClientMeta;
};
class HeyApiClient {
protected client: Client;
constructor(args?: {
client?: Client;
}) {
this.client = args?.client ?? client;
}
}
class HeyApiRegistry<T> {
private readonly defaultKey = 'default';
private readonly instances: Map<string, T> = new Map();
get(key?: string): T {
const instance = this.instances.get(key ?? this.defaultKey);
if (!instance) {
throw new Error(`No SDK client found. Create one with "new Sdk()" to fix this error.`);
}
return instance;
}
set(value: T, key?: string): void {
this.instances.set(key ?? this.defaultKey, value);
}
}
export class Sdk extends HeyApiClient {
public static readonly __registry: HeyApiRegistry<Sdk> = new HeyApiRegistry<Sdk>();
constructor(args?: {
client?: Client;
key?: string;
}) {
super(args);
Sdk.__registry.set(this, args?.key);
}
/**
* List property definitions with flexible filtering
*/
public listProperties<ThrowOnError extends boolean = false>(options: Options<ListPropertiesData, ThrowOnError>): RequestResult<ListPropertiesResponses, ListPropertiesErrors, ThrowOnError> {
return (options.client ?? this.client).get<ListPropertiesResponses, ListPropertiesErrors, ThrowOnError>({ url: '/properties/definitions', ...options });
}
/**
* Create a new property definition
*/
public createPropertyDefinition<ThrowOnError extends boolean = false>(options: Options<CreatePropertyDefinitionData, ThrowOnError>): RequestResult<CreatePropertyDefinitionResponses, CreatePropertyDefinitionErrors, ThrowOnError> {
return (options.client ?? this.client).post<CreatePropertyDefinitionResponses, CreatePropertyDefinitionErrors, ThrowOnError>({
url: '/properties/definitions',
...options,
headers: {
'Content-Type': 'application/json',
...options.headers
}
});
}
/**
* Delete a property definition
*/
public deletePropertyDefinition<ThrowOnError extends boolean = false>(options: Options<DeletePropertyDefinitionData, ThrowOnError>): RequestResult<DeletePropertyDefinitionResponses, DeletePropertyDefinitionErrors, ThrowOnError> {
return (options.client ?? this.client).delete<DeletePropertyDefinitionResponses, DeletePropertyDefinitionErrors, ThrowOnError>({ url: '/properties/definitions/{definition_id}', ...options });
}
/**
* Get a property definition by ID
*/
public getPropertyDefinition<ThrowOnError extends boolean = false>(options: Options<GetPropertyDefinitionData, ThrowOnError>): RequestResult<GetPropertyDefinitionResponses, GetPropertyDefinitionErrors, ThrowOnError> {
return (options.client ?? this.client).get<GetPropertyDefinitionResponses, GetPropertyDefinitionErrors, ThrowOnError>({ url: '/properties/definitions/{definition_id}', ...options });
}
/**
* Get all options for a property (for dropdowns)
*/
public getPropertyOptions<ThrowOnError extends boolean = false>(options: Options<GetPropertyOptionsData, ThrowOnError>): RequestResult<GetPropertyOptionsResponses, GetPropertyOptionsErrors, ThrowOnError> {
return (options.client ?? this.client).get<GetPropertyOptionsResponses, GetPropertyOptionsErrors, ThrowOnError>({ url: '/properties/definitions/{definition_id}/options', ...options });
}
/**
* Add a new option to a property dropdown
*/
public addPropertyOption<ThrowOnError extends boolean = false>(options: Options<AddPropertyOptionData, ThrowOnError>): RequestResult<AddPropertyOptionResponses, AddPropertyOptionErrors, ThrowOnError> {
return (options.client ?? this.client).post<AddPropertyOptionResponses, AddPropertyOptionErrors, ThrowOnError>({
url: '/properties/definitions/{definition_id}/options',
...options,
headers: {
'Content-Type': 'application/json',
...options.headers
}
});
}
/**
* Delete a property option
*/
public deletePropertyOption<ThrowOnError extends boolean = false>(options: Options<DeletePropertyOptionData, ThrowOnError>): RequestResult<DeletePropertyOptionResponses, DeletePropertyOptionErrors, ThrowOnError> {
return (options.client ?? this.client).delete<DeletePropertyOptionResponses, DeletePropertyOptionErrors, ThrowOnError>({ url: '/properties/definitions/{definition_id}/options/{option_id}', ...options });
}
/**
* Update a property option in place (rename / recolor / reorder).
*
* The option id is preserved, so the change is reflected on every entity that references it.
*/
public updatePropertyOption<ThrowOnError extends boolean = false>(options: Options<UpdatePropertyOptionData, ThrowOnError>): RequestResult<UpdatePropertyOptionResponses, UpdatePropertyOptionErrors, ThrowOnError> {
return (options.client ?? this.client).patch<UpdatePropertyOptionResponses, UpdatePropertyOptionErrors, ThrowOnError>({
url: '/properties/definitions/{definition_id}/options/{option_id}',
...options,
headers: {
'Content-Type': 'application/json',
...options.headers
}
});
}
/**
* Get properties for multiple entities in bulk (public endpoint with user auth)
*
* Only returns properties for entities the user has view permission for.
* Entities without permission are silently omitted from the response.
*/
public getBulkEntityProperties<ThrowOnError extends boolean = false>(options: Options<GetBulkEntityPropertiesData, ThrowOnError>): RequestResult<GetBulkEntityPropertiesResponses, GetBulkEntityPropertiesErrors, ThrowOnError> {
return (options.client ?? this.client).post<GetBulkEntityPropertiesResponses, GetBulkEntityPropertiesErrors, ThrowOnError>({
url: '/properties/entities/bulk',
...options,
headers: {
'Content-Type': 'application/json',
...options.headers
}
});
}
/**
* Get all properties for an entity
*/
public getEntityProperties<ThrowOnError extends boolean = false>(options: Options<GetEntityPropertiesData, ThrowOnError>): RequestResult<GetEntityPropertiesResponses, GetEntityPropertiesErrors, ThrowOnError> {
return (options.client ?? this.client).get<GetEntityPropertiesResponses, GetEntityPropertiesErrors, ThrowOnError>({ url: '/properties/entities/{entity_type}/{entity_id}', ...options });
}
/**
* Apply a complete tag-picker selection across an entity's multi-select
* properties in one request.
*
* Each property change is expressed as an option delta and applied to the
* current stored value under a per-row lock inside a single transaction, so the
* selection persists atomically and composes with concurrent edits instead of
* clobbering them. Returns the reconciled final option ids per property for
* cache reconciliation.
*/
public bulkUpdateEntityPropertyOptions<ThrowOnError extends boolean = false>(options: Options<BulkUpdateEntityPropertyOptionsData, ThrowOnError>): RequestResult<BulkUpdateEntityPropertyOptionsResponses, BulkUpdateEntityPropertyOptionsErrors, ThrowOnError> {
return (options.client ?? this.client).post<BulkUpdateEntityPropertyOptionsResponses, BulkUpdateEntityPropertyOptionsErrors, ThrowOnError>({
url: '/properties/entities/{entity_type}/{entity_id}/options/bulk',
...options,
headers: {
'Content-Type': 'application/json',
...options.headers
}
});
}
/**
* Set or update a property value for an entity, or attach a property without a value
*/
public setEntityProperty<ThrowOnError extends boolean = false>(options: Options<SetEntityPropertyData, ThrowOnError>): RequestResult<SetEntityPropertyResponses, SetEntityPropertyErrors, ThrowOnError> {
return (options.client ?? this.client).put<SetEntityPropertyResponses, SetEntityPropertyErrors, ThrowOnError>({
url: '/properties/entities/{entity_type}/{entity_id}/{property_id}',
...options,
headers: {
'Content-Type': 'application/json',
...options.headers
}
});
}
/**
* Remove a single option from an entity's multi-select property value.
*
* Atomic delta: the option is stripped from the current stored value (a no-op
* if absent), so concurrent edits to the same value merge rather than overwrite
* each other.
*/
public removeEntityPropertyOption<ThrowOnError extends boolean = false>(options: Options<RemoveEntityPropertyOptionData, ThrowOnError>): RequestResult<RemoveEntityPropertyOptionResponses, RemoveEntityPropertyOptionErrors, ThrowOnError> {
return (options.client ?? this.client).delete<RemoveEntityPropertyOptionResponses, RemoveEntityPropertyOptionErrors, ThrowOnError>({ url: '/properties/entities/{entity_type}/{entity_id}/{property_id}/options/{option_id}', ...options });
}
/**
* Add a single option to an entity's multi-select property value.
*
* Atomic delta: the option is appended to the current stored value (deduped,
* attaching the property if needed), so concurrent edits to the same value
* merge rather than overwrite each other. Prefer this over the full-value PUT
* when adding one option.
*/
public addEntityPropertyOption<ThrowOnError extends boolean = false>(options: Options<AddEntityPropertyOptionData, ThrowOnError>): RequestResult<AddEntityPropertyOptionResponses, AddEntityPropertyOptionErrors, ThrowOnError> {
return (options.client ?? this.client).post<AddEntityPropertyOptionResponses, AddEntityPropertyOptionErrors, ThrowOnError>({ url: '/properties/entities/{entity_type}/{entity_id}/{property_id}/options/{option_id}', ...options });
}
/**
* Remove a specific entity property by its ID
*/
public deleteEntityProperty<ThrowOnError extends boolean = false>(options: Options<DeleteEntityPropertyData, ThrowOnError>): RequestResult<DeleteEntityPropertyResponses, DeleteEntityPropertyErrors, ThrowOnError> {
return (options.client ?? this.client).delete<DeleteEntityPropertyResponses, DeleteEntityPropertyErrors, ThrowOnError>({ url: '/properties/entity_properties/{entity_property_id}', ...options });
}
/**
* Apply one shared option delta (add / remove option ids on a single
* multi-select property) to many entities in one request — e.g. tag a set of
* emails with one label.
*
* Best-effort per entity: one edit receipt is minted per entity, entities the
* caller can't edit are reported as `skipped_no_permission` (mirroring the
* read path, which silently drops entities the caller can't view), and each
* permitted entity is updated in its own transaction so one entity failing
* does not roll back the others. Returns one result per requested entity in
* request order, with the reconciled final option ids for the successes.
*/
public bulkUpdateEntitiesPropertyOptions<ThrowOnError extends boolean = false>(options: Options<BulkUpdateEntitiesPropertyOptionsData, ThrowOnError>): RequestResult<BulkUpdateEntitiesPropertyOptionsResponses, BulkUpdateEntitiesPropertyOptionsErrors, ThrowOnError> {
return (options.client ?? this.client).post<BulkUpdateEntitiesPropertyOptionsResponses, BulkUpdateEntitiesPropertyOptionsErrors, ThrowOnError>({
url: '/properties/options/bulk',
...options,
headers: {
'Content-Type': 'application/json',
...options.headers
}
});
}
/**
* List the caller's tag sets: their personal set, plus their team's set when on a team.
* Pure read - a scope with no provisioned definition yet returns an empty set.
*/
public listTags<ThrowOnError extends boolean = false>(options?: Options<ListTagsData, ThrowOnError>): RequestResult<ListTagsResponses, ListTagsErrors, ThrowOnError> {
return (options?.client ?? this.client).get<ListTagsResponses, ListTagsErrors, ThrowOnError>({ url: '/properties/tags', ...options });
}
/**
* Provision (get-or-create) the caller's tag set for a scope and return it. Called when
* the caller creates their first label for that scope, so the read path stays side-effect free.
*/
public ensureTagSet<ThrowOnError extends boolean = false>(options: Options<EnsureTagSetData, ThrowOnError>): RequestResult<EnsureTagSetResponses, EnsureTagSetErrors, ThrowOnError> {
return (options.client ?? this.client).post<EnsureTagSetResponses, EnsureTagSetErrors, ThrowOnError>({
url: '/properties/tags',
...options,
headers: {
'Content-Type': 'application/json',
...options.headers
}
});
}
/**
* Replace one of the caller's personal labels with an existing team label.
*
* Every entity carrying the personal label is retagged with the team label
* (deduped if it already has both) and the personal label is deleted. The team
* label's name and color win. This is the confirmation step after the promote
* endpoint reports a name collision.
*/
public mergeTag<ThrowOnError extends boolean = false>(options: Options<MergeTagData, ThrowOnError>): RequestResult<MergeTagResponses, MergeTagErrors, ThrowOnError> {
return (options.client ?? this.client).post<MergeTagResponses, MergeTagErrors, ThrowOnError>({
url: '/properties/tags/merge',
...options,
headers: {
'Content-Type': 'application/json',
...options.headers
}
});
}
/**
* Share one of the caller's personal labels with their team.
*
* The label moves into the team tag set keeping its option id, so every entity
* already carrying it keeps the label — it just becomes visible to, and usable
* by, the whole team. A 409 means the team already has a label with that name;
* its body carries that label, and confirming the replacement is a call to the
* merge endpoint with `conflicting_option.id` as `target_option_id`.
*/
public promoteTag<ThrowOnError extends boolean = false>(options: Options<PromoteTagData, ThrowOnError>): RequestResult<PromoteTagResponses, PromoteTagErrors, ThrowOnError> {
return (options.client ?? this.client).post<PromoteTagResponses, PromoteTagErrors, ThrowOnError>({
url: '/properties/tags/promote',
...options,
headers: {
'Content-Type': 'application/json',
...options.headers
}
});
}
}