@ptkl/sdk 1.0.3 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.0.10.js +453 -135
- package/dist/index.0.9.js +135 -8
- package/dist/package.json +1 -1
- package/dist/v0.10/api/component.d.ts +152 -20
- package/dist/v0.10/api/functions.d.ts +1 -2
- package/dist/v0.10/api/index.d.ts +4 -2
- package/dist/v0.10/api/integrations/dms.d.ts +0 -9
- package/dist/v0.10/api/integrations/mail.d.ts +125 -0
- package/dist/v0.10/api/integrations/serbia/minfin/index.d.ts +10 -0
- package/dist/v0.10/api/integrations/serbia/minfin/vpfr.d.ts +4 -0
- package/dist/v0.10/api/integrations/serbia/nbs/index.d.ts +10 -0
- package/dist/v0.10/api/integrations/serbiaUtil.d.ts +9 -7
- package/dist/v0.10/api/integrations.d.ts +6 -3
- package/dist/v0.10/api/platform.d.ts +2 -2
- package/dist/v0.10/api/platformBaseClient.d.ts +0 -1
- package/dist/v0.10/api/project.d.ts +6 -1
- package/dist/v0.10/index.cjs.js +453 -135
- package/dist/v0.10/index.esm.js +451 -135
- package/dist/v0.10/types/component.d.ts +73 -3
- package/dist/v0.10/types/integrations/mail.d.ts +156 -0
- package/dist/v0.10/types/integrations/minimax.d.ts +961 -0
- package/dist/v0.10/types/integrations/payments.d.ts +48 -0
- package/dist/v0.10/types/integrations/serbiaUtils.d.ts +40 -0
- package/dist/v0.10/types/integrations/serbiaUtits.d.ts +37 -0
- package/dist/v0.9/api/functions.d.ts +1 -2
- package/dist/v0.9/api/index.d.ts +1 -0
- package/dist/v0.9/api/integrations/mail.d.ts +69 -0
- package/dist/v0.9/api/integrations/serbiaUtil.d.ts +10 -7
- package/dist/v0.9/api/integrations.d.ts +2 -0
- package/dist/v0.9/api/platformBaseClient.d.ts +0 -1
- package/dist/v0.9/api/project.d.ts +6 -1
- package/dist/v0.9/api/roles.d.ts +12 -0
- package/dist/v0.9/index.cjs.js +135 -8
- package/dist/v0.9/index.esm.js +135 -9
- package/dist/v0.9/types/integrations/mail.d.ts +155 -0
- package/dist/v0.9/types/integrations/minimax.d.ts +961 -0
- package/dist/v0.9/types/integrations/payments.d.ts +48 -0
- package/dist/v0.9/types/integrations/serbiaUtits.d.ts +40 -0
- package/dist/v0.9/types/integrations.d.ts +0 -12
- package/package.json +1 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
type PaymentProvider = "monri";
|
|
2
|
+
type Transaction = {
|
|
3
|
+
id: string;
|
|
4
|
+
provider: PaymentProvider;
|
|
5
|
+
transactionId: string;
|
|
6
|
+
userId: string;
|
|
7
|
+
amount: number;
|
|
8
|
+
precision: number;
|
|
9
|
+
currency: string;
|
|
10
|
+
status: "pending" | "completed" | "failed" | "refunded" | "voided" | "deactivated" | "expired";
|
|
11
|
+
description: string;
|
|
12
|
+
paymentLink: string | null;
|
|
13
|
+
tokenizedPanEnc?: string;
|
|
14
|
+
tokenizedPan?: string;
|
|
15
|
+
formattedAmount?: string;
|
|
16
|
+
autoRefund: boolean;
|
|
17
|
+
redirectUrl: string | null;
|
|
18
|
+
metadata: {
|
|
19
|
+
lang?: "en" | "es" | "ba" | "hr";
|
|
20
|
+
items?: {
|
|
21
|
+
itemId?: string;
|
|
22
|
+
name: string;
|
|
23
|
+
pricePerUnit?: number;
|
|
24
|
+
quantity?: number;
|
|
25
|
+
price: number;
|
|
26
|
+
}[];
|
|
27
|
+
};
|
|
28
|
+
logs: {
|
|
29
|
+
timestamp: string;
|
|
30
|
+
status: string;
|
|
31
|
+
details?: any;
|
|
32
|
+
}[];
|
|
33
|
+
expiresAt: string | null;
|
|
34
|
+
createdAt: string;
|
|
35
|
+
updatedAt: string;
|
|
36
|
+
};
|
|
37
|
+
type PaymentAmount = {
|
|
38
|
+
totalAmount: string;
|
|
39
|
+
} | {
|
|
40
|
+
items: {
|
|
41
|
+
itemId?: string;
|
|
42
|
+
name: string;
|
|
43
|
+
pricePerUnit?: number;
|
|
44
|
+
quantity?: number;
|
|
45
|
+
price: number;
|
|
46
|
+
}[];
|
|
47
|
+
};
|
|
48
|
+
export type { PaymentProvider, PaymentAmount, Transaction };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export interface GenerateIPSQrCodeRequest {
|
|
2
|
+
TransactionType: string;
|
|
3
|
+
Version: string;
|
|
4
|
+
CharacterSet: string;
|
|
5
|
+
RecipientAccountNumber: string;
|
|
6
|
+
RecipientName: string;
|
|
7
|
+
AmountInLocalCurrency: string;
|
|
8
|
+
PaymentPurposeCode: string;
|
|
9
|
+
PurposeOfPayment?: string;
|
|
10
|
+
PaymentOrderNumber?: string;
|
|
11
|
+
PayerInformation?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ValidateIPSQrCodeRequest {
|
|
14
|
+
QRCodeString: string;
|
|
15
|
+
}
|
|
16
|
+
export interface IPSQrCodeResponse {
|
|
17
|
+
Status: {
|
|
18
|
+
StatusCode: number;
|
|
19
|
+
StatusDescription: string;
|
|
20
|
+
};
|
|
21
|
+
OriginalQRCodeString?: string;
|
|
22
|
+
ParsedData?: GenerateIPSQrCodeRequest;
|
|
23
|
+
Base64EncodedImage?: string;
|
|
24
|
+
Errors?: string[];
|
|
25
|
+
}
|
|
26
|
+
export type NbsIpsQrCode = {
|
|
27
|
+
TransactionType: string;
|
|
28
|
+
Version: string;
|
|
29
|
+
CharacterSet: string;
|
|
30
|
+
RecipientAccountNumber: string;
|
|
31
|
+
RecipientName: string;
|
|
32
|
+
AmountInLocalCurrency: string;
|
|
33
|
+
PayerInformation: string;
|
|
34
|
+
PaymentPurposeCode: string;
|
|
35
|
+
PurposeOfPayment: string;
|
|
36
|
+
PaymentOrderNumber: string;
|
|
37
|
+
};
|
|
38
|
+
export type NBSSearchParams = {
|
|
39
|
+
vatNumber: string;
|
|
40
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export interface GenerateIPSQrCodeRequest {
|
|
2
|
+
TransactionType: string;
|
|
3
|
+
Version: string;
|
|
4
|
+
CharacterSet: string;
|
|
5
|
+
RecipientAccountNumber: string;
|
|
6
|
+
RecipientName: string;
|
|
7
|
+
AmountInLocalCurrency: string;
|
|
8
|
+
PaymentPurposeCode: string;
|
|
9
|
+
PurposeOfPayment?: string;
|
|
10
|
+
PaymentOrderNumber?: string;
|
|
11
|
+
PayerInformation?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ValidateIPSQrCodeRequest {
|
|
14
|
+
QRCodeString: string;
|
|
15
|
+
}
|
|
16
|
+
export interface IPSQrCodeResponse {
|
|
17
|
+
Status: {
|
|
18
|
+
StatusCode: number;
|
|
19
|
+
StatusDescription: string;
|
|
20
|
+
};
|
|
21
|
+
OriginalQRCodeString?: string;
|
|
22
|
+
ParsedData?: GenerateIPSQrCodeRequest;
|
|
23
|
+
Base64EncodedImage?: string;
|
|
24
|
+
Errors?: string[];
|
|
25
|
+
}
|
|
26
|
+
export type NbsIpsQrCode = {
|
|
27
|
+
TransactionType: string;
|
|
28
|
+
Version: string;
|
|
29
|
+
CharacterSet: string;
|
|
30
|
+
RecipientAccountNumber: string;
|
|
31
|
+
RecipientName: string;
|
|
32
|
+
AmountInLocalCurrency: string;
|
|
33
|
+
PayerInformation: string;
|
|
34
|
+
PaymentPurposeCode: string;
|
|
35
|
+
PurposeOfPayment: string;
|
|
36
|
+
PaymentOrderNumber: string;
|
|
37
|
+
};
|
|
@@ -7,8 +7,7 @@ export default class Functions extends PlatformBaseClient {
|
|
|
7
7
|
* Run platform function
|
|
8
8
|
*
|
|
9
9
|
* @param id - Function ID
|
|
10
|
-
* @param
|
|
11
|
-
* @param query - Query parameters
|
|
10
|
+
* @param d - Object containing input data, query parameters, and headers
|
|
12
11
|
* @returns - Function result
|
|
13
12
|
*
|
|
14
13
|
* @example
|
package/dist/v0.9/api/index.d.ts
CHANGED
|
@@ -20,5 +20,6 @@ export { default as Invoicing } from './integrations/invoicing';
|
|
|
20
20
|
export { default as DMS } from './integrations/dms';
|
|
21
21
|
export { default as SerbiaUtil } from './integrations/serbiaUtil';
|
|
22
22
|
export { default as VPFR } from './integrations/vpfr';
|
|
23
|
+
export { default as Mail } from './integrations/mail';
|
|
23
24
|
import Platfrom from './platform';
|
|
24
25
|
export default Platfrom;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import IntegrationsBaseClient from "../integrationsBaseClient";
|
|
2
|
+
import { SendEmailRequest, SendEmailResponse, MailLog, EmailListResponse, ListEmailsParams, AttachmentMeta } from "../../types/integrations/mail";
|
|
3
|
+
/**
|
|
4
|
+
* SDK client for the Protokol Mail integration.
|
|
5
|
+
*
|
|
6
|
+
* Provides methods to send emails, list email logs, resend failed emails,
|
|
7
|
+
* and manage attachments through the Protokol Mail API.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { Mail } from "@ptkl/sdk"
|
|
12
|
+
*
|
|
13
|
+
* const mail = new Mail()
|
|
14
|
+
*
|
|
15
|
+
* // Send an email
|
|
16
|
+
* const result = await mail.send({
|
|
17
|
+
* to: ["user@example.com"],
|
|
18
|
+
* subject: "Hello",
|
|
19
|
+
* body: "<h1>Welcome!</h1>"
|
|
20
|
+
* })
|
|
21
|
+
*
|
|
22
|
+
* console.log(result.message_id)
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export default class Mail extends IntegrationsBaseClient {
|
|
26
|
+
/**
|
|
27
|
+
* Send an email. The email is queued for async delivery.
|
|
28
|
+
*
|
|
29
|
+
* @param input - The email content and recipients
|
|
30
|
+
* @returns The queued email's message ID and status
|
|
31
|
+
*/
|
|
32
|
+
send(input: SendEmailRequest): Promise<SendEmailResponse>;
|
|
33
|
+
/**
|
|
34
|
+
* List emails for the current project with optional filtering and pagination.
|
|
35
|
+
*
|
|
36
|
+
* @param params - Optional query parameters for filtering and pagination
|
|
37
|
+
* @returns Paginated list of email log entries
|
|
38
|
+
*/
|
|
39
|
+
list(params?: ListEmailsParams): Promise<EmailListResponse>;
|
|
40
|
+
/**
|
|
41
|
+
* Get a single email by its message ID.
|
|
42
|
+
*
|
|
43
|
+
* @param messageId - The UUID of the email message
|
|
44
|
+
* @returns The full email log entry
|
|
45
|
+
*/
|
|
46
|
+
get(messageId: string): Promise<MailLog>;
|
|
47
|
+
/**
|
|
48
|
+
* Resend a previously failed email.
|
|
49
|
+
*
|
|
50
|
+
* @param messageId - The UUID of the email to resend
|
|
51
|
+
* @returns Confirmation with the message ID
|
|
52
|
+
*/
|
|
53
|
+
resend(messageId: string): Promise<SendEmailResponse>;
|
|
54
|
+
/**
|
|
55
|
+
* List attachment metadata for a specific email.
|
|
56
|
+
*
|
|
57
|
+
* @param messageId - The UUID of the email message
|
|
58
|
+
* @returns Array of attachment metadata entries
|
|
59
|
+
*/
|
|
60
|
+
listAttachments(messageId: string): Promise<AttachmentMeta[]>;
|
|
61
|
+
/**
|
|
62
|
+
* Download an attachment's binary content.
|
|
63
|
+
*
|
|
64
|
+
* @param messageId - The UUID of the email message
|
|
65
|
+
* @param attachmentId - The UUID of the attachment
|
|
66
|
+
* @returns The raw binary data as an ArrayBuffer
|
|
67
|
+
*/
|
|
68
|
+
downloadAttachment(messageId: string, attachmentId: string): Promise<ArrayBuffer>;
|
|
69
|
+
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import IntegrationsBaseClient from "../integrationsBaseClient";
|
|
2
|
-
import { NbsIpsQrCode } from "../../types/integrations";
|
|
2
|
+
import { NbsIpsQrCode, NBSSearchParams, IPSQrCodeResponse } from "../../types/integrations/serbiaUtits";
|
|
3
|
+
import { AxiosResponse } from "axios";
|
|
3
4
|
export default class SerbiaUtil extends IntegrationsBaseClient {
|
|
4
|
-
nbsSearch(params:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
nbsSearch(params: NBSSearchParams): Promise<AxiosResponse<any, any>>;
|
|
6
|
+
getNbsIpsQrCode(code: NbsIpsQrCode, size: number, lang?: string): Promise<AxiosResponse<IPSQrCodeResponse>>;
|
|
7
|
+
validateNbsIpsQrCode(qrCodeString: string, lang?: string): Promise<AxiosResponse<IPSQrCodeResponse>>;
|
|
8
|
+
getReceiptFromUrl(url: string, source: string): Promise<AxiosResponse<any, any>>;
|
|
9
|
+
getReceiptFromQrCode(qrCodeImage: string, source: string): Promise<AxiosResponse<any, any>>;
|
|
10
|
+
getContoList(): Promise<AxiosResponse<any, any>>;
|
|
11
|
+
private services;
|
|
12
|
+
request(method: string, endpoint: string, params: any): Promise<AxiosResponse<any, any>>;
|
|
10
13
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Invoicing from "./integrations/invoicing";
|
|
2
2
|
import DMS from "./integrations/dms";
|
|
3
|
+
import Mail from "./integrations/mail";
|
|
3
4
|
import VPFR from "./integrations/vpfr";
|
|
4
5
|
import IntegrationsBaseClient from "./integrationsBaseClient";
|
|
5
6
|
import Payments from "./integrations/payments";
|
|
@@ -15,6 +16,7 @@ export default class Integrations extends IntegrationsBaseClient {
|
|
|
15
16
|
getDMS(): DMS;
|
|
16
17
|
getVPFR(): VPFR;
|
|
17
18
|
getInvoicing(): Invoicing;
|
|
19
|
+
getMail(): Mail;
|
|
18
20
|
getPayments(): Payments;
|
|
19
21
|
getMinimax(): Minimax;
|
|
20
22
|
isInstalled(id: string): Promise<boolean>;
|
|
@@ -24,7 +24,7 @@ export default class Project extends PlatformBaseClient {
|
|
|
24
24
|
archive(): Promise<AxiosResponse<any>>;
|
|
25
25
|
/**
|
|
26
26
|
* Invite a user to the project
|
|
27
|
-
* @param
|
|
27
|
+
* @param emails Array of emails
|
|
28
28
|
* @param roles Array of role UUIDs
|
|
29
29
|
*/
|
|
30
30
|
invite(emails: string[], roles: string[]): Promise<AxiosResponse<any>>;
|
|
@@ -42,6 +42,11 @@ export default class Project extends PlatformBaseClient {
|
|
|
42
42
|
* @param uuid Invite UUID
|
|
43
43
|
*/
|
|
44
44
|
acceptInvite(uuid: string): Promise<AxiosResponse<any>>;
|
|
45
|
+
/**
|
|
46
|
+
* Revoke an invite
|
|
47
|
+
* @param uuid Invite UUID
|
|
48
|
+
*/
|
|
49
|
+
revokeInvite(uuid: string): Promise<AxiosResponse<any>>;
|
|
45
50
|
/**
|
|
46
51
|
* Register through an invite
|
|
47
52
|
* @param uuid Invite UUID
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import BaseClient from "./baseClient";
|
|
2
|
+
/**
|
|
3
|
+
* Deprecation notice: The Roles API is deprecated and will be removed in future versions.
|
|
4
|
+
* Please use the Users API for role and permission management.
|
|
5
|
+
*/
|
|
6
|
+
export default class Roles extends BaseClient {
|
|
7
|
+
create(role: any): Promise<any>;
|
|
8
|
+
delete(uuid: string): Promise<any>;
|
|
9
|
+
list(): Promise<any>;
|
|
10
|
+
listPermissions(): Promise<any>;
|
|
11
|
+
edit(permissions: string[], workspaces: string[], level: number, uuid: string): Promise<any>;
|
|
12
|
+
}
|
package/dist/v0.9/index.cjs.js
CHANGED
|
@@ -18993,7 +18993,6 @@ const isSandbox = typeof window !== "undefined";
|
|
|
18993
18993
|
*
|
|
18994
18994
|
* @class PlatformBaseClient
|
|
18995
18995
|
* @extends BaseClient
|
|
18996
|
-
* @constructor
|
|
18997
18996
|
* @param {AxiosInstance} [client] - The axios instance to use for the client
|
|
18998
18997
|
*
|
|
18999
18998
|
* @example
|
|
@@ -19025,7 +19024,7 @@ class PlatformBaseClient extends BaseClient {
|
|
|
19025
19024
|
}
|
|
19026
19025
|
}
|
|
19027
19026
|
}
|
|
19028
|
-
|
|
19027
|
+
if (isNode) {
|
|
19029
19028
|
host = (_d = host !== null && host !== void 0 ? host : process.env.API_HOST) !== null && _d !== void 0 ? _d : null;
|
|
19030
19029
|
env = (_e = env !== null && env !== void 0 ? env : process.env.PROJECT_ENV) !== null && _e !== void 0 ? _e : null;
|
|
19031
19030
|
token = (_f = token !== null && token !== void 0 ? token : process.env.PROJECT_API_TOKEN) !== null && _f !== void 0 ? _f : null;
|
|
@@ -19443,8 +19442,7 @@ class Functions extends PlatformBaseClient {
|
|
|
19443
19442
|
* Run platform function
|
|
19444
19443
|
*
|
|
19445
19444
|
* @param id - Function ID
|
|
19446
|
-
* @param
|
|
19447
|
-
* @param query - Query parameters
|
|
19445
|
+
* @param d - Object containing input data, query parameters, and headers
|
|
19448
19446
|
* @returns - Function result
|
|
19449
19447
|
*
|
|
19450
19448
|
* @example
|
|
@@ -19959,7 +19957,7 @@ class Project extends PlatformBaseClient {
|
|
|
19959
19957
|
}
|
|
19960
19958
|
/**
|
|
19961
19959
|
* Invite a user to the project
|
|
19962
|
-
* @param
|
|
19960
|
+
* @param emails Array of emails
|
|
19963
19961
|
* @param roles Array of role UUIDs
|
|
19964
19962
|
*/
|
|
19965
19963
|
async invite(emails, roles) {
|
|
@@ -19985,6 +19983,13 @@ class Project extends PlatformBaseClient {
|
|
|
19985
19983
|
async acceptInvite(uuid) {
|
|
19986
19984
|
return await this.client.get(`/v1/project/invite/accept/${uuid}`);
|
|
19987
19985
|
}
|
|
19986
|
+
/**
|
|
19987
|
+
* Revoke an invite
|
|
19988
|
+
* @param uuid Invite UUID
|
|
19989
|
+
*/
|
|
19990
|
+
async revokeInvite(uuid) {
|
|
19991
|
+
return await this.client.delete(`/v1/project/invite/${uuid}`);
|
|
19992
|
+
}
|
|
19988
19993
|
/**
|
|
19989
19994
|
* Register through an invite
|
|
19990
19995
|
* @param uuid Invite UUID
|
|
@@ -20224,7 +20229,7 @@ class IntegrationsBaseClient extends BaseClient {
|
|
|
20224
20229
|
}
|
|
20225
20230
|
}
|
|
20226
20231
|
}
|
|
20227
|
-
|
|
20232
|
+
if (isNode) {
|
|
20228
20233
|
host = (_d = host !== null && host !== void 0 ? host : process.env.INTEGRATION_API) !== null && _d !== void 0 ? _d : null;
|
|
20229
20234
|
env = (_e = env !== null && env !== void 0 ? env : process.env.PROJECT_ENV) !== null && _e !== void 0 ? _e : null;
|
|
20230
20235
|
token = (_f = token !== null && token !== void 0 ? token : process.env.PROJECT_API_TOKEN) !== null && _f !== void 0 ? _f : null;
|
|
@@ -20921,18 +20926,135 @@ class DMS extends IntegrationsBaseClient {
|
|
|
20921
20926
|
}
|
|
20922
20927
|
}
|
|
20923
20928
|
|
|
20929
|
+
/**
|
|
20930
|
+
* SDK client for the Protokol Mail integration.
|
|
20931
|
+
*
|
|
20932
|
+
* Provides methods to send emails, list email logs, resend failed emails,
|
|
20933
|
+
* and manage attachments through the Protokol Mail API.
|
|
20934
|
+
*
|
|
20935
|
+
* @example
|
|
20936
|
+
* ```typescript
|
|
20937
|
+
* import { Mail } from "@ptkl/sdk"
|
|
20938
|
+
*
|
|
20939
|
+
* const mail = new Mail()
|
|
20940
|
+
*
|
|
20941
|
+
* // Send an email
|
|
20942
|
+
* const result = await mail.send({
|
|
20943
|
+
* to: ["user@example.com"],
|
|
20944
|
+
* subject: "Hello",
|
|
20945
|
+
* body: "<h1>Welcome!</h1>"
|
|
20946
|
+
* })
|
|
20947
|
+
*
|
|
20948
|
+
* console.log(result.message_id)
|
|
20949
|
+
* ```
|
|
20950
|
+
*/
|
|
20951
|
+
class Mail extends IntegrationsBaseClient {
|
|
20952
|
+
/**
|
|
20953
|
+
* Send an email. The email is queued for async delivery.
|
|
20954
|
+
*
|
|
20955
|
+
* @param input - The email content and recipients
|
|
20956
|
+
* @returns The queued email's message ID and status
|
|
20957
|
+
*/
|
|
20958
|
+
async send(input) {
|
|
20959
|
+
const { data } = await this.client.post("/protokol-mail/v1/emails", input);
|
|
20960
|
+
return data;
|
|
20961
|
+
}
|
|
20962
|
+
/**
|
|
20963
|
+
* List emails for the current project with optional filtering and pagination.
|
|
20964
|
+
*
|
|
20965
|
+
* @param params - Optional query parameters for filtering and pagination
|
|
20966
|
+
* @returns Paginated list of email log entries
|
|
20967
|
+
*/
|
|
20968
|
+
async list(params) {
|
|
20969
|
+
const { data } = await this.client.get("/protokol-mail/v1/emails", { params });
|
|
20970
|
+
return data;
|
|
20971
|
+
}
|
|
20972
|
+
/**
|
|
20973
|
+
* Get a single email by its message ID.
|
|
20974
|
+
*
|
|
20975
|
+
* @param messageId - The UUID of the email message
|
|
20976
|
+
* @returns The full email log entry
|
|
20977
|
+
*/
|
|
20978
|
+
async get(messageId) {
|
|
20979
|
+
const { data } = await this.client.get(`/protokol-mail/v1/emails/${messageId}`);
|
|
20980
|
+
return data;
|
|
20981
|
+
}
|
|
20982
|
+
/**
|
|
20983
|
+
* Resend a previously failed email.
|
|
20984
|
+
*
|
|
20985
|
+
* @param messageId - The UUID of the email to resend
|
|
20986
|
+
* @returns Confirmation with the message ID
|
|
20987
|
+
*/
|
|
20988
|
+
async resend(messageId) {
|
|
20989
|
+
const { data } = await this.client.post(`/protokol-mail/v1/emails/${messageId}/resend`);
|
|
20990
|
+
return data;
|
|
20991
|
+
}
|
|
20992
|
+
/**
|
|
20993
|
+
* List attachment metadata for a specific email.
|
|
20994
|
+
*
|
|
20995
|
+
* @param messageId - The UUID of the email message
|
|
20996
|
+
* @returns Array of attachment metadata entries
|
|
20997
|
+
*/
|
|
20998
|
+
async listAttachments(messageId) {
|
|
20999
|
+
const { data } = await this.client.get(`/protokol-mail/v1/emails/${messageId}/attachments`);
|
|
21000
|
+
return data;
|
|
21001
|
+
}
|
|
21002
|
+
/**
|
|
21003
|
+
* Download an attachment's binary content.
|
|
21004
|
+
*
|
|
21005
|
+
* @param messageId - The UUID of the email message
|
|
21006
|
+
* @param attachmentId - The UUID of the attachment
|
|
21007
|
+
* @returns The raw binary data as an ArrayBuffer
|
|
21008
|
+
*/
|
|
21009
|
+
async downloadAttachment(messageId, attachmentId) {
|
|
21010
|
+
const { data } = await this.client.get(`/protokol-mail/v1/emails/${messageId}/attachments/${attachmentId}`, { responseType: "arraybuffer" });
|
|
21011
|
+
return data;
|
|
21012
|
+
}
|
|
21013
|
+
}
|
|
21014
|
+
|
|
20924
21015
|
class SerbiaUtil extends IntegrationsBaseClient {
|
|
20925
21016
|
async nbsSearch(params) {
|
|
20926
|
-
return await this.services("GET", "nbs/search", {
|
|
21017
|
+
return await this.services("GET", "nbs/search", {
|
|
21018
|
+
params
|
|
21019
|
+
});
|
|
21020
|
+
}
|
|
21021
|
+
async getNbsIpsQrCode(code, size, lang) {
|
|
21022
|
+
return await this.request("GET", `ipsQr/generate`, {
|
|
21023
|
+
params: {
|
|
21024
|
+
size,
|
|
21025
|
+
lang
|
|
21026
|
+
},
|
|
21027
|
+
data: {
|
|
21028
|
+
...code
|
|
21029
|
+
}
|
|
21030
|
+
});
|
|
21031
|
+
}
|
|
21032
|
+
async validateNbsIpsQrCode(qrCodeString, lang) {
|
|
21033
|
+
return await this.request("GET", `ipsQr/validate`, {
|
|
21034
|
+
params: {
|
|
21035
|
+
lang
|
|
21036
|
+
},
|
|
21037
|
+
data: {
|
|
21038
|
+
QRCodeString: qrCodeString
|
|
21039
|
+
}
|
|
21040
|
+
});
|
|
20927
21041
|
}
|
|
20928
21042
|
async getReceiptFromUrl(url, source) {
|
|
20929
|
-
return await this.services("POST", "receipt/
|
|
21043
|
+
return await this.services("POST", "receipt/extract", {
|
|
20930
21044
|
data: {
|
|
20931
21045
|
url,
|
|
20932
21046
|
source
|
|
20933
21047
|
}
|
|
20934
21048
|
});
|
|
20935
21049
|
}
|
|
21050
|
+
async getReceiptFromQrCode(qrCodeImage, source) {
|
|
21051
|
+
return await this.services("POST", "receipt/extract", {
|
|
21052
|
+
data: {
|
|
21053
|
+
qrCodeImage,
|
|
21054
|
+
source
|
|
21055
|
+
}
|
|
21056
|
+
});
|
|
21057
|
+
}
|
|
20936
21058
|
async getContoList() {
|
|
20937
21059
|
return await this.services("GET", "conto");
|
|
20938
21060
|
}
|
|
@@ -21745,6 +21867,7 @@ class Integrations extends IntegrationsBaseClient {
|
|
|
21745
21867
|
'protokol-invoicing': new Invoicing().setClient(this.client),
|
|
21746
21868
|
'protokol-vpfr': new VPFR().setClient(this.client),
|
|
21747
21869
|
'protokol-dms': new DMS().setClient(this.client),
|
|
21870
|
+
'protokol-mail': new Mail().setClient(this.client),
|
|
21748
21871
|
'serbia-utilities': new SerbiaUtil().setClient(this.client),
|
|
21749
21872
|
'protokol-payments': new Payments().setClient(this.client),
|
|
21750
21873
|
'protokol-minimax': new Minimax().setClient(this.client),
|
|
@@ -21762,6 +21885,9 @@ class Integrations extends IntegrationsBaseClient {
|
|
|
21762
21885
|
getInvoicing() {
|
|
21763
21886
|
return this.getInterfaceOf('protokol-invoicing');
|
|
21764
21887
|
}
|
|
21888
|
+
getMail() {
|
|
21889
|
+
return this.getInterfaceOf('protokol-mail');
|
|
21890
|
+
}
|
|
21765
21891
|
getPayments() {
|
|
21766
21892
|
return this.getInterfaceOf('protokol-payments');
|
|
21767
21893
|
}
|
|
@@ -21797,6 +21923,7 @@ exports.Functions = Functions;
|
|
|
21797
21923
|
exports.Integration = Integrations;
|
|
21798
21924
|
exports.Integrations = Integrations;
|
|
21799
21925
|
exports.Invoicing = Invoicing;
|
|
21926
|
+
exports.Mail = Mail;
|
|
21800
21927
|
exports.Payments = Payments;
|
|
21801
21928
|
exports.Platform = Platform;
|
|
21802
21929
|
exports.Project = Project;
|