sessions.js 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. "use strict";
  2. // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
  3. Object.defineProperty(exports, "__esModule", { value: true });
  4. exports.Sessions = void 0;
  5. const resource_1 = require("../../../core/resource.js");
  6. const headers_1 = require("../../../internal/headers.js");
  7. class Sessions extends resource_1.APIResource {
  8. /**
  9. * Create an ephemeral API token for use in client-side applications with the
  10. * Realtime API. Can be configured with the same session parameters as the
  11. * `session.update` client event.
  12. *
  13. * It responds with a session object, plus a `client_secret` key which contains a
  14. * usable ephemeral API token that can be used to authenticate browser clients for
  15. * the Realtime API.
  16. *
  17. * @example
  18. * ```ts
  19. * const session =
  20. * await client.beta.realtime.sessions.create();
  21. * ```
  22. */
  23. create(body, options) {
  24. return this._client.post('/realtime/sessions', {
  25. body,
  26. ...options,
  27. headers: (0, headers_1.buildHeaders)([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
  28. });
  29. }
  30. }
  31. exports.Sessions = Sessions;
  32. //# sourceMappingURL=sessions.js.map