@scaleway/sdk-billing 2.22.0 → 2.23.1

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.
@@ -1,4 +1,4 @@
1
- import { Discount, DownloadInvoiceRequest, ExportInvoicesRequest, FinOpsApiListChargesRequest, GetInvoiceRequest, Invoice, ListChargesResponse, ListConsumptionsRequest, ListConsumptionsResponse, ListConsumptionsResponseConsumption, ListDiscountsRequest, ListDiscountsResponse, ListInvoicesRequest, ListInvoicesResponse, ListTaxesRequest, ListTaxesResponse, ListTaxesResponseTax, RedeemCouponRequest } from "./types.gen.js";
1
+ import { Discount, DiscountLine, DownloadInvoiceRequest, ExportInvoicesRequest, FinOpsApiListChargesRequest, GetInvoiceRequest, Invoice, InvoiceLine, ListChargesResponse, ListConsumptionsRequest, ListConsumptionsResponse, ListConsumptionsResponseConsumption, ListDiscountLinesRequest, ListDiscountLinesResponse, ListDiscountsRequest, ListDiscountsResponse, ListInvoiceLinesRequest, ListInvoiceLinesResponse, ListInvoicesRequest, ListInvoicesResponse, ListTaxesRequest, ListTaxesResponse, ListTaxesResponseTax, RedeemCouponRequest } from "./types.gen.js";
2
2
  import { API, RequestOptions } from "@scaleway/sdk-client";
3
3
  //#region src/v2beta1/api.gen.d.ts
4
4
  /**
@@ -82,6 +82,28 @@ declare class API$1 extends API {
82
82
  * @returns A Promise of Discount
83
83
  */
84
84
  redeemCoupon: (request: Readonly<RedeemCouponRequest>, options?: RequestOptions) => Promise<Discount>;
85
+ protected pageOfListInvoiceLines: (request: Readonly<ListInvoiceLinesRequest>, options?: RequestOptions) => Promise<ListInvoiceLinesResponse>;
86
+ /**
87
+ * List invoice lines. List all lines of a given invoice, specified by its ID.
88
+ *
89
+ * @param request - The request {@link ListInvoiceLinesRequest}
90
+ * @returns A Promise of ListInvoiceLinesResponse
91
+ */
92
+ listInvoiceLines: (request: Readonly<ListInvoiceLinesRequest>, options?: RequestOptions) => Promise<ListInvoiceLinesResponse> & {
93
+ all: () => Promise<InvoiceLine[]>;
94
+ [Symbol.asyncIterator]: () => AsyncGenerator<InvoiceLine[], void, void>;
95
+ };
96
+ protected pageOfListDiscountLines: (request: Readonly<ListDiscountLinesRequest>, options?: RequestOptions) => Promise<ListDiscountLinesResponse>;
97
+ /**
98
+ * List discount lines. List all discount lines of a given invoice, specified by its ID.
99
+ *
100
+ * @param request - The request {@link ListDiscountLinesRequest}
101
+ * @returns A Promise of ListDiscountLinesResponse
102
+ */
103
+ listDiscountLines: (request: Readonly<ListDiscountLinesRequest>, options?: RequestOptions) => Promise<ListDiscountLinesResponse> & {
104
+ all: () => Promise<DiscountLine[]>;
105
+ [Symbol.asyncIterator]: () => AsyncGenerator<DiscountLine[], void, void>;
106
+ };
85
107
  }
86
108
  /**
87
109
  * Billing FinOps API.
@@ -1,4 +1,4 @@
1
- import { unmarshalDiscount, unmarshalInvoice, unmarshalListChargesResponse, unmarshalListConsumptionsResponse, unmarshalListDiscountsResponse, unmarshalListInvoicesResponse, unmarshalListTaxesResponse } from "./marshalling.gen.js";
1
+ import { unmarshalDiscount, unmarshalInvoice, unmarshalListChargesResponse, unmarshalListConsumptionsResponse, unmarshalListDiscountLinesResponse, unmarshalListDiscountsResponse, unmarshalListInvoiceLinesResponse, unmarshalListInvoicesResponse, unmarshalListTaxesResponse } from "./marshalling.gen.js";
2
2
  import { API, enrichForPagination, resolveOneOf, urlParams, validatePathParam } from "@scaleway/sdk-client";
3
3
 
4
4
  //#region src/v2beta1/api.gen.ts
@@ -71,6 +71,20 @@ var API$1 = class extends API {
71
71
  urlParams: urlParams(["code", request.code], ["organization_id", request.organizationId ?? this.client.settings.defaultOrganizationId]),
72
72
  signal: options?.signal
73
73
  }, unmarshalDiscount);
74
+ this.pageOfListInvoiceLines = (request, options) => this.client.fetch({
75
+ method: "GET",
76
+ path: `/billing/v2beta1/invoices/${validatePathParam("invoiceId", request.invoiceId)}/lines`,
77
+ urlParams: urlParams(["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize]),
78
+ signal: options?.signal
79
+ }, unmarshalListInvoiceLinesResponse);
80
+ this.listInvoiceLines = (request, options) => enrichForPagination("invoiceLines", this.pageOfListInvoiceLines, request, options);
81
+ this.pageOfListDiscountLines = (request, options) => this.client.fetch({
82
+ method: "GET",
83
+ path: `/billing/v2beta1/invoices/${validatePathParam("invoiceId", request.invoiceId)}/discount-lines`,
84
+ urlParams: urlParams(["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize]),
85
+ signal: options?.signal
86
+ }, unmarshalListDiscountLinesResponse);
87
+ this.listDiscountLines = (request, options) => enrichForPagination("discountLines", this.pageOfListDiscountLines, request, options);
74
88
  }
75
89
  };
76
90
  /**
@@ -1,9 +1,11 @@
1
- import { DiscountDiscountMode, DiscountFilterType, DownloadInvoiceRequestFileType, ExportInvoicesRequestFileType, ExportInvoicesRequestOrderBy, InvoiceType, ListChargesRequestOrderBy, ListConsumptionsRequestOrderBy, ListDiscountsRequestOrderBy, ListInvoicesRequestOrderBy, ListTaxesRequestOrderBy } from "./types.gen.js";
1
+ import { DiscountDiscountMode, DiscountFilterType, DiscountLineOrigin, DownloadInvoiceRequestFileType, ExportInvoicesRequestFileType, ExportInvoicesRequestOrderBy, InvoiceType, ListChargesRequestOrderBy, ListConsumptionsRequestOrderBy, ListDiscountsRequestOrderBy, ListInvoicesRequestOrderBy, ListTaxesRequestOrderBy } from "./types.gen.js";
2
2
  //#region src/v2beta1/constants.gen.d.ts
3
3
  /** Lists all values of the enum {@link DiscountDiscountMode}. */
