sessions.js 1.1 KB

12345678910111213141516171819202122232425262728293031
  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("../../../resource.js");
  6. class Sessions extends resource_1.APIResource {
  7. /**
  8. * Create an ephemeral API token for use in client-side applications with the
  9. * Realtime API. Can be configured with the same session parameters as the
  10. * `session.update` client event.
  11. *
  12. * It responds with a session object, plus a `client_secret` key which contains a
  13. * usable ephemeral API token that can be used to authenticate browser clients for
  14. * the Realtime API.
  15. *
  16. * @example
  17. * ```ts
  18. * const session =
  19. * await client.beta.realtime.sessions.create();
  20. * ```
  21. */
  22. create(body, options) {
  23. return this._client.post('/realtime/sessions', {
  24. body,
  25. ...options,
  26. headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers },
  27. });
  28. }
  29. }
  30. exports.Sessions = Sessions;
  31. //# sourceMappingURL=sessions.js.map