Skip to content

Commit 2de71b2

Browse files
committed
klipy init
1 parent b79cea0 commit 2de71b2

File tree

7 files changed

+462
-2
lines changed

7 files changed

+462
-2
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import klipy from "../../klipy.app.mjs";
2+
import { axios } from "@pipedream/platform";
3+
4+
export default {
5+
key: "klipy-get-clips-by-slug",
6+
name: "Get Clips by Slug",
7+
description: "Identify user-viewed content and recommend tailored content to the same user. [See the documentation]()",
8+
version: "0.0.{{ts}}",
9+
type: "action",
10+
props: {
11+
klipy,
12+
slug: {
13+
propDefinition: [
14+
klipy,
15+
"viewClipsSlug",
16+
],
17+
},
18+
customerId: {
19+
propDefinition: [
20+
klipy,
21+
"viewClipsCustomerId",
22+
],
23+
},
24+
},
25+
async run({ $ }) {
26+
// Trigger the view action for the specified slug and customer ID
27+
await this.klipy.viewClips({
28+
slug: this.slug,
29+
customer_id: this.customerId,
30+
});
31+
32+
// Retrieve tailored content recommendations based on the viewed slug and customer ID
33+
const recommendations = await this.klipy.searchClips({
34+
q: this.slug,
35+
customer_id: this.customerId,
36+
});
37+
38+
// Export a summary of the action
39+
$.export("$summary", "Successfully identified viewed content and fetched tailored recommendations.");
40+
41+
// Return the recommended clips
42+
return recommendations;
43+
},
44+
};
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import klipy from "../../klipy.app.mjs";
2+
import { axios } from "@pipedream/platform";
3+
4+
export default {
5+
key: "klipy-get-gifs-by-slug",
6+
name: "Get GIFs by Slug",
7+
description: "Identify user-viewed content and recommend tailored content to the same user. [See the documentation]()",
8+
version: "0.0.{{ts}}",
9+
type: "action",
10+
props: {
11+
klipy,
12+
slug: {
13+
propDefinition: [
14+
klipy,
15+
"viewGifsSlug",
16+
],
17+
},
18+
customerId: {
19+
propDefinition: [
20+
klipy,
21+
"viewGifsCustomerId",
22+
],
23+
},
24+
searchQuery: {
25+
propDefinition: [
26+
klipy,
27+
"searchGifsQ",
28+
],
29+
},
30+
},
31+
async run({ $ }) {
32+
// Trigger the view action for the specified GIF
33+
await this.klipy.viewGifs();
34+
35+
// Search for tailored GIFs based on the provided query
36+
const recommendations = await this.klipy.searchGifs();
37+
38+
// Export a summary of the actions performed
39+
$.export(
40+
"$summary",
41+
`Viewed GIF with slug '${this.slug}' for customer '${this.customerId}' and retrieved ${recommendations.length} recommendations.`,
42+
);
43+
44+
// Return the recommendations
45+
return recommendations;
46+
},
47+
};
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import klipy from "../../klipy.app.mjs";
2+
import { axios } from "@pipedream/platform";
3+
4+
export default {
5+
key: "klipy-get-stickers-by-slug",
6+
name: "Get Stickers By Slug",
7+
description: "Identifies user-viewed content and recommends tailored content. [See the documentation]().",
8+
version: "0.0.{{ts}}",
9+
type: "action",
10+
props: {
11+
klipy,
12+
slug: {
13+
propDefinition: [
14+
"klipy",
15+
"viewStickersSlug",
16+
],
17+
label: "Slug",
18+
description: "The slug of the sticker to identify as viewed.",
19+
},
20+
customer_id: {
21+
propDefinition: [
22+
"klipy",
23+
"viewStickersCustomerId",
24+
],
25+
label: "Customer ID",
26+
description: "A unique user identifier in your system.",
27+
},
28+
},
29+
async run({ $ }) {
30+
// Log that the user has viewed the sticker
31+
await this.klipy.viewStickers();
32+
33+
// Recommend tailored content based on the viewed sticker
34+
const recommendations = await this.klipy._makeRequest({
35+
method: "GET",
36+
path: "/api/v1/stickers/search",
37+
params: {
38+
q: this.slug,
39+
customer_id: this.customer_id,
40+
page: 1,
41+
per_page: 24,
42+
},
43+
});
44+
45+
// Export a summary for the user
46+
$.export("$summary", `Fetched ${recommendations.length} tailored sticker recommendations for customer ID ${this.customer_id}.`);
47+
48+
// Return the recommended stickers
49+
return recommendations;
50+
},
51+
};
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import klipy from "../../klipy.app.mjs";
2+
import { axios } from "@pipedream/platform";
3+
4+
export default {
5+
key: "klipy-search-clips",
6+
name: "Search Clips",
7+
description: "Search and retrieve clips from Klipy's database. [See the documentation](https://docs.klipy.com/clips-api/clips-search-api)",
8+
version: "0.0.{{ts}}",
9+
type: "action",
10+
props: {
11+
klipy,
12+
q: {
13+
propDefinition: [
14+
klipy,
15+
"searchClipsQ",
16+
],
17+
},
18+
customer_id: {
19+
propDefinition: [
20+
klipy,
21+
"searchClipsCustomerId",
22+
],
23+
},
24+
locale: {
25+
propDefinition: [
26+
klipy,
27+
"searchClipsLocale",
28+
],
29+
optional: true,
30+
},
31+
},
32+
async run({ $ }) {
33+
const clips = await this.klipy.searchClips();
34+
$.export("$summary", `Retrieved ${clips.length} clips`);
35+
return clips;
36+
},
37+
};
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import klipy from "../../klipy.app.mjs";
2+
import { axios } from "@pipedream/platform";
3+
4+
export default {
5+
key: "klipy-search-gifs",
6+
name: "Search GIFs",
7+
description: "Search and retrieve GIFs from Klipy's database. [See the documentation](https://docs.klipy.com/gifs-api/gifs-search-api)",
8+
version: "0.0.{{ts}}",
9+
type: "action",
10+
props: {
11+
klipy,
12+
q: {
13+
propDefinition: [
14+
klipy,
15+
"searchGifsQ",
16+
],
17+
},
18+
customer_id: {
19+
propDefinition: [
20+
klipy,
21+
"searchGifsCustomerId",
22+
],
23+
},
24+
locale: {
25+
propDefinition: [
26+
klipy,
27+
"searchGifsLocale",
28+
],
29+
optional: true,
30+
},
31+
},
32+
async run({ $ }) {
33+
const response = await this.klipy.searchGifs();
34+
$.export("$summary", `Successfully retrieved GIFs for query "${this.q}"`);
35+
return response;
36+
},
37+
};
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import klipy from "../../klipy.app.mjs";
2+
import { axios } from "@pipedream/platform";
3+
4+
export default {
5+
key: "klipy-search-stickers",
6+
name: "Search Stickers",
7+
description: "Search and retrieve stickers from Klipy's database. [See the documentation]().",
8+
version: "0.0.{{ts}}",
9+
type: "action",
10+
props: {
11+
klipy,
12+
q: {
13+
propDefinition: [
14+
klipy,
15+
"searchStickersQ",
16+
],
17+
},
18+
customer_id: {
19+
propDefinition: [
20+
klipy,
21+
"searchStickersCustomerId",
22+
],
23+
},
24+
locale: {
25+
propDefinition: [
26+
klipy,
27+
"searchStickersLocale",
28+
],
29+
optional: true,
30+
},
31+
},
32+
async run({ $ }) {
33+
const response = await this.klipy.searchStickers();
34+
$.export("$summary", `Retrieved stickers with query "${this.q}" and customer ID "${this.customer_id}".`);
35+
return response;
36+
},
37+
};

0 commit comments

Comments
 (0)