4
4
  export declare const DISCOUNT_DISCOUNT_MODES: DiscountDiscountMode[];
5
5
  /** Lists all values of the enum {@link DiscountFilterType}. */
6
6
  export declare const DISCOUNT_FILTER_TYPES: DiscountFilterType[];
7
+ /** Lists all values of the enum {@link DiscountLineOrigin}. */
8
+ export declare const DISCOUNT_LINE_ORIGINS: DiscountLineOrigin[];
7
9
  /** Lists all values of the enum {@link DownloadInvoiceRequestFileType}. */
8
10
  export declare const DOWNLOAD_INVOICE_REQUEST_FILE_TYPES: DownloadInvoiceRequestFileType[];
9
11
  /** Lists all values of the enum {@link ExportInvoicesRequestFileType}. */
@@ -16,6 +16,16 @@ const DISCOUNT_FILTER_TYPES = [
16
16
  "region",
17
17
  "zone"
18
18
  ];
19
+ /** Lists all values of the enum {@link DiscountLineOrigin}. */
20
+ const DISCOUNT_LINE_ORIGINS = [
21
+ "unknown_origin",
22
+ "discount",
23
+ "contractual_commitment_range",
24
+ "savings_plan_activation",
25
+ "credit_note_rebate",
26
+ "reserved_resource_activation",
27
+ "offer_included"
28
+ ];
19
29
  /** Lists all values of the enum {@link DownloadInvoiceRequestFileType}. */
20
30
  const DOWNLOAD_INVOICE_REQUEST_FILE_TYPES = ["pdf"];
21
31
  /** Lists all values of the enum {@link ExportInvoicesRequestFileType}. */
@@ -88,4 +98,4 @@ const LIST_TAXES_REQUEST_ORDER_BIES = [
88
98
  ];
89
99
 
90
100
  //#endregion
91
- export { DISCOUNT_DISCOUNT_MODES, DISCOUNT_FILTER_TYPES, DOWNLOAD_INVOICE_REQUEST_FILE_TYPES, EXPORT_INVOICES_REQUEST_FILE_TYPES, EXPORT_INVOICES_REQUEST_ORDER_BIES, INVOICE_TYPES, LIST_CHARGES_REQUEST_ORDER_BIES, LIST_CONSUMPTIONS_REQUEST_ORDER_BIES, LIST_DISCOUNTS_REQUEST_ORDER_BIES, LIST_INVOICES_REQUEST_ORDER_BIES, LIST_TAXES_REQUEST_ORDER_BIES };
101
+ export { DISCOUNT_DISCOUNT_MODES, DISCOUNT_FILTER_TYPES, DISCOUNT_LINE_ORIGINS, DOWNLOAD_INVOICE_REQUEST_FILE_TYPES, EXPORT_INVOICES_REQUEST_FILE_TYPES, EXPORT_INVOICES_REQUEST_ORDER_BIES, INVOICE_TYPES, LIST_CHARGES_REQUEST_ORDER_BIES, LIST_CONSUMPTIONS_REQUEST_ORDER_BIES, LIST_DISCOUNTS_REQUEST_ORDER_BIES, LIST_INVOICES_REQUEST_ORDER_BIES, LIST_TAXES_REQUEST_ORDER_BIES };
@@ -1,10 +1,10 @@
1
- import { Charge, Discount, DiscountCoupon, DiscountDiscountMode, DiscountFilter, DiscountFilterType, DownloadInvoiceRequest, DownloadInvoiceRequestFileType, ExportInvoicesRequest, ExportInvoicesRequestFileType, ExportInvoicesRequestOrderBy, FinOpsApiListChargesRequest, GetInvoiceRequest, Invoice, InvoiceType, ListChargesRequestOrderBy, ListChargesResponse, ListConsumptionsRequest, ListConsumptionsRequestOrderBy, ListConsumptionsResponse, ListConsumptionsResponseConsumption, ListDiscountsRequest, ListDiscountsRequestOrderBy, ListDiscountsResponse, ListInvoicesRequest, ListInvoicesRequestOrderBy, ListInvoicesResponse, ListTaxesRequest, ListTaxesRequestOrderBy, ListTaxesResponse, ListTaxesResponseTax, RedeemCouponRequest } from "./types.gen.js";
1
+ import { Charge, Discount, DiscountCoupon, DiscountDiscountMode, DiscountFilter, DiscountFilterType, DiscountLine, DiscountLineOrigin, DownloadInvoiceRequest, DownloadInvoiceRequestFileType, ExportInvoicesRequest, ExportInvoicesRequestFileType, ExportInvoicesRequestOrderBy, FinOpsApiListChargesRequest, GetInvoiceRequest, Invoice, InvoiceLine, InvoiceType, ListChargesRequestOrderBy, ListChargesResponse, ListConsumptionsRequest, ListConsumptionsRequestOrderBy, ListConsumptionsResponse, ListConsumptionsResponseConsumption, ListDiscountLinesRequest, ListDiscountLinesResponse, ListDiscountsRequest, ListDiscountsRequestOrderBy, ListDiscountsResponse, ListInvoiceLinesRequest, ListInvoiceLinesResponse, ListInvoicesRequest, ListInvoicesRequestOrderBy, ListInvoicesResponse, ListTaxesRequest, ListTaxesRequestOrderBy, ListTaxesResponse, ListTaxesResponseTax, RedeemCouponRequest } from "./types.gen.js";
2
2
  import { API, FinOpsAPI } from "./api.gen.js";
