Skip to content

Commit c90e8e6

Browse files
committed
Added actions
1 parent 61d0151 commit c90e8e6

File tree

7 files changed

+320
-14
lines changed

7 files changed

+320
-14
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import app from "../../taggun.app.mjs";
2+
3+
export default {
4+
key: "taggun-submit-feedback",
5+
name: "Submit Feedback",
6+
description: "Add manually verified receipt data to a given receipt for feedback and training purposes. [See the documentation](https://developers.taggun.io/reference/improve-your-restuls)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
referenceId: {
12+
propDefinition: [
13+
app,
14+
"referenceId",
15+
],
16+
},
17+
totalAmount: {
18+
propDefinition: [
19+
app,
20+
"totalAmount",
21+
],
22+
},
23+
taxAmount: {
24+
propDefinition: [
25+
app,
26+
"taxAmount",
27+
],
28+
},
29+
merchantName: {
30+
propDefinition: [
31+
app,
32+
"merchantName",
33+
],
34+
},
35+
currencyCode: {
36+
propDefinition: [
37+
app,
38+
"currencyCode",
39+
],
40+
},
41+
},
42+
async run({ $ }) {
43+
const response = await this.app.submitFeedback({
44+
$,
45+
data: {
46+
referenceId: this.referenceId,
47+
totalAmount: this.totalAmount,
48+
taxAmount: this.taxAmount,
49+
merchantName: this.merchantName,
50+
currencyCode: this.currencyCode,
51+
},
52+
});
53+
$.export("$summary", "Successfully submitted feedback");
54+
return response;
55+
},
56+
};
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import app from "../../taggun.app.mjs";
2+
3+
export default {
4+
key: "taggun-url-data-extraction",
5+
name: "URL Data Extraction",
6+
description: "Provide a URL for a receipt or invoice to extract clear and basic data. [See the documentation](https://developers.taggun.io/reference/url-simple)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
url: {
12+
propDefinition: [
13+
app,
14+
"url",
15+
],
16+
},
17+
referenceId: {
18+
propDefinition: [
19+
app,
20+
"referenceId",
21+
],
22+
optional: true,
23+
},
24+
refresh: {
25+
propDefinition: [
26+
app,
27+
"refresh",
28+
],
29+
},
30+
near: {
31+
propDefinition: [
32+
app,
33+
"near",
34+
],
35+
},
36+
language: {
37+
propDefinition: [
38+
app,
39+
"language",
40+
],
41+
},
42+
incognito: {
43+
propDefinition: [
44+
app,
45+
"incognito",
46+
],
47+
},
48+
},
49+
async run({ $ }) {
50+
const response = await this.app.urlDataExtraction({
51+
$,
52+
data: {
53+
url: this.url,
54+
referenceId: this.referenceId,
55+
refresh: this.refresh,
56+
near: this.near,
57+
language: this.language,
58+
incognito: this.incognito,
59+
},
60+
});
61+
$.export("$summary", "Successfully sent the image for processing");
62+
return response;
63+
},
64+
};
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import app from "../../taggun.app.mjs";
2+
3+
export default {
4+
key: "taggun-verbose-url-data-extraction",
5+
name: "Verbose URL Data Extraction",
6+
description: "Provide a URL for a receipt or invoice to extract clear and comprehensive data. [See the documentation](https://developers.taggun.io/reference/url-verbose)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
url: {
12+
propDefinition: [
13+
app,
14+
"url",
15+
],
16+
},
17+
referenceId: {
18+
propDefinition: [
19+
app,
20+
"referenceId",
21+
],
22+
optional: true,
23+
},
24+
refresh: {
25+
propDefinition: [
26+
app,
27+
"refresh",
28+
],
29+
},
30+
near: {
31+
propDefinition: [
32+
app,
33+
"near",
34+
],
35+
},
36+
language: {
37+
propDefinition: [
38+
app,
39+
"language",
40+
],
41+
},
42+
incognito: {
43+
propDefinition: [
44+
app,
45+
"incognito",
46+
],
47+
},
48+
},
49+
async run({ $ }) {
50+
const response = await this.app.verboseUrlDataExtraction({
51+
$,
52+
data: {
53+
url: this.url,
54+
referenceId: this.referenceId,
55+
refresh: this.refresh,
56+
near: this.near,
57+
language: this.language,
58+
incognito: this.incognito,
59+
},
60+
});
61+
$.export("$summary", "Successfully sent the image for processing");
62+
return response;
63+
},
64+
};
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
export default {
2+
LANGUAGE_OPTIONS: [
3+
"en",
4+
"es",
5+
"fr",
6+
"jp",
7+
"he",
8+
"iw",
9+
"et",
10+
"lv",
11+
"lt",
12+
"fi",
13+
"el",
14+
"zh",
15+
"th",
16+
],
17+
};

