@@ -330,6 +330,52 @@ def delete_organizations_member_roles(organization_id, user_id, roles = [])
330
330
end
331
331
alias remove_organizations_member_roles delete_organizations_member_roles
332
332
333
+ # Get client grants associated to an organization
334
+ # @param organization_id [string] The Organization ID
335
+ # @param options [hash] The Hash options used to define the paging of results
336
+ # * :client_id [string] The client_id of the client grant to retrieve.
337
+ # * :audience [string] The audience of the client grant to retrieve.
338
+ # * :per_page [integer] The amount of entries per page. Default: 50. Max value: 100.
339
+ # * :page [integer] The page number. Zero based.
340
+ # * :include_totals [boolean] True to include query summary in the result, false or nil otherwise.
341
+ def get_organizations_client_grants ( organization_id , options = { } )
342
+ raise Auth0 ::MissingOrganizationId , 'Must supply a valid organization_id' if organization_id . to_s . empty?
343
+ request_params = {
344
+ client_id : options . fetch ( :client_id , nil ) ,
345
+ audience : options . fetch ( :audience , nil ) ,
346
+ per_page : options . fetch ( :per_page , nil ) ,
347
+ page : options . fetch ( :page , nil ) ,
348
+ include_totals : options . fetch ( :include_totals , nil )
349
+ }
350
+ path = "#{ organizations_client_grants_path ( organization_id ) } "
351
+ get ( path , request_params )
352
+ end
353
+
354
+ # Associate a client grant with an organization
355
+ # @param organization_id [string] The Organization ID
356
+ # @param grant_id [string] The Client Grant ID you want to associate to the Organization.
357
+ def create_organizations_client_grant ( organization_id , grant_id )
358
+ raise Auth0 ::MissingOrganizationId , 'Must supply a valid organization_id' if organization_id . to_s . empty?
359
+ raise Auth0 ::InvalidParameter , 'Must supply a valid grant_id' if grant_id . to_s . empty?
360
+
361
+ body = { }
362
+ body [ :grant_id ] = grant_id
363
+
364
+ path = "#{ organizations_client_grants_path ( organization_id ) } "
365
+ post ( path , body )
366
+ end
367
+
368
+ # Remove a client grant from an organization
369
+ # @param organization_id [string] The Organization ID
370
+ # @param grant_id [string] The Client Grant ID you want to remove from the Organization.
371
+ def delete_organizations_client_grant ( organization_id , grant_id )
372
+ raise Auth0 ::MissingOrganizationId , 'Must supply a valid organization_id' if organization_id . to_s . empty?
373
+ raise Auth0 ::InvalidParameter , 'Must supply a valid grant_id' if grant_id . to_s . empty?
374
+
375
+ path = "#{ organizations_path } /#{ organization_id } /client-grants/#{ grant_id } "
376
+ delete ( path )
377
+ end
378
+
333
379
private
334
380
# Organizations API path
335
381
def organizations_path
@@ -351,6 +397,10 @@ def organizations_member_roles_path(org_id, user_id)
351
397
def organizations_invitations_path ( org_id )
352
398
"#{ organizations_path } /#{ org_id } /invitations"
353
399
end
400
+
401
+ def organizations_client_grants_path ( org_id )
402
+ "#{ organizations_path } /#{ org_id } /client-grants"
403
+ end
354
404
end
355
405
end
356
406
end
0 commit comments