3
- import { DISCOUNT_DISCOUNT_MODES, DISCOUNT_FILTER_TYPES, DOWNLOAD_INVOICE_REQUEST_FILE_TYPES, EXPORT_INVOICES_REQUEST_FILE_TYPES, EXPORT_INVOICES_REQUEST_ORDER_BIES, INVOICE_TYPES, LIST_CHARGES_REQUEST_ORDER_BIES, LIST_CONSUMPTIONS_REQUEST_ORDER_BIES, LIST_DISCOUNTS_REQUEST_ORDER_BIES, LIST_INVOICES_REQUEST_ORDER_BIES, LIST_TAXES_REQUEST_ORDER_BIES } from "./constants.gen.js";
4
- import { unmarshalDiscount, unmarshalInvoice, unmarshalListChargesResponse, unmarshalListConsumptionsResponse, unmarshalListDiscountsResponse, unmarshalListInvoicesResponse, unmarshalListTaxesResponse } from "./marshalling.gen.js";
3
+ import { DISCOUNT_DISCOUNT_MODES, DISCOUNT_FILTER_TYPES, DISCOUNT_LINE_ORIGINS, DOWNLOAD_INVOICE_REQUEST_FILE_TYPES, EXPORT_INVOICES_REQUEST_FILE_TYPES, EXPORT_INVOICES_REQUEST_ORDER_BIES, INVOICE_TYPES, LIST_CHARGES_REQUEST_ORDER_BIES, LIST_CONSUMPTIONS_REQUEST_ORDER_BIES, LIST_DISCOUNTS_REQUEST_ORDER_BIES, LIST_INVOICES_REQUEST_ORDER_BIES, LIST_TAXES_REQUEST_ORDER_BIES } from "./constants.gen.js";
4
+ import { unmarshalDiscount, unmarshalInvoice, unmarshalListChargesResponse, unmarshalListConsumptionsResponse, unmarshalListDiscountLinesResponse, unmarshalListDiscountsResponse, unmarshalListInvoiceLinesResponse, unmarshalListInvoicesResponse, unmarshalListTaxesResponse } from "./marshalling.gen.js";
5
5
  import { validation_rules_gen_d_exports } from "./validation-rules.gen.js";
6
6
  declare namespace index_gen_d_exports {
7
- export { API, Charge, DISCOUNT_DISCOUNT_MODES, DISCOUNT_FILTER_TYPES, DOWNLOAD_INVOICE_REQUEST_FILE_TYPES, Discount, DiscountCoupon, DiscountDiscountMode, DiscountFilter, DiscountFilterType, DownloadInvoiceRequest, DownloadInvoiceRequestFileType, EXPORT_INVOICES_REQUEST_FILE_TYPES, EXPORT_INVOICES_REQUEST_ORDER_BIES, ExportInvoicesRequest, ExportInvoicesRequestFileType, ExportInvoicesRequestOrderBy, FinOpsAPI, FinOpsApiListChargesRequest, GetInvoiceRequest, INVOICE_TYPES, Invoice, InvoiceType, LIST_CHARGES_REQUEST_ORDER_BIES, LIST_CONSUMPTIONS_REQUEST_ORDER_BIES, LIST_DISCOUNTS_REQUEST_ORDER_BIES, LIST_INVOICES_REQUEST_ORDER_BIES, LIST_TAXES_REQUEST_ORDER_BIES, ListChargesRequestOrderBy, ListChargesResponse, ListConsumptionsRequest, ListConsumptionsRequestOrderBy, ListConsumptionsResponse, ListConsumptionsResponseConsumption, ListDiscountsRequest, ListDiscountsRequestOrderBy, ListDiscountsResponse, ListInvoicesRequest, ListInvoicesRequestOrderBy, ListInvoicesResponse, ListTaxesRequest, ListTaxesRequestOrderBy, ListTaxesResponse, ListTaxesResponseTax, RedeemCouponRequest, validation_rules_gen_d_exports as ValidationRules, unmarshalDiscount, unmarshalInvoice, unmarshalListChargesResponse, unmarshalListConsumptionsResponse, unmarshalListDiscountsResponse, unmarshalListInvoicesResponse, unmarshalListTaxesResponse };
7
+ export { API, Charge, DISCOUNT_DISCOUNT_MODES, DISCOUNT_FILTER_TYPES, DISCOUNT_LINE_ORIGINS, DOWNLOAD_INVOICE_REQUEST_FILE_TYPES, Discount, DiscountCoupon, DiscountDiscountMode, DiscountFilter, DiscountFilterType, DiscountLine, DiscountLineOrigin, DownloadInvoiceRequest, DownloadInvoiceRequestFileType, EXPORT_INVOICES_REQUEST_FILE_TYPES, EXPORT_INVOICES_REQUEST_ORDER_BIES, ExportInvoicesRequest, ExportInvoicesRequestFileType, ExportInvoicesRequestOrderBy, FinOpsAPI, FinOpsApiListChargesRequest, GetInvoiceRequest, INVOICE_TYPES, Invoice, InvoiceLine, InvoiceType, LIST_CHARGES_REQUEST_ORDER_BIES, LIST_CONSUMPTIONS_REQUEST_ORDER_BIES, LIST_DISCOUNTS_REQUEST_ORDER_BIES, LIST_INVOICES_REQUEST_ORDER_BIES, LIST_TAXES_REQUEST_ORDER_BIES, ListChargesRequestOrderBy, ListChargesResponse, ListConsumptionsRequest, ListConsumptionsRequestOrderBy, ListConsumptionsResponse, ListConsumptionsResponseConsumption, ListDiscountLinesRequest, ListDiscountLinesResponse, ListDiscountsRequest, ListDiscountsRequestOrderBy, ListDiscountsResponse, ListInvoiceLinesRequest, ListInvoiceLinesResponse, ListInvoicesRequest, ListInvoicesRequestOrderBy, ListInvoicesResponse, ListTaxesRequest, ListTaxesRequestOrderBy, ListTaxesResponse, ListTaxesResponseTax, RedeemCouponRequest, validation_rules_gen_d_exports as ValidationRules, unmarshalDiscount, unmarshalInvoice, unmarshalListChargesResponse, unmarshalListConsumptionsResponse, unmarshalListDiscountLinesResponse, unmarshalListDiscountsResponse, unmarshalListInvoiceLinesResponse, unmarshalListInvoicesResponse, unmarshalListTaxesResponse };
8
8
  }
