-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi-keys.ts
More file actions
48 lines (43 loc) · 1.32 KB
/
api-keys.ts
File metadata and controls
48 lines (43 loc) · 1.32 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
// 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';
export class APIKeys extends APIResource {
/**
* Given an authenticated service token and an environment, will exchange the
* service token for a secret API key that can be used to make requests to the
* public API.
*
* @example
* ```ts
* const response = await client.apiKeys.exchange({
* environment: 'development',
* });
* ```
*/
exchange(params: APIKeyExchangeParams, options?: RequestOptions): APIPromise<APIKeyExchangeResponse> {
const { environment } = params;
return this._client.post('/v1/api_keys/exchange', { query: { environment }, ...options });
}
}
/**
* Returns an API key that can be used to make requests to the public API.
*/
export interface APIKeyExchangeResponse {
/**
* The secret API key exchanged from the service token.
*/
api_key: string;
}
export interface APIKeyExchangeParams {
/**
* The environment slug.
*/
environment: string;
}
export declare namespace APIKeys {
export {
type APIKeyExchangeResponse as APIKeyExchangeResponse,
type APIKeyExchangeParams as APIKeyExchangeParams,
};
}