File tree Expand file tree Collapse file tree 12 files changed +291
-6
lines changed Expand file tree Collapse file tree 12 files changed +291
-6
lines changed Original file line number Diff line number Diff line change
1
+ import klipy from "../../klipy.app.mjs" ;
2
+
3
+ export default {
4
+ props : {
5
+ klipy,
6
+ customerId : {
7
+ propDefinition : [
8
+ klipy ,
9
+ "customerId" ,
10
+ ] ,
11
+ } ,
12
+ } ,
13
+ async run ( { $ } ) {
14
+ const model = this . getModel ( ) ;
15
+ const response = await this . klipy . search ( {
16
+ $,
17
+ model,
18
+ slug : this . slug ,
19
+ data : {
20
+ customer_id : this . customerId ,
21
+ } ,
22
+ } ) ;
23
+
24
+ $ . export ( "$summary" , `Successfully fetched ${ model } .` ) ;
25
+ return response ;
26
+ } ,
27
+ } ;
Original file line number Diff line number Diff line change
1
+ import { LIMIT } from "../../common/constants.mjs" ;
2
+ import klipy from "../../klipy.app.mjs" ;
3
+
4
+ export default {
5
+ props : {
6
+ klipy,
7
+ locale : {
8
+ propDefinition : [
9
+ klipy ,
10
+ "locale" ,
11
+ ] ,
12
+ optional : true ,
13
+ } ,
14
+ page : {
15
+ propDefinition : [
16
+ klipy ,
17
+ "page" ,
18
+ ] ,
19
+ } ,
20
+ } ,
21
+ async run ( { $ } ) {
22
+ const model = this . getModel ( ) ;
23
+ const response = await this . klipy . search ( {
24
+ $,
25
+ model,
26
+ data : {
27
+ q : this . q ,
28
+ customer_id : this . customer_id ,
29
+ locale : this . locale ,
30
+ page : this . page ,
31
+ per_page : LIMIT ,
32
+ } ,
33
+ } ) ;
34
+ $ . export ( "$summary" , `Retrieved ${ response . data . data . length } ${ model } ` ) ;
35
+ return response ;
36
+ } ,
37
+ } ;
Original file line number Diff line number Diff line change
1
+ import common from "../common/base-get-by-slug.mjs" ;
2
+
3
+ export default {
4
+ ...common ,
5
+ key : "klipy-get-clip-by-slug" ,
6
+ name : "Get Clip by Slug" ,
7
+ description : "Get a specific Clip idendified by its slug. [See the documentation](https://docs.klipy.com/clips-api/clips-search-api)" ,
8
+ version : "0.0.1" ,
9
+ type : "action" ,
10
+ props : {
11
+ ...common . props ,
12
+ slug : {
13
+ propDefinition : [
14
+ common . props . klipy ,
15
+ "slug" ,
16
+ ] ,
17
+ } ,
18
+ } ,
19
+ methods : {
20
+ getModel ( ) {
21
+ return "clips" ;
22
+ } ,
23
+ } ,
24
+ } ;
Original file line number Diff line number Diff line change
1
+ import common from "../common/base-get-by-slug.mjs" ;
2
+
3
+ export default {
4
+ ...common ,
5
+ key : "klipy-get-gif-by-slug" ,
6
+ name : "Get GIF by Slug" ,
7
+ description : "Get a specific GIF idendified by its slug. [See the documentation](https://docs.klipy.com/gifs-api/gifs-search-api)" ,
8
+ version : "0.0.1" ,
9
+ type : "action" ,
10
+ props : {
11
+ ...common . props ,
12
+ slug : {
13
+ propDefinition : [
14
+ common . props . klipy ,
15
+ "slug" ,
16
+ ] ,
17
+ description : "The slug of the GIF." ,
18
+ } ,
19
+ } ,
20
+ methods : {
21
+ getModel ( ) {
22
+ return "gifs" ;
23
+ } ,
24
+ } ,
25
+ } ;
Original file line number Diff line number Diff line change
1
+ import common from "../common/base-get-by-slug.mjs" ;
2
+
3
+ export default {
4
+ ...common ,
5
+ key : "klipy-get-sticker-by-slug" ,
6
+ name : "Get Sticker By Slug" ,
7
+ description : "Get a specific Sticker idendified by its slug. [See the documentation](https://docs.klipy.com/stickers-api/stickers-search-api)." ,
8
+ version : "0.0.1" ,
9
+ type : "action" ,
10
+ props : {
11
+ ...common . props ,
12
+ slug : {
13
+ propDefinition : [
14
+ common . props . klipy ,
15
+ "slug" ,
16
+ ] ,
17
+ description : "The slug of the sticker." ,
18
+ } ,
19
+ } ,
20
+ methods : {
21
+ getModel ( ) {
22
+ return "stickers" ;
23
+ } ,
24
+ } ,
25
+ } ;
Original file line number Diff line number Diff line change
1
+ import common from "../common/base-search.mjs" ;
2
+
3
+ export default {
4
+ ...common ,
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.1" ,
9
+ type : "action" ,
10
+ props : {
11
+ ...common . props ,
12
+ q : {
13
+ propDefinition : [
14
+ common . props . klipy ,
15
+ "q" ,
16
+ ] ,
17
+ } ,
18
+ customer_id : {
19
+ propDefinition : [
20
+ common . props . klipy ,
21
+ "customerId" ,
22
+ ] ,
23
+ } ,
24
+ } ,
25
+ methods : {
26
+ getModel ( ) {
27
+ return "clips" ;
28
+ } ,
29
+ } ,
30
+ } ;
Original file line number Diff line number Diff line change
1
+ import common from "../common/base-search.mjs" ;
2
+
3
+ export default {
4
+ ...common ,
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.1" ,
9
+ type : "action" ,
10
+ props : {
11
+ ...common . props ,
12
+ q : {
13
+ propDefinition : [
14
+ common . props . klipy ,
15
+ "q" ,
16
+ ] ,
17
+ description : "The search keyword for finding relevant GIFs." ,
18
+ } ,
19
+ customer_id : {
20
+ propDefinition : [
21
+ common . props . klipy ,
22
+ "customerId" ,
23
+ ] ,
24
+ description : "A unique user identifier in your system for GIFs." ,
25
+ } ,
26
+ } ,
27
+ methods : {
28
+ getModel ( ) {
29
+ return "gifs" ;
30
+ } ,
31
+ } ,
32
+ } ;
Original file line number Diff line number Diff line change
1
+ import common from "../common/base-search.mjs" ;
2
+
3
+ export default {
4
+ ...common ,
5
+ key : "klipy-search-stickers" ,
6
+ name : "Search Stickers" ,
7
+ description : "Search and retrieve stickers from Klipy's database. [See the documentation](https://docs.klipy.com/stickers-api/stickers-search-api)." ,
8
+ version : "0.0.1" ,
9
+ type : "action" ,
10
+ props : {
11
+ ...common . props ,
12
+ q : {
13
+ propDefinition : [
14
+ common . props . klipy ,
15
+ "q" ,
16
+ ] ,
17
+ description : "The search keyword for finding relevant stickers." ,
18
+ } ,
19
+ customer_id : {
20
+ propDefinition : [
21
+ common . props . klipy ,
22
+ "customerId" ,
23
+ ] ,
24
+ description : "A unique user identifier in your system for stickers." ,
25
+ } ,
26
+ } ,
27
+ methods : {
28
+ getModel ( ) {
29
+ return "stickers" ;
30
+ } ,
31
+ } ,
32
+ } ;
Original file line number Diff line number Diff line change
1
+ export const LIMIT = 50 ;
Original file line number Diff line number Diff line change
1
+ import { axios } from "@pipedream/platform" ;
2
+
1
3
export default {
2
4
type : "app" ,
3
5
app : "klipy" ,
4
- propDefinitions : { } ,
6
+ propDefinitions : {
7
+ q : {
8
+ type : "string" ,
9
+ label : "Search Query" ,
10
+ description : "The search keyword for finding relevant clips." ,
11
+ } ,
12
+ customerId : {
13
+ type : "string" ,
14
+ label : "Customer ID" ,
15
+ description : "A unique user identifier in your system for clips." ,
16
+ } ,
17
+ locale : {
18
+ type : "string" ,
19
+ label : "Locale" ,
20
+ description : "Country code / language of the customer (ISO 3166 Alpha-2)" ,
21
+ optional : true ,
22
+ } ,
23
+ page : {
24
+ type : "integer" ,
25
+ label : "Page" ,
26
+ description : "The requested page number." ,
27
+ default : 1 ,
28
+ } ,
29
+ slug : {
30
+ type : "string" ,
31
+ label : "Slug" ,
32
+ description : "The slug of the clip." ,
33
+ } ,
34
+ } ,
5
35
methods : {
6
- // this.$auth contains connected account data
7
- authKeys ( ) {
8
- console . log ( Object . keys ( this . $auth ) ) ;
36
+ _baseUrl ( ) {
37
+ return `https://api.klipy.co/api/v1/${ this . $auth . app_key } ` ;
38
+ } ,
39
+ _makeRequest ( {
40
+ $ = this , path, ...opts
41
+ } ) {
42
+ return axios ( $ , {
43
+ url : this . _baseUrl ( ) + path ,
44
+ ...opts ,
45
+ } ) ;
46
+ } ,
47
+ search ( {
48
+ model, slug = "search" , ...opts
49
+ } ) {
50
+ return this . _makeRequest ( {
51
+ path : `/${ model } /${ slug } ` ,
52
+ ...opts ,
53
+ } ) ;
9
54
} ,
10
55
} ,
11
56
} ;
You can’t perform that action at this time.
0 commit comments