Skip to content

Commit

Permalink
feat: Add git token crud api
Browse files Browse the repository at this point in the history
  • Loading branch information
mzottola committed Oct 24, 2023
1 parent 4a8ab16 commit af4b81b
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ paths:
$ref: './resources/OrganizationAvailableRole.yaml'
/organization/{organizationId}/gitToken:
$ref: './resources/GitToken.yaml'
/organization/{organizationId}/gitToken/{gitTokenId}:
$ref: './resources/GitTokenRef.yaml'
/organization/{organizationId}/member:
$ref: './resources/OrganizationMember.yaml'
/organization/{organizationId}/inviteMember:
Expand Down
2 changes: 2 additions & 0 deletions src/parameters/_index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ jobId:
# QUERY
gitCommitId:
$ref: ./query/gitCommitId.yaml
gitTokenId:
$ref: ./path/gitTokenId.yaml
instanceId:
$ref: ./path/instanceId.yaml
invoiceId:
Expand Down
7 changes: 7 additions & 0 deletions src/parameters/path/gitTokenId.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: gitTokenId
in: path
description: Git Token ID
required: true
schema:
type: string
format: uuid
26 changes: 26 additions & 0 deletions src/resources/GitToken.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,29 @@ get:
$ref: '../responses/Forbidden.yaml'
'404':
$ref: '../responses/NotFound.yaml'
post:
summary: 'Create a git token'
description: Create a new git token to be used as a git provider by a service
operationId: createGitToken
parameters:
- $ref: '../parameters/path/organizationId.yaml'
tags:
- Organization Main Calls
requestBody:
content:
application/json:
schema:
$ref: '../schemas/GitTokenRequest.yaml'
responses:
'201':
description: 'Git token created'
content:
application/json:
schema:
$ref: '../schemas/GitTokenResponse.yaml'
'401':
$ref: '../responses/NotAuthorized.yaml'
'403':
$ref: '../responses/Forbidden.yaml'
'404':
$ref: '../responses/NotFound.yaml'
45 changes: 45 additions & 0 deletions src/resources/GitTokenRef.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
put:

Check warning on line 1 in src/resources/GitTokenRef.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

operation-description

Operation "description" must be present and non-empty string.
summary: 'Edit a git token'
operationId: editGitToken
parameters:
- $ref: '../parameters/path/organizationId.yaml'
- $ref: '../parameters/path/gitTokenId.yaml'
tags:
- Organization Main Calls
requestBody:
content:
application/json:
schema:
$ref: '../schemas/GitTokenRequest.yaml'
responses:
'200':
description: 'Git token edited'
content:
application/json:
schema:
$ref: '../schemas/GitTokenResponse.yaml'
'400':
$ref: '../responses/BadRequest.yaml'
'401':
$ref: '../responses/NotAuthorized.yaml'
'403':
$ref: '../responses/Forbidden.yaml'
'404':
$ref: '../responses/NotFound.yaml'
delete:

Check warning on line 29 in src/resources/GitTokenRef.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

operation-description

Operation "description" must be present and non-empty string.
summary: 'Delete a git token'
operationId: deleteGitToken
parameters:
- $ref: '../parameters/path/organizationId.yaml'
- $ref: '../parameters/path/gitTokenId.yaml'
tags:
- Organization Main Calls
responses:
'204':
$ref: '../responses/Deleted.yaml'
'401':
$ref: '../responses/NotAuthorized.yaml'
'403':
$ref: '../responses/Forbidden.yaml'
'404':
$ref: '../responses/NotFound.yaml'
18 changes: 18 additions & 0 deletions src/schemas/GitTokenRequest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
type: object
required:
- name
- type
- token
properties:
name:
type: string
description:
type: string
type:
$ref: './enums/GitProvider.yaml'
token:
type: string
description: The token from your git provider side
workspace:
type: string
description: Mandatory only for BITBUCKET git provider, to allow us to fetch repositories at creation/edition of a service
3 changes: 3 additions & 0 deletions src/schemas/GitTokenResponse.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ allOf:
type: string
type:
$ref: './enums/GitProvider.yaml'
expired_at:
type: string
format: date

0 comments on commit af4b81b

Please sign in to comment.