-
-
Notifications
You must be signed in to change notification settings - Fork 476
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4863 from logto-io/gao-swagger-org-apis
refactor(core): add swagger data for org apis
- Loading branch information
Showing
9 changed files
with
732 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
291 changes: 291 additions & 0 deletions
291
packages/core/src/routes/organization/index.openapi.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,291 @@ | ||
{ | ||
"tags": [{ | ||
"name": "Organizations", | ||
"description": "Organization is a concept that brings together multiple identities (mostly users). Logto supports multiple organizations, and each organization can have multiple users.\n\nEvery organization shares the same set (organization template) of roles and permissions. Each user can have different roles in different organizations." | ||
}], | ||
"paths": { | ||
"/api/organizations": { | ||
"post": { | ||
"summary": "Create a new organization", | ||
"description": "Create a new organization with the given data.", | ||
"requestBody": { | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"properties": { | ||
"name": { | ||
"description": "The name of the organization." | ||
}, | ||
"description": { | ||
"description": "The description of the organization." | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"responses": { | ||
"201": { | ||
"description": "The organization was created successfully." | ||
} | ||
} | ||
}, | ||
"get": { | ||
"summary": "Get organizations", | ||
"description": "Get organizations that match the given query with pagination.", | ||
"parameters": [ | ||
{ | ||
"name": "q", | ||
"in": "query", | ||
"description": "The query to filter organizations. It can be a partial ID or name.\n\nIf not provided, all organizations will be returned." | ||
}, | ||
{ | ||
"name": "showFeatured", | ||
"in": "query", | ||
"description": "Whether to show featured users in the organization. Featured users are randomly selected from the organization members.\n\nIf not provided, `featuredUsers` will not be included in the response." | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "A list of organizations." | ||
} | ||
} | ||
} | ||
}, | ||
"/api/organizations/{id}": { | ||
"get": { | ||
"summary": "Get organization by ID", | ||
"description": "Get organization details by ID.", | ||
"responses": { | ||
"200": { | ||
"description": "Details of the organization." | ||
} | ||
} | ||
}, | ||
"patch": { | ||
"summary": "Update organization by ID", | ||
"description": "Update organization details by ID with the given data.", | ||
"requestBody": { | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"properties": { | ||
"name": { | ||
"description": "The updated name of the organization." | ||
}, | ||
"description": { | ||
"description": "The updated description of the organization." | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"responses": { | ||
"200": { | ||
"description": "The organization was updated successfully." | ||
} | ||
} | ||
}, | ||
"delete": { | ||
"summary": "Delete organization by ID", | ||
"description": "Delete organization by ID.", | ||
"responses": { | ||
"204": { | ||
"description": "The organization was deleted successfully." | ||
} | ||
} | ||
} | ||
}, | ||
"/api/organizations/{id}/users": { | ||
"post": { | ||
"summary": "Add user members to organization", | ||
"description": "Add users as members to the specified organization with the given user IDs.", | ||
"requestBody": { | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"properties": { | ||
"userIds": { | ||
"description": "An array of user IDs to be added to the organization." | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"responses": { | ||
"201": { | ||
"description": "Users were added to the organization successfully." | ||
}, | ||
"422": { | ||
"description": "At least one of the IDs provided is not valid. For example, the organization ID or user ID does not exist; or the user is already a member of the organization." | ||
} | ||
} | ||
}, | ||
"put": { | ||
"summary": "Replace organization user members", | ||
"description": "Replace all user members for the specified organization with the given users. This effectively removing all existing user memberships in the organization and adding the new users as members.", | ||
"requestBody": { | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"properties": { | ||
"userIds": { | ||
"description": "An array of user IDs to replace existing users." | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"responses": { | ||
"204": { | ||
"description": "Successfully replaced all users for the organization." | ||
}, | ||
"422": { | ||
"description": "At least one of the IDs provided is not valid. For example, the organization ID or user ID does not exist." | ||
} | ||
} | ||
}, | ||
"get": { | ||
"summary": "Get organization user members", | ||
"description": "Get users that are members of the specified organization for the given query with pagination.", | ||
"parameters": [ | ||
{ | ||
"name": "q", | ||
"in": "query", | ||
"description": "The query to filter users. It will match multiple fields of users, including ID, name, username, email, and phone number.\n\nIf not provided, all users will be returned." | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "A list of users that are members of the organization." | ||
} | ||
} | ||
} | ||
}, | ||
"/api/organizations/{id}/users/{userId}": { | ||
"delete": { | ||
"summary": "Remove user member from organization", | ||
"description": "Remove a user's membership from the specified organization.", | ||
"responses": { | ||
"204": { | ||
"description": "The user was removed from the organization members successfully." | ||
}, | ||
"404": { | ||
"description": "The user is not a member of the organization." | ||
} | ||
} | ||
} | ||
}, | ||
"/api/organizations/{id}/users/roles": { | ||
"post": { | ||
"summary": "Assign roles to organization user members", | ||
"description": "Assign roles to user members of the specified organization with the given data.", | ||
"requestBody": { | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"properties": { | ||
"userIds": { | ||
"description": "An array of user IDs to assign roles." | ||
}, | ||
"organizationRoleIds": { | ||
"description": "An array of organization role IDs to assign." | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"responses": { | ||
"201": { | ||
"description": "Roles were assigned to organization users successfully." | ||
}, | ||
"422": { | ||
"description": "At least one of the IDs provided is not valid. For example, the organization ID, user ID, or organization role ID does not exist; the user is not a member of the organization; or the user already has the role." | ||
} | ||
} | ||
} | ||
}, | ||
"/api/organizations/{id}/users/{userId}/roles": { | ||
"get": { | ||
"summary": "Get roles for a user in an organization", | ||
"description": "Get roles assigned to a user in the specified organization with pagination.", | ||
"responses": { | ||
"200": { | ||
"description": "A list of roles assigned to the user." | ||
}, | ||
"422": { | ||
"description": "The user is not a member of the organization." | ||
} | ||
} | ||
}, | ||
"put": { | ||
"summary": "Update roles for a user in an organization", | ||
"description": "Update roles assigned to a user in the specified organization with the provided data.", | ||
"requestBody": { | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"properties": { | ||
"organizationRoleIds": { | ||
"description": "An array of organization role IDs to update for the user." | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"responses": { | ||
"204": { | ||
"description": "Roles were updated for the user successfully." | ||
}, | ||
"422": { | ||
"description": "The user is not a member of the organization; or at least one of the IDs provided is not valid. For example, the organization ID or organization role ID does not exist." | ||
} | ||
} | ||
}, | ||
"post": { | ||
"summary": "Assign roles to a user in an organization", | ||
"description": "Assign roles to a user in the specified organization with the provided data.", | ||
"requestBody": { | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"properties": { | ||
"organizationRoleIds": { | ||
"description": "An array of organization role IDs to assign to the user." | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"responses": { | ||
"201": { | ||
"description": "Roles were assigned to the user successfully." | ||
}, | ||
"422": { | ||
"description": "The user is not a member of the organization; or at least one of the IDs provided is not valid. For example, the organization ID or organization role ID does not exist; or the user already has the role." | ||
} | ||
} | ||
} | ||
}, | ||
"/api/organizations/{id}/users/{userId}/roles/{roleId}": { | ||
"delete": { | ||
"summary": "Remove a role from a user in an organization", | ||
"description": "Remove a role assignment from a user in the specified organization.", | ||
"responses": { | ||
"204": { | ||
"description": "The role was removed from the user successfully." | ||
}, | ||
"404": { | ||
"description": "The user is not a member of the organization; or the user does not have the role." | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.