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
37 changes: 37 additions & 0 deletions components/redcircle_api/actions/add-zipcode/add-zipcode.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import app from "../../redcircle_api.app.mjs";

export default {
key: "redcircle_api-add-zipcode",
name: "Add Zipcode",
description: "Add a zipcode to Redcircle API. [See the documentation](https://docs.trajectdata.com/redcircleapi/zipcodes-api/add)",
version: "0.0.1",
type: "action",
props: {
app,
zipcode: {
propDefinition: [
app,
"zipcode",
],
},
domain: {
propDefinition: [
app,
"domain",
],
},
},
async run({ $ }) {
const response = await this.app.addZipcode({
$,
data: [
{
zipcode: this.zipcode,
domain: this.domain,
},
],
});
$.export("$summary", "Successfully sent the request");
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import app from "../../redcircle_api.app.mjs";

export default {
key: "redcircle_api-get-account-data",
name: "Get Account Data",
description: "Get your account details. [See the documentation](https://docs.trajectdata.com/redcircleapi/account-api)",
version: "0.0.1",
type: "action",
props: {
app,
},
async run({ $ }) {
const response = await this.app.getAccountData({
$,
});
$.export("$summary", "Successfully retrieved the account data");
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import app from "../../redcircle_api.app.mjs";

export default {
key: "redcircle_api-search-categories",
name: "Search Categories",
description: "Search for a category in Redcirle API. [See the documentation](https://docs.trajectdata.com/redcircleapi/categories-api/list-and-search)",
version: "0.0.1",
type: "action",
props: {
app,
searchTerm: {
propDefinition: [
app,
"searchTerm",
],
},
},
async run({ $ }) {
const response = await this.app.searchCategories({
$,
params: {
"search_term": this.searchTerm,
},
});
$.export("$summary", "Successfully sent the request and retrieved " + response.categories.length + " categories");
return response;
},
};
5 changes: 4 additions & 1 deletion components/redcircle_api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/redcircle_api",
"version": "0.0.1",
"version": "0.1.0",
"description": "Pipedream RedCircle API Components",
"main": "redcircle_api.app.mjs",
"keywords": [
Expand All @@ -11,5 +11,8 @@
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^3.1.0"
}
}
63 changes: 58 additions & 5 deletions components/redcircle_api/redcircle_api.app.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,64 @@
import { axios } from "@pipedream/platform";

export default {
type: "app",
app: "redcircle_api",
propDefinitions: {},
propDefinitions: {
searchTerm: {
type: "string",
label: "Search Term",
description: "The term to search for a category",
optional: true,
},
zipcode: {
type: "string",
label: "Zipcode",
description: "Description for zipcode",
},
domain: {
type: "string",
label: "Domain",
description: "Description for domain",
},
},
methods: {
// this.$auth contains connected account data
authKeys() {
console.log(Object.keys(this.$auth));
_baseUrl() {
return "https://api.redcircleapi.com";
},
async _makeRequest(opts = {}) {
const {
$ = this,
path,
params,
...otherOpts
} = opts;
return axios($, {
...otherOpts,
url: this._baseUrl() + path,
params: {
api_key: `${this.$auth.api_key}`,
...params,
},
});
},
async searchCategories(args = {}) {
return this._makeRequest({
path: "/categories",
...args,
});
},
async getAccountData(args = {}) {
return this._makeRequest({
path: "/account",
...args,
});
},
async addZipcode(args = {}) {
return this._makeRequest({
path: "/zipcodes",
method: "post",
...args,
});
},
},
};
};
15 changes: 8 additions & 7 deletions pnpm-lock.yaml

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

Loading