- list - List all directories
- create - Create a directory
- get - Retrieve a directory
- update - Update a directory
- delete - Delete a directory
- rotate_api_key - Rotate a directory's API key
- list_group_role_mappings - List directory group role mappings
- create_group_role_mapping - Create a directory group role mapping
- replace_group_role_mappings - Replace directory group role mappings
- delete_group_role_mapping - Delete a directory group role mapping
Returns a list of all directories for the instance.
require 'clerk_sdk_ruby'
Models = ::Clerk::Models
s = ::Clerk::OpenAPIClient.new(
bearer_auth: '<YOUR_BEARER_TOKEN_HERE>'
)
res = s.directories.list(limit: 10, offset: 0)
unless res.directory_list.nil?
# handle response
end| Parameter | Type | Required | Description |
|---|---|---|---|
limit |
Crystalline::Nilable.new(::Integer) | ➖ | Applies a limit to the number of results returned. Can be used for paginating the results together with offset. |
offset |
Crystalline::Nilable.new(::Integer) | ➖ | Skip the first offset results when paginating.Needs to be an integer greater or equal to zero. To be used in conjunction with limit. |
Crystalline::Nilable.new(Models::Operations::ListDirectoriesResponse)
| Error Type | Status Code | Content Type |
|---|---|---|
| Models::Errors::ClerkErrors | 401, 403 | application/json |
| Errors::APIError | 4XX, 5XX | */* |
Create a new directory for the instance.
require 'clerk_sdk_ruby'
Models = ::Clerk::Models
s = ::Clerk::OpenAPIClient.new(
bearer_auth: '<YOUR_BEARER_TOKEN_HERE>'
)
req = nil
res = s.directories.create(request: req)
unless res.directory.nil?
# handle response
end| Parameter | Type | Required | Description |
|---|---|---|---|
request |
Models::Operations::CreateDirectoryRequest | ✔️ | The request object to use for the request. |
Crystalline::Nilable.new(Models::Operations::CreateDirectoryResponse)
| Error Type | Status Code | Content Type |
|---|---|---|
| Models::Errors::ClerkErrors | 400, 401, 403, 422 | application/json |
| Errors::APIError | 4XX, 5XX | */* |
Returns the details of a directory.
require 'clerk_sdk_ruby'
Models = ::Clerk::Models
s = ::Clerk::OpenAPIClient.new(
bearer_auth: '<YOUR_BEARER_TOKEN_HERE>'
)
res = s.directories.get(directory_id: '<id>')
unless res.directory.nil?
# handle response
end| Parameter | Type | Required | Description |
|---|---|---|---|
directory_id |
::String | ✔️ | The ID of the directory to retrieve |
Crystalline::Nilable.new(Models::Operations::GetDirectoryResponse)
| Error Type | Status Code | Content Type |
|---|---|---|
| Models::Errors::ClerkErrors | 401, 403, 404 | application/json |
| Errors::APIError | 4XX, 5XX | */* |
Updates a directory.
require 'clerk_sdk_ruby'
Models = ::Clerk::Models
s = ::Clerk::OpenAPIClient.new(
bearer_auth: '<YOUR_BEARER_TOKEN_HERE>'
)
res = s.directories.update(directory_id: '<id>')
unless res.directory.nil?
# handle response
end| Parameter | Type | Required | Description |
|---|---|---|---|
directory_id |
::String | ✔️ | The ID of the directory to update |
body |
Crystalline::Nilable.new(Models::Operations::UpdateDirectoryRequestBody) | ➖ | N/A |
Crystalline::Nilable.new(Models::Operations::UpdateDirectoryResponse)
| Error Type | Status Code | Content Type |
|---|---|---|
| Models::Errors::ClerkErrors | 400, 401, 403, 404, 422 | application/json |
| Errors::APIError | 4XX, 5XX | */* |
Deletes a directory and stops provisioning for it. Provisioning requests authenticated with the directory's API key are rejected afterwards.
require 'clerk_sdk_ruby'
Models = ::Clerk::Models
s = ::Clerk::OpenAPIClient.new(
bearer_auth: '<YOUR_BEARER_TOKEN_HERE>'
)
res = s.directories.delete(directory_id: '<id>')
unless res.deleted_object.nil?
# handle response
end| Parameter | Type | Required | Description |
|---|---|---|---|
directory_id |
::String | ✔️ | The ID of the directory to delete |
Crystalline::Nilable.new(Models::Operations::DeleteDirectoryResponse)
| Error Type | Status Code | Content Type |
|---|---|---|
| Models::Errors::ClerkErrors | 401, 403, 404 | application/json |
| Errors::APIError | 4XX, 5XX | */* |
Generates a new API key for the directory and returns it in the api_key field.
This is the only way to obtain the key after creation, so make sure to update it in
your identity provider. The previous key remains valid for a short grace period before
it expires.
require 'clerk_sdk_ruby'
Models = ::Clerk::Models
s = ::Clerk::OpenAPIClient.new(
bearer_auth: '<YOUR_BEARER_TOKEN_HERE>'
)
res = s.directories.rotate_api_key(directory_id: '<id>')
unless res.directory.nil?
# handle response
end| Parameter | Type | Required | Description |
|---|---|---|---|
directory_id |
::String | ✔️ | The ID of the directory whose API key to rotate |
Crystalline::Nilable.new(Models::Operations::RotateDirectoryAPIKeyResponse)
| Error Type | Status Code | Content Type |
|---|---|---|
| Models::Errors::ClerkErrors | 401, 403, 404, 422 | application/json |
| Errors::APIError | 4XX, 5XX | */* |
Returns the list of directory group to organization role mappings for a directory, ordered by precedence.
require 'clerk_sdk_ruby'
Models = ::Clerk::Models
s = ::Clerk::OpenAPIClient.new(
bearer_auth: '<YOUR_BEARER_TOKEN_HERE>'
)
res = s.directories.list_group_role_mappings(directory_id: '<id>')
unless res.directory_group_role_mapping_list.nil?
# handle response
end| Parameter | Type | Required | Description |
|---|---|---|---|
directory_id |
::String | ✔️ | The ID of the directory. |
Crystalline::Nilable.new(Models::Operations::ListDirectoryGroupRoleMappingsResponse)
| Error Type | Status Code | Content Type |
|---|---|---|
| Models::Errors::ClerkErrors | 401, 403, 404 | application/json |
| Errors::APIError | 4XX, 5XX | */* |
Creates a new directory group to organization role mapping for a directory. Mappings can be created while group role mapping is disabled on the directory, but they only take effect once it is enabled.
require 'clerk_sdk_ruby'
Models = ::Clerk::Models
s = ::Clerk::OpenAPIClient.new(
bearer_auth: '<YOUR_BEARER_TOKEN_HERE>'
)
res = s.directories.create_group_role_mapping(directory_id: '<id>', body: Models::Operations::CreateDirectoryGroupRoleMappingRequestBody.new(
role_id: '<id>'
))
unless res.directory_group_role_mapping.nil?
# handle response
end| Parameter | Type | Required | Description |
|---|---|---|---|
directory_id |
::String | ✔️ | The ID of the directory. |
body |
Models::Operations::CreateDirectoryGroupRoleMappingRequestBody | ✔️ | N/A |
Crystalline::Nilable.new(Models::Operations::CreateDirectoryGroupRoleMappingResponse)
| Error Type | Status Code | Content Type |
|---|---|---|
| Models::Errors::ClerkErrors | 400, 401, 403, 404, 422 | application/json |
| Errors::APIError | 4XX, 5XX | */* |
Replaces the entire set of directory group role mappings for a directory. The position of
each item in the mappings array determines its precedence (the first item gets
precedence 1). Passing an empty array removes all mappings. Mappings can be replaced
while group role mapping is disabled on the directory, but they only take effect once
it is enabled.
require 'clerk_sdk_ruby'
Models = ::Clerk::Models
s = ::Clerk::OpenAPIClient.new(
bearer_auth: '<YOUR_BEARER_TOKEN_HERE>'
)
res = s.directories.replace_group_role_mappings(directory_id: '<id>', body: Models::Operations::ReplaceDirectoryGroupRoleMappingsRequestBody.new(
mappings: [
Models::Operations::ReplaceDirectoryGroupRoleMappingsMapping.new(
role_id: '<id>'
),
]
))
unless res.directory_group_role_mapping_list.nil?
# handle response
end| Parameter | Type | Required | Description |
|---|---|---|---|
directory_id |
::String | ✔️ | The ID of the directory. |
body |
Models::Operations::ReplaceDirectoryGroupRoleMappingsRequestBody | ✔️ | N/A |
Crystalline::Nilable.new(Models::Operations::ReplaceDirectoryGroupRoleMappingsResponse)
| Error Type | Status Code | Content Type |
|---|---|---|
| Models::Errors::ClerkErrors | 400, 401, 403, 404, 422 | application/json |
| Errors::APIError | 4XX, 5XX | */* |
Deletes a single directory group role mapping. Mappings can be deleted while group role mapping is disabled on the directory, but the change only takes effect once it is enabled.
require 'clerk_sdk_ruby'
Models = ::Clerk::Models
s = ::Clerk::OpenAPIClient.new(
bearer_auth: '<YOUR_BEARER_TOKEN_HERE>'
)
res = s.directories.delete_group_role_mapping(directory_id: '<id>', mapping_id: '<id>')
unless res.directory_group_role_mapping_deleted.nil?
# handle response
end| Parameter | Type | Required | Description |
|---|---|---|---|
directory_id |
::String | ✔️ | The ID of the directory. |
mapping_id |
::String | ✔️ | The ID of the directory group role mapping to delete. |
Crystalline::Nilable.new(Models::Operations::DeleteDirectoryGroupRoleMappingResponse)
| Error Type | Status Code | Content Type |
|---|---|---|
| Models::Errors::ClerkErrors | 400, 401, 403, 404 | application/json |
| Errors::APIError | 4XX, 5XX | */* |