9
9
  //#endregion
10
- export { API, type Charge, DISCOUNT_DISCOUNT_MODES, DISCOUNT_FILTER_TYPES, DOWNLOAD_INVOICE_REQUEST_FILE_TYPES, type Discount, type DiscountCoupon, type DiscountDiscountMode, type DiscountFilter, type DiscountFilterType, type DownloadInvoiceRequest, type DownloadInvoiceRequestFileType, EXPORT_INVOICES_REQUEST_FILE_TYPES, EXPORT_INVOICES_REQUEST_ORDER_BIES, type ExportInvoicesRequest, type ExportInvoicesRequestFileType, type ExportInvoicesRequestOrderBy, FinOpsAPI, type FinOpsApiListChargesRequest, type GetInvoiceRequest, INVOICE_TYPES, type Invoice, type InvoiceType, LIST_CHARGES_REQUEST_ORDER_BIES, LIST_CONSUMPTIONS_REQUEST_ORDER_BIES, LIST_DISCOUNTS_REQUEST_ORDER_BIES, LIST_INVOICES_REQUEST_ORDER_BIES, LIST_TAXES_REQUEST_ORDER_BIES, type ListChargesRequestOrderBy, type ListChargesResponse, type ListConsumptionsRequest, type ListConsumptionsRequestOrderBy, type ListConsumptionsResponse, type ListConsumptionsResponseConsumption, type ListDiscountsRequest, type ListDiscountsRequestOrderBy, type ListDiscountsResponse, type ListInvoicesRequest, type ListInvoicesRequestOrderBy, type ListInvoicesResponse, type ListTaxesRequest, type ListTaxesRequestOrderBy, type ListTaxesResponse, type ListTaxesResponseTax, type RedeemCouponRequest, validation_rules_gen_d_exports as ValidationRules, index_gen_d_exports, unmarshalDiscount, unmarshalInvoice, unmarshalListChargesResponse, unmarshalListConsumptionsResponse, unmarshalListDiscountsResponse, unmarshalListInvoicesResponse, unmarshalListTaxesResponse };
10
+ export { API, type Charge, DISCOUNT_DISCOUNT_MODES, DISCOUNT_FILTER_TYPES, DISCOUNT_LINE_ORIGINS, DOWNLOAD_INVOICE_REQUEST_FILE_TYPES, type Discount, type DiscountCoupon, type DiscountDiscountMode, type DiscountFilter, type DiscountFilterType, type DiscountLine, type DiscountLineOrigin, type DownloadInvoiceRequest, type DownloadInvoiceRequestFileType, EXPORT_INVOICES_REQUEST_FILE_TYPES, EXPORT_INVOICES_REQUEST_ORDER_BIES, type ExportInvoicesRequest, type ExportInvoicesRequestFileType, type ExportInvoicesRequestOrderBy, FinOpsAPI, type FinOpsApiListChargesRequest, type GetInvoiceRequest, INVOICE_TYPES, type Invoice, type InvoiceLine, type InvoiceType, LIST_CHARGES_REQUEST_ORDER_BIES, LIST_CONSUMPTIONS_REQUEST_ORDER_BIES, LIST_DISCOUNTS_REQUEST_ORDER_BIES, LIST_INVOICES_REQUEST_ORDER_BIES, LIST_TAXES_REQUEST_ORDER_BIES, type ListChargesRequestOrderBy, type ListChargesResponse, type ListConsumptionsRequest, type ListConsumptionsRequestOrderBy, type ListConsumptionsResponse, type ListConsumptionsResponseConsumption, type ListDiscountLinesRequest, type ListDiscountLinesResponse, type ListDiscountsRequest, type ListDiscountsRequestOrderBy, type ListDiscountsResponse, type ListInvoiceLinesRequest, type ListInvoiceLinesResponse, type ListInvoicesRequest, type ListInvoicesRequestOrderBy, type ListInvoicesResponse, type ListTaxesRequest, type ListTaxesRequestOrderBy, type ListTaxesResponse, type ListTaxesResponseTax, type RedeemCouponRequest, validation_rules_gen_d_exports as ValidationRules, index_gen_d_exports, unmarshalDiscount, unmarshalInvoice, unmarshalListChargesResponse, unmarshalListConsumptionsResponse, unmarshalListDiscountLinesResponse, unmarshalListDiscountsResponse, unmarshalListInvoiceLinesResponse, unmarshalListInvoicesResponse, unmarshalListTaxesResponse };
@@ -1,7 +1,7 @@
1
1
  import { __exportAll } from "../_virtual/_rolldown/runtime.js";