components/taggun/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,8 @@
1111
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
1212
"publishConfig": {
1313
"access": "public"
14+
},
15+
"dependencies": {
16+
"@pipedream/platform": "^3.1.0"
1417
}
1518
}

components/taggun/taggun.app.mjs

Lines changed: 105 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,111 @@
1+
import { axios } from "@pipedream/platform";
2+
import constants from "./common/constants.mjs";
3+
14
export default {
25
type: "app",
36
app: "taggun",
4-
propDefinitions: {},
7+
propDefinitions: {
8+
url: {
9+
type: "string",
10+
label: "URL",
11+
description: "Image URL to process",
12+
},
13+
referenceId: {
14+
type: "string",
15+
label: "Reference ID",
16+
description: "Custom reference ID for tracking the request",
17+
},
18+
refresh: {
19+
type: "boolean",
20+
label: "Refresh",
21+
description: "Force reprocessing of the image instead of using cached results",
22+
optional: true,
23+
},
24+
near: {
25+
type: "string",
26+
label: "Near",
27+
description: "Provide a nearby location to improve result accuracy",
28+
optional: true,
29+
},
30+
language: {
31+
type: "string",
32+
label: "Language",
33+
description: "Preferred language for extracted text",
34+
options: constants.LANGUAGE_OPTIONS,
35+
optional: true,
36+
},
37+
incognito: {
38+
type: "boolean",
39+
label: "Incognito",
40+
description: "Do not store or use the image for system training",
41+
optional: true,
42+
},
43+
totalAmount: {
44+
type: "string",
45+
label: "Total Amount",
46+
description: "The expected total amount from the user",
47+
optional: true,
48+
},
49+
taxAmount: {
50+
type: "string",
51+
label: "Tax Amount",
52+
description: "The expected tax amount from the user",
53+
optional: true,
54+
},
55+
merchantName: {
56+
type: "string",
57+
label: "Merchant Name",
58+
description: "The expected merchant name from the user",
59+
optional: true,
60+
},
61+
currencyCode: {
62+
type: "string",
63+
label: "Currency Code",
64+
description: "The expected currency code from the user.",
65+
optional: true,
66+
},
67+
},
568
methods: {
6-
// this.$auth contains connected account data
7-
authKeys() {
8-
console.log(Object.keys(this.$auth));
69+
_baseUrl() {
70+
return "https://api.taggun.io/api";
71+
},
72+
async _makeRequest(opts = {}) {
73+
const {
74+
$ = this,
75+
path,
76+
headers,
77+
...otherOpts
78+
} = opts;
79+
return axios($, {
80+
...otherOpts,
81+
url: this._baseUrl() + path,
82+
headers: {
83+
"apikey": `${this.$auth.api_key}`,
84+
"Content-Type": "application/json",
85+
...headers,
86+
},
87+
});
88+
},
89+
async urlDataExtraction(args = {}) {
90+
return this._makeRequest({
91+
path: "/receipt/v1/simple/url",
92+
method: "post",
93+
...args,
94+
});
95+
},
96+
async submitFeedback(args = {}) {
97+
return this._makeRequest({
98+
path: "/account/v1/feedback",
99+
method: "post",
100+
...args,
101+
});
102+
},
103+
async verboseUrlDataExtraction(args = {}) {
104+
return this._makeRequest({
105+
path: "/receipt/v1/verbose/url",
106+
method: "post",
107+
...args,
108+
});
9109
},
10110
},
11-
};
111+
};

pnpm-lock.yaml

Lines changed: 11 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)