-
Notifications
You must be signed in to change notification settings - Fork 46
Authorization Resources (external ID) endpoints and listResources endpoint #1472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
310eeb1
685643c
107fc6c
ea2628e
543b121
c2734e8
5037673
ca6f2d1
dfdd37d
43a0765
b61be8a
0b65b75
9281d60
24f6758
ea41192
6fb444c
5689bee
1cb2d25
f77627f
1ddca39
3e87446
7364e46
0dc5d30
be4b7d3
b38b24d
fc934f0
de58c56
1d6124d
64383ed
bb2fb27
6389419
53d03ba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| { | ||
| "object": "list", | ||
| "data": [ | ||
| { | ||
| "object": "authorization_resource", | ||
| "id": "authz_resource_01HXYZ123ABC456DEF789ABC", | ||
| "external_id": "doc-12345678", | ||
| "name": "Q5 Budget Report", | ||
| "description": "Financial report for Q5 2025", | ||
| "resource_type_slug": "document", | ||
| "organization_id": "org_01HXYZ123ABC456DEF789ABC", | ||
| "parent_resource_id": "authz_resource_01HXYZ123ABC456DEF789XYZ", | ||
| "created_at": "2024-01-15T09:30:00.000Z", | ||
| "updated_at": "2024-01-15T09:30:00.000Z" | ||
| }, | ||
| { | ||
| "object": "authorization_resource", | ||
| "id": "authz_resource_01HXYZ123ABC456DEF789DEF", | ||
| "external_id": "folder-123", | ||
| "name": "Finance Folder", | ||
| "description": null, | ||
| "resource_type_slug": "folder", | ||
| "organization_id": "org_01HXYZ123ABC456DEF789ABC", | ||
| "parent_resource_id": null, | ||
| "created_at": "2024-01-14T08:00:00.000Z", | ||
| "updated_at": "2024-01-14T08:00:00.000Z" | ||
| } | ||
| ], | ||
| "list_metadata": { | ||
| "before": null, | ||
| "after": "authz_resource_01HXYZ123ABC456DEF789DEF" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| export interface DeleteAuthorizationResourceByExternalIdOptions { | ||
| organizationId: string; | ||
| resourceTypeSlug: string; | ||
| externalId: string; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| export interface GetAuthorizationResourceByExternalIdOptions { | ||
| organizationId: string; | ||
| resourceTypeSlug: string; | ||
| externalId: string; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import { PaginationOptions } from '../../common/interfaces/pagination-options.interface'; | ||
|
|
||
| export interface ListAuthorizationResourcesOptions extends PaginationOptions { | ||
| organizationIds?: string[]; | ||
| resourceTypeSlugs?: string[]; | ||
| parentResourceId?: string; | ||
| parentResourceTypeSlug?: string; | ||
| parentExternalId?: string; | ||
| search?: string; | ||
| } | ||
|
|
||
| export interface SerializedListAuthorizationResourcesOptions { | ||
| organization_ids?: string; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have a ticket to change this and slugs to singular
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll update with a change once it is merged |
||
| resource_type_slugs?: string; | ||
| parent_resource_id?: string; | ||
| parent_resource_type_slug?: string; | ||
| parent_external_id?: string; | ||
| search?: string; | ||
| limit?: number; | ||
| after?: string; | ||
| before?: string; | ||
| order?: 'asc' | 'desc'; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| export interface UpdateAuthorizationResourceByExternalIdOptions { | ||
| organizationId: string; | ||
| resourceTypeSlug: string; | ||
| externalId: string; | ||
| name?: string; | ||
| description?: string | null; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import { | ||
| ListAuthorizationResourcesOptions, | ||
| SerializedListAuthorizationResourcesOptions, | ||
| } from '../interfaces/list-authorization-resources-options.interface'; | ||
|
|
||
| export const serializeListAuthorizationResourcesOptions = ( | ||
| options: ListAuthorizationResourcesOptions, | ||
| ): SerializedListAuthorizationResourcesOptions => ({ | ||
| ...(options.organizationIds && { | ||
| organization_ids: options.organizationIds.join(','), | ||
| }), | ||
| ...(options.resourceTypeSlugs && { | ||
| resource_type_slugs: options.resourceTypeSlugs.join(','), | ||
| }), | ||
| ...(options.parentResourceId && { | ||
| parent_resource_id: options.parentResourceId, | ||
| }), | ||
| ...(options.parentResourceTypeSlug && { | ||
| parent_resource_type_slug: options.parentResourceTypeSlug, | ||
| }), | ||
| ...(options.parentExternalId && { | ||
| parent_external_id: options.parentExternalId, | ||
| }), | ||
| ...(options.search && { search: options.search }), | ||
| ...(options.limit !== undefined && { limit: options.limit }), | ||
| ...(options.after && { after: options.after }), | ||
| ...(options.before && { before: options.before }), | ||
| ...(options.order && { order: options.order }), | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import { UpdateAuthorizationResourceByExternalIdOptions } from '../interfaces/update-authorization-resource-by-external-id-options.interface'; | ||
| import { SerializedUpdateAuthorizationResourceOptions } from '../interfaces/authorization-resource.interface'; | ||
|
|
||
| export const serializeUpdateResourceByExternalIdOptions = ( | ||
| options: UpdateAuthorizationResourceByExternalIdOptions, | ||
| ): SerializedUpdateAuthorizationResourceOptions => ({ | ||
| ...(options.name !== undefined && { name: options.name }), | ||
| ...(options.description !== undefined && { | ||
| description: options.description, | ||
| }), | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: could
externalIdcontain URL-significant characters? Not sure if this is gated elsewhere but could be good to wrap withencodeURIComponent.