2
- import { unmarshalDiscount, unmarshalInvoice, unmarshalListChargesResponse, unmarshalListConsumptionsResponse, unmarshalListDiscountsResponse, unmarshalListInvoicesResponse, unmarshalListTaxesResponse } from "./marshalling.gen.js";
2
+ import { unmarshalDiscount, unmarshalInvoice, unmarshalListChargesResponse, unmarshalListConsumptionsResponse, unmarshalListDiscountLinesResponse, unmarshalListDiscountsResponse, unmarshalListInvoiceLinesResponse, unmarshalListInvoicesResponse, unmarshalListTaxesResponse } from "./marshalling.gen.js";
3
3
  import { API, FinOpsAPI } from "./api.gen.js";
4
- import { DISCOUNT_DISCOUNT_MODES, DISCOUNT_FILTER_TYPES, DOWNLOAD_INVOICE_REQUEST_FILE_TYPES, EXPORT_INVOICES_REQUEST_FILE_TYPES, EXPORT_INVOICES_REQUEST_ORDER_BIES, INVOICE_TYPES, LIST_CHARGES_REQUEST_ORDER_BIES, LIST_CONSUMPTIONS_REQUEST_ORDER_BIES, LIST_DISCOUNTS_REQUEST_ORDER_BIES, LIST_INVOICES_REQUEST_ORDER_BIES, LIST_TAXES_REQUEST_ORDER_BIES } from "./constants.gen.js";
4
+ import { DISCOUNT_DISCOUNT_MODES, DISCOUNT_FILTER_TYPES, DISCOUNT_LINE_ORIGINS, DOWNLOAD_INVOICE_REQUEST_FILE_TYPES, EXPORT_INVOICES_REQUEST_FILE_TYPES, EXPORT_INVOICES_REQUEST_ORDER_BIES, INVOICE_TYPES, LIST_CHARGES_REQUEST_ORDER_BIES, LIST_CONSUMPTIONS_REQUEST_ORDER_BIES, LIST_DISCOUNTS_REQUEST_ORDER_BIES, LIST_INVOICES_REQUEST_ORDER_BIES, LIST_TAXES_REQUEST_ORDER_BIES } from "./constants.gen.js";
5
5
  import { validation_rules_gen_exports } from "./validation-rules.gen.js";
6
6
 
7
7
  //#region src/v2beta1/index.gen.ts
