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
3 changes: 0 additions & 3 deletions components/klipfolio/.gitignore

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import app from "../../klipfolio.app.mjs";

export default {
key: "klipfolio-create-datasource",
name: "Create Datasource",
description: "Create a data source. [See the documentation](https://apidocs.klipfolio.com/reference/data-sources#post-datasources)",
version: "0.0.1",
type: "action",
props: {
app,
name: {
propDefinition: [
app,
"name",
],
},
description: {
propDefinition: [
app,
"description",
],
},
format: {
propDefinition: [
app,
"format",
],
},
connector: {
propDefinition: [
app,
"connector",
],
},
refreshInterval: {
propDefinition: [
app,
"refreshInterval",
],
},
endpointUrl: {
propDefinition: [
app,
"endpointUrl",
],
},
method: {
propDefinition: [
app,
"method",
],
},
additionalProperties: {
propDefinition: [
app,
"additionalProperties",
],
},
},

async run({ $ }) {
const response = await this.app.createDatasource({
$,
data: {
name: this.name,
description: this.description,
format: this.format,
connector: this.connector,
refresh_interval: parseInt(this.refreshInterval, 10),
properties: {
endpoint_url: this.endpointUrl,
method: this.method,
...this.additionalProperties,
},
},
});

$.export("$summary", `Successfully created Datasource named '${this.name}'`);

return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import app from "../../klipfolio.app.mjs";

export default {
key: "klipfolio-delete-datasource",
name: "Delete Datasource",
description: "Delete the data source associated with a specific data source ID. [See the documentation](https://apidocs.klipfolio.com/reference/data-sources#delete-datasourcesid)",
version: "0.0.1",
type: "action",
props: {
app,
datasourceId: {
propDefinition: [
app,
"datasourceId",
],
},
},

async run({ $ }) {
const response = await this.app.deleteDatasource({
$,
datasourceId: this.datasourceId,
});

$.export("$summary", `Successfully deleted datasource with ID: ${this.datasourceId}`);

return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import app from "../../klipfolio.app.mjs";

export default {
key: "klipfolio-update-datasource",
name: "Update Datasource",
description: "Update the specified data source. [See the documentation](https://apidocs.klipfolio.com/reference/data-sources#put-datasourcesid)",
version: "0.0.1",
type: "action",
props: {
app,
datasourceId: {
propDefinition: [
app,
"datasourceId",
],
},
name: {
propDefinition: [
app,
"name",
],
},
description: {
propDefinition: [
app,
"description",
],
},
refreshInterval: {
propDefinition: [
app,
"refreshInterval",
],
},
},

async run({ $ }) {
const response = await this.app.updateDatasource({
$,
datasourceId: this.datasourceId,
data: {
name: this.name,
description: this.description,
refresh_interval: parseInt(this.refreshInterval, 10),
},
});

$.export("$summary", `Successfully updated Datasource named '${this.name}'`);

return response;
},
};
13 changes: 0 additions & 13 deletions components/klipfolio/app/klipfolio.app.ts

This file was deleted.

40 changes: 40 additions & 0 deletions components/klipfolio/common/constants.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
export default {
DATASOURCE_CONNECTORS: [
"box",
"comscore",
"db",
"dropbox",
"facebook",
"ftp",
"google_adwords",
"google_analytics",
"google_drive",
"google_spreadsheets",
"hubspot",
"iformbuilder",
"marketo",
"omniture",
"radian6",
"salesforce",
"searchMetrics",
"shopify",
"simple_rest",
"survey_monkey",
"versature",
"xero",
"xmla",
],
REFRESH_INTERVALS: [
"0",
"60",
"300",
"900",
"1800",
"3600",
"7200",
"10800",
"14400",
"43200",
"86400",
],
};
119 changes: 119 additions & 0 deletions components/klipfolio/klipfolio.app.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
import { axios } from "@pipedream/platform";
import constants from "./common/constants.mjs";

export default {
type: "app",
app: "klipfolio",
propDefinitions: {
name: {
type: "string",
label: "Name",
description: "Name of the Datasource",
},
description: {
type: "string",
label: "Description",
description: "Description of the Datasource",
},
format: {
type: "string",
label: "Format",
description: "Format of the Datasource, i.e.: `xml`",
},
connector: {
type: "string",
label: "Connector",
description: "Connector of the Datasource",
options: constants.DATASOURCE_CONNECTORS,
},
refreshInterval: {
type: "string",
label: "Refresh Interval",
description: "Refresh Interval of the Datasource",
options: constants.REFRESH_INTERVALS,
},
endpointUrl: {
type: "string",
label: "Endpoint URL",
description: "Endpoint URL of the Datasource, i.e.: `http://test/data/scatter.xml`",
},
method: {
type: "string",
label: "Method",
description: "Method for the endpoint, i.e.: `GET`",
},
datasourceId: {
type: "string",
label: "Datasource ID",
description: "ID of the Datasource",
async options() {
const response = await this.getDatasources();
const datasourceIds = response.data.datasources;
return datasourceIds.map(({
id, name,
}) => ({
label: name,
value: id,
}));
},
},
additionalProperties: {
type: "object",
label: "Additional Properties",
description: "Data source additional properties. For example, Google Analytics API has the following properties: `oauth_provider_id`, `oauth_user_header`, `oauth_user_token`, `token_id`, `prop:profile_id`.",
optional: true,
},
},
methods: {
_baseUrl() {
return "https://app.klipfolio.com/api/1.0";
},
async _makeRequest(opts = {}) {
const {
$ = this,
path,
headers,
...otherOpts
} = opts;
return axios($, {
...otherOpts,
url: this._baseUrl() + path,
headers: {
...headers,
"kf-api-key": `${this.$auth.api_key}`,
},
});
},
async createDatasource(args = {}) {
return this._makeRequest({
path: "/datasources",
method: "post",
...args,
});
},
async updateDatasource({
datasourceId, ...args
}) {
return this._makeRequest({
path: `/datasources/${datasourceId}`,
method: "put",
...args,
});
},
async deleteDatasource({
datasourceId, ...args
}) {
return this._makeRequest({
path: `/datasources/${datasourceId}`,
method: "delete",
...args,
});
},
async getDatasources(args = {}) {
return this._makeRequest({
path: "/datasources",
...args,
});
},
},
};
8 changes: 5 additions & 3 deletions components/klipfolio/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
{
"name": "@pipedream/klipfolio",
"version": "0.0.2",
"version": "0.1.0",
"description": "Pipedream Klipfolio Components",
"main": "dist/app/klipfolio.app.mjs",
"main": "klipfolio.app.mjs",
"keywords": [
"pipedream",
"klipfolio"
],
"files": ["dist"],
"homepage": "https://pipedream.com/apps/klipfolio",
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^3.0.3"
}
}
6 changes: 5 additions & 1 deletion pnpm-lock.yaml

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

Loading