sessions.d.mts 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import { APIResource } from "../../../core/resource.mjs";
  2. import * as ThreadsAPI from "./threads.mjs";
  3. import { APIPromise } from "../../../core/api-promise.mjs";
  4. import { RequestOptions } from "../../../internal/request-options.mjs";
  5. export declare class Sessions extends APIResource {
  6. /**
  7. * Create a ChatKit session
  8. *
  9. * @example
  10. * ```ts
  11. * const chatSession =
  12. * await client.beta.chatkit.sessions.create({
  13. * user: 'x',
  14. * workflow: { id: 'id' },
  15. * });
  16. * ```
  17. */
  18. create(body: SessionCreateParams, options?: RequestOptions): APIPromise<ThreadsAPI.ChatSession>;
  19. /**
  20. * Cancel a ChatKit session
  21. *
  22. * @example
  23. * ```ts
  24. * const chatSession =
  25. * await client.beta.chatkit.sessions.cancel('cksess_123');
  26. * ```
  27. */
  28. cancel(sessionID: string, options?: RequestOptions): APIPromise<ThreadsAPI.ChatSession>;
  29. }
  30. export interface SessionCreateParams {
  31. /**
  32. * A free-form string that identifies your end user; ensures this Session can
  33. * access other objects that have the same `user` scope.
  34. */
  35. user: string;
  36. /**
  37. * Workflow that powers the session.
  38. */
  39. workflow: ThreadsAPI.ChatSessionWorkflowParam;
  40. /**
  41. * Optional overrides for ChatKit runtime configuration features
  42. */
  43. chatkit_configuration?: ThreadsAPI.ChatSessionChatKitConfigurationParam;
  44. /**
  45. * Optional override for session expiration timing in seconds from creation.
  46. * Defaults to 10 minutes.
  47. */
  48. expires_after?: ThreadsAPI.ChatSessionExpiresAfterParam;
  49. /**
  50. * Optional override for per-minute request limits. When omitted, defaults to 10.
  51. */
  52. rate_limits?: ThreadsAPI.ChatSessionRateLimitsParam;
  53. }
  54. export declare namespace Sessions {
  55. export { type SessionCreateParams as SessionCreateParams };
  56. }
  57. //# sourceMappingURL=sessions.d.mts.map