@@ -9,6 +9,7 @@ var index_gen_exports = /* @__PURE__ */ __exportAll({
9
9
  API: () => API,
10
10
  DISCOUNT_DISCOUNT_MODES: () => DISCOUNT_DISCOUNT_MODES,
11
11
  DISCOUNT_FILTER_TYPES: () => DISCOUNT_FILTER_TYPES,
12
+ DISCOUNT_LINE_ORIGINS: () => DISCOUNT_LINE_ORIGINS,
12
13
  DOWNLOAD_INVOICE_REQUEST_FILE_TYPES: () => DOWNLOAD_INVOICE_REQUEST_FILE_TYPES,
13
14
  EXPORT_INVOICES_REQUEST_FILE_TYPES: () => EXPORT_INVOICES_REQUEST_FILE_TYPES,
14
15
  EXPORT_INVOICES_REQUEST_ORDER_BIES: () => EXPORT_INVOICES_REQUEST_ORDER_BIES,
@@ -24,10 +25,12 @@ var index_gen_exports = /* @__PURE__ */ __exportAll({
24
25
  unmarshalInvoice: () => unmarshalInvoice,
25
26
  unmarshalListChargesResponse: () => unmarshalListChargesResponse,
26
27
  unmarshalListConsumptionsResponse: () => unmarshalListConsumptionsResponse,
28
+ unmarshalListDiscountLinesResponse: () => unmarshalListDiscountLinesResponse,
27
29
  unmarshalListDiscountsResponse: () => unmarshalListDiscountsResponse,
30
+ unmarshalListInvoiceLinesResponse: () => unmarshalListInvoiceLinesResponse,
28
31
  unmarshalListInvoicesResponse: () => unmarshalListInvoicesResponse,
29
32
  unmarshalListTaxesResponse: () => unmarshalListTaxesResponse
30
33
  });
31
34
 
32
35
  //#endregion
33
- export { API, DISCOUNT_DISCOUNT_MODES, DISCOUNT_FILTER_TYPES, DOWNLOAD_INVOICE_REQUEST_FILE_TYPES, EXPORT_INVOICES_REQUEST_FILE_TYPES, EXPORT_INVOICES_REQUEST_ORDER_BIES, FinOpsAPI, INVOICE_TYPES, LIST_CHARGES_REQUEST_ORDER_BIES, LIST_CONSUMPTIONS_REQUEST_ORDER_BIES, LIST_DISCOUNTS_REQUEST_ORDER_BIES, LIST_INVOICES_REQUEST_ORDER_BIES, LIST_TAXES_REQUEST_ORDER_BIES, validation_rules_gen_exports as ValidationRules, index_gen_exports, unmarshalDiscount, unmarshalInvoice, unmarshalListChargesResponse, unmarshalListConsumptionsResponse, unmarshalListDiscountsResponse, unmarshalListInvoicesResponse, unmarshalListTaxesResponse };
36
+ export { API, DISCOUNT_DISCOUNT_MODES, DISCOUNT_FILTER_TYPES, DISCOUNT_LINE_ORIGINS, DOWNLOAD_INVOICE_REQUEST_FILE_TYPES, EXPORT_INVOICES_REQUEST_FILE_TYPES, EXPORT_INVOICES_REQUEST_ORDER_BIES, FinOpsAPI, INVOICE_TYPES, LIST_CHARGES_REQUEST_ORDER_BIES, LIST_CONSUMPTIONS_REQUEST_ORDER_BIES, LIST_DISCOUNTS_REQUEST_ORDER_BIES, LIST_INVOICES_REQUEST_ORDER_BIES, LIST_TAXES_REQUEST_ORDER_BIES, validation_rules_gen_exports as ValidationRules, index_gen_exports, unmarshalDiscount, unmarshalInvoice, unmarshalListChargesResponse, unmarshalListConsumptionsResponse, unmarshalListDiscountLinesResponse, unmarshalListDiscountsResponse, unmarshalListInvoiceLinesResponse, unmarshalListInvoicesResponse, unmarshalListTaxesResponse };
@@ -1,10 +1,12 @@
1
- import { Discount, Invoice, ListChargesResponse, ListConsumptionsResponse, ListDiscountsResponse, ListInvoicesResponse, ListTaxesResponse } from "./types.gen.js";
1
+ import { Discount, Invoice, ListChargesResponse, ListConsumptionsResponse, ListDiscountLinesResponse, ListDiscountsResponse, ListInvoiceLinesResponse, ListInvoicesResponse, ListTaxesResponse } from "./types.gen.js";
2
2
  //#region src/v2beta1/marshalling.gen.d.ts
3
3
  export declare const unmarshalDiscount: (data: unknown) => Discount;
4
4
  export declare const unmarshalInvoice: (data: unknown) => Invoice;
5
5
  export declare const unmarshalListChargesResponse: (data: unknown) => ListChargesResponse;
6
6
  export declare const unmarshalListConsumptionsResponse: (data: unknown) => ListConsumptionsResponse;
7
+ export declare const unmarshalListDiscountLinesResponse: (data: unknown) => ListDiscountLinesResponse;
7
8
  export declare const unmarshalListDiscountsResponse: (data: unknown) => ListDiscountsResponse;
9
+ export declare const unmarshalListInvoiceLinesResponse: (data: unknown) => ListInvoiceLinesResponse;
8
10
  export declare const unmarshalListInvoicesResponse: (data: unknown) => ListInvoicesResponse;
9
11
  export declare const unmarshalListTaxesResponse: (data: unknown) => ListTaxesResponse;
10
12
  //#endregion
@@ -101,6 +101,22 @@ const unmarshalListConsumptionsResponse = (data) => {
101
101
  updatedAt: unmarshalDate(data.updated_at) ?? null
102
102
  };
103
103
  };
104
+ const unmarshalDiscountLine = (data) => {
105
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'DiscountLine' failed as data isn't a dictionary.`);
106
+ return {
107
+ id: data.id,
108
+ invoiceLineId: data.invoice_line_id,
109
+ origin: data.origin,
110
+ value: data.value ? unmarshalMoney(data.value) : null
111
+ };
112
+ };
113
+ const unmarshalListDiscountLinesResponse = (data) => {
114
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListDiscountLinesResponse' failed as data isn't a dictionary.`);
115
+ return {
116
+ discountLines: unmarshalArrayOfObject(data.discount_lines, unmarshalDiscountLine),
117
+ totalCount: data.total_count
118
+ };
119
+ };
104
120
  const unmarshalListDiscountsResponse = (data) => {
105
121
  if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListDiscountsResponse' failed as data isn't a dictionary.`);
106
122
  return {
@@ -108,6 +124,36 @@ const unmarshalListDiscountsResponse = (data) => {
108
124
  totalCount: data.total_count
109
125
  };
110
126
  };
127
+ const unmarshalInvoiceLine = (data) => {
128
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'InvoiceLine' failed as data isn't a dictionary.`);
129
+ return {
130
+ billedQuantity: data.billed_quantity,
131
+ categoryName: data.category_name,
132
+ id: data.id,
133
+ invoiceId: data.invoice_id,
134
+ organizationId: data.organization_id,
135
+ organizationName: data.organization_name,
136
+ productName: data.product_name,
137
+ projectId: data.project_id,
138
+ projectName: data.project_name,
139
+ resourceCount: data.resource_count,
140
+ resourceName: data.resource_name,
141
+ sku: data.sku,
142
+ startDate: unmarshalDate(data.start_date) ?? null,
143
+ stopDate: unmarshalDate(data.stop_date) ?? null,
144
+ unit: data.unit,
145
+ unitPrice: data.unit_price ? unmarshalMoney(data.unit_price) : null,
146
+ unitQuantity: data.unit_quantity,
147
+ untaxedValue: data.untaxed_value ? unmarshalMoney(data.untaxed_value) : null
148
+ };
149
+ };
150
+ const unmarshalListInvoiceLinesResponse = (data) => {
151
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListInvoiceLinesResponse' failed as data isn't a dictionary.`);
152
+ return {
153
+ invoiceLines: unmarshalArrayOfObject(data.invoice_lines, unmarshalInvoiceLine),
154
+ totalCount: data.total_count
155
+ };
156
+ };
111
157
  const unmarshalListInvoicesResponse = (data) => {
112
158
  if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListInvoicesResponse' failed as data isn't a dictionary.`);
113
159
  return {
@@ -134,4 +180,4 @@ const unmarshalListTaxesResponse = (data) => {
134
180
  };
135
181
 
136
182
  //#endregion
137
- export { unmarshalDiscount, unmarshalInvoice, unmarshalListChargesResponse, unmarshalListConsumptionsResponse, unmarshalListDiscountsResponse, unmarshalListInvoicesResponse, unmarshalListTaxesResponse };
183
+ export { unmarshalDiscount, unmarshalInvoice, unmarshalListChargesResponse, unmarshalListConsumptionsResponse, unmarshalListDiscountLinesResponse, unmarshalListDiscountsResponse, unmarshalListInvoiceLinesResponse, unmarshalListInvoicesResponse, unmarshalListTaxesResponse };
@@ -67,6 +67,32 @@ export declare const queriesMetadata: {
67
67
  readonly listItemTypeNamespace: '@scaleway/sdk-billing/v2beta1';
68
68
  readonly isPrivate: false;
69
69
  readonly description: '"';
70
+ }, {
71
+ readonly methodName: 'listInvoiceLines';
72
+ readonly protoName: 'ListInvoiceLines';
73
+ readonly paramsType: 'ListInvoiceLinesRequest';
74
+ readonly returnType: 'ListInvoiceLinesResponse';
75
+ readonly returnTypeNamespace: '@scaleway/sdk-billing/v2beta1';
76
+ readonly isList: true;
77
+ readonly paginationType: 'offset';
78
+ readonly pageParamKey: 'page';
79
+ readonly listItemType: 'InvoiceLine';
80
+ readonly listItemTypeNamespace: '@scaleway/sdk-billing/v2beta1';
81
+ readonly isPrivate: false;
82
+ readonly description: '"';
83
+ }, {
84
+ readonly methodName: 'listDiscountLines';
85
+ readonly protoName: 'ListDiscountLines';
86
+ readonly paramsType: 'ListDiscountLinesRequest';
87
+ readonly returnType: 'ListDiscountLinesResponse';
88
+ readonly returnTypeNamespace: '@scaleway/sdk-billing/v2beta1';
89
+ readonly isList: true;
90
+ readonly paginationType: 'offset';
91
+ readonly pageParamKey: 'page';
92
+ readonly listItemType: 'DiscountLine';
93
+ readonly listItemTypeNamespace: '@scaleway/sdk-billing/v2beta1';
94
+ readonly isPrivate: false;
95
+ readonly description: '"';
70
96
  }];
71
97
  }, {
72
98
  readonly apiClass: 'FinOpsAPI';
@@ -72,6 +72,34 @@ const queriesMetadata = {
72
72
  listItemTypeNamespace: "@scaleway/sdk-billing/v2beta1",
73
73
  isPrivate: false,
74
74
  description: "\""
75
+ },
76
+ {
77
+ methodName: "listInvoiceLines",
78
+ protoName: "ListInvoiceLines",
79
+ paramsType: "ListInvoiceLinesRequest",
80
+ returnType: "ListInvoiceLinesResponse",
81
+ returnTypeNamespace: "@scaleway/sdk-billing/v2beta1",
82
+ isList: true,
83
+ paginationType: "offset",
84
+ pageParamKey: "page",
85
+ listItemType: "InvoiceLine",
86
+ listItemTypeNamespace: "@scaleway/sdk-billing/v2beta1",
87
+ isPrivate: false,
88
+ description: "\""
89
+ },
90
+ {
91
+ methodName: "listDiscountLines",
92
+ protoName: "ListDiscountLines",
93
+ paramsType: "ListDiscountLinesRequest",
94
+ returnType: "ListDiscountLinesResponse",
95
+ returnTypeNamespace: "@scaleway/sdk-billing/v2beta1",
96
+ isList: true,
97
+ paginationType: "offset",
98
+ pageParamKey: "page",
99
+ listItemType: "DiscountLine",
100
+ listItemTypeNamespace: "@scaleway/sdk-billing/v2beta1",
101
+ isPrivate: false,
102
+ description: "\""
75
103
  }
76
104
  ]
