Skip to content

Commit 856b79d

Browse files
authored
Merge branch 'master' into issue-14021
2 parents c16f283 + 1ee9386 commit 856b79d

File tree

125 files changed

+9264
-2220
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+9264
-2220
lines changed
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Run SDK Tests
2+
3+
on:
4+
pull_request:
5+
types: [opened, edited, synchronize]
6+
paths:
7+
- 'packages/sdk/**'
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v3
16+
17+
- name: Set up Node.js
18+
uses: actions/setup-node@v3
19+
with:
20+
node-version: '18'
21+
22+
- name: Install dependencies
23+
run: npm install
24+
working-directory: packages/sdk
25+
26+
- name: Run tests
27+
run: npm test
28+
working-directory: packages/sdk
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
import { defineApp } from "@pipedream/types";
2-
3-
export default defineApp({
1+
export default {
42
type: "app",
5-
app: "opsgenie",
3+
app: "agentos",
64
propDefinitions: {},
75
methods: {
86
// this.$auth contains connected account data
97
authKeys() {
108
console.log(Object.keys(this.$auth));
119
},
1210
},
13-
});
11+
};

components/agentos/package.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "@pipedream/agentos",
3+
"version": "0.0.1",
4+
"description": "Pipedream agentOS Components",
5+
"main": "agentos.app.mjs",
6+
"keywords": [
7+
"pipedream",
8+
"agentos"
9+
],
10+
"homepage": "https://pipedream.com/apps/agentos",
11+
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
12+
"publishConfig": {
13+
"access": "public"
14+
}
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import app from "../../agility_cms.app.mjs";
2+
3+
export default {
4+
key: "agility_cms-get-content-items",
5+
name: "Get Content Items",
6+
description: "Retrieves all content items. [See the documentation](https://api.aglty.io/swagger/index.html#operations-Sync-get__guid___apitype___locale__sync_items)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
locale: {
12+
propDefinition: [
13+
app,
14+
"locale",
15+
],
16+
},
17+
},
18+
async run({ $ }) {
19+
const response = await this.app.getItems({
20+
$,
21+
locale: this.locale,
22+
});
23+
24+
$.export("$summary", `Successfully retrieved ${response.items.length} Items`);
25+
26+
return response;
27+
},
28+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import app from "../../agility_cms.app.mjs";
2+
3+
export default {
4+
key: "agility_cms-get-content-models",
5+
name: "Get Content Models",
6+
description: "Retrieve content models for the Agility instance. [See the documentation](https://api.aglty.io/swagger/index.html#operations-ContentModels-get__guid___apitype__contentmodels)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
},
12+
async run({ $ }) {
13+
const response = await this.app.getContentModels({
14+
$,
15+
});
16+
17+
$.export("$summary", `Successfully retrieved ${Object.keys(response).length} content models`);
18+
19+
return response;
20+
},
21+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import app from "../../agility_cms.app.mjs";
2+
3+
export default {
4+
key: "agility_cms-get-item",
5+
name: "Get Item Details",
6+
description: "Get details of the specified item. [See the documentation](https://api.aglty.io/swagger/index.html#operations-Item-get__guid___apitype___locale__item__id_)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
locale: {
12+
propDefinition: [
13+
app,
14+
"locale",
15+
],
16+
},
17+
itemId: {
18+
propDefinition: [
19+
app,
20+
"itemId",
21+
(c) => ({
22+
locale: c.locale,
23+
}),
24+
],
25+
},
26+
},
27+
async run({ $ }) {
28+
const response = await this.app.getItem({
29+
$,
30+
locale: this.locale,
31+
itemId: this.itemId,
32+
});
33+
34+
$.export("$summary", `Successfully retrieved details of item ID '${response.contentID}'`);
35+
36+
return response;
37+
},
38+
};
+70-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,76 @@
1+
import { axios } from "@pipedream/platform";
2+
import constants from "./common/constants.mjs";
3+
14
export default {
25
type: "app",
36
app: "agility_cms",
4-
propDefinitions: {},
7+
propDefinitions: {
8+
locale: {
9+
type: "string",
10+
label: "Locale",
11+
description: "The locale code you want to retrieve content for (it must already be in `Locales Settings` of your Agility account)",
12+
options: constants.LOCALE_OPTIONS,
13+
default: "en-us",
14+
},
15+
itemId: {
16+
type: "string",
17+
label: "Item ID",
18+
description: "ID of the item to get details of",
19+
async options({ locale }) {
20+
const response = await this.getItems({
21+
locale,
22+
});
23+
const itemsIds = response.items;
24+
return itemsIds.map(({
25+
contentID, properties,
26+
}) => ({
27+
value: contentID,
28+
label: properties.referenceName,
29+
}));
30+
},
31+
},
32+
},
533
methods: {
6-
// this.$auth contains connected account data
7-
authKeys() {
8-
console.log(Object.keys(this.$auth));
34+
_baseUrl() {
35+
return `${this.$auth.api_url}/${this.$auth.guid}/${this.$auth.api_type}`;
36+
},
37+
async _makeRequest(opts = {}) {
38+
const {
39+
$ = this,
40+
path,
41+
headers,
42+
...otherOpts
43+
} = opts;
44+
return axios($, {
45+
...otherOpts,
46+
url: this._baseUrl() + path,
47+
headers: {
48+
...headers,
49+
"APIKey": `${this.$auth.api_key}`,
50+
},
51+
});
52+
},
53+
async getContentModels(args = {}) {
54+
return this._makeRequest({
55+
path: "/contentmodels",
56+
...args,
57+
});
58+
},
59+
async getItems({
60+
locale, ...args
61+
}) {
62+
return this._makeRequest({
63+
path: `/${locale}/sync/items`,
64+
...args,
65+
});
66+
},
67+
async getItem({
68+
locale, itemId, ...args
69+
}) {
70+
return this._makeRequest({
71+
path: `/${locale}/item/${itemId}`,
72+
...args,
73+
});
974
},
1075
},
11-
};
76+
};

0 commit comments

Comments
 (0)