@sentdm/sentdm 0.5.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +2 -8
  3. package/client.d.mts +3 -2
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +3 -2
  6. package/client.d.ts.map +1 -1
  7. package/client.js +6 -1
  8. package/client.js.map +1 -1
  9. package/client.mjs +7 -2
  10. package/client.mjs.map +1 -1
  11. package/package.json +1 -1
  12. package/resources/index.d.mts +1 -1
  13. package/resources/index.d.mts.map +1 -1
  14. package/resources/index.d.ts +1 -1
  15. package/resources/index.d.ts.map +1 -1
  16. package/resources/index.js.map +1 -1
  17. package/resources/index.mjs +1 -1
  18. package/resources/index.mjs.map +1 -1
  19. package/resources/organizations/index.d.mts +2 -2
  20. package/resources/organizations/index.d.mts.map +1 -1
  21. package/resources/organizations/index.d.ts +2 -2
  22. package/resources/organizations/index.d.ts.map +1 -1
  23. package/resources/organizations/index.js.map +1 -1
  24. package/resources/organizations/index.mjs +2 -2
  25. package/resources/organizations/index.mjs.map +1 -1
  26. package/resources/organizations/organizations.d.mts +2 -55
  27. package/resources/organizations/organizations.d.mts.map +1 -1
  28. package/resources/organizations/organizations.d.ts +2 -55
  29. package/resources/organizations/organizations.d.ts.map +1 -1
  30. package/resources/organizations/organizations.js +0 -29
  31. package/resources/organizations/organizations.js.map +1 -1
  32. package/resources/organizations/organizations.mjs +1 -30
  33. package/resources/organizations/organizations.mjs.map +1 -1
  34. package/resources/organizations/users.d.mts +0 -122
  35. package/resources/organizations/users.d.mts.map +1 -1
  36. package/resources/organizations/users.d.ts +0 -122
  37. package/resources/organizations/users.d.ts.map +1 -1
  38. package/resources/organizations/users.js +0 -86
  39. package/resources/organizations/users.js.map +1 -1
  40. package/resources/organizations/users.mjs +0 -86
  41. package/resources/organizations/users.mjs.map +1 -1
  42. package/src/client.ts +9 -13
  43. package/src/resources/index.ts +1 -6
  44. package/src/resources/organizations/index.ts +2 -16
  45. package/src/resources/organizations/organizations.ts +2 -103
  46. package/src/resources/organizations/users.ts +1 -185
  47. package/src/version.ts +1 -1
  48. package/version.d.mts +1 -1
  49. package/version.d.ts +1 -1
  50. package/version.js +1 -1
  51. package/version.mjs +1 -1
package/src/client.ts CHANGED
@@ -46,12 +46,7 @@ import {
46
46
  TemplateVariable,
47
47
  Templates,
48
48
  } from './resources/templates';
49
- import {
50
- OrganizationListResponse,
51
- OrganizationRetrieveProfilesResponse,
52
- Organizations,
53
- ProfileSummary,
54
- } from './resources/organizations/organizations';
49
+ import { Organizations } from './resources/organizations/organizations';
55
50
  import { type Fetch } from './internal/builtin-types';
56
51
  import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
57
52
  import { FinalRequestOptions, RequestOptions } from './internal/request-options';