77
105
  }, {
@@ -2,6 +2,7 @@ import { Money } from "@scaleway/sdk-client";
2
2
  //#region src/v2beta1/types.gen.d.ts
3
3
  export type DiscountDiscountMode = 'unknown_discount_mode' | 'discount_mode_rate' | 'discount_mode_value' | 'discount_mode_splittable';
4
4
  export type DiscountFilterType = 'unknown_type' | 'category_name' | 'product_name' | 'product_range' | 'resource_name' | 'region' | 'zone';
5
+ export type DiscountLineOrigin = 'unknown_origin' | 'discount' | 'contractual_commitment_range' | 'savings_plan_activation' | 'credit_note_rebate' | 'reserved_resource_activation' | 'offer_included';
5
6
  export type DownloadInvoiceRequestFileType = 'pdf';
6
7
  export type ExportInvoicesRequestFileType = 'csv';
7
8
  export type ExportInvoicesRequestOrderBy = 'invoice_number_desc' | 'invoice_number_asc' | 'start_date_desc' | 'start_date_asc' | 'issued_date_desc' | 'issued_date_asc' | 'due_date_desc' | 'due_date_asc' | 'total_untaxed_desc' | 'total_untaxed_asc' | 'total_taxed_desc' | 'total_taxed_asc' | 'invoice_type_desc' | 'invoice_type_asc';
@@ -127,6 +128,24 @@ export interface ListConsumptionsResponseConsumption {
127
128
  */
128
129
  organizationName: string;
129
130
  }
131
+ export interface DiscountLine {
132
+ /**
133
+ * Discount line ID.
134
+ */
135
+ id: string;
136
+ /**
137
+ * ID of the invoice line the discount applies to.
138
+ */
139
+ invoiceLineId: string;
140
+ /**
141
+ * The origin of the discount line.
142
+ */
143
+ origin: DiscountLineOrigin;
144
+ /**
145
+ * The value of the discount.
146
+ */
147
+ value?: Money | null;
148
+ }
130
149
  export interface Discount {
131
150
  /**
132
151
  * The ID of the discount.
@@ -177,6 +196,80 @@ export interface Discount {
177
196
  */
178
197
  filters: DiscountFilter[];
179
198
  }
199
+ export interface InvoiceLine {
200
+ /**
201
+ * Invoice line ID.
202
+ */
203
+ id: string;
204
+ /**
205
+ * ID of the invoice the line belongs to.
206
+ */
207
+ invoiceId: string;
208
+ /**
209
+ * Organization ID of the consumer for this line.
210
+ */
211
+ organizationId: string;
212
+ /**
213
+ * Organization name of the consumer for this line.
214
+ */
215
+ organizationName: string;
216
+ /**
217
+ * Project ID of the line.
218
+ */
219
+ projectId: string;
220
+ /**
221
+ * Project name of the line.
222
+ */
223
+ projectName: string;
224
+ /**
225
+ * Unique identifier of the product.
226
+ */
227
+ sku: string;
228
+ /**
229
+ * Name of consumption category.
230
+ */
231
+ categoryName: string;
232
+ /**
233
+ * The product name.
234
+ */
235
+ productName: string;
236
+ /**
237
+ * Identifies the reference based on the category.
238
+ */
239
+ resourceName: string;
240
+ /**
241
+ * Start date of the line.
242
+ */
243
+ startDate?: Date | null;
244
+ /**
245
+ * Stop date of the line.
246
+ */
247
+ stopDate?: Date | null;
248
+ /**
249
+ * Unit price of the reference.
250
+ */
251
+ unitPrice?: Money | null;
252
+ /**
253
+ * Untaxed value of the line.
254
+ */
255
+ untaxedValue?: Money | null;
256
+ /**
257
+ * Unit of consumed quantity.
258
+ */
259
+ unit: string;
260
+ /**
261
+ * Quantity per unit.
262
+ */
263
+ unitQuantity: string;
264
+ /**
265
+ * Billed quantity.
266
+ */
267
+ billedQuantity: string;
268
+ /**
269
+ * Number of unique resources billed on this line.
270
+ */
271
+ resourceCount: number;
272
+ }
180
273
  export interface Invoice {
181
274
  /**
182
275
  * Invoice ID.
@@ -418,6 +511,30 @@ export interface ListConsumptionsResponse {
418
511
  */
419
512
  updatedAt?: Date | null;
420
513
  }
514
+ export type ListDiscountLinesRequest = {
515
+ /**
516
+ * Invoice ID.
517
+ */
518
+ invoiceId: string;
519
+ /**
520
+ * Positive integer to choose the page to return.
521
+ */
522
+ page?: number | null;
523
+ /**
524
+ * Positive integer lower or equal to 1000 to select the number of items to return.
525
+ */
526
+ pageSize?: number | null;
527
+ };
528
+ export interface ListDiscountLinesResponse {
529
+ /**
530
+ * Total number of discount lines.
531
+ */
532
+ totalCount: number;
533
+ /**
534
+ * Paginated returned discount lines.
535
+ */
536
+ discountLines: DiscountLine[];
537
+ }
421
538
  export type ListDiscountsRequest = {
422
539
  /**
423
540
  * Order discounts in the response by their description.
@@ -446,6 +563,30 @@ export interface ListDiscountsResponse {
446
563
  */
447
564
  discounts: Discount[];
448
565
  }
566
+ export type ListInvoiceLinesRequest = {
567
+ /**
568
+ * Invoice ID.
569
+ */
570
+ invoiceId: string;
571
+ /**
572
+ * Positive integer to choose the page to return.
573
+ */
574
+ page?: number | null;
575
+ /**
576
+ * Positive integer lower or equal to 1000 to select the number of items to return.
577
+ */
578
+ pageSize?: number | null;
579
+ };
580
+ export interface ListInvoiceLinesResponse {
581
+ /**
582
+ * Total number of invoice lines.
583
+ */
584
+ totalCount: number;
585
+ /**
586
+ * Paginated returned invoice lines.
587
+ */
588
+ invoiceLines: InvoiceLine[];
589
+ }
449
590
  export type ListInvoicesRequest = {
450
591
  /**
451
592
  * Organization ID. If specified, only invoices from this Organization will be returned.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scaleway/sdk-billing",
3
- "version": "2.22.0",
3
+ "version": "2.23.1",
4
4
  "description": "Scaleway SDK billing",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -33,14 +33,14 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@scaleway/random-name": "6.0.2",
36
- "@scaleway/sdk-std": "2.9.6"
36
+ "@scaleway/sdk-std": "2.9.7"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@repo/configs": "^0.1.1",
40
- "@scaleway/sdk-client": "^2.17.0"
40
+ "@scaleway/sdk-client": "^2.18.0"
41
41
  },
42
42
  "peerDependencies": {
43
- "@scaleway/sdk-client": "^2.17.0"
43
+ "@scaleway/sdk-client": "^2.18.0"
44
44
  },
45
45
  "scripts": {
46
46
  "package:check": "pnpm publint",