Note
All URIs are relative to https://api.fastly.com
Method | HTTP request | Description |
---|---|---|
GetInvoiceByInvoiceID | GET /billing/v3/invoices/{invoice_id} |
Get invoice by ID. |
GetMonthToDateInvoice | GET /billing/v3/invoices/month-to-date |
Get month-to-date invoice. |
ListInvoices | GET /billing/v3/invoices |
List of invoices. |
Get invoice by ID.
package main
import (
"context"
"fmt"
"os"
"github.com/fastly/fastly-go/fastly"
)
func main() {
invoiceID := int32(4183280) // int32 |
cfg := fastly.NewConfiguration()
apiClient := fastly.NewAPIClient(cfg)
ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
resp, r, err := apiClient.BillingInvoicesAPI.GetInvoiceByInvoiceID(ctx, invoiceID).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `BillingInvoicesAPI.GetInvoiceByInvoiceID`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetInvoiceByInvoiceID`: EomInvoiceResponse
fmt.Fprintf(os.Stdout, "Response from `BillingInvoicesAPI.GetInvoiceByInvoiceID`: %v\n", resp)
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
invoiceID | int32 |
Other parameters are passed through a pointer to a apiGetInvoiceByInvoiceIDRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
- Content-Type: Not defined
- Accept: application/json
Back to top | Back to API list | Back to README
Get month-to-date invoice.
package main
import (
"context"
"fmt"
"os"
"github.com/fastly/fastly-go/fastly"
)
func main() {
cfg := fastly.NewConfiguration()
apiClient := fastly.NewAPIClient(cfg)
ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
resp, r, err := apiClient.BillingInvoicesAPI.GetMonthToDateInvoice(ctx).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `BillingInvoicesAPI.GetMonthToDateInvoice`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetMonthToDateInvoice`: MtdInvoiceResponse
fmt.Fprintf(os.Stdout, "Response from `BillingInvoicesAPI.GetMonthToDateInvoice`: %v\n", resp)
}
This endpoint does not need any parameter.
Other parameters are passed through a pointer to a apiGetMonthToDateInvoiceRequest struct via the builder pattern
- Content-Type: Not defined
- Accept: application/json
Back to top | Back to API list | Back to README
List of invoices.
package main
import (
"context"
"fmt"
"os"
"github.com/fastly/fastly-go/fastly"
)
func main() {
billingStartDate := "2023-01-01" // string | (optional)
billingEndDate := "2023-01-31" // string | (optional)
limit := "limit_example" // string | Number of results per page. The maximum is 200. (optional) (default to "100")
cursor := "cursor_example" // string | Cursor value from the `next_cursor` field of a previous response, used to retrieve the next page. To request the first page, this should be empty. (optional)
cfg := fastly.NewConfiguration()
apiClient := fastly.NewAPIClient(cfg)
ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
resp, r, err := apiClient.BillingInvoicesAPI.ListInvoices(ctx).BillingStartDate(billingStartDate).BillingEndDate(billingEndDate).Limit(limit).Cursor(cursor).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `BillingInvoicesAPI.ListInvoices`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `ListInvoices`: ListEomInvoicesResponse
fmt.Fprintf(os.Stdout, "Response from `BillingInvoicesAPI.ListInvoices`: %v\n", resp)
}
Other parameters are passed through a pointer to a apiListInvoicesRequest struct via the builder pattern
Name | Type | Description | Notes |
---|---|---|---|
billingStartDate | string | billingEndDate |
- Content-Type: Not defined
- Accept: application/json