-
Notifications
You must be signed in to change notification settings - Fork 1
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 #14 from WilfredAlmeida/apis
Apis
- Loading branch information
Showing
15 changed files
with
543 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Bug report | ||
description: Create a report to help us improve | ||
title: '[bug]' | ||
labels: ['bug'] | ||
body: | ||
- type: textarea | ||
attributes: | ||
label: Describe the bug | ||
description: A clear and concise description of what the bug is | ||
validations: | ||
required: false | ||
- type: textarea | ||
attributes: | ||
label: To Reproduce | ||
description: | | ||
Steps to reproduce the behavior. | ||
1. Go to '...' | ||
2. Click on '...' | ||
3. Scroll down to '...' | ||
4. See error | ||
validations: | ||
required: false | ||
- type: textarea | ||
attributes: | ||
label: Expected Behavior | ||
description: A clear and concise description of what you expected to happen. | ||
validations: | ||
required: false | ||
- type: textarea | ||
attributes: | ||
label: Screenshot/ Video | ||
description: If applicable, add screenshots to help explain your problem. | ||
validations: | ||
required: false | ||
- type: textarea | ||
attributes: | ||
label: Additional context | ||
description: Add any other context about the problem here. | ||
validations: | ||
required: false |
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,5 @@ | ||
blank_issues_enabled: false | ||
contact_links: | ||
- name: Discord community support | ||
url: https://unkey.dev/discord | ||
about: Need any help? Found any bug? Please chat with us via Discord. |
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,18 @@ | ||
name: Documentation request | ||
description: Change regarding improving the docs to be more accessible | ||
title: '[docs]' | ||
labels: ['documentation'] | ||
body: | ||
- type: textarea | ||
attributes: | ||
label: Category of documentation update | ||
description: | | ||
What category does this change fall under.For example Typo error, New category addition, Rephrasing the sentences, fixing broken links etc | ||
validations: | ||
required: true | ||
- type: textarea | ||
attributes: | ||
label: Describe the change you think might work | ||
description: Please describe the change & need of change in atmost detail possible. | ||
validations: | ||
required: false |
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,24 @@ | ||
name: Feature request | ||
description: Suggest an idea for this project | ||
title: '[feat]' | ||
labels: ['enhancement'] | ||
body: | ||
- type: textarea | ||
attributes: | ||
label: Would you like to have a new feature? Please describe. | ||
description: A clear and concise description of what the feature is | ||
placeholder: Ex. Whenever I try to do (xyz) then [...] | ||
validations: | ||
required: false | ||
- type: textarea | ||
attributes: | ||
label: How would this feature be beneficial for the project | ||
description: A clear and concise description about the importance of the feature | ||
validations: | ||
required: false | ||
- type: textarea | ||
attributes: | ||
label: Additional context | ||
description: Add any other context or screenshots about the feature request here. | ||
validations: | ||
required: false |
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,22 @@ | ||
name: Other | ||
description: Use this for any other issues. PLEASE do not create blank issues | ||
title: "[other]" | ||
labels: ["random"] | ||
body: | ||
- type: markdown | ||
attributes: | ||
value: "# Other issue" | ||
- type: textarea | ||
id: issuedescription | ||
attributes: | ||
label: What would you like to share? | ||
description: Provide a clear and concise explanation of your issue. | ||
validations: | ||
required: true | ||
- type: textarea | ||
id: extrainfo | ||
attributes: | ||
label: Additional information | ||
description: Is there anything else we should know about this issue? | ||
validations: | ||
required: false |
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,32 @@ | ||
<!--Type in all the issues that have been fixed through this pull request ex : #1 --> | ||
|
||
## Fixes Issue | ||
|
||
This PR fixes the following issues: | ||
|
||
#example | ||
|
||
<!-- Write down all the changes made--> | ||
## Changes proposed | ||
|
||
Here comes all the changes proposed through this PR | ||
|
||
<!-- Check all the boxes which are applicable to check the box correct follow the following conventions--> | ||
<!-- | ||
[x] - Correct | ||
[X] - Correct | ||
--> | ||
|
||
## Check List (Check all the boxes which are applicable) <!--Follow the above conventions to check the box--> | ||
|
||
- [ ] My code follows the code style of this project. | ||
- [ ] My change requires a change to the documentation. | ||
- [ ] I have updated the documentation accordingly. | ||
- [ ] All new and existing tests passed. | ||
- [ ] This PR does not contain plagiarized content. | ||
- [ ] The title of my pull request is a short description of the requested changes. | ||
|
||
|
||
<!--Add screen shots of the changed output--> | ||
## Screenshots | ||
Add all the screenshots which support your changes |
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,15 @@ | ||
name: Greetings | ||
|
||
on: [pull_request_target, issues] | ||
|
||
jobs: | ||
welcome: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: EddieHubCommunity/gh-action-community/src/welcome@main | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
issue-message: '<h3>Hello 👋 Thank you very much for raising an issue 🙌 The maintainers will get back to you soon for discussion over the issue! Thank you for your contributions. 🚀</h3>' | ||
pr-message: '<h3>Yeah! You did it 🎉 Now, Relax 😉 -> Grab a drink ☕ -> And wait for the maintainers to check your contributions. Meanwhile, you can discuss on other issues and solve them 😀</h3>' | ||
footer: 'Meanwhile you can discuss about the project in our <a href="https://unkey.dev/discord/">Discord</a> Server 😀</h3>' |
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,29 @@ | ||
name: Changelog | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
changelog: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Conventional Changelog Action | ||
id: changelog | ||
uses: TriPSs/conventional-changelog-action@v3 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
output-file: "false" | ||
|
||
- name: Create Release | ||
uses: actions/create-release@v1 | ||
if: ${{ steps.changelog.outputs.skipped == 'false' }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ steps.changelog.outputs.tag }} | ||
release_name: ${{ steps.changelog.outputs.tag }} | ||
body: ${{ steps.changelog.outputs.clean_changelog }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package features | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
"io" | ||
"net/http" | ||
|
||
"github.com/WilfredAlmeida/unkey-go/utils" | ||
) | ||
|
||
type APIGetResponse struct { | ||
ID string `json:"id"` | ||
Name string `json:"name"` | ||
WorkspaceID string `json:"workspaceId"` | ||
} | ||
|
||
func APIGet(apiID, authToken string) (APIGetResponse, error) { | ||
|
||
// Create a new HTTP client | ||
client := &http.Client{} | ||
|
||
// Create a new GET request | ||
req, err := http.NewRequest("GET", utils.UNKEY_API_URL+"/apis/"+apiID, nil) | ||
if err != nil { | ||
return APIGetResponse{}, err | ||
} | ||
|
||
// Set the authorization header | ||
req.Header.Set("Authorization", authToken) | ||
|
||
// Send the request | ||
resp, err := client.Do(req) | ||
if err != nil { | ||
return APIGetResponse{}, err | ||
} | ||
defer resp.Body.Close() | ||
|
||
// Read the response body | ||
body, err := io.ReadAll(resp.Body) | ||
if err != nil { | ||
return APIGetResponse{}, err | ||
} | ||
|
||
// Check the response status code | ||
if resp.StatusCode != http.StatusOK { | ||
return APIGetResponse{}, fmt.Errorf(string(body)) | ||
} | ||
|
||
// Parse the response JSON | ||
var response APIGetResponse | ||
err = json.Unmarshal(body, &response) | ||
if err != nil { | ||
return APIGetResponse{}, err | ||
} | ||
|
||
return response, nil | ||
} |
Oops, something went wrong.