(CustomerPortal.CustomerMeters)
List meters of the authenticated customer.
Scopes: customer_portal:read
customer_portal:write
package main
import(
"context"
polargo "github.com/polarsource/polar-go"
"github.com/polarsource/polar-go/models/operations"
"os"
"log"
)
func main() {
ctx := context.Background()
s := polargo.New()
res, err := s.CustomerPortal.CustomerMeters.List(ctx, operations.CustomerPortalCustomerMetersListRequest{}, operations.CustomerPortalCustomerMetersListSecurity{
CustomerSession: os.Getenv("POLAR_CUSTOMER_SESSION"),
})
if err != nil {
log.Fatal(err)
}
if res.ListResourceCustomerCustomerMeter != nil {
for {
// handle items
res, err = res.Next()
if err != nil {
// handle error
}
if res == nil {
break
}
}
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.CustomerPortalCustomerMetersListRequest | ✔️ | The request object to use for the request. |
security |
operations.CustomerPortalCustomerMetersListSecurity | ✔️ | The security requirements to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.CustomerPortalCustomerMetersListResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.HTTPValidationError | 422 | application/json |
apierrors.APIError | 4XX, 5XX | */* |
Get a meter by ID for the authenticated customer.
Scopes: customer_portal:read
customer_portal:write
package main
import(
"context"
polargo "github.com/polarsource/polar-go"
"os"
"github.com/polarsource/polar-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := polargo.New()
res, err := s.CustomerPortal.CustomerMeters.Get(ctx, operations.CustomerPortalCustomerMetersGetSecurity{
CustomerSession: os.Getenv("POLAR_CUSTOMER_SESSION"),
}, "<value>")
if err != nil {
log.Fatal(err)
}
if res.CustomerCustomerMeter != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
security |
operations.CustomerPortalCustomerMetersGetSecurity | ✔️ | The security requirements to use for the request. |
id |
string | ✔️ | The customer meter ID. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.CustomerPortalCustomerMetersGetResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.ResourceNotFound | 404 | application/json |
apierrors.HTTPValidationError | 422 | application/json |
apierrors.APIError | 4XX, 5XX | */* |