@@ -548,7 +543,7 @@ export class SentDm {
548
543
  controller: AbortController,
549
544
  ): Promise<Response> {
550
545
  const { signal, method, ...options } = init || {};
551
- const abort = controller.abort.bind(controller);
546
+ const abort = this._makeAbort(controller);
552
547
  if (signal) signal.addEventListener('abort', abort, { once: true });
553
548
 
554
549
  const timeout = setTimeout(abort, ms);
@@ -718,6 +713,12 @@ export class SentDm {
718
713
  return headers.values;
719
714
  }
720
715
 
716
+ private _makeAbort(controller: AbortController) {
717
+ // note: we can't just inline this method inside `fetchWithTimeout()` because then the closure
718
+ // would capture all request options, and cause a memory leak.
719
+ return () => controller.abort();
720
+ }
721
+
721
722
  private buildBody({ options: { body, headers: rawHeaders } }: { options: FinalRequestOptions }): {
722
723
  bodyHeaders: HeadersLike;
723
724
  body: BodyInit | undefined;
@@ -824,10 +825,5 @@ export declare namespace SentDm {
824
825
  type NumberLookupRetrieveParams as NumberLookupRetrieveParams,
825
826
  };
826
827
 
827
- export {
828
- Organizations as Organizations,
829
- type ProfileSummary as ProfileSummary,
830
- type OrganizationListResponse as OrganizationListResponse,
831
- type OrganizationRetrieveProfilesResponse as OrganizationRetrieveProfilesResponse,
832
- };
828
+ export { Organizations as Organizations };
833
829
  }
@@ -20,12 +20,7 @@ export {
20
20
  type NumberLookupRetrieveResponse,
21
21
  type NumberLookupRetrieveParams,
22
22
  } from './number-lookup';
23
- export {
24
- Organizations,
25
- type ProfileSummary,
26
- type OrganizationListResponse,
27
- type OrganizationRetrieveProfilesResponse,
28
- } from './organizations/organizations';
23
+ export { Organizations } from './organizations/organizations';
29
24
  export {
30
25
  Templates,
31
26
  type TemplateBodyContent,
@@ -1,18 +1,4 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- export {
4
- Organizations,
5
- type ProfileSummary,
6
- type OrganizationListResponse,
7
- type OrganizationRetrieveProfilesResponse,
8
- } from './organizations';
9
- export {
10
- Users,
11
- type CustomerUser,
12
- type UserListResponse,
13
- type UserRetrieveParams,
14
- type UserListParams,
15
- type UserDeleteParams,
16
- type UserInviteParams,
17
- type UserUpdateRoleParams,
18
- } from './users';
3
+ export { Organizations } from './organizations';
4
+ export { Users } from './users';
@@ -1,116 +1,15 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { APIResource } from '../../core/resource';
4
- import * as OrganizationsAPI from './organizations';
5
4
  import * as UsersAPI from './users';
6
- import {
7
- CustomerUser,
8
- UserDeleteParams,
9
- UserInviteParams,
10
- UserListParams,
11
- UserListResponse,
12
- UserRetrieveParams,
13
- UserUpdateRoleParams,
14
- Users,
15
- } from './users';
16
- import { APIPromise } from '../../core/api-promise';
17
- import { RequestOptions } from '../../internal/request-options';
18
- import { path } from '../../internal/utils/path';
5
+ import { Users } from './users';
19
6
 
20
7
  export class Organizations extends APIResource {
21
8
  users: UsersAPI.Users = new UsersAPI.Users(this._client);
22
-
23
- /**
24
- * Retrieves all organizations that the authenticated user has access to, including
25
- * the sender profiles within each organization that the user can access. Returns
26
- * organization details with nested profiles filtered by user permissions.
27
- *
28
- * @example
29
- * ```ts
30
- * const organizations = await client.organizations.list();
31
- * ```
32
- */
33
- list(options?: RequestOptions): APIPromise<OrganizationListResponse> {
34
- return this._client.get('/v2/organizations', options);
35
- }
36
-
37
- /**
38
- * Retrieves all sender profiles within an organization that the authenticated user
39
- * has access to. Returns filtered list based on user's permissions.
40
- *
41
- * @example
42
- * ```ts
43
- * const response =
44
- * await client.organizations.retrieveProfiles(
45
- * '6ba7b810-9dad-11d1-80b4-00c04fd430c8',
46
- * );
47
- * ```
48
- */
49
- retrieveProfiles(
50
- orgID: string,
51
- options?: RequestOptions,
52
- ): APIPromise<OrganizationRetrieveProfilesResponse> {
53
- return this._client.get(path`/v2/organizations/${orgID}/profiles`, options);
54
- }
55
- }
56
-
57
- export interface ProfileSummary {
58
- id?: string;
59
-
60
- createdAt?: string;
61
-
62
- description?: string | null;
63
-
64
- icon?: string | null;
65
-
66
- name?: string;
67
-
68
- shortName?: string | null;
69
- }
70
-
71
- export interface OrganizationListResponse {
72
- organizations?: Array<OrganizationListResponse.Organization>;
73
- }
74
-
75
- export namespace OrganizationListResponse {
76
- export interface Organization {
77
- id?: string;
78
-
79
- createdAt?: string;
80
-
81
- description?: string | null;
82
-
83
- icon?: string | null;
84
-
85
- name?: string;
86
-
87
- profiles?: Array<OrganizationsAPI.ProfileSummary>;
88
- }
89
- }
90
-
91
- export interface OrganizationRetrieveProfilesResponse {
92
- organizationId?: string;
93
-
94
- profiles?: Array<ProfileSummary>;
95
9
  }
96
10
 
97
11
  Organizations.Users = Users;
98
12
 
99
13
  export declare namespace Organizations {
100
- export {
101
- type ProfileSummary as ProfileSummary,
102
- type OrganizationListResponse as OrganizationListResponse,
103
- type OrganizationRetrieveProfilesResponse as OrganizationRetrieveProfilesResponse,
104
- };
105
-
106
- export {
107
- Users as Users,
108
- type CustomerUser as CustomerUser,
109
- type UserListResponse as UserListResponse,
110
- type UserRetrieveParams as UserRetrieveParams,
111
- type UserListParams as UserListParams,
112
- type UserDeleteParams as UserDeleteParams,
113
- type UserInviteParams as UserInviteParams,
114
- type UserUpdateRoleParams as UserUpdateRoleParams,
115
- };
14
+ export { Users as Users };
116
15
  }
@@ -1,189 +1,5 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { APIResource } from '../../core/resource';
4
- import { APIPromise } from '../../core/api-promise';
5
- import { buildHeaders } from '../../internal/headers';
6
- import { RequestOptions } from '../../internal/request-options';
7
- import { path } from '../../internal/utils/path';
8
4
 
9
- export class Users extends APIResource {
10
- /**
11
- * Retrieves a specific user by their ID. Requires appropriate permissions. The
12
- * customerId can be either an organization ID or a profile ID.
13
- *
14
- * @example
15
- * ```ts
16
- * const customerUser =
17
- * await client.organizations.users.retrieve(
18
- * '650e8400-e29b-41d4-a716-446655440000',
19
- * { customerId: '550e8400-e29b-41d4-a716-446655440000' },
20
- * );
21
- * ```
22
- */
23
- retrieve(userID: string, params: UserRetrieveParams, options?: RequestOptions): APIPromise<CustomerUser> {
24
- const { customerId } = params;
25
- return this._client.get(path`/v2/organizations/${customerId}/users/${userID}`, options);
26
- }
27
-
28
- /**
29
- * Retrieves all users associated with an organization or sender profile. Requires
30
- * appropriate permissions. Supports pagination.
31
- *
32
- * @example
33
- * ```ts
34
- * const users = await client.organizations.users.list(
35
- * '550e8400-e29b-41d4-a716-446655440000',
36
- * { page: 0, pageSize: 0 },
37
- * );
38
- * ```
39
- */
40
- list(customerID: string, query: UserListParams, options?: RequestOptions): APIPromise<UserListResponse> {
41
- return this._client.get(path`/v2/organizations/${customerID}/users`, { query, ...options });
42
- }
43
-
44
- /**
45
- * Removes a user from an organization or sender profile. Requires admin
46
- * permissions. This action permanently deletes the user association.
47
- *
48
- * @example
49
- * ```ts
50
- * await client.organizations.users.delete(
51
- * '650e8400-e29b-41d4-a716-446655440000',
52
- * { customerId: '550e8400-e29b-41d4-a716-446655440000' },
53
- * );
54
- * ```
55
- */
56
- delete(userID: string, params: UserDeleteParams, options?: RequestOptions): APIPromise<void> {
57
- const { customerId } = params;
58
- return this._client.delete(path`/v2/organizations/${customerId}/users/${userID}`, {
59
- ...options,
60
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
61
- });
62
- }
63
-
64
- /**
65
- * Invites a user to an organization or sender profile with a specified role.
66
- * Requires appropriate permissions. The customerId can be either an organization
67
- * ID or a profile ID.
68
- *
69
- * @example
70
- * ```ts
71
- * const customerUser =
72
- * await client.organizations.users.invite(
73
- * '550e8400-e29b-41d4-a716-446655440000',
74
- * );
75
- * ```
76
- */
77
- invite(customerID: string, body: UserInviteParams, options?: RequestOptions): APIPromise<CustomerUser> {
78
- return this._client.post(path`/v2/organizations/${customerID}/users`, { body, ...options });
79
- }
80
-
81
- /**
82
- * Updates a user's role within an organization or sender profile. Requires admin
83
- * permissions. Valid roles are: admin, billing, developer.
84
- *
85
- * @example
86
- * ```ts
87
- * const customerUser =
88
- * await client.organizations.users.updateRole(
89
- * '650e8400-e29b-41d4-a716-446655440000',
90
- * { customerId: '550e8400-e29b-41d4-a716-446655440000' },
91
- * );
92
- * ```
93
- */
94
- updateRole(
95
- userID: string,
96
- params: UserUpdateRoleParams,
97
- options?: RequestOptions,
98
- ): APIPromise<CustomerUser> {
99
- const { customerId, ...body } = params;
100
- return this._client.put(path`/v2/organizations/${customerId}/users/${userID}`, { body, ...options });
101
- }
102
- }
103
-
104
- export interface CustomerUser {
105
- /**
106
- * Unique identifier
107
- */
108
- id?: string;
109
-
110
- createdAt?: string;
111
-
112
- customerId?: string;
113
-
114
- email?: string;
115
-
116
- invitationSentAt?: string | null;
117
-
118
- invitationToken?: string | null;
119
-
120
- invitationTokenExpiresAt?: string | null;
121
-
122
- lastLoginAt?: string | null;
123
-
124
- name?: string;
125
-
126
- role?: string;
127
-
128
- status?: string;
129
-
130
- updatedAt?: string | null;
131
- }
132
-
133
- export interface UserListResponse {
134
- page?: number;
135
-
136
- pageSize?: number;
137
-
138
- totalCount?: number;
139
-
140
- users?: Array<CustomerUser>;
141
- }
142
-
143
- export interface UserRetrieveParams {
144
- customerId: string;
145
- }
146
-
147
- export interface UserListParams {
148
- page: number;
149
-
150
- pageSize: number;
151
- }
152
-
153
- export interface UserDeleteParams {
154
- customerId: string;
155
- }
156
-
157
- export interface UserInviteParams {
158
- email?: string;
159
-
160
- invitedBy?: string | null;
161
-
162
- name?: string;
163
-
164
- role?: string;
165
- }
166
-
167
- export interface UserUpdateRoleParams {
168
- /**
169
- * Path param
170
- */
171
- customerId: string;
172
-
173
- /**
174
- * Body param
175
- */
176
- role?: string;
177
- }
178
-
179
- export declare namespace Users {
180
- export {
181
- type CustomerUser as CustomerUser,
182
- type UserListResponse as UserListResponse,
183
- type UserRetrieveParams as UserRetrieveParams,
184
- type UserListParams as UserListParams,
185
- type UserDeleteParams as UserDeleteParams,
186
- type UserInviteParams as UserInviteParams,
187
- type UserUpdateRoleParams as UserUpdateRoleParams,
188
- };
189
- }
5
+ export class Users extends APIResource {}
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.5.1'; // x-release-please-version
1
+ export const VERSION = '0.6.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.5.1";
1
+ export declare const VERSION = "0.6.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.5.1";
1
+ export declare const VERSION = "0.6.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.5.1'; // x-release-please-version
4
+ exports.VERSION = '0.6.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.5.1'; // x-release-please-version
1
+ export const VERSION = '0.6.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map