Add new organization endpoints to API reference

This commit is contained in:
Tuan Dang
2023-01-16 00:00:04 +07:00
parent f19db530b1
commit 992357cbc4
28 changed files with 1546 additions and 199 deletions

View File

@@ -0,0 +1,4 @@
---
title: "Delete Membership"
openapi: "DELETE /api/v2/organizations/{organizationId}/memberships/{membershipId}"
---

View File

@@ -0,0 +1,4 @@
---
title: "Get Memberships"
openapi: "GET /api/v2/organizations/{organizationId}/memberships"
---

View File

@@ -0,0 +1,4 @@
---
title: "Update Membership"
openapi: "PATCH /api/v2/organizations/{organizationId}/memberships/{membershipId}"
---

View File

@@ -0,0 +1,4 @@
---
title: "Get Projects"
openapi: "GET /api/v2/organizations/{organizationId}/workspaces"
---

View File

@@ -1,4 +1,4 @@
---
title: "Get Current User"
title: "Get My User"
openapi: "GET /api/v2/users/me"
---

View File

@@ -0,0 +1,4 @@
---
title: "Get My Organizations"
openapi: "GET /api/v2/users/me/organizations"
---

View File

@@ -162,7 +162,17 @@
{
"group": "Users",
"pages": [
"api-reference/endpoints/users/me"
"api-reference/endpoints/users/me",
"api-reference/endpoints/users/my-organizations"
]
},
{
"group": "Organizations",
"pages": [
"api-reference/endpoints/organizations/memberships",
"api-reference/endpoints/organizations/update-membership",
"api-reference/endpoints/organizations/delete-membership",
"api-reference/endpoints/organizations/workspaces"
]
},
{

View File

@@ -1392,6 +1392,229 @@ paths:
description: Bad Request
security:
- apiKeyAuth: []
/api/v2/users/me/organizations:
get:
summary: Return organizations that current user is part of
description: Return organizations that current user is part of
parameters: []
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
organizations:
type: array
items:
$ref: '#/components/schemas/Organization'
description: Organizations that user is part of
'400':
description: Bad Request
security:
- apiKeyAuth: []
/api/v2/organizations/{organizationId}/memberships:
get:
summary: Return organization memberships
description: Return organization memberships
parameters:
- name: organizationId
in: path
required: true
schema:
type: string
description: ID of organization
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
memberships:
type: array
items:
$ref: '#/components/schemas/MembershipOrg'
description: Memberships of organization
'400':
description: Bad Request
security:
- apiKeyAuth: []
/api/v2/organizations/{organizationId}/memberships/{membershipId}:
patch:
summary: Update organization membership
description: Update organization membership
parameters:
- name: organizationId
in: path
required: true
schema:
type: string
description: ID of organization
- name: membershipId
in: path
required: true
schema:
type: string
description: ID of organization membership to update
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
membership:
$ref: '#/components/schemas/MembershipOrg'
description: Updated organization membership
'400':
description: Bad Request
security:
- apiKeyAuth: []
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
role:
type: string
description: >-
Role of organization membership - either owner, admin, or
member
delete:
summary: Delete organization membership
description: Delete organization membership
parameters:
- name: organizationId
in: path
required: true
schema:
type: string
description: ID of organization
- name: membershipId
in: path
required: true
schema:
type: string
description: ID of organization membership to delete
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
membership:
$ref: '#/components/schemas/MembershipOrg'
description: Deleted organization membership
'400':
description: Bad Request
security:
- apiKeyAuth: []
/api/v2/organizations/{organizationId}/workspaces:
get:
summary: Return projects in organization that user is part of
description: Return projects in organization that user is part of
parameters:
- name: organizationId
in: path
required: true
schema:
type: string
description: ID of organization
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
workspaces:
type: array
items:
$ref: '#/components/schemas/Project'
description: Projects of organization
'400':
description: Bad Request
security:
- apiKeyAuth: []
/api/v2/workspace/{workspaceId}/environments:
post:
description: ''
parameters:
- name: workspaceId
in: path
required: true
schema:
type: string
responses:
'200':
description: OK
'400':
description: Bad Request
requestBody:
content:
application/json:
schema:
type: object
properties:
environmentName:
example: any
environmentSlug:
example: any
put:
description: ''
parameters:
- name: workspaceId
in: path
required: true
schema:
type: string
responses:
'200':
description: OK
'400':
description: Bad Request
requestBody:
content:
application/json:
schema:
type: object
properties:
environmentName:
example: any
environmentSlug:
example: any
oldEnvironmentSlug:
example: any
delete:
description: ''
parameters:
- name: workspaceId
in: path
required: true
schema:
type: string
responses:
'200':
description: OK
'400':
description: Bad Request
requestBody:
content:
application/json:
schema:
type: object
properties:
environmentSlug:
example: any
/api/v2/workspace/{workspaceId}/secrets:
post:
description: ''
@@ -1509,37 +1732,6 @@ paths:
security:
- apiKeyAuth: []
/api/v2/workspace/{workspaceId}/memberships/{membershipId}:
delete:
summary: Delete project membership
description: Delete project membership
parameters:
- name: workspaceId
in: path
required: true
schema:
type: string
description: ID of project
- name: membershipId
in: path
required: true
schema:
type: string
description: ID of membership
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
membership:
$ref: '#/components/schemas/Membership'
description: Deleted membership
'400':
description: Bad Request
security:
- apiKeyAuth: []
patch:
summary: Update project membership
description: Update project membership
@@ -1555,7 +1747,7 @@ paths:
required: true
schema:
type: string
description: ID of membership
description: ID of project membership to update
responses:
'200':
description: OK
@@ -1581,6 +1773,37 @@ paths:
role:
type: string
description: Role of membership - either admin or member
delete:
summary: Delete project membership
description: Delete project membership
parameters:
- name: workspaceId
in: path
required: true
schema:
type: string
description: ID of project
- name: membershipId
in: path
required: true
schema:
type: string
description: ID of project membership to delete
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
membership:
$ref: '#/components/schemas/Membership'
description: Deleted membership
'400':
description: Bad Request
security:
- apiKeyAuth: []
/api/v2/secret/batch-create/workspace/{workspaceId}/environment/{environment}:
post:
description: ''
@@ -1927,7 +2150,7 @@ paths:
description: OK
'400':
description: Bad Request
/api/v2/api-key-data/:
/api/v2/api-key/:
get:
description: ''
parameters: []
@@ -1954,7 +2177,7 @@ paths:
example: any
expiresIn:
example: any
/api/v2/api-key-data/{apiKeyDataId}:
/api/v2/api-key/{apiKeyDataId}:
delete:
description: ''
parameters:
@@ -2043,6 +2266,74 @@ components:
role:
type: string
example: admin
MembershipOrg:
type: object
properties:
user:
type: object
properties:
_id:
type: string
example: ''
email:
type: string
example: ''
firstName:
type: string
example: ''
lastName:
type: string
example: ''
publicKey:
type: string
example: ''
updatedAt:
type: string
example: ''
createdAt:
type: string
example: ''
organization:
type: string
example: ''
role:
type: string
example: owner
status:
type: string
example: accepted
Organization:
type: object
properties:
_id:
type: string
example: ''
name:
type: string
example: ''
customerId:
type: string
example: ''
Project:
type: object
properties:
name:
type: string
example: My Project
organization:
type: string
example: ''
environments:
type: array
items:
type: object
properties:
name:
type: string
example: development
slug:
type: string
example: dev
ProjectKey:
type: object
properties: