Skip to content

Commit

Permalink
docs: Migrate to Bruno (keyshade-xyz#525)
Browse files Browse the repository at this point in the history
  • Loading branch information
rajdip-b authored Nov 10, 2024
1 parent 7c8ee5d commit 1793d92
Show file tree
Hide file tree
Showing 110 changed files with 2,362 additions and 21 deletions.
36 changes: 36 additions & 0 deletions api-collection/Api Key Controller/Can access live updates.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
meta {
name: Can access live updates
type: http
seq: 5
}

get {
url: {{BASE_URL}}/api/api-key/access/live-updates
body: none
auth: apikey
}

auth:apikey {
key: x-keyshade-token
value: {{vault:API_KEY}}
placement: header
}

docs {
## Description

This endpoint is specific to the keyshade CLI. In order for `keyshade run` to be successful, it needs to check that the API key has access to the following authorities or not:

- `READ_WORKSPACE`

- `READ_PROJECT`

- `READ_ENVIRONMENT`

- `READ_SECRET`

- `READ_VARIABLE`


If this is satisfied, the client can proceed.
}
43 changes: 43 additions & 0 deletions api-collection/Api Key Controller/Create API key.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
meta {
name: Create API key
type: http
seq: 1
}

post {
url: {{BASE_URL}}/api/api-key
body: json
auth: bearer
}

auth:bearer {
token: {{JWT}}
}

body:json {
{
"name": "My key",
"authorities": [
"READ_API_KEY",
"READ_WORKSPACE",
"READ_PROJECT",
"READ_ENVIRONMENT",
"READ_VARIABLE",
"READ_SECRET"
]
}
}

docs {
## Description

Allows users to create an API key that allows them to access keyshade API using any REST client.

### Request Body

- `name`: The name of the API key

- `expiresAfter`: (Optional) The amount of time after which the API key will expire. Defaults to \`never\`. Accepts: `'24' | '168' | '720' | '8760'`. Durations are in hours.

- `authorities`: (Optional) An array of authorities that are allowed for this API key. Defaults to \`\[\]\`
}
25 changes: 25 additions & 0 deletions api-collection/Api Key Controller/Delete API key.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
meta {
name: Delete API key
type: http
seq: 6
}

delete {
url: {{BASE_URL}}/api/api-key/:api_key_slug
body: none
auth: bearer
}

params:path {
api_key_slug: my-key-zxvie
}

auth:bearer {
token: {{JWT}}
}

docs {
## Description

Deletes an API key
}
25 changes: 25 additions & 0 deletions api-collection/Api Key Controller/Get API key.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
meta {
name: Get API key
type: http
seq: 3
}

get {
url: {{BASE_URL}}/api/api-key/:api_key_slug
body: none
auth: bearer
}

params:path {
api_key_slug: my-key-zxvies
}

auth:bearer {
token: {{JWT}}
}

docs {
## Description

Fetch an API key by its slug.
}
21 changes: 21 additions & 0 deletions api-collection/Api Key Controller/Get API keys.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
meta {
name: Get API keys
type: http
seq: 4
}

get {
url: {{BASE_URL}}/api/api-key
body: none
auth: bearer
}

auth:bearer {
token: {{JWT}}
}

docs {
## Description

Fetches all the API keys
}
49 changes: 49 additions & 0 deletions api-collection/Api Key Controller/Update API key.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
meta {
name: Update API key
type: http
seq: 2
}

put {
url: {{BASE_URL}}/api/api-key/:api_key_slug
body: json
auth: bearer
}

params:path {
api_key_slug: my-key-2
}

auth:bearer {
token: {{JWT}}
}

body:json {
{
"authorities": [
"READ_API_KEY",
"READ_WORKSPACE",
"READ_PROJECT",
"READ_ENVIRONMENT",
"READ_VARIABLE",
"READ_SECRET",
"CREATE_WORKSPACE",
"UPDATE_WORKSPACE",
"DELETE_WORKSPACE",
"WORKSPACE_ADMIN"
]
}
}

docs {
## Description

Allows users to update an API key.

### Request Body

- `name`: (Optional) The name of the API key. Note that, changing the name would also change the slug of the api key.

- `expiresAfter`: (Optional) The amount of time after which the API key will expire. Defaults to \`never\`. Accepts: `'24' | '168' | '720' | '8760'`. Durations are in hours.
- `authorities`: (Optional) An array of authorities that are allowed for this API key. Defaults to \`\[\]\`
}
6 changes: 6 additions & 0 deletions api-collection/Api Key Controller/bruno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"version": "1",
"name": "Api Key Controller",
"type": "collection",
"ignore": ["node_modules", ".git"]
}
7 changes: 7 additions & 0 deletions api-collection/Api Key Controller/collection.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
meta {
name: Api Kei Controller
}

auth {
mode: none
}
15 changes: 15 additions & 0 deletions api-collection/Auth Controller/GitHub auth.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
meta {
name: GitHub auth
type: http
seq: 3
}

get {
url: {{BASE_URL}}/api/auth/github
body: none
auth: none
}

docs {
This endpoint validates Github OAuth. If the OAuth is valid, it returns a valid token along with the user details
}
15 changes: 15 additions & 0 deletions api-collection/Auth Controller/GitLab auth.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
meta {
name: GitLab auth
type: http
seq: 4
}

get {
url: {{BASE_URL}}/api/auth/gitlab
body: none
auth: none
}

docs {
This endpoint validates GitLab OAuth. If the OAuth is valid, it returns a valid token along with the user details
}
15 changes: 15 additions & 0 deletions api-collection/Auth Controller/Google auth.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
meta {
name: Google auth
type: http
seq: 5
}

get {
url: {{BASE_URL}}/api/auth/google
body: none
auth: none
}

docs {
This endpoint validates Google OAuth. If the OAuth is valid, it returns a valid token along with the user details
}
25 changes: 25 additions & 0 deletions api-collection/Auth Controller/Send OTP.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
meta {
name: Send OTP
type: http
seq: 1
}

post {
url: {{BASE_URL}}/api/auth/send-otp/:email
body: none
auth: none
}

params:query {
~:
}

params:path {
email: rajdip@keyshade.xyz
}

docs {
## Description

This endpoint sends OTPs to an email address. The OTP can then be used to generate valid tokens
}
22 changes: 22 additions & 0 deletions api-collection/Auth Controller/Validate OTP.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
meta {
name: Validate OTP
type: http
seq: 2
}

post {
url: {{BASE_URL}}/api/auth/validate-otp?email=rajdip@keyshade.xyz&otp=774626
body: none
auth: none
}

params:query {
email: rajdip@keyshade.xyz
otp: 774626
}

docs {
## Description

This endpoint validates OTPs. If the OTP is valid, it returns a valid token along with the user details
}
9 changes: 9 additions & 0 deletions api-collection/Auth Controller/bruno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"version": "1",
"name": "Auth Controller",
"type": "collection",
"ignore": [
"node_modules",
".git"
]
}
7 changes: 7 additions & 0 deletions api-collection/Auth Controller/collection.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
meta {
name: Auth Controller
}

auth {
mode: none
}
37 changes: 37 additions & 0 deletions api-collection/Environment Controller/Create environment.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
meta {
name: Create environment
type: http
seq: 1
}

post {
url: {{BASE_URL}}/api/environment/:project_slug
body: json
auth: bearer
}

params:path {
project_slug:
}

auth:bearer {
token: {{JWT}}
}

body:json {
{
"name": "Alpha"
}
}

docs {
## Description

Creates an environment under a particular project.

### Request Body

- `name`: The name of the environment. Should be unique in the project.

- `description`: (Optional) An optional description about the environment.
}
19 changes: 19 additions & 0 deletions api-collection/Environment Controller/Delete environment.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
meta {
name: Delete environment
type: http
seq: 5
}

delete {
url: {{BASE_URL}}/api/environment/:environment_slug
body: none
auth: bearer
}

params:path {
environment_slug:
}

auth:bearer {
token: {{JWT}}
}
Loading

0 comments on commit 1793d92

Please sign in to comment.