summaryrefslogtreecommitdiffhomepage
path: root/packages/sdk/src/resources/session/permissions.ts
blob: 62fa946980344d3876ba074fd51e187662196dfa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import { APIResource } from '../../core/resource';
import { APIPromise } from '../../core/api-promise';
import { RequestOptions } from '../../internal/request-options';
import { path } from '../../internal/utils/path';

export class Permissions extends APIResource {
  /**
   * Respond to a permission request
   */
  respond(
    permissionID: string,
    params: PermissionRespondParams,
    options?: RequestOptions,
  ): APIPromise<PermissionRespondResponse> {
    const { id, ...body } = params;
    return this._client.post(path`/session/${id}/permissions/${permissionID}`, { body, ...options });
  }
}

export interface Permission {
  id: string;

  messageID: string;

  metadata: { [key: string]: unknown };

  sessionID: string;

  time: Permission.Time;

  title: string;

  toolCallID?: string;
}

export namespace Permission {
  export interface Time {
    created: number;
  }
}

export type PermissionRespondResponse = boolean;

export interface PermissionRespondParams {
  /**
   * Path param:
   */
  id: string;

  /**
   * Body param:
   */
  response: 'once' | 'always' | 'reject';
}

export declare namespace Permissions {
  export {
    type Permission as Permission,
    type PermissionRespondResponse as PermissionRespondResponse,
    type PermissionRespondParams as PermissionRespondParams,
  };
}