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 { ActivateScheduledActionTemplateData, ActivateScheduledActionTemplateErrors, ActivateScheduledActionTemplateResponses, CreateScheduledActionData, CreateScheduledActionErrors, CreateScheduledActionResponses, DeleteScheduledActionData, DeleteScheduledActionErrors, DeleteScheduledActionResponses, DraftRoutineData, DraftRoutineErrors, DraftRoutineResponses, ExecuteScheduledActionNowData, ExecuteScheduledActionNowErrors, ExecuteScheduledActionNowResponses, GetScheduledActionData, GetScheduledActionErrors, GetScheduledActionResponses, GetScheduledActionTemplateData, GetScheduledActionTemplateErrors, GetScheduledActionTemplateResponses, ListScheduledActionCodeUpgradesData, ListScheduledActionCodeUpgradesErrors, ListScheduledActionCodeUpgradesResponses, ListScheduledActionHistoryData, ListScheduledActionHistoryErrors, ListScheduledActionHistoryResponses, ListScheduledActionsData, ListScheduledActionsErrors, ListScheduledActionsResponses, RoutineCodeStartersData, RoutineCodeStartersErrors, RoutineCodeStartersResponses, ScheduledActionHealthData, ScheduledActionHealthResponses, SetScheduledActionEnabledData, SetScheduledActionEnabledErrors, SetScheduledActionEnabledResponses, ShareScheduledActionTemplateData, ShareScheduledActionTemplateErrors, ShareScheduledActionTemplateResponses, UnshareScheduledActionTemplateData, UnshareScheduledActionTemplateErrors, UnshareScheduledActionTemplateResponses, UpdateScheduledActionData, UpdateScheduledActionErrors, UpdateScheduledActionResponses } 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);
}
public scheduledActionHealth<ThrowOnError extends boolean = false>(options?: Options<ScheduledActionHealthData, ThrowOnError>): RequestResult<ScheduledActionHealthResponses, unknown, ThrowOnError> {
return (options?.client ?? this.client).get<ScheduledActionHealthResponses, unknown, ThrowOnError>({ url: '/health', ...options });
}
public listScheduledActions<ThrowOnError extends boolean = false>(options?: Options<ListScheduledActionsData, ThrowOnError>): RequestResult<ListScheduledActionsResponses, ListScheduledActionsErrors, ThrowOnError> {
return (options?.client ?? this.client).get<ListScheduledActionsResponses, ListScheduledActionsErrors, ThrowOnError>({ url: '/scheduled-actions', ...options });
}
public createScheduledAction<ThrowOnError extends boolean = false>(options: Options<CreateScheduledActionData, ThrowOnError>): RequestResult<CreateScheduledActionResponses, CreateScheduledActionErrors, ThrowOnError> {
return (options.client ?? this.client).post<CreateScheduledActionResponses, CreateScheduledActionErrors, ThrowOnError>({
url: '/scheduled-actions',
...options,
headers: {
'Content-Type': 'application/json',
...options.headers
}
});
}
public routineCodeStarters<ThrowOnError extends boolean = false>(options?: Options<RoutineCodeStartersData, ThrowOnError>): RequestResult<RoutineCodeStartersResponses, RoutineCodeStartersErrors, ThrowOnError> {
return (options?.client ?? this.client).get<RoutineCodeStartersResponses, RoutineCodeStartersErrors, ThrowOnError>({ url: '/scheduled-actions/code/starters', ...options });
}
public draftRoutine<ThrowOnError extends boolean = false>(options: Options<DraftRoutineData, ThrowOnError>): RequestResult<DraftRoutineResponses, DraftRoutineErrors, ThrowOnError> {
return (options.client ?? this.client).post<DraftRoutineResponses, DraftRoutineErrors, ThrowOnError>({
url: '/scheduled-actions/drafts',
...options,
headers: {
'Content-Type': 'application/json',
...options.headers
}
});
}
public deleteScheduledAction<ThrowOnError extends boolean = false>(options: Options<DeleteScheduledActionData, ThrowOnError>): RequestResult<DeleteScheduledActionResponses, DeleteScheduledActionErrors, ThrowOnError> {
return (options.client ?? this.client).delete<DeleteScheduledActionResponses, DeleteScheduledActionErrors, ThrowOnError>({ url: '/scheduled-actions/{id}', ...options });
}
public getScheduledAction<ThrowOnError extends boolean = false>(options: Options<GetScheduledActionData, ThrowOnError>): RequestResult<GetScheduledActionResponses, GetScheduledActionErrors, ThrowOnError> {
return (options.client ?? this.client).get<GetScheduledActionResponses, GetScheduledActionErrors, ThrowOnError>({ url: '/scheduled-actions/{id}', ...options });
}
public updateScheduledAction<ThrowOnError extends boolean = false>(options: Options<UpdateScheduledActionData, ThrowOnError>): RequestResult<UpdateScheduledActionResponses, UpdateScheduledActionErrors, ThrowOnError> {
return (options.client ?? this.client).put<UpdateScheduledActionResponses, UpdateScheduledActionErrors, ThrowOnError>({
url: '/scheduled-actions/{id}',
...options,
headers: {
'Content-Type': 'application/json',
...options.headers
}
});
}
public listScheduledActionCodeUpgrades<ThrowOnError extends boolean = false>(options: Options<ListScheduledActionCodeUpgradesData, ThrowOnError>): RequestResult<ListScheduledActionCodeUpgradesResponses, ListScheduledActionCodeUpgradesErrors, ThrowOnError> {
return (options.client ?? this.client).get<ListScheduledActionCodeUpgradesResponses, ListScheduledActionCodeUpgradesErrors, ThrowOnError>({ url: '/scheduled-actions/{id}/code-upgrades', ...options });
}
public setScheduledActionEnabled<ThrowOnError extends boolean = false>(options: Options<SetScheduledActionEnabledData, ThrowOnError>): RequestResult<SetScheduledActionEnabledResponses, SetScheduledActionEnabledErrors, ThrowOnError> {
return (options.client ?? this.client).put<SetScheduledActionEnabledResponses, SetScheduledActionEnabledErrors, ThrowOnError>({
url: '/scheduled-actions/{id}/enabled',
...options,
headers: {
'Content-Type': 'application/json',
...options.headers
}
});
}
public executeScheduledActionNow<ThrowOnError extends boolean = false>(options: Options<ExecuteScheduledActionNowData, ThrowOnError>): RequestResult<ExecuteScheduledActionNowResponses, ExecuteScheduledActionNowErrors, ThrowOnError> {
return (options.client ?? this.client).post<ExecuteScheduledActionNowResponses, ExecuteScheduledActionNowErrors, ThrowOnError>({ url: '/scheduled-actions/{id}/execute', ...options });
}
public listScheduledActionHistory<ThrowOnError extends boolean = false>(options: Options<ListScheduledActionHistoryData, ThrowOnError>): RequestResult<ListScheduledActionHistoryResponses, ListScheduledActionHistoryErrors, ThrowOnError> {
return (options.client ?? this.client).get<ListScheduledActionHistoryResponses, ListScheduledActionHistoryErrors, ThrowOnError>({ url: '/scheduled-actions/{id}/history', ...options });
}
public unshareScheduledActionTemplate<ThrowOnError extends boolean = false>(options: Options<UnshareScheduledActionTemplateData, ThrowOnError>): RequestResult<UnshareScheduledActionTemplateResponses, UnshareScheduledActionTemplateErrors, ThrowOnError> {
return (options.client ?? this.client).delete<UnshareScheduledActionTemplateResponses, UnshareScheduledActionTemplateErrors, ThrowOnError>({ url: '/scheduled-actions/{id}/template', ...options });
}
public getScheduledActionTemplate<ThrowOnError extends boolean = false>(options: Options<GetScheduledActionTemplateData, ThrowOnError>): RequestResult<GetScheduledActionTemplateResponses, GetScheduledActionTemplateErrors, ThrowOnError> {
return (options.client ?? this.client).get<GetScheduledActionTemplateResponses, GetScheduledActionTemplateErrors, ThrowOnError>({ url: '/scheduled-actions/{id}/template', ...options });
}
public shareScheduledActionTemplate<ThrowOnError extends boolean = false>(options: Options<ShareScheduledActionTemplateData, ThrowOnError>): RequestResult<ShareScheduledActionTemplateResponses, ShareScheduledActionTemplateErrors, ThrowOnError> {
return (options.client ?? this.client).put<ShareScheduledActionTemplateResponses, ShareScheduledActionTemplateErrors, ThrowOnError>({
url: '/scheduled-actions/{id}/template',
...options,
headers: {
'Content-Type': 'application/json',
...options.headers
}
});
}
public activateScheduledActionTemplate<ThrowOnError extends boolean = false>(options: Options<ActivateScheduledActionTemplateData, ThrowOnError>): RequestResult<ActivateScheduledActionTemplateResponses, ActivateScheduledActionTemplateErrors, ThrowOnError> {
return (options.client ?? this.client).post<ActivateScheduledActionTemplateResponses, ActivateScheduledActionTemplateErrors, ThrowOnError>({
url: '/scheduled-actions/{id}/template/activate',
...options,
headers: {
'Content-Type': 'application/json',
...options.headers
}
});
}
}