Documentation
¶
Overview ¶
Package billing provides methods and message types of the billing v2alpha1 API.
Index ¶
- Constants
- type API
- func (s *API) DownloadInvoice(req *DownloadInvoiceRequest, opts ...scw.RequestOption) (*scw.File, error)
- func (s *API) GetConsumption(req *GetConsumptionRequest, opts ...scw.RequestOption) (*GetConsumptionResponse, error)
- func (s *API) ListDiscounts(req *ListDiscountsRequest, opts ...scw.RequestOption) (*ListDiscountsResponse, error)
- func (s *API) ListInvoices(req *ListInvoicesRequest, opts ...scw.RequestOption) (*ListInvoicesResponse, error)
- type Discount
- type DiscountCoupon
- type DiscountDiscountMode
- type DiscountFilter
- type DiscountFilterType
- type DownloadInvoiceRequest
- type DownloadInvoiceRequestFileType
- type GetConsumptionRequest
- type GetConsumptionResponse
- type GetConsumptionResponseConsumption
- type Invoice
- type InvoiceType
- type ListDiscountsRequest
- type ListDiscountsRequestOrderBy
- type ListDiscountsResponse
- type ListInvoicesRequest
- type ListInvoicesRequestOrderBy
- type ListInvoicesResponse
Constants ¶
const ( // Unknown discount mode. DiscountDiscountModeUnknownDiscountMode = DiscountDiscountMode("unknown_discount_mode") // A rate discount that reduces each customer bill by the discount value percentage. DiscountDiscountModeDiscountModeRate = DiscountDiscountMode("discount_mode_rate") // A value discount that reduces the amount of the customer bill by the discount value. DiscountDiscountModeDiscountModeValue = DiscountDiscountMode("discount_mode_value") // A fixed sum to be deducted from the user's bills. DiscountDiscountModeDiscountModeSplittable = DiscountDiscountMode("discount_mode_splittable") )
const ( // Unknown filter type. DiscountFilterTypeUnknownType = DiscountFilterType("unknown_type") // Product category, such as Compute, Network, Observability. DiscountFilterTypeProductCategory = DiscountFilterType("product_category") // Products within the Product category. For example, VPC, Private Networks, and Public Gateways are products in the Network category. DiscountFilterTypeProduct = DiscountFilterType("product") // The offer of a product. For example, "VPC Public Gateway S", "VPC Public Gateway M" for the VPC product. DiscountFilterTypeProductOffer = DiscountFilterType("product_offer") // Identifies the reference based on category, product, range, size, region, and zone. It can sometimes include different product options, such as licenses and monthly payments. DiscountFilterTypeProductReference = DiscountFilterType("product_reference") // Region name like "FR-PAR", "NL-AMS", "PL-WAW". DiscountFilterTypeRegion = DiscountFilterType("region") // Zone name like "FR-PAR-1", "FR-PAR-2", "FR-PAR-3". DiscountFilterTypeZone = DiscountFilterType("zone") )
const ( InvoiceTypeUnknownType = InvoiceType("unknown_type") InvoiceTypePeriodic = InvoiceType("periodic") InvoiceTypePurchase = InvoiceType("purchase") )
const ( // Order discounts by creation date (descending chronological order). ListDiscountsRequestOrderByCreationDateDesc = ListDiscountsRequestOrderBy("creation_date_desc") // Order discounts by creation date (ascending chronological order). ListDiscountsRequestOrderByCreationDateAsc = ListDiscountsRequestOrderBy("creation_date_asc") )
const ( ListInvoicesRequestOrderByInvoiceNumberDesc = ListInvoicesRequestOrderBy("invoice_number_desc") ListInvoicesRequestOrderByInvoiceNumberAsc = ListInvoicesRequestOrderBy("invoice_number_asc") ListInvoicesRequestOrderByStartDateDesc = ListInvoicesRequestOrderBy("start_date_desc") ListInvoicesRequestOrderByStartDateAsc = ListInvoicesRequestOrderBy("start_date_asc") ListInvoicesRequestOrderByIssuedDateDesc = ListInvoicesRequestOrderBy("issued_date_desc") ListInvoicesRequestOrderByIssuedDateAsc = ListInvoicesRequestOrderBy("issued_date_asc") ListInvoicesRequestOrderByDueDateDesc = ListInvoicesRequestOrderBy("due_date_desc") ListInvoicesRequestOrderByDueDateAsc = ListInvoicesRequestOrderBy("due_date_asc") ListInvoicesRequestOrderByTotalUntaxedDesc = ListInvoicesRequestOrderBy("total_untaxed_desc") ListInvoicesRequestOrderByTotalUntaxedAsc = ListInvoicesRequestOrderBy("total_untaxed_asc") ListInvoicesRequestOrderByTotalTaxedDesc = ListInvoicesRequestOrderBy("total_taxed_desc") ListInvoicesRequestOrderByTotalTaxedAsc = ListInvoicesRequestOrderBy("total_taxed_asc") ListInvoicesRequestOrderByInvoiceTypeDesc = ListInvoicesRequestOrderBy("invoice_type_desc") ListInvoicesRequestOrderByInvoiceTypeAsc = ListInvoicesRequestOrderBy("invoice_type_asc") )
const (
DownloadInvoiceRequestFileTypePdf = DownloadInvoiceRequestFileType("pdf")
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
This API allows you to query your consumption.
func (*API) DownloadInvoice ¶
func (s *API) DownloadInvoice(req *DownloadInvoiceRequest, opts ...scw.RequestOption) (*scw.File, error)
DownloadInvoice: Download a specific invoice, specified by its ID.
func (*API) GetConsumption ¶
func (s *API) GetConsumption(req *GetConsumptionRequest, opts ...scw.RequestOption) (*GetConsumptionResponse, error)
GetConsumption: The consumption reflects the amount of money you have spent for the products you have used. The consumption value is monetary and is not computed in real time.
func (*API) ListDiscounts ¶
func (s *API) ListDiscounts(req *ListDiscountsRequest, opts ...scw.RequestOption) (*ListDiscountsResponse, error)
ListDiscounts: List all discounts for an organization and usable categories/products/offers/references/regions/zones where the discount can be applied.
func (*API) ListInvoices ¶
func (s *API) ListInvoices(req *ListInvoicesRequest, opts ...scw.RequestOption) (*ListInvoicesResponse, error)
ListInvoices: List all your invoices, filtering by `start_date` and `invoice_type`. Each invoice has its own ID.
type Discount ¶
type Discount struct { // ID: the ID of the discount. ID string `json:"id"` // CreationDate: the creation date of the discount. CreationDate *time.Time `json:"creation_date"` // OrganizationID: the organization ID of the discount. OrganizationID string `json:"organization_id"` // Description: the description of the discount. Description string `json:"description"` // Value: the initial value of the discount. Value float64 `json:"value"` // ValueUsed: the value indicating how much of the discount has been used. ValueUsed float64 `json:"value_used"` // ValueRemaining: the remaining value of the discount. ValueRemaining float64 `json:"value_remaining"` // Mode: the mode of the discount. // Default value: unknown_discount_mode Mode DiscountDiscountMode `json:"mode"` // StartDate: the start date of the discount. StartDate *time.Time `json:"start_date"` // StopDate: the stop date of the discount. StopDate *time.Time `json:"stop_date"` // Coupon: the description of the coupon. Coupon *DiscountCoupon `json:"coupon"` // Filters: list of products/ranges/regions/zones to limit the usability of discounts. Filters []*DiscountFilter `json:"filters"` }
Discount: discount.
type DiscountCoupon ¶
type DiscountCoupon struct { // Description: the description of the coupon. Description *string `json:"description"` }
DiscountCoupon: discount coupon.
type DiscountDiscountMode ¶
type DiscountDiscountMode string
func (DiscountDiscountMode) MarshalJSON ¶
func (enum DiscountDiscountMode) MarshalJSON() ([]byte, error)
func (DiscountDiscountMode) String ¶
func (enum DiscountDiscountMode) String() string
func (*DiscountDiscountMode) UnmarshalJSON ¶
func (enum *DiscountDiscountMode) UnmarshalJSON(data []byte) error
type DiscountFilter ¶
type DiscountFilter struct { // Type: type of the filter. // Default value: unknown_type Type DiscountFilterType `json:"type"` // Value: value of filter, it can be a product/range/region/zone value. Value string `json:"value"` }
DiscountFilter: discount filter.
type DiscountFilterType ¶
type DiscountFilterType string
func (DiscountFilterType) MarshalJSON ¶
func (enum DiscountFilterType) MarshalJSON() ([]byte, error)
func (DiscountFilterType) String ¶
func (enum DiscountFilterType) String() string
func (*DiscountFilterType) UnmarshalJSON ¶
func (enum *DiscountFilterType) UnmarshalJSON(data []byte) error
type DownloadInvoiceRequest ¶
type DownloadInvoiceRequest struct { // InvoiceID: invoice ID. InvoiceID string `json:"-"` // FileType: wanted file type. // Default value: pdf FileType DownloadInvoiceRequestFileType `json:"-"` }
DownloadInvoiceRequest: download invoice request.
type DownloadInvoiceRequestFileType ¶
type DownloadInvoiceRequestFileType string
func (DownloadInvoiceRequestFileType) MarshalJSON ¶
func (enum DownloadInvoiceRequestFileType) MarshalJSON() ([]byte, error)
func (DownloadInvoiceRequestFileType) String ¶
func (enum DownloadInvoiceRequestFileType) String() string
func (*DownloadInvoiceRequestFileType) UnmarshalJSON ¶
func (enum *DownloadInvoiceRequestFileType) UnmarshalJSON(data []byte) error
type GetConsumptionRequest ¶
type GetConsumptionRequest struct { // OrganizationID: filter by organization ID. OrganizationID string `json:"-"` }
GetConsumptionRequest: get consumption request.
type GetConsumptionResponse ¶
type GetConsumptionResponse struct { // Consumptions: detailed consumption list. Consumptions []*GetConsumptionResponseConsumption `json:"consumptions"` // UpdatedAt: last consumption update date. UpdatedAt *time.Time `json:"updated_at"` }
GetConsumptionResponse: get consumption response.
type GetConsumptionResponseConsumption ¶
type GetConsumptionResponseConsumption struct { // Value: monetary value of the consumption. Value *scw.Money `json:"value"` // Description: description of the consumption. Description string `json:"description"` // ProjectID: project ID of the consumption. ProjectID string `json:"project_id"` // Category: category of the consumption. Category string `json:"category"` // OperationPath: unique identifier of the product. OperationPath string `json:"operation_path"` }
GetConsumptionResponseConsumption: get consumption response consumption.
type Invoice ¶
type Invoice struct { // ID: invoice ID. ID string `json:"id"` // StartDate: start date of the billing period. StartDate *time.Time `json:"start_date"` // IssuedDate: date when the invoice was sent to the customer. IssuedDate *time.Time `json:"issued_date"` // DueDate: payment time limit, set according to the Organization's payment conditions. DueDate *time.Time `json:"due_date"` // TotalUntaxed: total amount, untaxed. TotalUntaxed *scw.Money `json:"total_untaxed"` // TotalTaxed: total amount, taxed. TotalTaxed *scw.Money `json:"total_taxed"` // InvoiceType: type of invoice. // Default value: unknown_type InvoiceType InvoiceType `json:"invoice_type"` // Number: invoice number. Number int32 `json:"number"` }
Invoice: invoice.
type InvoiceType ¶
type InvoiceType string
func (InvoiceType) MarshalJSON ¶
func (enum InvoiceType) MarshalJSON() ([]byte, error)
func (InvoiceType) String ¶
func (enum InvoiceType) String() string
func (*InvoiceType) UnmarshalJSON ¶
func (enum *InvoiceType) UnmarshalJSON(data []byte) error
type ListDiscountsRequest ¶
type ListDiscountsRequest struct { // OrderBy: order discounts in the response by their description. // Default value: creation_date_desc OrderBy ListDiscountsRequestOrderBy `json:"-"` // Page: positive integer to choose the page to return. Page *int32 `json:"-"` // PageSize: positive integer lower or equal to 100 to select the number of items to return. PageSize *uint32 `json:"-"` // OrganizationID: ID of the organization. OrganizationID *string `json:"-"` }
ListDiscountsRequest: list discounts request.
type ListDiscountsRequestOrderBy ¶
type ListDiscountsRequestOrderBy string
func (ListDiscountsRequestOrderBy) MarshalJSON ¶
func (enum ListDiscountsRequestOrderBy) MarshalJSON() ([]byte, error)
func (ListDiscountsRequestOrderBy) String ¶
func (enum ListDiscountsRequestOrderBy) String() string
func (*ListDiscountsRequestOrderBy) UnmarshalJSON ¶
func (enum *ListDiscountsRequestOrderBy) UnmarshalJSON(data []byte) error
type ListDiscountsResponse ¶
type ListDiscountsResponse struct { // TotalCount: total number of discounts. TotalCount uint64 `json:"total_count"` // Discounts: paginated returned discounts. Discounts []*Discount `json:"discounts"` }
ListDiscountsResponse: list discounts response.
func (*ListDiscountsResponse) UnsafeAppend ¶
func (r *ListDiscountsResponse) UnsafeAppend(res interface{}) (uint64, error)
UnsafeAppend should not be used Internal usage only
func (*ListDiscountsResponse) UnsafeGetTotalCount ¶
func (r *ListDiscountsResponse) UnsafeGetTotalCount() uint64
UnsafeGetTotalCount should not be used Internal usage only
type ListInvoicesRequest ¶
type ListInvoicesRequest struct { // OrganizationID: organization ID to filter for, only invoices from this Organization will be returned. OrganizationID *string `json:"-"` // StartedAfter: invoice's `start_date` is greater or equal to `started_after`. StartedAfter *time.Time `json:"-"` // StartedBefore: invoice's `start_date` precedes `started_before`. StartedBefore *time.Time `json:"-"` // InvoiceType: invoice type. It can either be `periodic` or `purchase`. // Default value: unknown_type InvoiceType InvoiceType `json:"-"` // Page: positive integer to choose the page to return. Page *int32 `json:"-"` // PageSize: positive integer lower or equal to 100 to select the number of items to return. PageSize *uint32 `json:"-"` // OrderBy: how invoices are ordered in the response. // Default value: invoice_number_desc OrderBy ListInvoicesRequestOrderBy `json:"-"` }
ListInvoicesRequest: list invoices request.
type ListInvoicesRequestOrderBy ¶
type ListInvoicesRequestOrderBy string
func (ListInvoicesRequestOrderBy) MarshalJSON ¶
func (enum ListInvoicesRequestOrderBy) MarshalJSON() ([]byte, error)
func (ListInvoicesRequestOrderBy) String ¶
func (enum ListInvoicesRequestOrderBy) String() string
func (*ListInvoicesRequestOrderBy) UnmarshalJSON ¶
func (enum *ListInvoicesRequestOrderBy) UnmarshalJSON(data []byte) error
type ListInvoicesResponse ¶
type ListInvoicesResponse struct { // TotalCount: total number of invoices. TotalCount uint32 `json:"total_count"` // Invoices: paginated returned invoices. Invoices []*Invoice `json:"invoices"` }
ListInvoicesResponse: list invoices response.
func (*ListInvoicesResponse) UnsafeAppend ¶
func (r *ListInvoicesResponse) UnsafeAppend(res interface{}) (uint32, error)
UnsafeAppend should not be used Internal usage only
func (*ListInvoicesResponse) UnsafeGetTotalCount ¶
func (r *ListInvoicesResponse) UnsafeGetTotalCount() uint32
UnsafeGetTotalCount should not be used Internal usage only