cloudflare
Version:
The official TypeScript library for the Cloudflare API
192 lines • 7.56 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../core/resource.mjs";
import { path } from "../../internal/utils/path.mjs";
export var BaseSessions = /* @__PURE__ */ (() => {
class BaseSessions extends APIResource {
/**
* Trigger Summary generation of Transcripts for the session ID.
*
* @example
* ```ts
* const response =
* await client.realtimeKit.sessions.generateSummaryOfTranscripts(
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
* {
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* app_id: '14a396e7-ca44-4937-bf1f-050a69118543',
* },
* );
* ```
*/
generateSummaryOfTranscripts(sessionID, params, options) {
const { account_id, app_id } = params;
return this._client.post(path `/accounts/${account_id}/realtime/kit/${app_id}/sessions/${sessionID}/summary`, options);
}
/**
* Returns participant details for the given peer ID along with call statistics.
*
* @example
* ```ts
* const response =
* await client.realtimeKit.sessions.getParticipantDataFromPeerID(
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
* {
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* app_id: '14a396e7-ca44-4937-bf1f-050a69118543',
* },
* );
* ```
*/
getParticipantDataFromPeerID(peerID, params, options) {
const { account_id, app_id, ...query } = params;
return this._client.get(path `/accounts/${account_id}/realtime/kit/${app_id}/sessions/peer-report/${peerID}`, { query, ...options });
}
/**
* Returns a URL to download all chat messages of the session ID in CSV format.
*
* @example
* ```ts
* const response =
* await client.realtimeKit.sessions.getSessionChat(
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
* {
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* app_id: '14a396e7-ca44-4937-bf1f-050a69118543',
* },
* );
* ```
*/
getSessionChat(sessionID, params, options) {
const { account_id, app_id } = params;
return this._client.get(path `/accounts/${account_id}/realtime/kit/${app_id}/sessions/${sessionID}/chat`, options);
}
/**
* Returns data of the given session ID including recording details.
*
* @example
* ```ts
* const response =
* await client.realtimeKit.sessions.getSessionDetails(
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
* {
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* app_id: '14a396e7-ca44-4937-bf1f-050a69118543',
* },
* );
* ```
*/
getSessionDetails(sessionID, params, options) {
const { account_id, app_id, ...query } = params;
return this._client.get(path `/accounts/${account_id}/realtime/kit/${app_id}/sessions/${sessionID}`, {
query,
...options,
});
}
/**
* Returns details of the given participant ID for the given session ID. Use the
* peer report endpoint to retrieve call statistics.
*
* @example
* ```ts
* const response =
* await client.realtimeKit.sessions.getSessionParticipantDetails(
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
* {
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* app_id: '14a396e7-ca44-4937-bf1f-050a69118543',
* session_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
* },
* );
* ```
*/
getSessionParticipantDetails(participantID, params, options) {
const { account_id, app_id, session_id, ...query } = params;
return this._client.get(path `/accounts/${account_id}/realtime/kit/${app_id}/sessions/${session_id}/participants/${participantID}`, { query, ...options });
}
/**
* Returns a list of participants for the given session ID.
*
* @example
* ```ts
* const response =
* await client.realtimeKit.sessions.getSessionParticipants(
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
* {
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* app_id: '14a396e7-ca44-4937-bf1f-050a69118543',
* },
* );
* ```
*/
getSessionParticipants(sessionID, params, options) {
const { account_id, app_id, ...query } = params;
return this._client.get(path `/accounts/${account_id}/realtime/kit/${app_id}/sessions/${sessionID}/participants`, { query, ...options });
}
/**
* Returns a Summary URL to download the Summary of Transcripts for the session ID
* as plain text.
*
* @example
* ```ts
* const response =
* await client.realtimeKit.sessions.getSessionSummary(
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
* {
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* app_id: '14a396e7-ca44-4937-bf1f-050a69118543',
* },
* );
* ```
*/
getSessionSummary(sessionID, params, options) {
const { account_id, app_id } = params;
return this._client.get(path `/accounts/${account_id}/realtime/kit/${app_id}/sessions/${sessionID}/summary`, options);
}
/**
* Returns a URL to download the transcript for the session ID in CSV format.
*
* @example
* ```ts
* const response =
* await client.realtimeKit.sessions.getSessionTranscripts(
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
* {
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* app_id: '14a396e7-ca44-4937-bf1f-050a69118543',
* },
* );
* ```
*/
getSessionTranscripts(sessionID, params, options) {
const { account_id, app_id, ...query } = params;
return this._client.get(path `/accounts/${account_id}/realtime/kit/${app_id}/sessions/${sessionID}/transcript`, { query, ...options });
}
/**
* Returns details of all sessions of an App.
*
* @example
* ```ts
* const response =
* await client.realtimeKit.sessions.getSessions(
* '14a396e7-ca44-4937-bf1f-050a69118543',
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
getSessions(appID, params, options) {
const { account_id, ...query } = params;
return this._client.get(path `/accounts/${account_id}/realtime/kit/${appID}/sessions`, {
query,
...options,
});
}
}
BaseSessions._key = Object.freeze([
'realtimeKit',
'sessions',
]);
return BaseSessions;
})();
export class Sessions extends BaseSessions {
}
//# sourceMappingURL=sessions.mjs.map