Skip to content

Latest commit

 

History

History
203 lines (128 loc) · 5.75 KB

BillingInvoicesAPI.md

File metadata and controls

203 lines (128 loc) · 5.75 KB

BillingInvoicesAPI

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.

GetInvoiceByInvoiceID

Get invoice by ID.

Example

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)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
invoiceID int32

Other Parameters

Other parameters are passed through a pointer to a apiGetInvoiceByInvoiceIDRequest struct via the builder pattern

Name Type Description Notes

Return type

EomInvoiceResponse

Authorization

API Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

Back to top | Back to API list | Back to README

GetMonthToDateInvoice

Get month-to-date invoice.

Example

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)
}

Path Parameters

This endpoint does not need any parameter.

Other Parameters

Other parameters are passed through a pointer to a apiGetMonthToDateInvoiceRequest struct via the builder pattern

Return type

MtdInvoiceResponse

Authorization

API Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

Back to top | Back to API list | Back to README

ListInvoices

List of invoices.

Example

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)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiListInvoicesRequest struct via the builder pattern

Name Type Description Notes
billingStartDate string billingEndDate

Return type

ListEomInvoicesResponse

Authorization

API Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

Back to top | Back to API list | Back to README