diff --git a/api.md b/api.md index f9a360b..e76b53e 100755 --- a/api.md +++ b/api.md @@ -2,15 +2,22 @@ Types: +- BaseUsageFilter - Commit - ContractWithoutAmendments +- Credit - CreditType - Discount +- EventTypeFilter - ID - Override +- PropertyFilter +- ProService - Rate -- SchedulePointInTime - ScheduledCharge +- ScheduleDuration +- SchedulePointInTime +- Tier # Alerts @@ -299,6 +306,9 @@ Methods: Types: +- ProductListItemState +- QuantityConversion +- QuantityRounding - ProductCreateResponse - ProductRetrieveResponse - ProductUpdateResponse diff --git a/src/index.ts b/src/index.ts index 5924a65..6188a98 100755 --- a/src/index.ts +++ b/src/index.ts @@ -333,15 +333,22 @@ export namespace Metronome { export import ContractSetUsageFilterParams = API.ContractSetUsageFilterParams; export import ContractUpdateEndDateParams = API.ContractUpdateEndDateParams; + export import BaseUsageFilter = API.BaseUsageFilter; export import Commit = API.Commit; export import ContractWithoutAmendments = API.ContractWithoutAmendments; + export import Credit = API.Credit; export import CreditType = API.CreditType; export import Discount = API.Discount; + export import EventTypeFilter = API.EventTypeFilter; export import ID = API.ID; export import Override = API.Override; + export import PropertyFilter = API.PropertyFilter; + export import ProService = API.ProService; export import Rate = API.Rate; - export import SchedulePointInTime = API.SchedulePointInTime; export import ScheduledCharge = API.ScheduledCharge; + export import ScheduleDuration = API.ScheduleDuration; + export import SchedulePointInTime = API.SchedulePointInTime; + export import Tier = API.Tier; } export default Metronome; diff --git a/src/resources/billable-metrics.ts b/src/resources/billable-metrics.ts index 97c83bc..1dc72c5 100755 --- a/src/resources/billable-metrics.ts +++ b/src/resources/billable-metrics.ts @@ -105,7 +105,7 @@ export namespace BillableMetricRetrieveResponse { /** * An optional filtering rule to match the 'event_type' property of an event. */ - event_type_filter?: Data.EventTypeFilter; + event_type_filter?: Shared.EventTypeFilter; /** * Property names that are used to group usage costs on an invoice. Each entry @@ -118,65 +118,13 @@ export namespace BillableMetricRetrieveResponse { * rule on an event property. All rules must pass for the event to match the * billable metric. */ - property_filters?: Array; + property_filters?: Array; /** * The SQL query associated with the billable metric */ sql?: string; } - - export namespace Data { - /** - * An optional filtering rule to match the 'event_type' property of an event. - */ - export interface EventTypeFilter { - /** - * A list of event types that are explicitly included in the billable metric. If - * specified, only events of these types will match the billable metric. Must be - * non-empty if present. - */ - in_values?: Array; - - /** - * A list of event types that are explicitly excluded from the billable metric. If - * specified, events of these types will not match the billable metric. Must be - * non-empty if present. - */ - not_in_values?: Array; - } - - export interface PropertyFilter { - /** - * The name of the event property. - */ - name: string; - - /** - * Determines whether the property must exist in the event. If true, only events - * with this property will pass the filter. If false, only events without this - * property will pass the filter. If null or omitted, the existence of the property - * is optional. - */ - exists?: boolean; - - /** - * Specifies the allowed values for the property to match an event. An event will - * pass the filter only if its property value is included in this list. If - * undefined, all property values will pass the filter. Must be non-empty if - * present. - */ - in_values?: Array; - - /** - * Specifies the values that prevent an event from matching the filter. An event - * will not pass the filter if its property value is included in this list. If null - * or empty, all property values will pass the filter. Must be non-empty if - * present. - */ - not_in_values?: Array; - } - } } export interface BillableMetricListResponse { @@ -211,7 +159,7 @@ export interface BillableMetricListResponse { /** * An optional filtering rule to match the 'event_type' property of an event. */ - event_type_filter?: BillableMetricListResponse.EventTypeFilter; + event_type_filter?: Shared.EventTypeFilter; /** * (DEPRECATED) use property_filters & event_type_filter instead @@ -234,7 +182,7 @@ export interface BillableMetricListResponse { * rule on an event property. All rules must pass for the event to match the * billable metric. */ - property_filters?: Array; + property_filters?: Array; /** * The SQL query associated with the billable metric @@ -242,58 +190,6 @@ export interface BillableMetricListResponse { sql?: string; } -export namespace BillableMetricListResponse { - /** - * An optional filtering rule to match the 'event_type' property of an event. - */ - export interface EventTypeFilter { - /** - * A list of event types that are explicitly included in the billable metric. If - * specified, only events of these types will match the billable metric. Must be - * non-empty if present. - */ - in_values?: Array; - - /** - * A list of event types that are explicitly excluded from the billable metric. If - * specified, events of these types will not match the billable metric. Must be - * non-empty if present. - */ - not_in_values?: Array; - } - - export interface PropertyFilter { - /** - * The name of the event property. - */ - name: string; - - /** - * Determines whether the property must exist in the event. If true, only events - * with this property will pass the filter. If false, only events without this - * property will pass the filter. If null or omitted, the existence of the property - * is optional. - */ - exists?: boolean; - - /** - * Specifies the allowed values for the property to match an event. An event will - * pass the filter only if its property value is included in this list. If - * undefined, all property values will pass the filter. Must be non-empty if - * present. - */ - in_values?: Array; - - /** - * Specifies the values that prevent an event from matching the filter. An event - * will not pass the filter if its property value is included in this list. If null - * or empty, all property values will pass the filter. Must be non-empty if - * present. - */ - not_in_values?: Array; - } -} - export interface BillableMetricArchiveResponse { data: Shared.ID; } @@ -324,7 +220,7 @@ export interface BillableMetricCreateParams { /** * An optional filtering rule to match the 'event_type' property of an event. */ - event_type_filter?: BillableMetricCreateParams.EventTypeFilter; + event_type_filter?: Shared.EventTypeFilter; /** * Property names that are used to group usage costs on an invoice. Each entry @@ -337,59 +233,7 @@ export interface BillableMetricCreateParams { * rule on an event property. All rules must pass for the event to match the * billable metric. */ - property_filters?: Array; -} - -export namespace BillableMetricCreateParams { - /** - * An optional filtering rule to match the 'event_type' property of an event. - */ - export interface EventTypeFilter { - /** - * A list of event types that are explicitly included in the billable metric. If - * specified, only events of these types will match the billable metric. Must be - * non-empty if present. - */ - in_values?: Array; - - /** - * A list of event types that are explicitly excluded from the billable metric. If - * specified, events of these types will not match the billable metric. Must be - * non-empty if present. - */ - not_in_values?: Array; - } - - export interface PropertyFilter { - /** - * The name of the event property. - */ - name: string; - - /** - * Determines whether the property must exist in the event. If true, only events - * with this property will pass the filter. If false, only events without this - * property will pass the filter. If null or omitted, the existence of the property - * is optional. - */ - exists?: boolean; - - /** - * Specifies the allowed values for the property to match an event. An event will - * pass the filter only if its property value is included in this list. If - * undefined, all property values will pass the filter. Must be non-empty if - * present. - */ - in_values?: Array; - - /** - * Specifies the values that prevent an event from matching the filter. An event - * will not pass the filter if its property value is included in this list. If null - * or empty, all property values will pass the filter. Must be non-empty if - * present. - */ - not_in_values?: Array; - } + property_filters?: Array; } export interface BillableMetricListParams extends CursorPageParams { diff --git a/src/resources/contracts/contracts.ts b/src/resources/contracts/contracts.ts index b300230..8887e7d 100755 --- a/src/resources/contracts/contracts.ts +++ b/src/resources/contracts/contracts.ts @@ -178,7 +178,7 @@ export namespace ContractRetrieveResponse { starting_at: string; - credits?: Array; + credits?: Array; /** * This field's availability is dependent on your client's configuration. @@ -193,7 +193,7 @@ export namespace ContractRetrieveResponse { /** * This field's availability is dependent on your client's configuration. */ - professional_services?: Array; + professional_services?: Array; /** * This field's availability is dependent on your client's configuration. @@ -207,193 +207,6 @@ export namespace ContractRetrieveResponse { } export namespace Amendment { - export interface Credit { - id: string; - - product: Credit.Product; - - type: 'CREDIT'; - - /** - * The schedule that the customer will gain access to the credits. - */ - access_schedule?: Credit.AccessSchedule; - - applicable_contract_ids?: Array; - - applicable_product_ids?: Array; - - applicable_product_tags?: Array; - - contract?: Credit.Contract; - - custom_fields?: Record; - - description?: string; - - /** - * A list of ordered events that impact the balance of a credit. For example, an - * invoice deduction or an expiration. - */ - ledger?: Array< - | Credit.CreditSegmentStartLedgerEntry - | Credit.CreditAutomatedInvoiceDeductionLedgerEntry - | Credit.CreditExpirationLedgerEntry - | Credit.CreditCanceledLedgerEntry - | Credit.CreditCreditedLedgerEntry - | Credit.CreditManualLedgerEntry - >; - - name?: string; - - /** - * This field's availability is dependent on your client's configuration. - */ - netsuite_sales_order_id?: string; - - /** - * If multiple credits or commits are applicable, the one with the lower priority - * will apply first. - */ - priority?: number; - - /** - * This field's availability is dependent on your client's configuration. - */ - salesforce_opportunity_id?: string; - } - - export namespace Credit { - export interface Product { - id: string; - - name: string; - } - - /** - * The schedule that the customer will gain access to the credits. - */ - export interface AccessSchedule { - schedule_items: Array; - - credit_type?: Shared.CreditType; - } - - export namespace AccessSchedule { - export interface ScheduleItem { - id: string; - - amount: number; - - ending_before: string; - - starting_at: string; - } - } - - export interface Contract { - id: string; - } - - export interface CreditSegmentStartLedgerEntry { - amount: number; - - segment_id: string; - - timestamp: string; - - type: 'CREDIT_SEGMENT_START'; - } - - export interface CreditAutomatedInvoiceDeductionLedgerEntry { - amount: number; - - invoice_id: string; - - segment_id: string; - - timestamp: string; - - type: 'CREDIT_AUTOMATED_INVOICE_DEDUCTION'; - } - - export interface CreditExpirationLedgerEntry { - amount: number; - - segment_id: string; - - timestamp: string; - - type: 'CREDIT_EXPIRATION'; - } - - export interface CreditCanceledLedgerEntry { - amount: number; - - invoice_id: string; - - segment_id: string; - - timestamp: string; - - type: 'CREDIT_CANCELED'; - } - - export interface CreditCreditedLedgerEntry { - amount: number; - - invoice_id: string; - - segment_id: string; - - timestamp: string; - - type: 'CREDIT_CREDITED'; - } - - export interface CreditManualLedgerEntry { - amount: number; - - reason: string; - - timestamp: string; - - type: 'CREDIT_MANUAL'; - } - } - - export interface ProfessionalService { - id: string; - - /** - * Maximum amount for the term. - */ - max_amount: number; - - product_id: string; - - /** - * Quantity for the charge. Will be multiplied by unit_price to determine the - * amount. - */ - quantity: number; - - /** - * Unit price for the charge. Will be multiplied by quantity to determine the - * amount and must be specified. - */ - unit_price: number; - - custom_fields?: Record; - - description?: string; - - /** - * This field's availability is dependent on your client's configuration. - */ - netsuite_sales_order_id?: string; - } - export interface ResellerRoyalty { reseller_type: 'AWS' | 'AWS_PRO_SERVICE' | 'GCP' | 'GCP_PRO_SERVICE'; @@ -485,7 +298,7 @@ export namespace ContractListResponse { starting_at: string; - credits?: Array; + credits?: Array; /** * This field's availability is dependent on your client's configuration. @@ -500,7 +313,7 @@ export namespace ContractListResponse { /** * This field's availability is dependent on your client's configuration. */ - professional_services?: Array; + professional_services?: Array; /** * This field's availability is dependent on your client's configuration. @@ -514,193 +327,6 @@ export namespace ContractListResponse { } export namespace Amendment { - export interface Credit { - id: string; - - product: Credit.Product; - - type: 'CREDIT'; - - /** - * The schedule that the customer will gain access to the credits. - */ - access_schedule?: Credit.AccessSchedule; - - applicable_contract_ids?: Array; - - applicable_product_ids?: Array; - - applicable_product_tags?: Array; - - contract?: Credit.Contract; - - custom_fields?: Record; - - description?: string; - - /** - * A list of ordered events that impact the balance of a credit. For example, an - * invoice deduction or an expiration. - */ - ledger?: Array< - | Credit.CreditSegmentStartLedgerEntry - | Credit.CreditAutomatedInvoiceDeductionLedgerEntry - | Credit.CreditExpirationLedgerEntry - | Credit.CreditCanceledLedgerEntry - | Credit.CreditCreditedLedgerEntry - | Credit.CreditManualLedgerEntry - >; - - name?: string; - - /** - * This field's availability is dependent on your client's configuration. - */ - netsuite_sales_order_id?: string; - - /** - * If multiple credits or commits are applicable, the one with the lower priority - * will apply first. - */ - priority?: number; - - /** - * This field's availability is dependent on your client's configuration. - */ - salesforce_opportunity_id?: string; - } - - export namespace Credit { - export interface Product { - id: string; - - name: string; - } - - /** - * The schedule that the customer will gain access to the credits. - */ - export interface AccessSchedule { - schedule_items: Array; - - credit_type?: Shared.CreditType; - } - - export namespace AccessSchedule { - export interface ScheduleItem { - id: string; - - amount: number; - - ending_before: string; - - starting_at: string; - } - } - - export interface Contract { - id: string; - } - - export interface CreditSegmentStartLedgerEntry { - amount: number; - - segment_id: string; - - timestamp: string; - - type: 'CREDIT_SEGMENT_START'; - } - - export interface CreditAutomatedInvoiceDeductionLedgerEntry { - amount: number; - - invoice_id: string; - - segment_id: string; - - timestamp: string; - - type: 'CREDIT_AUTOMATED_INVOICE_DEDUCTION'; - } - - export interface CreditExpirationLedgerEntry { - amount: number; - - segment_id: string; - - timestamp: string; - - type: 'CREDIT_EXPIRATION'; - } - - export interface CreditCanceledLedgerEntry { - amount: number; - - invoice_id: string; - - segment_id: string; - - timestamp: string; - - type: 'CREDIT_CANCELED'; - } - - export interface CreditCreditedLedgerEntry { - amount: number; - - invoice_id: string; - - segment_id: string; - - timestamp: string; - - type: 'CREDIT_CREDITED'; - } - - export interface CreditManualLedgerEntry { - amount: number; - - reason: string; - - timestamp: string; - - type: 'CREDIT_MANUAL'; - } - } - - export interface ProfessionalService { - id: string; - - /** - * Maximum amount for the term. - */ - max_amount: number; - - product_id: string; - - /** - * Quantity for the charge. Will be multiplied by unit_price to determine the - * amount. - */ - quantity: number; - - /** - * Unit price for the charge. Will be multiplied by quantity to determine the - * amount and must be specified. - */ - unit_price: number; - - custom_fields?: Record; - - description?: string; - - /** - * This field's availability is dependent on your client's configuration. - */ - netsuite_sales_order_id?: string; - } - export interface ResellerRoyalty { reseller_type: 'AWS' | 'AWS_PRO_SERVICE' | 'GCP' | 'GCP_PRO_SERVICE'; @@ -754,168 +380,11 @@ export interface ContractArchiveResponse { } export interface ContractListBalancesResponse { - data: Array; + data: Array; next_page: string | null; } -export namespace ContractListBalancesResponse { - export interface Credit { - id: string; - - product: Credit.Product; - - type: 'CREDIT'; - - /** - * The schedule that the customer will gain access to the credits. - */ - access_schedule?: Credit.AccessSchedule; - - applicable_contract_ids?: Array; - - applicable_product_ids?: Array; - - applicable_product_tags?: Array; - - contract?: Credit.Contract; - - custom_fields?: Record; - - description?: string; - - /** - * A list of ordered events that impact the balance of a credit. For example, an - * invoice deduction or an expiration. - */ - ledger?: Array< - | Credit.CreditSegmentStartLedgerEntry - | Credit.CreditAutomatedInvoiceDeductionLedgerEntry - | Credit.CreditExpirationLedgerEntry - | Credit.CreditCanceledLedgerEntry - | Credit.CreditCreditedLedgerEntry - | Credit.CreditManualLedgerEntry - >; - - name?: string; - - /** - * This field's availability is dependent on your client's configuration. - */ - netsuite_sales_order_id?: string; - - /** - * If multiple credits or commits are applicable, the one with the lower priority - * will apply first. - */ - priority?: number; - - /** - * This field's availability is dependent on your client's configuration. - */ - salesforce_opportunity_id?: string; - } - - export namespace Credit { - export interface Product { - id: string; - - name: string; - } - - /** - * The schedule that the customer will gain access to the credits. - */ - export interface AccessSchedule { - schedule_items: Array; - - credit_type?: Shared.CreditType; - } - - export namespace AccessSchedule { - export interface ScheduleItem { - id: string; - - amount: number; - - ending_before: string; - - starting_at: string; - } - } - - export interface Contract { - id: string; - } - - export interface CreditSegmentStartLedgerEntry { - amount: number; - - segment_id: string; - - timestamp: string; - - type: 'CREDIT_SEGMENT_START'; - } - - export interface CreditAutomatedInvoiceDeductionLedgerEntry { - amount: number; - - invoice_id: string; - - segment_id: string; - - timestamp: string; - - type: 'CREDIT_AUTOMATED_INVOICE_DEDUCTION'; - } - - export interface CreditExpirationLedgerEntry { - amount: number; - - segment_id: string; - - timestamp: string; - - type: 'CREDIT_EXPIRATION'; - } - - export interface CreditCanceledLedgerEntry { - amount: number; - - invoice_id: string; - - segment_id: string; - - timestamp: string; - - type: 'CREDIT_CANCELED'; - } - - export interface CreditCreditedLedgerEntry { - amount: number; - - invoice_id: string; - - segment_id: string; - - timestamp: string; - - type: 'CREDIT_CREDITED'; - } - - export interface CreditManualLedgerEntry { - amount: number; - - reason: string; - - timestamp: string; - - type: 'CREDIT_MANUAL'; - } - } -} - export interface ContractRetrieveRateScheduleResponse { data: Array; @@ -1043,7 +512,7 @@ export interface ContractCreateParams { */ uniqueness_key?: string; - usage_filter?: ContractCreateParams.UsageFilter; + usage_filter?: Shared.BaseUsageFilter; usage_statement_schedule?: ContractCreateParams.UsageStatementSchedule; } @@ -1559,15 +1028,7 @@ export namespace ContractCreateParams { /** * Only set for TIERED rate_type. */ - tiers?: Array; - } - - export namespace OverwriteRate { - export interface Tier { - price: number; - - size?: number; - } + tiers?: Array; } export interface Tier { @@ -1787,14 +1248,6 @@ export namespace ContractCreateParams { } } - export interface UsageFilter { - group_key: string; - - group_values: Array; - - starting_at?: string; - } - export interface UsageStatementSchedule { frequency: 'MONTHLY' | 'QUARTERLY'; @@ -2446,15 +1899,7 @@ export namespace ContractAmendParams { /** * Only set for TIERED rate_type. */ - tiers?: Array; - } - - export namespace OverwriteRate { - export interface Tier { - price: number; - - size?: number; - } + tiers?: Array; } export interface Tier { @@ -2903,6 +2348,9 @@ export namespace Contracts { export import ContractSetUsageFilterParams = ContractsAPI.ContractSetUsageFilterParams; export import ContractUpdateEndDateParams = ContractsAPI.ContractUpdateEndDateParams; export import Products = ProductsAPI.Products; + export import ProductListItemState = ProductsAPI.ProductListItemState; + export import QuantityConversion = ProductsAPI.QuantityConversion; + export import QuantityRounding = ProductsAPI.QuantityRounding; export import ProductCreateResponse = ProductsAPI.ProductCreateResponse; export import ProductRetrieveResponse = ProductsAPI.ProductRetrieveResponse; export import ProductUpdateResponse = ProductsAPI.ProductUpdateResponse; diff --git a/src/resources/contracts/index.ts b/src/resources/contracts/index.ts index f1c36e4..210eb28 100755 --- a/src/resources/contracts/index.ts +++ b/src/resources/contracts/index.ts @@ -30,6 +30,9 @@ export { NamedSchedules, } from './named-schedules'; export { + ProductListItemState, + QuantityConversion, + QuantityRounding, ProductCreateResponse, ProductRetrieveResponse, ProductUpdateResponse, diff --git a/src/resources/contracts/products.ts b/src/resources/contracts/products.ts index 7b4f0db..1985a3e 100755 --- a/src/resources/contracts/products.ts +++ b/src/resources/contracts/products.ts @@ -69,242 +69,135 @@ export class Products extends APIResource { export class ProductListResponsesCursorPage extends CursorPage {} -export interface ProductCreateResponse { - data: Shared.ID; -} - -export interface ProductRetrieveResponse { - data: ProductRetrieveResponse.Data; -} - -export namespace ProductRetrieveResponse { - export interface Data { - id: string; - - current: Data.Current; - - initial: Data.Initial; - - type: 'USAGE' | 'SUBSCRIPTION' | 'COMPOSITE' | 'FIXED' | 'PRO_SERVICE'; - - updates: Array; - - archived_at?: string | null; - - custom_fields?: Record; - } - - export namespace Data { - export interface Current { - created_at: string; - - created_by: string; - - name: string; - - billable_metric_id?: string; - - composite_product_ids?: Array; +export interface ProductListItemState { + created_at: string; - composite_tags?: Array; - - exclude_free_usage?: boolean; - - /** - * This field's availability is dependent on your client's configuration. - */ - is_refundable?: boolean; - - /** - * This field's availability is dependent on your client's configuration. - */ - netsuite_internal_item_id?: string; - - /** - * This field's availability is dependent on your client's configuration. - */ - netsuite_overage_item_id?: string; + created_by: string; - /** - * For USAGE products only. Groups usage line items on invoices. - */ - presentation_group_key?: Array; + name: string; - /** - * For USAGE products only. If set, pricing for this product will be determined for - * each pricing_group_key value, as opposed to the product as a whole. - */ - pricing_group_key?: Array; + billable_metric_id?: string; - /** - * Optional. Only valid for USAGE products. If provided, the quantity will be - * converted using the provided conversion factor and operation. For example, if - * the operation is "multiply" and the conversion factor is 100, then the quantity - * will be multiplied by 100. This can be used in cases where data is sent in one - * unit and priced in another. For example, data could be sent in MB and priced in - * GB. In this case, the conversion factor would be 1024 and the operation would be - * "divide". - */ - quantity_conversion?: Current.QuantityConversion | null; + composite_product_ids?: Array; - /** - * Optional. Only valid for USAGE products. If provided, the quantity will be - * rounded using the provided rounding method and decimal places. For example, if - * the method is "round up" and the decimal places is 0, then the quantity will be - * rounded up to the nearest integer. - */ - quantity_rounding?: Current.QuantityRounding | null; + composite_tags?: Array; - starting_at?: string; + exclude_free_usage?: boolean; - tags?: Array; - } + /** + * This field's availability is dependent on your client's configuration. + */ + is_refundable?: boolean; - export namespace Current { - /** - * Optional. Only valid for USAGE products. If provided, the quantity will be - * converted using the provided conversion factor and operation. For example, if - * the operation is "multiply" and the conversion factor is 100, then the quantity - * will be multiplied by 100. This can be used in cases where data is sent in one - * unit and priced in another. For example, data could be sent in MB and priced in - * GB. In this case, the conversion factor would be 1024 and the operation would be - * "divide". - */ - export interface QuantityConversion { - /** - * The factor to multiply or divide the quantity by. - */ - conversion_factor: number; - - /** - * The operation to perform on the quantity - */ - operation: 'MULTIPLY' | 'DIVIDE'; - - /** - * Optional name for this conversion. - */ - name?: string; - } + /** + * This field's availability is dependent on your client's configuration. + */ + netsuite_internal_item_id?: string; - /** - * Optional. Only valid for USAGE products. If provided, the quantity will be - * rounded using the provided rounding method and decimal places. For example, if - * the method is "round up" and the decimal places is 0, then the quantity will be - * rounded up to the nearest integer. - */ - export interface QuantityRounding { - decimal_places: number; + /** + * This field's availability is dependent on your client's configuration. + */ + netsuite_overage_item_id?: string; - rounding_method: 'ROUND_UP' | 'ROUND_DOWN' | 'ROUND_HALF_UP'; - } - } + /** + * For USAGE products only. Groups usage line items on invoices. + */ + presentation_group_key?: Array; - export interface Initial { - created_at: string; + /** + * For USAGE products only. If set, pricing for this product will be determined for + * each pricing_group_key value, as opposed to the product as a whole. + */ + pricing_group_key?: Array; - created_by: string; + /** + * Optional. Only valid for USAGE products. If provided, the quantity will be + * converted using the provided conversion factor and operation. For example, if + * the operation is "multiply" and the conversion factor is 100, then the quantity + * will be multiplied by 100. This can be used in cases where data is sent in one + * unit and priced in another. For example, data could be sent in MB and priced in + * GB. In this case, the conversion factor would be 1024 and the operation would be + * "divide". + */ + quantity_conversion?: QuantityConversion | null; - name: string; + /** + * Optional. Only valid for USAGE products. If provided, the quantity will be + * rounded using the provided rounding method and decimal places. For example, if + * the method is "round up" and the decimal places is 0, then the quantity will be + * rounded up to the nearest integer. + */ + quantity_rounding?: QuantityRounding | null; - billable_metric_id?: string; + starting_at?: string; - composite_product_ids?: Array; + tags?: Array; +} - composite_tags?: Array; +/** + * Optional. Only valid for USAGE products. If provided, the quantity will be + * converted using the provided conversion factor and operation. For example, if + * the operation is "multiply" and the conversion factor is 100, then the quantity + * will be multiplied by 100. This can be used in cases where data is sent in one + * unit and priced in another. For example, data could be sent in MB and priced in + * GB. In this case, the conversion factor would be 1024 and the operation would be + * "divide". + */ +export interface QuantityConversion { + /** + * The factor to multiply or divide the quantity by. + */ + conversion_factor: number; - exclude_free_usage?: boolean; + /** + * The operation to perform on the quantity + */ + operation: 'MULTIPLY' | 'DIVIDE'; - /** - * This field's availability is dependent on your client's configuration. - */ - is_refundable?: boolean; + /** + * Optional name for this conversion. + */ + name?: string; +} - /** - * This field's availability is dependent on your client's configuration. - */ - netsuite_internal_item_id?: string; +/** + * Optional. Only valid for USAGE products. If provided, the quantity will be + * rounded using the provided rounding method and decimal places. For example, if + * the method is "round up" and the decimal places is 0, then the quantity will be + * rounded up to the nearest integer. + */ +export interface QuantityRounding { + decimal_places: number; - /** - * This field's availability is dependent on your client's configuration. - */ - netsuite_overage_item_id?: string; + rounding_method: 'ROUND_UP' | 'ROUND_DOWN' | 'ROUND_HALF_UP'; +} - /** - * For USAGE products only. Groups usage line items on invoices. - */ - presentation_group_key?: Array; +export interface ProductCreateResponse { + data: Shared.ID; +} - /** - * For USAGE products only. If set, pricing for this product will be determined for - * each pricing_group_key value, as opposed to the product as a whole. - */ - pricing_group_key?: Array; +export interface ProductRetrieveResponse { + data: ProductRetrieveResponse.Data; +} - /** - * Optional. Only valid for USAGE products. If provided, the quantity will be - * converted using the provided conversion factor and operation. For example, if - * the operation is "multiply" and the conversion factor is 100, then the quantity - * will be multiplied by 100. This can be used in cases where data is sent in one - * unit and priced in another. For example, data could be sent in MB and priced in - * GB. In this case, the conversion factor would be 1024 and the operation would be - * "divide". - */ - quantity_conversion?: Initial.QuantityConversion | null; +export namespace ProductRetrieveResponse { + export interface Data { + id: string; - /** - * Optional. Only valid for USAGE products. If provided, the quantity will be - * rounded using the provided rounding method and decimal places. For example, if - * the method is "round up" and the decimal places is 0, then the quantity will be - * rounded up to the nearest integer. - */ - quantity_rounding?: Initial.QuantityRounding | null; + current: ProductsAPI.ProductListItemState; - starting_at?: string; + initial: ProductsAPI.ProductListItemState; - tags?: Array; - } + type: 'USAGE' | 'SUBSCRIPTION' | 'COMPOSITE' | 'FIXED' | 'PRO_SERVICE'; - export namespace Initial { - /** - * Optional. Only valid for USAGE products. If provided, the quantity will be - * converted using the provided conversion factor and operation. For example, if - * the operation is "multiply" and the conversion factor is 100, then the quantity - * will be multiplied by 100. This can be used in cases where data is sent in one - * unit and priced in another. For example, data could be sent in MB and priced in - * GB. In this case, the conversion factor would be 1024 and the operation would be - * "divide". - */ - export interface QuantityConversion { - /** - * The factor to multiply or divide the quantity by. - */ - conversion_factor: number; - - /** - * The operation to perform on the quantity - */ - operation: 'MULTIPLY' | 'DIVIDE'; - - /** - * Optional name for this conversion. - */ - name?: string; - } + updates: Array; - /** - * Optional. Only valid for USAGE products. If provided, the quantity will be - * rounded using the provided rounding method and decimal places. For example, if - * the method is "round up" and the decimal places is 0, then the quantity will be - * rounded up to the nearest integer. - */ - export interface QuantityRounding { - decimal_places: number; + archived_at?: string | null; - rounding_method: 'ROUND_UP' | 'ROUND_DOWN' | 'ROUND_HALF_UP'; - } - } + custom_fields?: Record; + } + export namespace Data { export interface Update { created_at: string; @@ -352,7 +245,7 @@ export namespace ProductRetrieveResponse { * GB. In this case, the conversion factor would be 1024 and the operation would be * "divide". */ - quantity_conversion?: Update.QuantityConversion | null; + quantity_conversion?: ProductsAPI.QuantityConversion | null; /** * Optional. Only valid for USAGE products. If provided, the quantity will be @@ -360,52 +253,12 @@ export namespace ProductRetrieveResponse { * the method is "round up" and the decimal places is 0, then the quantity will be * rounded up to the nearest integer. */ - quantity_rounding?: Update.QuantityRounding | null; + quantity_rounding?: ProductsAPI.QuantityRounding | null; starting_at?: string; tags?: Array; } - - export namespace Update { - /** - * Optional. Only valid for USAGE products. If provided, the quantity will be - * converted using the provided conversion factor and operation. For example, if - * the operation is "multiply" and the conversion factor is 100, then the quantity - * will be multiplied by 100. This can be used in cases where data is sent in one - * unit and priced in another. For example, data could be sent in MB and priced in - * GB. In this case, the conversion factor would be 1024 and the operation would be - * "divide". - */ - export interface QuantityConversion { - /** - * The factor to multiply or divide the quantity by. - */ - conversion_factor: number; - - /** - * The operation to perform on the quantity - */ - operation: 'MULTIPLY' | 'DIVIDE'; - - /** - * Optional name for this conversion. - */ - name?: string; - } - - /** - * Optional. Only valid for USAGE products. If provided, the quantity will be - * rounded using the provided rounding method and decimal places. For example, if - * the method is "round up" and the decimal places is 0, then the quantity will be - * rounded up to the nearest integer. - */ - export interface QuantityRounding { - decimal_places: number; - - rounding_method: 'ROUND_UP' | 'ROUND_DOWN' | 'ROUND_HALF_UP'; - } - } } } @@ -416,9 +269,9 @@ export interface ProductUpdateResponse { export interface ProductListResponse { id: string; - current: ProductListResponse.Current; + current: ProductListItemState; - initial: ProductListResponse.Initial; + initial: ProductListItemState; type: 'USAGE' | 'SUBSCRIPTION' | 'COMPOSITE' | 'FIXED' | 'PRO_SERVICE'; @@ -430,216 +283,6 @@ export interface ProductListResponse { } export namespace ProductListResponse { - export interface Current { - created_at: string; - - created_by: string; - - name: string; - - billable_metric_id?: string; - - composite_product_ids?: Array; - - composite_tags?: Array; - - exclude_free_usage?: boolean; - - /** - * This field's availability is dependent on your client's configuration. - */ - is_refundable?: boolean; - - /** - * This field's availability is dependent on your client's configuration. - */ - netsuite_internal_item_id?: string; - - /** - * This field's availability is dependent on your client's configuration. - */ - netsuite_overage_item_id?: string; - - /** - * For USAGE products only. Groups usage line items on invoices. - */ - presentation_group_key?: Array; - - /** - * For USAGE products only. If set, pricing for this product will be determined for - * each pricing_group_key value, as opposed to the product as a whole. - */ - pricing_group_key?: Array; - - /** - * Optional. Only valid for USAGE products. If provided, the quantity will be - * converted using the provided conversion factor and operation. For example, if - * the operation is "multiply" and the conversion factor is 100, then the quantity - * will be multiplied by 100. This can be used in cases where data is sent in one - * unit and priced in another. For example, data could be sent in MB and priced in - * GB. In this case, the conversion factor would be 1024 and the operation would be - * "divide". - */ - quantity_conversion?: Current.QuantityConversion | null; - - /** - * Optional. Only valid for USAGE products. If provided, the quantity will be - * rounded using the provided rounding method and decimal places. For example, if - * the method is "round up" and the decimal places is 0, then the quantity will be - * rounded up to the nearest integer. - */ - quantity_rounding?: Current.QuantityRounding | null; - - starting_at?: string; - - tags?: Array; - } - - export namespace Current { - /** - * Optional. Only valid for USAGE products. If provided, the quantity will be - * converted using the provided conversion factor and operation. For example, if - * the operation is "multiply" and the conversion factor is 100, then the quantity - * will be multiplied by 100. This can be used in cases where data is sent in one - * unit and priced in another. For example, data could be sent in MB and priced in - * GB. In this case, the conversion factor would be 1024 and the operation would be - * "divide". - */ - export interface QuantityConversion { - /** - * The factor to multiply or divide the quantity by. - */ - conversion_factor: number; - - /** - * The operation to perform on the quantity - */ - operation: 'MULTIPLY' | 'DIVIDE'; - - /** - * Optional name for this conversion. - */ - name?: string; - } - - /** - * Optional. Only valid for USAGE products. If provided, the quantity will be - * rounded using the provided rounding method and decimal places. For example, if - * the method is "round up" and the decimal places is 0, then the quantity will be - * rounded up to the nearest integer. - */ - export interface QuantityRounding { - decimal_places: number; - - rounding_method: 'ROUND_UP' | 'ROUND_DOWN' | 'ROUND_HALF_UP'; - } - } - - export interface Initial { - created_at: string; - - created_by: string; - - name: string; - - billable_metric_id?: string; - - composite_product_ids?: Array; - - composite_tags?: Array; - - exclude_free_usage?: boolean; - - /** - * This field's availability is dependent on your client's configuration. - */ - is_refundable?: boolean; - - /** - * This field's availability is dependent on your client's configuration. - */ - netsuite_internal_item_id?: string; - - /** - * This field's availability is dependent on your client's configuration. - */ - netsuite_overage_item_id?: string; - - /** - * For USAGE products only. Groups usage line items on invoices. - */ - presentation_group_key?: Array; - - /** - * For USAGE products only. If set, pricing for this product will be determined for - * each pricing_group_key value, as opposed to the product as a whole. - */ - pricing_group_key?: Array; - - /** - * Optional. Only valid for USAGE products. If provided, the quantity will be - * converted using the provided conversion factor and operation. For example, if - * the operation is "multiply" and the conversion factor is 100, then the quantity - * will be multiplied by 100. This can be used in cases where data is sent in one - * unit and priced in another. For example, data could be sent in MB and priced in - * GB. In this case, the conversion factor would be 1024 and the operation would be - * "divide". - */ - quantity_conversion?: Initial.QuantityConversion | null; - - /** - * Optional. Only valid for USAGE products. If provided, the quantity will be - * rounded using the provided rounding method and decimal places. For example, if - * the method is "round up" and the decimal places is 0, then the quantity will be - * rounded up to the nearest integer. - */ - quantity_rounding?: Initial.QuantityRounding | null; - - starting_at?: string; - - tags?: Array; - } - - export namespace Initial { - /** - * Optional. Only valid for USAGE products. If provided, the quantity will be - * converted using the provided conversion factor and operation. For example, if - * the operation is "multiply" and the conversion factor is 100, then the quantity - * will be multiplied by 100. This can be used in cases where data is sent in one - * unit and priced in another. For example, data could be sent in MB and priced in - * GB. In this case, the conversion factor would be 1024 and the operation would be - * "divide". - */ - export interface QuantityConversion { - /** - * The factor to multiply or divide the quantity by. - */ - conversion_factor: number; - - /** - * The operation to perform on the quantity - */ - operation: 'MULTIPLY' | 'DIVIDE'; - - /** - * Optional name for this conversion. - */ - name?: string; - } - - /** - * Optional. Only valid for USAGE products. If provided, the quantity will be - * rounded using the provided rounding method and decimal places. For example, if - * the method is "round up" and the decimal places is 0, then the quantity will be - * rounded up to the nearest integer. - */ - export interface QuantityRounding { - decimal_places: number; - - rounding_method: 'ROUND_UP' | 'ROUND_DOWN' | 'ROUND_HALF_UP'; - } - } - export interface Update { created_at: string; @@ -687,7 +330,7 @@ export namespace ProductListResponse { * GB. In this case, the conversion factor would be 1024 and the operation would be * "divide". */ - quantity_conversion?: Update.QuantityConversion | null; + quantity_conversion?: ProductsAPI.QuantityConversion | null; /** * Optional. Only valid for USAGE products. If provided, the quantity will be @@ -695,52 +338,12 @@ export namespace ProductListResponse { * the method is "round up" and the decimal places is 0, then the quantity will be * rounded up to the nearest integer. */ - quantity_rounding?: Update.QuantityRounding | null; + quantity_rounding?: ProductsAPI.QuantityRounding | null; starting_at?: string; tags?: Array; } - - export namespace Update { - /** - * Optional. Only valid for USAGE products. If provided, the quantity will be - * converted using the provided conversion factor and operation. For example, if - * the operation is "multiply" and the conversion factor is 100, then the quantity - * will be multiplied by 100. This can be used in cases where data is sent in one - * unit and priced in another. For example, data could be sent in MB and priced in - * GB. In this case, the conversion factor would be 1024 and the operation would be - * "divide". - */ - export interface QuantityConversion { - /** - * The factor to multiply or divide the quantity by. - */ - conversion_factor: number; - - /** - * The operation to perform on the quantity - */ - operation: 'MULTIPLY' | 'DIVIDE'; - - /** - * Optional name for this conversion. - */ - name?: string; - } - - /** - * Optional. Only valid for USAGE products. If provided, the quantity will be - * rounded using the provided rounding method and decimal places. For example, if - * the method is "round up" and the decimal places is 0, then the quantity will be - * rounded up to the nearest integer. - */ - export interface QuantityRounding { - decimal_places: number; - - rounding_method: 'ROUND_UP' | 'ROUND_DOWN' | 'ROUND_HALF_UP'; - } - } } export interface ProductArchiveResponse { @@ -812,7 +415,7 @@ export interface ProductCreateParams { * GB. In this case, the conversion factor would be 1024 and the operation would be * "divide". */ - quantity_conversion?: ProductCreateParams.QuantityConversion | null; + quantity_conversion?: QuantityConversion | null; /** * Optional. Only valid for USAGE products. If provided, the quantity will be @@ -820,51 +423,11 @@ export interface ProductCreateParams { * the method is "round up" and the decimal places is 0, then the quantity will be * rounded up to the nearest integer. */ - quantity_rounding?: ProductCreateParams.QuantityRounding | null; + quantity_rounding?: QuantityRounding | null; tags?: Array; } -export namespace ProductCreateParams { - /** - * Optional. Only valid for USAGE products. If provided, the quantity will be - * converted using the provided conversion factor and operation. For example, if - * the operation is "multiply" and the conversion factor is 100, then the quantity - * will be multiplied by 100. This can be used in cases where data is sent in one - * unit and priced in another. For example, data could be sent in MB and priced in - * GB. In this case, the conversion factor would be 1024 and the operation would be - * "divide". - */ - export interface QuantityConversion { - /** - * The factor to multiply or divide the quantity by. - */ - conversion_factor: number; - - /** - * The operation to perform on the quantity - */ - operation: 'MULTIPLY' | 'DIVIDE'; - - /** - * Optional name for this conversion. - */ - name?: string; - } - - /** - * Optional. Only valid for USAGE products. If provided, the quantity will be - * rounded using the provided rounding method and decimal places. For example, if - * the method is "round up" and the decimal places is 0, then the quantity will be - * rounded up to the nearest integer. - */ - export interface QuantityRounding { - decimal_places: number; - - rounding_method: 'ROUND_UP' | 'ROUND_DOWN' | 'ROUND_HALF_UP'; - } -} - export interface ProductRetrieveParams { id: string; } @@ -949,7 +512,7 @@ export interface ProductUpdateParams { * GB. In this case, the conversion factor would be 1024 and the operation would be * "divide". */ - quantity_conversion?: ProductUpdateParams.QuantityConversion | null; + quantity_conversion?: QuantityConversion | null; /** * Optional. Only valid for USAGE products. If provided, the quantity will be @@ -957,7 +520,7 @@ export interface ProductUpdateParams { * the method is "round up" and the decimal places is 0, then the quantity will be * rounded up to the nearest integer. */ - quantity_rounding?: ProductUpdateParams.QuantityRounding | null; + quantity_rounding?: QuantityRounding | null; /** * If not provided, defaults to product's current tags @@ -965,46 +528,6 @@ export interface ProductUpdateParams { tags?: Array; } -export namespace ProductUpdateParams { - /** - * Optional. Only valid for USAGE products. If provided, the quantity will be - * converted using the provided conversion factor and operation. For example, if - * the operation is "multiply" and the conversion factor is 100, then the quantity - * will be multiplied by 100. This can be used in cases where data is sent in one - * unit and priced in another. For example, data could be sent in MB and priced in - * GB. In this case, the conversion factor would be 1024 and the operation would be - * "divide". - */ - export interface QuantityConversion { - /** - * The factor to multiply or divide the quantity by. - */ - conversion_factor: number; - - /** - * The operation to perform on the quantity - */ - operation: 'MULTIPLY' | 'DIVIDE'; - - /** - * Optional name for this conversion. - */ - name?: string; - } - - /** - * Optional. Only valid for USAGE products. If provided, the quantity will be - * rounded using the provided rounding method and decimal places. For example, if - * the method is "round up" and the decimal places is 0, then the quantity will be - * rounded up to the nearest integer. - */ - export interface QuantityRounding { - decimal_places: number; - - rounding_method: 'ROUND_UP' | 'ROUND_DOWN' | 'ROUND_HALF_UP'; - } -} - export interface ProductListParams extends CursorPageParams { /** * Body param: Filter options for the product list @@ -1020,6 +543,9 @@ export interface ProductArchiveParams { } export namespace Products { + export import ProductListItemState = ProductsAPI.ProductListItemState; + export import QuantityConversion = ProductsAPI.QuantityConversion; + export import QuantityRounding = ProductsAPI.QuantityRounding; export import ProductCreateResponse = ProductsAPI.ProductCreateResponse; export import ProductRetrieveResponse = ProductsAPI.ProductRetrieveResponse; export import ProductUpdateResponse = ProductsAPI.ProductUpdateResponse; diff --git a/src/resources/contracts/rate-cards/rate-cards.ts b/src/resources/contracts/rate-cards/rate-cards.ts index 2431675..f77d970 100755 --- a/src/resources/contracts/rate-cards/rate-cards.ts +++ b/src/resources/contracts/rate-cards/rate-cards.ts @@ -134,15 +134,7 @@ export namespace RateCardRetrieveResponse { starting_at?: string; - tiers?: Array; - } - - export namespace Current { - export interface Tier { - price: number; - - size?: number; - } + tiers?: Array; } export interface Update { @@ -172,15 +164,7 @@ export namespace RateCardRetrieveResponse { quantity?: number; - tiers?: Array; - } - - export namespace Update { - export interface Tier { - price: number; - - size?: number; - } + tiers?: Array; } } @@ -257,15 +241,7 @@ export namespace RateCardListResponse { starting_at?: string; - tiers?: Array; - } - - export namespace Current { - export interface Tier { - price: number; - - size?: number; - } + tiers?: Array; } export interface Update { @@ -295,15 +271,7 @@ export namespace RateCardListResponse { quantity?: number; - tiers?: Array; - } - - export namespace Update { - export interface Tier { - price: number; - - size?: number; - } + tiers?: Array; } } diff --git a/src/resources/contracts/rate-cards/rates.ts b/src/resources/contracts/rate-cards/rates.ts index 0c23c65..c2c4a06 100755 --- a/src/resources/contracts/rate-cards/rates.ts +++ b/src/resources/contracts/rate-cards/rates.ts @@ -188,7 +188,7 @@ export interface RateAddParams { /** * Only set for TIERED rate_type. */ - tiers?: Array; + tiers?: Array; /** * Only set for PERCENTAGE rate_type. Defaults to false. If true, rate is computed @@ -198,14 +198,6 @@ export interface RateAddParams { use_list_prices?: boolean; } -export namespace RateAddParams { - export interface Tier { - price: number; - - size?: number; - } -} - export interface RateAddManyParams { rate_card_id?: string; @@ -272,7 +264,7 @@ export namespace RateAddManyParams { /** * Only set for TIERED rate_type. */ - tiers?: Array; + tiers?: Array; /** * Only set for PERCENTAGE rate_type. Defaults to false. If true, rate is computed @@ -281,14 +273,6 @@ export namespace RateAddManyParams { */ use_list_prices?: boolean; } - - export namespace Rate { - export interface Tier { - price: number; - - size?: number; - } - } } export namespace Rates { diff --git a/src/resources/customers/credits.ts b/src/resources/customers/credits.ts index a6f8d26..bc58b35 100755 --- a/src/resources/customers/credits.ts +++ b/src/resources/customers/credits.ts @@ -36,168 +36,11 @@ export interface CreditCreateResponse { } export interface CreditListResponse { - data: Array; + data: Array; next_page: string | null; } -export namespace CreditListResponse { - export interface Data { - id: string; - - product: Data.Product; - - type: 'CREDIT'; - - /** - * The schedule that the customer will gain access to the credits. - */ - access_schedule?: Data.AccessSchedule; - - applicable_contract_ids?: Array; - - applicable_product_ids?: Array; - - applicable_product_tags?: Array; - - contract?: Data.Contract; - - custom_fields?: Record; - - description?: string; - - /** - * A list of ordered events that impact the balance of a credit. For example, an - * invoice deduction or an expiration. - */ - ledger?: Array< - | Data.CreditSegmentStartLedgerEntry - | Data.CreditAutomatedInvoiceDeductionLedgerEntry - | Data.CreditExpirationLedgerEntry - | Data.CreditCanceledLedgerEntry - | Data.CreditCreditedLedgerEntry - | Data.CreditManualLedgerEntry - >; - - name?: string; - - /** - * This field's availability is dependent on your client's configuration. - */ - netsuite_sales_order_id?: string; - - /** - * If multiple credits or commits are applicable, the one with the lower priority - * will apply first. - */ - priority?: number; - - /** - * This field's availability is dependent on your client's configuration. - */ - salesforce_opportunity_id?: string; - } - - export namespace Data { - export interface Product { - id: string; - - name: string; - } - - /** - * The schedule that the customer will gain access to the credits. - */ - export interface AccessSchedule { - schedule_items: Array; - - credit_type?: Shared.CreditType; - } - - export namespace AccessSchedule { - export interface ScheduleItem { - id: string; - - amount: number; - - ending_before: string; - - starting_at: string; - } - } - - export interface Contract { - id: string; - } - - export interface CreditSegmentStartLedgerEntry { - amount: number; - - segment_id: string; - - timestamp: string; - - type: 'CREDIT_SEGMENT_START'; - } - - export interface CreditAutomatedInvoiceDeductionLedgerEntry { - amount: number; - - invoice_id: string; - - segment_id: string; - - timestamp: string; - - type: 'CREDIT_AUTOMATED_INVOICE_DEDUCTION'; - } - - export interface CreditExpirationLedgerEntry { - amount: number; - - segment_id: string; - - timestamp: string; - - type: 'CREDIT_EXPIRATION'; - } - - export interface CreditCanceledLedgerEntry { - amount: number; - - invoice_id: string; - - segment_id: string; - - timestamp: string; - - type: 'CREDIT_CANCELED'; - } - - export interface CreditCreditedLedgerEntry { - amount: number; - - invoice_id: string; - - segment_id: string; - - timestamp: string; - - type: 'CREDIT_CREDITED'; - } - - export interface CreditManualLedgerEntry { - amount: number; - - reason: string; - - timestamp: string; - - type: 'CREDIT_MANUAL'; - } - } -} - export interface CreditUpdateEndDateResponse { data: Shared.ID; } diff --git a/src/resources/customers/customers.ts b/src/resources/customers/customers.ts index ddec519..585aa04 100755 --- a/src/resources/customers/customers.ts +++ b/src/resources/customers/customers.ts @@ -282,7 +282,7 @@ export interface CustomerListBillableMetricsResponse { /** * An optional filtering rule to match the 'event_type' property of an event. */ - event_type_filter?: CustomerListBillableMetricsResponse.EventTypeFilter; + event_type_filter?: Shared.EventTypeFilter; /** * (DEPRECATED) use property_filters & event_type_filter instead @@ -305,7 +305,7 @@ export interface CustomerListBillableMetricsResponse { * rule on an event property. All rules must pass for the event to match the * billable metric. */ - property_filters?: Array; + property_filters?: Array; /** * The SQL query associated with the billable metric @@ -313,58 +313,6 @@ export interface CustomerListBillableMetricsResponse { sql?: string; } -export namespace CustomerListBillableMetricsResponse { - /** - * An optional filtering rule to match the 'event_type' property of an event. - */ - export interface EventTypeFilter { - /** - * A list of event types that are explicitly included in the billable metric. If - * specified, only events of these types will match the billable metric. Must be - * non-empty if present. - */ - in_values?: Array; - - /** - * A list of event types that are explicitly excluded from the billable metric. If - * specified, events of these types will not match the billable metric. Must be - * non-empty if present. - */ - not_in_values?: Array; - } - - export interface PropertyFilter { - /** - * The name of the event property. - */ - name: string; - - /** - * Determines whether the property must exist in the event. If true, only events - * with this property will pass the filter. If false, only events without this - * property will pass the filter. If null or omitted, the existence of the property - * is optional. - */ - exists?: boolean; - - /** - * Specifies the allowed values for the property to match an event. An event will - * pass the filter only if its property value is included in this list. If - * undefined, all property values will pass the filter. Must be non-empty if - * present. - */ - in_values?: Array; - - /** - * Specifies the values that prevent an event from matching the filter. An event - * will not pass the filter if its property value is included in this list. If null - * or empty, all property values will pass the filter. Must be non-empty if - * present. - */ - not_in_values?: Array; - } -} - export interface CustomerListCostsResponse { credit_types: Record; diff --git a/src/resources/shared.ts b/src/resources/shared.ts index 9123fd7..0e61e75 100755 --- a/src/resources/shared.ts +++ b/src/resources/shared.ts @@ -2,6 +2,14 @@ import * as Shared from './shared'; +export interface BaseUsageFilter { + group_key: string; + + group_values: Array; + + starting_at?: string; +} + export interface Commit { id: string; @@ -13,7 +21,7 @@ export interface Commit { * The schedule that the customer will gain access to the credits purposed with * this commit. */ - access_schedule?: Commit.AccessSchedule; + access_schedule?: ScheduleDuration; /** * (DEPRECATED) Use access_schedule + invoice_schedule instead. @@ -92,28 +100,6 @@ export namespace Commit { name: string; } - /** - * The schedule that the customer will gain access to the credits purposed with - * this commit. - */ - export interface AccessSchedule { - schedule_items: Array; - - credit_type?: Shared.CreditType; - } - - export namespace AccessSchedule { - export interface ScheduleItem { - id: string; - - amount: number; - - ending_before: string; - - starting_at: string; - } - } - export interface Contract { id: string; } @@ -287,7 +273,7 @@ export interface ContractWithoutAmendments { usage_statement_schedule: ContractWithoutAmendments.UsageStatementSchedule; - credits?: Array; + credits?: Array; /** * This field's availability is dependent on your client's configuration. @@ -308,7 +294,7 @@ export interface ContractWithoutAmendments { /** * This field's availability is dependent on your client's configuration. */ - professional_services?: Array; + professional_services?: Array; rate_card_id?: string; @@ -343,253 +329,184 @@ export namespace ContractWithoutAmendments { frequency: 'MONTHLY' | 'QUARTERLY'; } - export interface Credit { - id: string; - - product: Credit.Product; + export interface ResellerRoyalty { + fraction: number; - type: 'CREDIT'; + netsuite_reseller_id: string; - /** - * The schedule that the customer will gain access to the credits. - */ - access_schedule?: Credit.AccessSchedule; + reseller_type: 'AWS' | 'AWS_PRO_SERVICE' | 'GCP' | 'GCP_PRO_SERVICE'; - applicable_contract_ids?: Array; + starting_at: string; applicable_product_ids?: Array; applicable_product_tags?: Array; - contract?: Credit.Contract; - - custom_fields?: Record; + aws_account_number?: string; - description?: string; + aws_offer_id?: string; - /** - * A list of ordered events that impact the balance of a credit. For example, an - * invoice deduction or an expiration. - */ - ledger?: Array< - | Credit.CreditSegmentStartLedgerEntry - | Credit.CreditAutomatedInvoiceDeductionLedgerEntry - | Credit.CreditExpirationLedgerEntry - | Credit.CreditCanceledLedgerEntry - | Credit.CreditCreditedLedgerEntry - | Credit.CreditManualLedgerEntry - >; + aws_payer_reference_id?: string; - name?: string; + ending_before?: string; - /** - * This field's availability is dependent on your client's configuration. - */ - netsuite_sales_order_id?: string; + gcp_account_id?: string; - /** - * If multiple credits or commits are applicable, the one with the lower priority - * will apply first. - */ - priority?: number; + gcp_offer_id?: string; - /** - * This field's availability is dependent on your client's configuration. - */ - salesforce_opportunity_id?: string; + reseller_contract_value?: number; } - export namespace Credit { - export interface Product { - id: string; - - name: string; - } - - /** - * The schedule that the customer will gain access to the credits. - */ - export interface AccessSchedule { - schedule_items: Array; - - credit_type?: Shared.CreditType; - } - - export namespace AccessSchedule { - export interface ScheduleItem { - id: string; - - amount: number; - - ending_before: string; - - starting_at: string; - } - } - - export interface Contract { - id: string; - } - - export interface CreditSegmentStartLedgerEntry { - amount: number; - - segment_id: string; - - timestamp: string; - - type: 'CREDIT_SEGMENT_START'; - } + export interface UsageFilter { + current: Shared.BaseUsageFilter | null; - export interface CreditAutomatedInvoiceDeductionLedgerEntry { - amount: number; + initial: Shared.BaseUsageFilter; - invoice_id: string; + updates: Array; + } - segment_id: string; + export namespace UsageFilter { + export interface Update { + group_key: string; - timestamp: string; + group_values: Array; - type: 'CREDIT_AUTOMATED_INVOICE_DEDUCTION'; + starting_at: string; } + } +} - export interface CreditExpirationLedgerEntry { - amount: number; - - segment_id: string; +export interface Credit { + id: string; - timestamp: string; + product: Credit.Product; - type: 'CREDIT_EXPIRATION'; - } + type: 'CREDIT'; - export interface CreditCanceledLedgerEntry { - amount: number; + /** + * The schedule that the customer will gain access to the credits. + */ + access_schedule?: ScheduleDuration; - invoice_id: string; + applicable_contract_ids?: Array; - segment_id: string; + applicable_product_ids?: Array; - timestamp: string; + applicable_product_tags?: Array; - type: 'CREDIT_CANCELED'; - } + contract?: Credit.Contract; - export interface CreditCreditedLedgerEntry { - amount: number; + custom_fields?: Record; - invoice_id: string; + description?: string; - segment_id: string; + /** + * A list of ordered events that impact the balance of a credit. For example, an + * invoice deduction or an expiration. + */ + ledger?: Array< + | Credit.CreditSegmentStartLedgerEntry + | Credit.CreditAutomatedInvoiceDeductionLedgerEntry + | Credit.CreditExpirationLedgerEntry + | Credit.CreditCanceledLedgerEntry + | Credit.CreditCreditedLedgerEntry + | Credit.CreditManualLedgerEntry + >; - timestamp: string; + name?: string; - type: 'CREDIT_CREDITED'; - } + /** + * This field's availability is dependent on your client's configuration. + */ + netsuite_sales_order_id?: string; - export interface CreditManualLedgerEntry { - amount: number; + /** + * If multiple credits or commits are applicable, the one with the lower priority + * will apply first. + */ + priority?: number; - reason: string; + /** + * This field's availability is dependent on your client's configuration. + */ + salesforce_opportunity_id?: string; +} - timestamp: string; +export namespace Credit { + export interface Product { + id: string; - type: 'CREDIT_MANUAL'; - } + name: string; } - export interface ProfessionalService { + export interface Contract { id: string; + } - /** - * Maximum amount for the term. - */ - max_amount: number; - - product_id: string; - - /** - * Quantity for the charge. Will be multiplied by unit_price to determine the - * amount. - */ - quantity: number; - - /** - * Unit price for the charge. Will be multiplied by quantity to determine the - * amount and must be specified. - */ - unit_price: number; + export interface CreditSegmentStartLedgerEntry { + amount: number; - custom_fields?: Record; + segment_id: string; - description?: string; + timestamp: string; - /** - * This field's availability is dependent on your client's configuration. - */ - netsuite_sales_order_id?: string; + type: 'CREDIT_SEGMENT_START'; } - export interface ResellerRoyalty { - fraction: number; - - netsuite_reseller_id: string; - - reseller_type: 'AWS' | 'AWS_PRO_SERVICE' | 'GCP' | 'GCP_PRO_SERVICE'; + export interface CreditAutomatedInvoiceDeductionLedgerEntry { + amount: number; - starting_at: string; + invoice_id: string; - applicable_product_ids?: Array; + segment_id: string; - applicable_product_tags?: Array; + timestamp: string; - aws_account_number?: string; + type: 'CREDIT_AUTOMATED_INVOICE_DEDUCTION'; + } - aws_offer_id?: string; + export interface CreditExpirationLedgerEntry { + amount: number; - aws_payer_reference_id?: string; + segment_id: string; - ending_before?: string; + timestamp: string; - gcp_account_id?: string; + type: 'CREDIT_EXPIRATION'; + } - gcp_offer_id?: string; + export interface CreditCanceledLedgerEntry { + amount: number; - reseller_contract_value?: number; - } + invoice_id: string; - export interface UsageFilter { - current: UsageFilter.Current | null; + segment_id: string; - initial: UsageFilter.Initial; + timestamp: string; - updates: Array; + type: 'CREDIT_CANCELED'; } - export namespace UsageFilter { - export interface Current { - group_key: string; + export interface CreditCreditedLedgerEntry { + amount: number; - group_values: Array; + invoice_id: string; - starting_at?: string; - } + segment_id: string; - export interface Initial { - group_key: string; + timestamp: string; - group_values: Array; + type: 'CREDIT_CREDITED'; + } - starting_at?: string; - } + export interface CreditManualLedgerEntry { + amount: number; - export interface Update { - group_key: string; + reason: string; - group_values: Array; + timestamp: string; - starting_at: string; - } + type: 'CREDIT_MANUAL'; } } @@ -622,6 +539,25 @@ export namespace Discount { } } +/** + * An optional filtering rule to match the 'event_type' property of an event. + */ +export interface EventTypeFilter { + /** + * A list of event types that are explicitly included in the billable metric. If + * specified, only events of these types will match the billable metric. Must be + * non-empty if present. + */ + in_values?: Array; + + /** + * A list of event types that are explicitly excluded from the billable metric. If + * specified, events of these types will not match the billable metric. Must be + * non-empty if present. + */ + not_in_values?: Array; +} + export interface ID { id: string; } @@ -672,7 +608,7 @@ export interface Override { /** * Only set for TIERED rate_type. */ - tiers?: Array; + tiers?: Array; type?: 'OVERWRITE' | 'MULTIPLIER' | 'TIERED'; @@ -730,15 +666,7 @@ export namespace Override { /** * Only set for TIERED rate_type. */ - tiers?: Array; - } - - export namespace OverwriteRate { - export interface Tier { - price: number; - - size?: number; - } + tiers?: Array; } export interface Product { @@ -746,12 +674,69 @@ export namespace Override { name: string; } +} - export interface Tier { - price: number; +export interface PropertyFilter { + /** + * The name of the event property. + */ + name: string; - size?: number; - } + /** + * Determines whether the property must exist in the event. If true, only events + * with this property will pass the filter. If false, only events without this + * property will pass the filter. If null or omitted, the existence of the property + * is optional. + */ + exists?: boolean; + + /** + * Specifies the allowed values for the property to match an event. An event will + * pass the filter only if its property value is included in this list. If + * undefined, all property values will pass the filter. Must be non-empty if + * present. + */ + in_values?: Array; + + /** + * Specifies the values that prevent an event from matching the filter. An event + * will not pass the filter if its property value is included in this list. If null + * or empty, all property values will pass the filter. Must be non-empty if + * present. + */ + not_in_values?: Array; +} + +export interface ProService { + id: string; + + /** + * Maximum amount for the term. + */ + max_amount: number; + + product_id: string; + + /** + * Quantity for the charge. Will be multiplied by unit_price to determine the + * amount. + */ + quantity: number; + + /** + * Unit price for the charge. Will be multiplied by quantity to determine the + * amount and must be specified. + */ + unit_price: number; + + custom_fields?: Record; + + description?: string; + + /** + * This field's availability is dependent on your client's configuration. + */ + netsuite_sales_order_id?: string; } export interface Rate { @@ -790,7 +775,7 @@ export interface Rate { /** * Only set for TIERED rate_type. */ - tiers?: Array; + tiers?: Array; /** * Only set for PERCENTAGE rate_type. Defaults to false. If true, rate is computed @@ -800,11 +785,49 @@ export interface Rate { use_list_prices?: boolean; } -export namespace Rate { - export interface Tier { - price: number; +export interface ScheduledCharge { + id: string; + + product: ScheduledCharge.Product; - size?: number; + schedule: SchedulePointInTime; + + custom_fields?: Record; + + /** + * displayed on invoices + */ + name?: string; + + /** + * This field's availability is dependent on your client's configuration. + */ + netsuite_sales_order_id?: string; +} + +export namespace ScheduledCharge { + export interface Product { + id: string; + + name: string; + } +} + +export interface ScheduleDuration { + schedule_items: Array; + + credit_type?: CreditType; +} + +export namespace ScheduleDuration { + export interface ScheduleItem { + id: string; + + amount: number; + + ending_before: string; + + starting_at: string; } } @@ -830,30 +853,8 @@ export namespace SchedulePointInTime { } } -export interface ScheduledCharge { - id: string; - - product: ScheduledCharge.Product; - - schedule: SchedulePointInTime; - - custom_fields?: Record; - - /** - * displayed on invoices - */ - name?: string; - - /** - * This field's availability is dependent on your client's configuration. - */ - netsuite_sales_order_id?: string; -} - -export namespace ScheduledCharge { - export interface Product { - id: string; +export interface Tier { + price: number; - name: string; - } + size?: number; }