Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/anchor_browser/anchor_browser.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
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 components/apiary/actions/fetch-blueprint/fetch-blueprint.mjs
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,
});

$.export("$summary", "Successfully fetched the blueprint for the specified API Subdomain");

return response;
},
};
37 changes: 37 additions & 0 deletions components/apiary/actions/publish-blueprint/publish-blueprint.mjs
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;
},
};
110 changes: 106 additions & 4 deletions components/apiary/apiary.app.mjs
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,
}));
},
},
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,
});
},
},
};
6 changes: 6 additions & 0 deletions components/apiary/common/constants.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default {
API_TYPES: [
"personal",
"team",
],
};
6 changes: 3 additions & 3 deletions components/apiary/package.json
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"
}
}
2 changes: 1 addition & 1 deletion components/cloudentity/cloudentity.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/databricks_oauth/databricks_oauth.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/griptape/griptape.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/ihomefinder/ihomefinder.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/jira_data_center/jira_data_center.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/koyeb/koyeb.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
7 changes: 4 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading