-
Notifications
You must be signed in to change notification settings - Fork 0
/
organizations.ts
106 lines (91 loc) · 3.57 KB
/
organizations.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
// 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';
import * as OrganizationsAPI from './organizations';
import * as Shared from '../shared';
import { OrganizationsListObjects } from '../shared';
import * as MembersAPI from './members';
import { type ListObjectsParams } from '../../pagination';
export class Organizations extends APIResource {
members: MembersAPI.Members = new MembersAPI.Members(this._client);
/**
* Get an organization object by its id
*/
retrieve(organizationId: string, options?: Core.RequestOptions): Core.APIPromise<Shared.Organization> {
return this._client.get(`/v1/organization/${organizationId}`, options);
}
/**
* Partially update an organization object. Specify the fields to update in the
* payload. Any object-type fields will be deep-merged with existing content.
* Currently we do not support removing fields or setting them to null.
*/
update(
organizationId: string,
body?: OrganizationUpdateParams,
options?: Core.RequestOptions,
): Core.APIPromise<Shared.Organization>;
update(organizationId: string, options?: Core.RequestOptions): Core.APIPromise<Shared.Organization>;
update(
organizationId: string,
body: OrganizationUpdateParams | Core.RequestOptions = {},
options?: Core.RequestOptions,
): Core.APIPromise<Shared.Organization> {
if (isRequestOptions(body)) {
return this.update(organizationId, {}, body);
}
return this._client.patch(`/v1/organization/${organizationId}`, { body, ...options });
}
/**
* List out all organizations. The organizations are sorted by creation date, with
* the most recently-created organizations coming first
*/
list(
query?: OrganizationListParams,
options?: Core.RequestOptions,
): Core.PagePromise<OrganizationsListObjects, Shared.Organization>;
list(options?: Core.RequestOptions): Core.PagePromise<OrganizationsListObjects, Shared.Organization>;
list(
query: OrganizationListParams | Core.RequestOptions = {},
options?: Core.RequestOptions,
): Core.PagePromise<OrganizationsListObjects, Shared.Organization> {
if (isRequestOptions(query)) {
return this.list({}, query);
}
return this._client.getAPIList('/v1/organization', OrganizationsListObjects, { query, ...options });
}
/**
* Delete an organization object by its id
*/
delete(organizationId: string, options?: Core.RequestOptions): Core.APIPromise<Shared.Organization> {
return this._client.delete(`/v1/organization/${organizationId}`, options);
}
}
export interface OrganizationUpdateParams {
api_url?: string | null;
is_universal_api?: boolean | null;
/**
* Name of the organization
*/
name?: string | null;
proxy_url?: string | null;
realtime_url?: string | null;
}
export interface OrganizationListParams extends ListObjectsParams {
/**
* Filter search results to a particular set of object IDs. To specify a list of
* IDs, include the query param multiple times
*/
ids?: string | Array<string>;
/**
* Filter search results to within a particular organization
*/
org_name?: string;
}
export namespace Organizations {
export import OrganizationUpdateParams = OrganizationsAPI.OrganizationUpdateParams;
export import OrganizationListParams = OrganizationsAPI.OrganizationListParams;
export import Members = MembersAPI.Members;
export import MemberUpdateParams = MembersAPI.MemberUpdateParams;
}
export { OrganizationsListObjects };