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

export default {
key: "autoblogger-get-blogposts",
name: "Get Blogposts",
description: "Retrieves blogposts using the API key. [See the documentation](https://u.pcloud.link/publink/show?code=XZdjuv0ZtabS8BN58thUiE8FGjznajoMc6Qy)",
version: "0.0.1",
type: "action",
props: {
app,
},

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

$.export("$summary", `Successfully retrieved ${response.length} blogposts`);

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

export default {
key: "autoblogger-validate-api-key",
name: "Validate API Key",
description: "Validates the provided API key. [See the documentation](https://u.pcloud.link/publink/show?code=XZdjuv0ZtabS8BN58thUiE8FGjznajoMc6Qy)",
version: "0.0.1",
type: "action",
props: {
app,
},
async run({ $ }) {
const response = await this.app.validateKey({
$,
});

$.export("$summary", `API Key ${response.is_valid
? "is"
: "isn't"} valid`);

return response;
},
};
36 changes: 33 additions & 3 deletions components/autoblogger/autoblogger.app.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,41 @@
import { axios } from "@pipedream/platform";

export default {
type: "app",
app: "autoblogger",
propDefinitions: {},
methods: {
// this.$auth contains connected account data
authKeys() {
console.log(Object.keys(this.$auth));
_baseUrl() {
return "https://autoblogger-api.otherweb.com";
},
async _makeRequest(opts = {}) {
const {
$ = this,
path,
headers,
...otherOpts
} = opts;
return axios($, {
...otherOpts,
url: this._baseUrl() + path,
headers: {
...headers,
"x-api-key": `${this.$auth.api_key}`,
"Accept": "application/json",
},
});
},
async validateKey(args = {}) {
return this._makeRequest({
path: "/api/v1/site/validate/apikey",
...args,
});
},
async getBlogposts(args = {}) {
return this._makeRequest({
path: "/api/v1/blogposts",
...args,
});
},
},
};
7 changes: 5 additions & 2 deletions components/autoblogger/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/autoblogger",
"version": "0.0.1",
"version": "0.1.0",
"description": "Pipedream AutoBlogger Components",
"main": "autoblogger.app.mjs",
"keywords": [
Expand All @@ -11,5 +11,8 @@
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^3.0.3"
}
}
}
7 changes: 5 additions & 2 deletions pnpm-lock.yaml

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

Loading