-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsecrets.ts
More file actions
136 lines (109 loc) · 3.34 KB
/
secrets.ts
File metadata and controls
136 lines (109 loc) · 3.34 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../resource';
import { isRequestOptions } from '../core';
import * as Core from '../core';
export class Secrets extends APIResource {
/**
* Create a new secret for a developer.
*
* Args: developer_id: ID of the developer creating the secret secret: Secret to
* create
*
* Returns: The created secret
*
* Raises: HTTPException: If a secret with this name already exists (409 Conflict)
*/
create(body: SecretCreateParams, options?: Core.RequestOptions): Core.APIPromise<Secret> {
return this._client.post('/secrets', { body, ...options });
}
/**
* Update a developer secret.
*
* Args: developer_id: ID of the developer who owns the secret secret_id: ID of the
* secret to update data: New secret data
*
* Returns: The updated secret
*
* Raises: HTTPException: If the secret doesn't exist or doesn't belong to the
* developer
*/
update(secretId: string, body: SecretUpdateParams, options?: Core.RequestOptions): Core.APIPromise<Secret> {
return this._client.put(`/secrets/${secretId}`, { body, ...options });
}
/**
* List all secrets for a developer.
*
* Args: x_developer_id: ID of the developer whose secrets to list limit: Maximum
* number of secrets to return offset: Number of secrets to skip
*
* Returns: List of secrets
*/
list(query?: SecretListParams, options?: Core.RequestOptions): Core.APIPromise<SecretListResponse>;
list(options?: Core.RequestOptions): Core.APIPromise<SecretListResponse>;
list(
query: SecretListParams | Core.RequestOptions = {},
options?: Core.RequestOptions,
): Core.APIPromise<SecretListResponse> {
if (isRequestOptions(query)) {
return this.list({}, query);
}
return this._client.get('/secrets', { query, ...options });
}
/**
* Delete a secret.
*
* Args: secret_id: ID of the secret to delete x_developer_id: ID of the developer
* who owns the secret
*
* Returns: The deleted secret
*
* Raises: HTTPException: If the secret doesn't exist
*/
delete(secretId: string, options?: Core.RequestOptions): Core.APIPromise<SecretDeleteResponse> {
return this._client.delete(`/secrets/${secretId}`, options);
}
}
/**
* A secret that can be used in tasks and sessions
*/
export interface Secret {
id: string;
created_at: string;
name: string;
updated_at: string;
value: string;
description?: string | null;
metadata?: unknown | null;
}
export type SecretListResponse = Array<Secret>;
export interface SecretDeleteResponse {
id: string;
deleted_at: string;
jobs?: Array<string>;
}
export interface SecretCreateParams {
name: string;
value: string;
description?: string | null;
metadata?: unknown | null;
}
export interface SecretUpdateParams {
name: string;
value: string;
description?: string | null;
metadata?: unknown | null;
}
export interface SecretListParams {
limit?: number;
offset?: number;
}
export declare namespace Secrets {
export {
type Secret as Secret,
type SecretListResponse as SecretListResponse,
type SecretDeleteResponse as SecretDeleteResponse,
type SecretCreateParams as SecretCreateParams,
type SecretUpdateParams as SecretUpdateParams,
type SecretListParams as SecretListParams,
};
}