-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathidentity.ts
144 lines (132 loc) · 3.67 KB
/
identity.ts
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
137
138
139
140
141
142
143
144
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../resource';
import * as Shared from './shared';
import { APIPromise } from '../api-promise';
import { RequestOptions } from '../internal/request-options';
export class Identity extends APIResource {
/**
* Exchanges an exchange token for a new access token.
*
* Use this method to:
*
* - Convert exchange tokens to access tokens
* - Obtain new access credentials
* - Complete token exchange flows
*
* ### Examples
*
* - Exchange token:
*
* Trades an exchange token for an access token.
*
* ```yaml
* exchangeToken: "exchange-token-value"
* ```
*/
exchangeToken(
body: IdentityExchangeTokenParams,
options?: RequestOptions,
): APIPromise<IdentityExchangeTokenResponse> {
return this._client.post('/gitpod.v1.IdentityService/ExchangeToken', { body, ...options });
}
/**
* Retrieves information about the currently authenticated identity.
*
* Use this method to:
*
* - Get current user information
* - Check authentication status
* - Retrieve organization context
* - Validate authentication principal
*
* ### Examples
*
* - Get current identity:
*
* Retrieves details about the authenticated user.
*
* ```yaml
* {}
* ```
*/
getAuthenticatedIdentity(
body: IdentityGetAuthenticatedIdentityParams,
options?: RequestOptions,
): APIPromise<IdentityGetAuthenticatedIdentityResponse> {
return this._client.post('/gitpod.v1.IdentityService/GetAuthenticatedIdentity', { body, ...options });
}
/**
* Gets an ID token for authenticating with other services.
*
* Use this method to:
*
* - Obtain authentication tokens for service-to-service calls
* - Access protected resources
* - Generate scoped access tokens
*
* ### Examples
*
* - Get token for single service:
*
* Retrieves a token for authenticating with one service.
*
* ```yaml
* audience:
* - "https://api.gitpod.io"
* ```
*
* - Get token for multiple services:
*
* Retrieves a token valid for multiple services.
*
* ```yaml
* audience:
* - "https://api.gitpod.io"
* - "https://ws.gitpod.io"
* ```
*/
getIDToken(
body: IdentityGetIDTokenParams,
options?: RequestOptions,
): APIPromise<IdentityGetIDTokenResponse> {
return this._client.post('/gitpod.v1.IdentityService/GetIDToken', { body, ...options });
}
}
export interface IdentityExchangeTokenResponse {
/**
* access_token is the new access token
*/
accessToken?: string;
}
export interface IdentityGetAuthenticatedIdentityResponse {
organizationId?: string;
/**
* subject is the identity of the current user
*/
subject?: Shared.Subject;
}
export interface IdentityGetIDTokenResponse {
token?: string;
}
export interface IdentityExchangeTokenParams {
/**
* exchange_token is the token to exchange
*/
exchangeToken?: string;
}
export interface IdentityGetAuthenticatedIdentityParams {
empty?: boolean;
}
export interface IdentityGetIDTokenParams {
audience?: Array<string>;
}
export declare namespace Identity {
export {
type IdentityExchangeTokenResponse as IdentityExchangeTokenResponse,
type IdentityGetAuthenticatedIdentityResponse as IdentityGetAuthenticatedIdentityResponse,
type IdentityGetIDTokenResponse as IdentityGetIDTokenResponse,
type IdentityExchangeTokenParams as IdentityExchangeTokenParams,
type IdentityGetAuthenticatedIdentityParams as IdentityGetAuthenticatedIdentityParams,
type IdentityGetIDTokenParams as IdentityGetIDTokenParams,
};
}