fathom-typescript
Version:
Fathom's official TypeScript SDK.
207 lines (193 loc) • 5.14 kB
text/typescript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import { createWebhook } from "../funcs/createWebhook.js";
import { deleteWebhook } from "../funcs/deleteWebhook.js";
import { getRecordingSummary } from "../funcs/getRecordingSummary.js";
import { getRecordingTranscript } from "../funcs/getRecordingTranscript.js";
import { listMeetings } from "../funcs/listMeetings.js";
import { listTeamMembers } from "../funcs/listTeamMembers.js";
import { listTeams } from "../funcs/listTeams.js";
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
import { PageIterator, unwrapResultIterator } from "../sdk/types/operations.js";
import * as operations from "./models/operations/index.js";
import * as shared from "./models/shared/index.js";
import { unwrapAsync } from "./types/fp.js";
// #region imports
import {
Webhook,
WebhookRequiredHeaders,
WebhookUnbrandedRequiredHeaders,
} from "svix";
import {
getAuthorizationUrl,
GetAuthorizationUrlRequest,
} from "../funcs/getAuthorizationUrl.js";
import {
InMemoryTokenStore,
TokenStore,
withAuthorization,
} from "../funcs/withAuthorization.js";
// #endregion imports
export class Fathom extends ClientSDK {
// #region sdk-class-body
static newTokenStore(): TokenStore {
return new InMemoryTokenStore();
}
static getAuthorizationUrl(
request: GetAuthorizationUrlRequest,
): string {
return getAuthorizationUrl(
request,
);
}
static withAuthorization(
{ clientId, clientSecret, code, redirectUri, tokenStore }: {
clientId: string;
clientSecret: string;
code: string;
redirectUri: string;
tokenStore: TokenStore;
},
) {
return withAuthorization({
clientId,
clientSecret,
code,
redirectUri,
tokenStore,
});
}
static verifyWebhook(
webhookSecret: string,
headers:
| WebhookRequiredHeaders
| WebhookUnbrandedRequiredHeaders
| Record<string, string>,
payload: string | Buffer,
): unknown {
const wh = new Webhook(webhookSecret);
return wh.verify(payload, headers);
}
// #endregion sdk-class-body
/**
* List meetings
*/
async listMeetings(
request?: operations.ListMeetingsRequest | undefined,
options?: RequestOptions,
): Promise<
PageIterator<
operations.ListMeetingsResponse | undefined,
{ cursor: string }
>
> {
return unwrapResultIterator(listMeetings(
this,
request,
options,
));
}
/**
* Get summary
*
* @remarks
* This endpoint has two behaviors depending on your request payload:
* - If you send `destination_url`, the endpoint will behave in an asynchronous manner.
* - If you do not send `destination_url`, the endpoint will return the data directly.
*/
async getRecordingSummary(
request: operations.GetRecordingSummaryRequest,
options?: RequestOptions,
): Promise<operations.GetRecordingSummaryResponse | undefined> {
return unwrapAsync(getRecordingSummary(
this,
request,
options,
));
}
/**
* Get transcript
*
* @remarks
* This endpoint has two behaviors depending on your request payload:
* - If you send `destination_url`, the endpoint will behave in an asynchronous manner.
* - If you do not send `destination_url`, the endpoint will return the data directly.
*/
async getRecordingTranscript(
request: operations.GetRecordingTranscriptRequest,
options?: RequestOptions,
): Promise<operations.GetRecordingTranscriptResponse | undefined> {
return unwrapAsync(getRecordingTranscript(
this,
request,
options,
));
}
/**
* List teams
*/
async listTeams(
request?: operations.ListTeamsRequest | undefined,
options?: RequestOptions,
): Promise<
PageIterator<operations.ListTeamsResponse | undefined, { cursor: string }>
> {
return unwrapResultIterator(listTeams(
this,
request,
options,
));
}
/**
* List team members
*/
async listTeamMembers(
request?: operations.ListTeamMembersRequest | undefined,
options?: RequestOptions,
): Promise<
PageIterator<
operations.ListTeamMembersResponse | undefined,
{ cursor: string }
>
> {
return unwrapResultIterator(listTeamMembers(
this,
request,
options,
));
}
/**
* Create a webhook
*
* @remarks
* Create a webhook to receive new meeting content.
* At least one of `include_transcript`, `include_crm_matches`, `include_summary`, or `include_action_items` must be true.
*/
async createWebhook(
request: operations.CreateWebhookRequest,
options?: RequestOptions,
): Promise<shared.Webhook | undefined> {
return unwrapAsync(createWebhook(
this,
request,
options,
));
}
/**
* Delete a webhook
*
* @remarks
* Delete a webhook.
*/
async deleteWebhook(
request: operations.DeleteWebhookRequest,
options?: RequestOptions,
): Promise<void> {
return unwrapAsync(deleteWebhook(
this,
request,
options,
));
}
}