@@ -3,10 +3,14 @@ import type { InitOverride, ApiResponse } from '../../../lib/runtime.js';
33import type {
44 ClientGrant ,
55 ClientGrantCreate ,
6+ GetClientGrantOrganizations200Response ,
67 GetClientGrants200Response ,
78 PatchClientGrantsByIdRequest ,
9+ GetClientGrantOrganizations200ResponseOneOf ,
10+ GetClientGrantOrganizations200ResponseOneOfInner ,
811 GetClientGrants200ResponseOneOf ,
912 DeleteClientGrantsByIdRequest ,
13+ GetClientGrantOrganizationsRequest ,
1014 GetClientGrantsRequest ,
1115 PatchClientGrantsByIdOperationRequest ,
1216} from '../models/index.js' ;
@@ -43,6 +47,63 @@ export class ClientGrantsManager extends BaseAPI {
4347 return runtime . VoidApiResponse . fromResponse ( response ) ;
4448 }
4549
50+ /**
51+ * Get the organizations associated to a client grant
52+ *
53+ * @throws {RequiredError }
54+ */
55+ async getAllOrganizations (
56+ requestParameters : GetClientGrantOrganizationsRequest & { include_totals : true } ,
57+ initOverrides ?: InitOverride
58+ ) : Promise < ApiResponse < GetClientGrantOrganizations200ResponseOneOf > > ;
59+ async getAllOrganizations (
60+ requestParameters ?: GetClientGrantOrganizationsRequest ,
61+ initOverrides ?: InitOverride
62+ ) : Promise < ApiResponse < Array < GetClientGrantOrganizations200ResponseOneOfInner > > > ;
63+ async getAllOrganizations (
64+ requestParameters : GetClientGrantOrganizationsRequest ,
65+ initOverrides ?: InitOverride
66+ ) : Promise < ApiResponse < GetClientGrantOrganizations200Response > > {
67+ runtime . validateRequiredRequestParams ( requestParameters , [ 'id' ] ) ;
68+
69+ const queryParameters = runtime . applyQueryParams ( requestParameters , [
70+ {
71+ key : 'page' ,
72+ config : { } ,
73+ } ,
74+ {
75+ key : 'per_page' ,
76+ config : { } ,
77+ } ,
78+ {
79+ key : 'include_totals' ,
80+ config : { } ,
81+ } ,
82+ {
83+ key : 'from' ,
84+ config : { } ,
85+ } ,
86+ {
87+ key : 'take' ,
88+ config : { } ,
89+ } ,
90+ ] ) ;
91+
92+ const response = await this . request (
93+ {
94+ path : `/client-grants/{id}/organizations` . replace (
95+ '{id}' ,
96+ encodeURIComponent ( String ( requestParameters . id ) )
97+ ) ,
98+ method : 'GET' ,
99+ query : queryParameters ,
100+ } ,
101+ initOverrides
102+ ) ;
103+
104+ return runtime . JSONApiResponse . fromResponse ( response ) ;
105+ }
106+
46107 /**
47108 * Retrieve <a href="https://auth0.com/docs/api-auth/grant/client-credentials">client grants</a>.
48109 *
0 commit comments