Skip to content

Commit 39872ed

Browse files
committed
more docstring fun
1 parent 648baea commit 39872ed

16 files changed

Lines changed: 139 additions & 160 deletions

File tree

src/admin-portal/admin-portal.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export class AdminPortal {
1717
*
1818
* Generate a Portal Link scoped to an Organization.
1919
* @param payload - Object containing organization.
20-
* @returns {PortalLinkResponse}
20+
* @returns {Promise<PortalLinkResponse>}
2121
* @throws {BadRequestException} 400
2222
* @throws {AuthorizationException} 403
2323
* @throws {NotFoundException} 404

src/api-keys/api-keys.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export class ApiKeys {
1616
*
1717
* Validate an API key value and return the API key object if valid.
1818
* @param payload - Object containing value.
19-
* @returns {ApiKeyValidationResponse}
19+
* @returns {Promise<ApiKeyValidationResponse>}
2020
* @throws {UnauthorizedException} 401
2121
* @throws {UnprocessableEntityException} 422
2222
*/
@@ -37,7 +37,7 @@ export class ApiKeys {
3737
* Permanently deletes an API key. This action cannot be undone. Once deleted, any requests using this API key will fail authentication.
3838
* @param id - The unique ID of the API key.
3939
* @example "api_key_01EHZNVPK3SFK441A1RGBFSHRT"
40-
* @returns {void}
40+
* @returns {Promise<void>}
4141
* @throws {NotFoundException} 404
4242
*/
4343
async deleteApiKey(id: string): Promise<void> {

src/audit-logs/audit-logs.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class AuditLogs {
3838
*
3939
* Idempotency keys expire after 24 hours. The API will generate a new response if you submit a request with an expired key.
4040
* @param payload - Object containing organizationId, event.
41-
* @returns {AuditLogEventCreateResponse}
41+
* @returns {Promise<void>}
4242
* @throws {BadRequestException} 400
4343
* @throws {NotFoundException} 404
4444
* @throws {UnprocessableEntityException} 422
@@ -72,7 +72,7 @@ export class AuditLogs {
7272
*
7373
* Create an Audit Log Export. Exports are scoped to a single organization within a specified date range.
7474
* @param payload - Object containing organizationId, rangeStart, rangeEnd.
75-
* @returns {AuditLogExportJson}
75+
* @returns {Promise<AuditLogExport>}
7676
* @throws {BadRequestException} 400
7777
*/
7878
async createExport(options: AuditLogExportOptions): Promise<AuditLogExport> {
@@ -90,7 +90,7 @@ export class AuditLogs {
9090
* Get an Audit Log Export. The URL will expire after 10 minutes. If the export is needed again at a later time, refetching the export will regenerate the URL.
9191
* @param auditLogExportId - The unique ID of the Audit Log Export.
9292
* @example "audit_log_export_01GBZK5MP7TD1YCFQHFR22180V"
93-
* @returns {AuditLogExportJson}
93+
* @returns {Promise<AuditLogExport>}
9494
* @throws {NotFoundException} 404
9595
*/
9696
async getExport(auditLogExportId: string): Promise<AuditLogExport> {
@@ -102,14 +102,11 @@ export class AuditLogs {
102102
}
103103

104104
/**
105-
* List Schemas
105+
* Create Schema
106106
*
107-
* Get a list of all schemas for the Audit Logs action identified by `:name`.
108-
* @param actionName - The name of the Audit Log action.
109-
* @example "user.logged_in"
110-
* @param options - Pagination and filter options.
111-
* @returns {AutoPaginatable<AuditLogSchemaJson>}
112-
* @throws {NotFoundException} 404
107+
* Creates a new Audit Log schema used to validate the payload of incoming Audit Log Events. If the `action` does not exist, it will also be created.
108+
* @param payload - Object containing targets.
109+
* @returns {Promise<AuditLogSchema>}
113110
* @throws {UnprocessableEntityException} 422
114111
*/
115112
async createSchema(

src/authorization/authorization.ts

Lines changed: 43 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,13 @@ export class Authorization {
9292
* Create an environment role
9393
*
9494
* Create a new environment role.
95-
* @param options - Object containing slug, name.
96-
* @returns {EnvironmentRole}
95+
* @param payload - Object containing slug, name.
96+
* @returns {Promise<EnvironmentRole>}
97+
* @throws {BadRequestException} 400
98+
* @throws {AuthorizationException} 403
99+
* @throws {NotFoundException} 404
100+
* @throws {ConflictException} 409
101+
* @throws {UnprocessableEntityException} 422
97102
*/
98103
async createEnvironmentRole(
99104
options: CreateEnvironmentRoleOptions,
@@ -109,7 +114,8 @@ export class Authorization {
109114
* List environment roles
110115
*
111116
* List all environment roles in priority order.
112-
* @returns {EnvironmentRoleList}
117+
* @returns {Promise<EnvironmentRoleList>}
118+
* @throws {AuthorizationException} 403
113119
*/
114120
async listEnvironmentRoles(): Promise<EnvironmentRoleList> {
115121
const { data } = await this.workos.get<EnvironmentRoleListResponse>(
@@ -127,7 +133,7 @@ export class Authorization {
127133
* Get an environment role by its slug.
128134
* @param slug - The slug of the environment role.
129135
* @example "admin"
130-
* @returns {Role}
136+
* @returns {Promise<EnvironmentRole>}
131137
* @throws {AuthorizationException} 403
132138
* @throws {NotFoundException} 404
133139
*/
@@ -145,7 +151,7 @@ export class Authorization {
145151
* @param slug - The slug of the environment role.
146152
* @example "admin"
147153
* @param payload - The request body.
148-
* @returns {Role}
154+
* @returns {Promise<EnvironmentRole>}
149155
* @throws {BadRequestException} 400
150156
* @throws {AuthorizationException} 403
151157
* @throws {NotFoundException} 404
@@ -163,13 +169,13 @@ export class Authorization {
163169
}
164170

165171
/**
166-
* Add a permission to an environment role
172+
* Set permissions for an environment role
167173
*
168-
* Add a single permission to an environment role. If the permission is already assigned to the role, this operation has no effect.
174+
* Replace all permissions on an environment role with the provided list.
169175
* @param slug - The slug of the environment role.
170176
* @example "admin"
171-
* @param payload - Object containing slug.
172-
* @returns {Role}
177+
* @param payload - Object containing permissions.
178+
* @returns {Promise<EnvironmentRole>}
173179
* @throws {BadRequestException} 400
174180
* @throws {AuthorizationException} 403
175181
* @throws {NotFoundException} 404
@@ -187,13 +193,13 @@ export class Authorization {
187193
}
188194

189195
/**
190-
* Set permissions for an environment role
196+
* Add a permission to an environment role
191197
*
192-
* Replace all permissions on an environment role with the provided list.
198+
* Add a single permission to an environment role. If the permission is already assigned to the role, this operation has no effect.
193199
* @param slug - The slug of the environment role.
194200
* @example "admin"
195-
* @param payload - Object containing permissions.
196-
* @returns {Role}
201+
* @param payload - Object containing slug.
202+
* @returns {Promise<EnvironmentRole>}
197203
* @throws {BadRequestException} 400
198204
* @throws {AuthorizationException} 403
199205
* @throws {NotFoundException} 404
@@ -217,7 +223,7 @@ export class Authorization {
217223
* @param organizationId - The ID of the organization.
218224
* @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
219225
* @param payload - Object containing name.
220-
* @returns {Role}
226+
* @returns {Promise<OrganizationRole>}
221227
* @throws {BadRequestException} 400
222228
* @throws {AuthorizationException} 403
223229
* @throws {NotFoundException} 404
@@ -241,7 +247,7 @@ export class Authorization {
241247
* Get a list of all roles that apply to an organization. This includes both environment roles and organization-specific roles, returned in priority order.
242248
* @param organizationId - The ID of the organization.
243249
* @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
244-
* @returns {RoleList}
250+
* @returns {Promise<RoleList>}
245251
* @throws {AuthorizationException} 403
246252
* @throws {NotFoundException} 404
247253
*/
@@ -263,7 +269,7 @@ export class Authorization {
263269
* @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
264270
* @param slug - The slug of the role.
265271
* @example "org-billing-admin"
266-
* @returns {Role}
272+
* @returns {Promise<Role>}
267273
* @throws {AuthorizationException} 403
268274
* @throws {NotFoundException} 404
269275
*/
@@ -286,7 +292,7 @@ export class Authorization {
286292
* @param slug - The slug of the role.
287293
* @example "org-billing-admin"
288294
* @param payload - The request body.
289-
* @returns {Role}
295+
* @returns {Promise<OrganizationRole>}
290296
* @throws {BadRequestException} 400
291297
* @throws {AuthorizationException} 403
292298
* @throws {NotFoundException} 404
@@ -312,7 +318,7 @@ export class Authorization {
312318
* @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
313319
* @param slug - The slug of the role.
314320
* @example "org-admin"
315-
* @returns {void}
321+
* @returns {Promise<void>}
316322
* @throws {BadRequestException} 400
317323
* @throws {AuthorizationException} 403
318324
* @throws {NotFoundException} 404
@@ -390,7 +396,7 @@ export class Authorization {
390396
* @example "org-admin"
391397
* @param permissionSlug - The slug of the permission to remove.
392398
* @example "documents:read"
393-
* @returns {void}
399+
* @returns {Promise<void>}
394400
* @throws {AuthorizationException} 403
395401
* @throws {NotFoundException} 404
396402
*/
@@ -409,7 +415,7 @@ export class Authorization {
409415
*
410416
* Create a new permission in your WorkOS environment. The permission can then be assigned to environment roles and organization roles.
411417
* @param payload - Object containing slug, name.
412-
* @returns {Permission}
418+
* @returns {Promise<Permission>}
413419
* @throws {BadRequestException} 400
414420
* @throws {NotFoundException} 404
415421
* @throws {ConflictException} 409
@@ -431,7 +437,7 @@ export class Authorization {
431437
*
432438
* Get a list of all permissions in your WorkOS environment.
433439
* @param options - Pagination and filter options.
434-
* @returns {AutoPaginatable<AuthorizationPermission>}
440+
* @returns {Promise<PermissionList>}
435441
* @throws {NotFoundException} 404
436442
* @deprecated Use `workos.permissions.list()` instead.
437443
*/
@@ -458,7 +464,7 @@ export class Authorization {
458464
* Retrieve a permission by its unique slug.
459465
* @param slug - A unique key to reference the permission. Must be lowercase and contain only letters, numbers, hyphens, underscores, colons, periods, and asterisks.
460466
* @example "documents:read"
461-
* @returns {AuthorizationPermission}
467+
* @returns {Promise<Permission>}
462468
* @throws {NotFoundException} 404
463469
* @deprecated Use `workos.permissions.find()` instead.
464470
*/
@@ -476,7 +482,7 @@ export class Authorization {
476482
* @param slug - A unique key to reference the permission. Must be lowercase and contain only letters, numbers, hyphens, underscores, colons, periods, and asterisks.
477483
* @example "documents:read"
478484
* @param payload - The request body.
479-
* @returns {AuthorizationPermission}
485+
* @returns {Promise<Permission>}
480486
* @throws {AuthorizationException} 403
481487
* @throws {NotFoundException} 404
482488
* @throws {UnprocessableEntityException} 422
@@ -499,7 +505,7 @@ export class Authorization {
499505
* Delete an existing permission. System permissions cannot be deleted.
500506
* @param slug - A unique key to reference the permission. Must be lowercase and contain only letters, numbers, hyphens, underscores, colons, periods, and asterisks.
501507
* @example "documents:read"
502-
* @returns {void}
508+
* @returns {Promise<void>}
503509
* @throws {AuthorizationException} 403
504510
* @throws {NotFoundException} 404
505511
* @deprecated Use `workos.permissions.delete()` instead.
@@ -514,7 +520,7 @@ export class Authorization {
514520
* Retrieve the details of an authorization resource by its ID.
515521
* @param resourceId - The ID of the authorization resource.
516522
* @example "authz_resource_01HXYZ123456789ABCDEFGHIJ"
517-
* @returns {AuthorizationResource}
523+
* @returns {Promise<AuthorizationResource>}
518524
* @throws {AuthorizationException} 403
519525
* @throws {NotFoundException} 404
520526
* @throws {UnprocessableEntityException} 422
@@ -531,7 +537,7 @@ export class Authorization {
531537
*
532538
* Create a new authorization resource.
533539
* @param payload - Object containing externalId, name, resourceTypeSlug, organizationId.
534-
* @returns {AuthorizationResource}
540+
* @returns {Promise<AuthorizationResource>}
535541
* @throws {BadRequestException} 400
536542
* @throws {AuthorizationException} 403
537543
* @throws {NotFoundException} 404
@@ -553,7 +559,7 @@ export class Authorization {
553559
*
554560
* Update an existing authorization resource.
555561
* @param payload - The request body.
556-
* @returns {AuthorizationResource}
562+
* @returns {Promise<AuthorizationResource>}
557563
* @throws {BadRequestException} 400
558564
* @throws {AuthorizationException} 403
559565
* @throws {NotFoundException} 404
@@ -578,7 +584,7 @@ export class Authorization {
578584
* @default false
579585
* @example false
580586
* @param options - Additional query options.
581-
* @returns {void}
587+
* @returns {Promise<void>}
582588
* @throws {BadRequestException} 400
583589
* @throws {AuthorizationException} 403
584590
* @throws {NotFoundException} 404
@@ -602,7 +608,7 @@ export class Authorization {
602608
*
603609
* Get a paginated list of authorization resources.
604610
* @param options - Pagination and filter options.
605-
* @returns {AutoPaginatable<AuthorizationResource>}
611+
* @returns {Promise<AuthorizationResourceList>}
606612
* @throws {AuthorizationException} 403
607613
* @throws {UnprocessableEntityException} 422
608614
*/
@@ -714,7 +720,7 @@ export class Authorization {
714720
*
715721
* Check if an organization membership has a specific permission on a resource. Supports identification by resource_id OR by resource_external_id + resource_type_slug.
716722
* @param payload - Object containing permissionSlug.
717-
* @returns {AuthorizationCheck}
723+
* @returns {Promise<AuthorizationCheckResult>}
718724
* @throws {AuthorizationException} 403
719725
* @throws {NotFoundException} 404
720726
* @throws {UnprocessableEntityException} 422
@@ -736,7 +742,7 @@ export class Authorization {
736742
* @param organizationMembershipId - The ID of the organization membership.
737743
* @example "om_01HXYZ123456789ABCDEFGHIJ"
738744
* @param options - Pagination and filter options.
739-
* @returns {AutoPaginatable<RoleAssignment>}
745+
* @returns {Promise<AutoPaginatable<RoleAssignment>>}
740746
* @throws {AuthorizationException} 403
741747
* @throws {NotFoundException} 404
742748
*/
@@ -762,10 +768,8 @@ export class Authorization {
762768
* Assign a role
763769
*
764770
* Assign a role to an organization membership on a specific resource.
765-
* @param organizationMembershipId - The ID of the organization membership.
766-
* @example "om_01HXYZ123456789ABCDEFGHIJ"
767771
* @param payload - Object containing roleSlug.
768-
* @returns {RoleAssignment}
772+
* @returns {Promise<RoleAssignment>}
769773
* @throws {AuthorizationException} 403
770774
* @throws {NotFoundException} 404
771775
* @throws {UnprocessableEntityException} 422
@@ -782,10 +786,8 @@ export class Authorization {
782786
* Remove a role assignment
783787
*
784788
* Remove a role assignment by role slug and resource.
785-
* @param organizationMembershipId - The ID of the organization membership.
786-
* @example "om_01HXYZ123456789ABCDEFGHIJ"
787789
* @param payload - Object containing roleSlug.
788-
* @returns {void}
790+
* @returns {Promise<void>}
789791
* @throws {AuthorizationException} 403
790792
* @throws {NotFoundException} 404
791793
* @throws {UnprocessableEntityException} 422
@@ -805,7 +807,7 @@ export class Authorization {
805807
* @example "om_01HXYZ123456789ABCDEFGHIJ"
806808
* @param roleAssignmentId - The ID of the role assignment to remove.
807809
* @example "role_assignment_01HXYZ123456789ABCDEFGH"
808-
* @returns {void}
810+
* @returns {Promise<void>}
809811
* @throws {AuthorizationException} 403
810812
* @throws {NotFoundException} 404
811813
*/
@@ -826,7 +828,7 @@ export class Authorization {
826828
* @param organizationMembershipId - The ID of the organization membership.
827829
* @example "om_01HXYZ123456789ABCDEFGHIJ"
828830
* @param options - Pagination and filter options.
829-
* @returns {AutoPaginatable<AuthorizationResource>}
831+
* @returns {Promise<AutoPaginatable<AuthorizationResource>>}
830832
* @throws {BadRequestException} 400
831833
* @throws {AuthorizationException} 403
832834
* @throws {NotFoundException} 404
@@ -857,7 +859,7 @@ export class Authorization {
857859
*
858860
* Returns all organization memberships that have a specific permission on a resource instance. This is useful for answering "Who can access this resource?".
859861
* @param options - Pagination and filter options.
860-
* @returns {AutoPaginatable<UserOrganizationMembershipBaseListData>}
862+
* @returns {Promise<AuthorizationOrganizationMembershipList>}
861863
* @throws {BadRequestException} 400
862864
* @throws {AuthorizationException} 403
863865
* @throws {NotFoundException} 404
@@ -895,7 +897,7 @@ export class Authorization {
895897
* @param externalId - An identifier you provide to reference the resource in your system.
896898
* @example "proj-456"
897899
* @param options - Pagination and filter options.
898-
* @returns {AutoPaginatable<UserOrganizationMembershipBaseListData>}
900+
* @returns {Promise<AutoPaginatable<UserOrganizationMembershipBaseListData>>}
899901
* @throws {BadRequestException} 400
900902
* @throws {AuthorizationException} 403
901903
* @throws {NotFoundException} 404

0 commit comments

Comments
 (0)