-
Notifications
You must be signed in to change notification settings - Fork 5.5k
[Components] apiary #13264 #14777
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
[Components] apiary #13264 #14777
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
b4b1df6
Added actions
lcaresia 0e7e7d0
Added actions
lcaresia 1b7ff1b
Added actions
lcaresia 20ba36d
Merge branch 'issue-13264' of github.com:PipedreamHQ/pipedream into i…
lcaresia b595b43
Fixed requested changes
lcaresia 87d9d92
Merge branch 'master' into issue-13264
lcaresia a48c1c6
Update components/apiary/actions/publish-blueprint/publish-blueprint.mjs
lcaresia f6052d2
Fixed requested changes
lcaresia 8268a78
fixes
michelle0927 fa611a1
Merge remote-tracking branch 'origin/master' into issue-13264
michelle0927 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
---|---|---|
|
@@ -8,4 +8,4 @@ export default { | |
console.log(Object.keys(this.$auth)); | ||
}, | ||
}, | ||
}; | ||
}; |
51 changes: 51 additions & 0 deletions
51
components/apiary/actions/create-api-project/create-api-project.mjs
This file contains hidden or 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,51 @@ | ||
import app from "../../apiary.app.mjs"; | ||
|
||
export default { | ||
key: "apiary-create-api-project", | ||
name: "Create API Project", | ||
description: "Create a new API project. [See the documentation](https://apiary.docs.apiary.io/#reference/blueprint/create-api-project/create-api-project)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
app, | ||
type: { | ||
propDefinition: [ | ||
app, | ||
"type", | ||
], | ||
}, | ||
public: { | ||
propDefinition: [ | ||
app, | ||
"public", | ||
], | ||
}, | ||
desiredName: { | ||
propDefinition: [ | ||
app, | ||
"desiredName", | ||
], | ||
}, | ||
code: { | ||
propDefinition: [ | ||
app, | ||
"code", | ||
], | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const response = await this.app.createApiProject({ | ||
$, | ||
data: { | ||
type: this.type, | ||
public: this.public, | ||
desiredName: this.desiredName, | ||
code: this.code, | ||
}, | ||
}); | ||
|
||
$.export("$summary", `Successfully created a new API Project with the following domain: ${response.domain}`); | ||
|
||
return response; | ||
}, | ||
}; |
28 changes: 28 additions & 0 deletions
28
components/apiary/actions/fetch-blueprint/fetch-blueprint.mjs
This file contains hidden or 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,28 @@ | ||
import app from "../../apiary.app.mjs"; | ||
|
||
export default { | ||
key: "apiary-fetch-blueprint", | ||
name: "Fetch Blueprint", | ||
description: "Fetch an API Blueprint for a particular API. [See the documentation](https://apiary.docs.apiary.io/#reference/blueprint/fetch-blueprint/fetch-blueprint)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
app, | ||
apiSubdomain: { | ||
propDefinition: [ | ||
app, | ||
"apiSubdomain", | ||
], | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const response = await this.app.fetchBlueprint({ | ||
$, | ||
apiSubdomain: this.apiSubdomain, | ||
}); | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
$.export("$summary", "Successfully fetched the blueprint for the specified API Subdomain"); | ||
|
||
return response; | ||
}, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}; |
37 changes: 37 additions & 0 deletions
37
components/apiary/actions/publish-blueprint/publish-blueprint.mjs
This file contains hidden or 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,37 @@ | ||
import app from "../../apiary.app.mjs"; | ||
|
||
export default { | ||
key: "apiary-publish-blueprint", | ||
name: "Publish Blueprint", | ||
description: "Publish an API Blueprint for a particular API. [See the documentation](https://apiary.docs.apiary.io/#reference/blueprint/publish-blueprint/publish-blueprint)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
app, | ||
apiSubdomain: { | ||
propDefinition: [ | ||
app, | ||
"apiSubdomain", | ||
], | ||
}, | ||
code: { | ||
propDefinition: [ | ||
app, | ||
"code", | ||
], | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const response = await this.app.publishBlueprint({ | ||
$, | ||
apiSubdomain: this.apiSubdomain, | ||
data: { | ||
code: this.code, | ||
}, | ||
}); | ||
|
||
$.export("$summary", `Successfully published the blueprint with the subdomain '${this.apiSubdomain}'`); | ||
|
||
return response; | ||
}, | ||
}; |
This file contains hidden or 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 |
---|---|---|
@@ -1,11 +1,113 @@ | ||
import { axios } from "@pipedream/platform"; | ||
import constants from "./common/constants.mjs"; | ||
|
||
export default { | ||
type: "app", | ||
app: "apiary", | ||
propDefinitions: {}, | ||
propDefinitions: { | ||
apiSubdomain: { | ||
type: "string", | ||
label: "API Subdomain", | ||
description: "Subdomain of the API", | ||
async options() { | ||
const response = await this.listApis(); | ||
const apisSubdomains = response.apis; | ||
return apisSubdomains.map(({ | ||
apiSubdomain, apiName, | ||
}) => ({ | ||
value: apiSubdomain, | ||
label: apiName, | ||
})); | ||
}, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}, | ||
type: { | ||
type: "string", | ||
label: "API Type", | ||
description: "Type of the API", | ||
options: constants.API_TYPES, | ||
}, | ||
public: { | ||
type: "boolean", | ||
label: "Public", | ||
description: "Defines if the API is public or private", | ||
}, | ||
desiredName: { | ||
type: "string", | ||
label: "Desired Name", | ||
description: "If the desiredName is already taken, a different domain will be generated for your API Project. It can be later changed in the settings", | ||
}, | ||
code: { | ||
type: "string", | ||
label: "Code", | ||
description: "`FORMAT: 1`", | ||
}, | ||
}, | ||
methods: { | ||
// this.$auth contains connected account data | ||
authKeys() { | ||
console.log(Object.keys(this.$auth)); | ||
_baseUrl() { | ||
return "https://api.apiary.io"; | ||
}, | ||
_headers({ | ||
headers = {}, legacy = false, | ||
}) { | ||
return legacy | ||
? { | ||
...headers, | ||
Authentication: `Token ${this.$auth.token}`, | ||
} | ||
: { | ||
...headers, | ||
Authorization: `Bearer ${this.$auth.token}`, | ||
}; | ||
}, | ||
async _makeRequest(opts = {}) { | ||
const { | ||
$ = this, | ||
path, | ||
headers, | ||
legacy, | ||
...otherOpts | ||
} = opts; | ||
return axios($, { | ||
...otherOpts, | ||
url: this._baseUrl() + path, | ||
headers: this._headers({ | ||
headers, | ||
legacy, | ||
}), | ||
}); | ||
}, | ||
async createApiProject(args = {}) { | ||
return this._makeRequest({ | ||
path: "/blueprint/create", | ||
method: "post", | ||
legacy: true, | ||
...args, | ||
}); | ||
}, | ||
async fetchBlueprint({ | ||
apiSubdomain, ...args | ||
}) { | ||
return this._makeRequest({ | ||
path: `/blueprint/get/${apiSubdomain}`, | ||
legacy: true, | ||
...args, | ||
}); | ||
}, | ||
async publishBlueprint({ | ||
apiSubdomain, ...args | ||
}) { | ||
return this._makeRequest({ | ||
path: `/blueprint/publish/${apiSubdomain}`, | ||
method: "post", | ||
legacy: true, | ||
...args, | ||
}); | ||
}, | ||
async listApis(args = {}) { | ||
return this._makeRequest({ | ||
path: "/me/apis", | ||
...args, | ||
}); | ||
}, | ||
}, | ||
}; |
This file contains hidden or 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,6 @@ | ||
export default { | ||
API_TYPES: [ | ||
"personal", | ||
"team", | ||
], | ||
}; |
This file contains hidden or 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 |
---|---|---|
@@ -1,18 +1,18 @@ | ||
{ | ||
"name": "@pipedream/apiary", | ||
"version": "0.6.0", | ||
"version": "0.7.0", | ||
"description": "Pipedream apiary Components", | ||
"main": "apiary.app.mjs", | ||
"keywords": [ | ||
"pipedream", | ||
"apiary" | ||
], | ||
"homepage": "https://pipedream.com/apps/apiary", | ||
"author": "Pipedream [email protected] (https://pipedream.com/)", | ||
"author": "Pipedream <[email protected]> (https://pipedream.com/)", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"dependencies": { | ||
"@pipedream/platform": "^3.0.0" | ||
"@pipedream/platform": "^3.0.3" | ||
} | ||
} |
This file contains hidden or 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 |
---|---|---|
|
@@ -8,4 +8,4 @@ export default { | |
console.log(Object.keys(this.$auth)); | ||
}, | ||
}, | ||
}; | ||
}; |
This file contains hidden or 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 |
---|---|---|
|
@@ -8,4 +8,4 @@ export default { | |
console.log(Object.keys(this.$auth)); | ||
}, | ||
}, | ||
}; | ||
}; |
This file contains hidden or 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 |
---|---|---|
|
@@ -8,4 +8,4 @@ export default { | |
console.log(Object.keys(this.$auth)); | ||
}, | ||
}, | ||
}; | ||
}; |
This file contains hidden or 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 |
---|---|---|
|
@@ -8,4 +8,4 @@ export default { | |
console.log(Object.keys(this.$auth)); | ||
}, | ||
}, | ||
}; | ||
}; |
This file contains hidden or 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 |
---|---|---|
|
@@ -8,4 +8,4 @@ export default { | |
console.log(Object.keys(this.$auth)); | ||
}, | ||
}, | ||
}; | ||
}; |
This file contains hidden or 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 |
---|---|---|
|
@@ -8,4 +8,4 @@ export default { | |
console.log(Object.keys(this.$auth)); | ||
}, | ||
}, | ||
}; | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.