Skip to content

Commit de2f679

Browse files
author
awstools
committed
feat(client-invoicing): Added new invoicing get-invoice-pdf API Operation
1 parent 647406d commit de2f679

File tree

8 files changed

+441
-0
lines changed

8 files changed

+441
-0
lines changed

clients/client-invoicing/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,14 @@ DeleteInvoiceUnit
226226

227227
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/invoicing/command/DeleteInvoiceUnitCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-invoicing/Interface/DeleteInvoiceUnitCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-invoicing/Interface/DeleteInvoiceUnitCommandOutput/)
228228

229+
</details>
230+
<details>
231+
<summary>
232+
GetInvoicePDF
233+
</summary>
234+
235+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/invoicing/command/GetInvoicePDFCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-invoicing/Interface/GetInvoicePDFCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-invoicing/Interface/GetInvoicePDFCommandOutput/)
236+
229237
</details>
230238
<details>
231239
<summary>

clients/client-invoicing/src/Invoicing.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ import {
1717
DeleteInvoiceUnitCommandInput,
1818
DeleteInvoiceUnitCommandOutput,
1919
} from "./commands/DeleteInvoiceUnitCommand";
20+
import {
21+
GetInvoicePDFCommand,
22+
GetInvoicePDFCommandInput,
23+
GetInvoicePDFCommandOutput,
24+
} from "./commands/GetInvoicePDFCommand";
2025
import {
2126
GetInvoiceUnitCommand,
2227
GetInvoiceUnitCommandInput,
@@ -54,6 +59,7 @@ const commands = {
5459
BatchGetInvoiceProfileCommand,
5560
CreateInvoiceUnitCommand,
5661
DeleteInvoiceUnitCommand,
62+
GetInvoicePDFCommand,
5763
GetInvoiceUnitCommand,
5864
ListInvoiceSummariesCommand,
5965
ListInvoiceUnitsCommand,
@@ -115,6 +121,17 @@ export interface Invoicing {
115121
cb: (err: any, data?: DeleteInvoiceUnitCommandOutput) => void
116122
): void;
117123

124+
/**
125+
* @see {@link GetInvoicePDFCommand}
126+
*/
127+
getInvoicePDF(args: GetInvoicePDFCommandInput, options?: __HttpHandlerOptions): Promise<GetInvoicePDFCommandOutput>;
128+
getInvoicePDF(args: GetInvoicePDFCommandInput, cb: (err: any, data?: GetInvoicePDFCommandOutput) => void): void;
129+
getInvoicePDF(
130+
args: GetInvoicePDFCommandInput,
131+
options: __HttpHandlerOptions,
132+
cb: (err: any, data?: GetInvoicePDFCommandOutput) => void
133+
): void;
134+
118135
/**
119136
* @see {@link GetInvoiceUnitCommand}
120137
*/

clients/client-invoicing/src/InvoicingClient.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ import {
6363
} from "./commands/BatchGetInvoiceProfileCommand";
6464
import { CreateInvoiceUnitCommandInput, CreateInvoiceUnitCommandOutput } from "./commands/CreateInvoiceUnitCommand";
6565
import { DeleteInvoiceUnitCommandInput, DeleteInvoiceUnitCommandOutput } from "./commands/DeleteInvoiceUnitCommand";
66+
import { GetInvoicePDFCommandInput, GetInvoicePDFCommandOutput } from "./commands/GetInvoicePDFCommand";
6667
import { GetInvoiceUnitCommandInput, GetInvoiceUnitCommandOutput } from "./commands/GetInvoiceUnitCommand";
6768
import {
6869
ListInvoiceSummariesCommandInput,
@@ -94,6 +95,7 @@ export type ServiceInputTypes =
9495
| BatchGetInvoiceProfileCommandInput
9596
| CreateInvoiceUnitCommandInput
9697
| DeleteInvoiceUnitCommandInput
98+
| GetInvoicePDFCommandInput
9799
| GetInvoiceUnitCommandInput
98100
| ListInvoiceSummariesCommandInput
99101
| ListInvoiceUnitsCommandInput
@@ -109,6 +111,7 @@ export type ServiceOutputTypes =
109111
| BatchGetInvoiceProfileCommandOutput
110112
| CreateInvoiceUnitCommandOutput
111113
| DeleteInvoiceUnitCommandOutput
114+
| GetInvoicePDFCommandOutput
112115
| GetInvoiceUnitCommandOutput
113116
| ListInvoiceSummariesCommandOutput
114117
| ListInvoiceUnitsCommandOutput
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
// smithy-typescript generated code
2+
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
3+
import { Command as $Command } from "@smithy/smithy-client";
4+
import { MetadataBearer as __MetadataBearer } from "@smithy/types";
5+
6+
import { commonParams } from "../endpoint/EndpointParameters";
7+
import { InvoicingClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../InvoicingClient";
8+
import { GetInvoicePDFRequest, GetInvoicePDFResponse } from "../models/models_0";
9+
import { GetInvoicePDF } from "../schemas/schemas_0";
10+
11+
/**
12+
* @public
13+
*/
14+
export type { __MetadataBearer };
15+
export { $Command };
16+
/**
17+
* @public
18+
*
19+
* The input for {@link GetInvoicePDFCommand}.
20+
*/
21+
export interface GetInvoicePDFCommandInput extends GetInvoicePDFRequest {}
22+
/**
23+
* @public
24+
*
25+
* The output of {@link GetInvoicePDFCommand}.
26+
*/
27+
export interface GetInvoicePDFCommandOutput extends GetInvoicePDFResponse, __MetadataBearer {}
28+
29+
/**
30+
* <p>Returns a URL to download the invoice document and supplemental documents associated with an invoice. The URLs are pre-signed and have expiration time. For special cases like Brazil, where Amazon Web Services generated invoice identifiers and government provided identifiers do not match, use the Amazon Web Services generated invoice identifier when making API requests. To grant IAM permission to use this operation, the caller needs the <code>invoicing:GetInvoicePDF</code> policy action.</p>
31+
* @example
32+
* Use a bare-bones client and the command you need to make an API call.
33+
* ```javascript
34+
* import { InvoicingClient, GetInvoicePDFCommand } from "@aws-sdk/client-invoicing"; // ES Modules import
35+
* // const { InvoicingClient, GetInvoicePDFCommand } = require("@aws-sdk/client-invoicing"); // CommonJS import
36+
* // import type { InvoicingClientConfig } from "@aws-sdk/client-invoicing";
37+
* const config = {}; // type is InvoicingClientConfig
38+
* const client = new InvoicingClient(config);
39+
* const input = { // GetInvoicePDFRequest
40+
* InvoiceId: "STRING_VALUE", // required
41+
* };
42+
* const command = new GetInvoicePDFCommand(input);
43+
* const response = await client.send(command);
44+
* // { // GetInvoicePDFResponse
45+
* // InvoicePDF: { // InvoicePDF
46+
* // InvoiceId: "STRING_VALUE",
47+
* // DocumentUrl: "STRING_VALUE",
48+
* // DocumentUrlExpirationDate: new Date("TIMESTAMP"),
49+
* // SupplementalDocuments: [ // SupplementalDocuments
50+
* // { // SupplementalDocument
51+
* // DocumentUrl: "STRING_VALUE",
52+
* // DocumentUrlExpirationDate: new Date("TIMESTAMP"),
53+
* // },
54+
* // ],
55+
* // },
56+
* // };
57+
*
58+
* ```
59+
*
60+
* @param GetInvoicePDFCommandInput - {@link GetInvoicePDFCommandInput}
61+
* @returns {@link GetInvoicePDFCommandOutput}
62+
* @see {@link GetInvoicePDFCommandInput} for command's `input` shape.
63+
* @see {@link GetInvoicePDFCommandOutput} for command's `response` shape.
64+
* @see {@link InvoicingClientResolvedConfig | config} for InvoicingClient's `config` shape.
65+
*
66+
* @throws {@link AccessDeniedException} (client fault)
67+
* <p>You don't have sufficient access to perform this action.</p>
68+
*
69+
* @throws {@link InternalServerException} (server fault)
70+
* <p>The processing request failed because of an unknown error, exception, or failure. </p>
71+
*
72+
* @throws {@link ResourceNotFoundException} (client fault)
73+
* <p>The resource could not be found. </p>
74+
*
75+
* @throws {@link ThrottlingException} (client fault)
76+
* <p>The request was denied due to request throttling.</p>
77+
*
78+
* @throws {@link ValidationException} (client fault)
79+
* <p> The input fails to satisfy the constraints specified by an Amazon Web Services service. </p>
80+
*
81+
* @throws {@link InvoicingServiceException}
82+
* <p>Base exception class for all service exceptions from Invoicing service.</p>
83+
*
84+
*
85+
* @example GetInvoicePDF without supplemental documents
86+
* ```javascript
87+
* //
88+
* const input = {
89+
* InvoiceId: "abc123"
90+
* };
91+
* const command = new GetInvoicePDFCommand(input);
92+
* const response = await client.send(command);
93+
* /* response is
94+
* {
95+
* InvoicePDF: {
96+
* DocumentUrl: "https://abcd123.com?securityTokenForDoc",
97+
* DocumentUrlExpirationDate: "2025-04-01T01:00:00.000Z",
98+
* InvoiceId: "abc123",
99+
* SupplementalDocuments: []
100+
* }
101+
* }
102+
* *\/
103+
* ```
104+
*
105+
* @example GetInvoicePDF with supplemental documents
106+
* ```javascript
107+
* //
108+
* const input = {
109+
* InvoiceId: "abc123"
110+
* };
111+
* const command = new GetInvoicePDFCommand(input);
112+
* const response = await client.send(command);
113+
* /* response is
114+
* {
115+
* InvoicePDF: {
116+
* DocumentUrl: "https://abcd123.com?securityTokenForDoc",
117+
* DocumentUrlExpirationDate: "2025-04-01T01:00:00.000Z",
118+
* InvoiceId: "abc123",
119+
* SupplementalDocuments: [
120+
* {
121+
* DocumentUrl: "https://abcd123.com?securityTokenForSupplementalDoc",
122+
* DocumentUrlExpirationDate: "2025-04-01T01:00:00.000Z"
123+
* }
124+
* ]
125+
* }
126+
* }
127+
* *\/
128+
* ```
129+
*
130+
* @public
131+
*/
132+
export class GetInvoicePDFCommand extends $Command
133+
.classBuilder<
134+
GetInvoicePDFCommandInput,
135+
GetInvoicePDFCommandOutput,
136+
InvoicingClientResolvedConfig,
137+
ServiceInputTypes,
138+
ServiceOutputTypes
139+
>()
140+
.ep(commonParams)
141+
.m(function (this: any, Command: any, cs: any, config: InvoicingClientResolvedConfig, o: any) {
142+
return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
143+
})
144+
.s("Invoicing", "GetInvoicePDF", {})
145+
.n("InvoicingClient", "GetInvoicePDFCommand")
146+
.sc(GetInvoicePDF)
147+
.build() {
148+
/** @internal type navigation helper, not in runtime. */
149+
protected declare static __types: {
150+
api: {
151+
input: GetInvoicePDFRequest;
152+
output: GetInvoicePDFResponse;
153+
};
154+
sdk: {
155+
input: GetInvoicePDFCommandInput;
156+
output: GetInvoicePDFCommandOutput;
157+
};
158+
};
159+
}

clients/client-invoicing/src/commands/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
export * from "./BatchGetInvoiceProfileCommand";
33
export * from "./CreateInvoiceUnitCommand";
44
export * from "./DeleteInvoiceUnitCommand";
5+
export * from "./GetInvoicePDFCommand";
56
export * from "./GetInvoiceUnitCommand";
67
export * from "./ListInvoiceSummariesCommand";
78
export * from "./ListInvoiceUnitsCommand";

clients/client-invoicing/src/models/models_0.ts

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,76 @@ export interface Filters {
669669
Accounts?: string[] | undefined;
670670
}
671671

672+
/**
673+
* @public
674+
*/
675+
export interface GetInvoicePDFRequest {
676+
/**
677+
* <p> Your unique invoice ID. </p>
678+
* @public
679+
*/
680+
InvoiceId: string | undefined;
681+
}
682+
683+
/**
684+
* <p>Supplemental document associated with the invoice.</p>
685+
* @public
686+
*/
687+
export interface SupplementalDocument {
688+
/**
689+
* <p>The pre-signed URL to download invoice supplemental document.</p>
690+
* @public
691+
*/
692+
DocumentUrl?: string | undefined;
693+
694+
/**
695+
* <p>The pre-signed URL expiration date of invoice supplemental document.</p>
696+
* @public
697+
*/
698+
DocumentUrlExpirationDate?: Date | undefined;
699+
}
700+
701+
/**
702+
* <p> Invoice document data. </p>
703+
* @public
704+
*/
705+
export interface InvoicePDF {
706+
/**
707+
* <p> Your unique invoice ID. </p>
708+
* @public
709+
*/
710+
InvoiceId?: string | undefined;
711+
712+
/**
713+
* <p>The pre-signed URL to download the invoice document. </p>
714+
* @public
715+
*/
716+
DocumentUrl?: string | undefined;
717+
718+
/**
719+
* <p>The pre-signed URL expiration date of the invoice document.</p>
720+
* @public
721+
*/
722+
DocumentUrlExpirationDate?: Date | undefined;
723+
724+
/**
725+
* <p>List of supplemental documents associated with the invoice.</p>
726+
* @public
727+
*/
728+
SupplementalDocuments?: SupplementalDocument[] | undefined;
729+
}
730+
731+
/**
732+
* @public
733+
*/
734+
export interface GetInvoicePDFResponse {
735+
/**
736+
* <p> The invoice document and supplemental documents associated with the invoice. </p>
737+
* @public
738+
*/
739+
InvoicePDF?: InvoicePDF | undefined;
740+
}
741+
672742
/**
673743
* @public
674744
*/

0 commit comments

Comments
 (0)