(CustomerPortal.BenefitGrants)
List benefits grants of the authenticated customer or user.
package main
import(
"context"
"os"
polargo "github.com/polarsource/polar-go"
"github.com/polarsource/polar-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := polargo.New(
polargo.WithSecurity(os.Getenv("POLAR_ACCESS_TOKEN")),
)
res, err := s.CustomerPortal.BenefitGrants.List(ctx, operations.CustomerPortalBenefitGrantsListRequest{})
if err != nil {
log.Fatal(err)
}
if res.ListResourceCustomerBenefitGrant != 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.CustomerPortalBenefitGrantsListRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.CustomerPortalBenefitGrantsListResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.HTTPValidationError | 422 | application/json |
apierrors.APIError | 4XX, 5XX | */* |
Get a benefit grant by ID for the authenticated customer or user.
package main
import(
"context"
"os"
polargo "github.com/polarsource/polar-go"
"log"
)
func main() {
ctx := context.Background()
s := polargo.New(
polargo.WithSecurity(os.Getenv("POLAR_ACCESS_TOKEN")),
)
res, err := s.CustomerPortal.BenefitGrants.Get(ctx, "<value>")
if err != nil {
log.Fatal(err)
}
if res.CustomerBenefitGrant != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
id |
string | ✔️ | The benefit grant ID. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.CustomerPortalBenefitGrantsGetResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.ResourceNotFound | 404 | application/json |
apierrors.HTTPValidationError | 422 | application/json |
apierrors.APIError | 4XX, 5XX | */* |
Update a benefit grant for the authenticated customer or user.
package main
import(
"context"
"os"
polargo "github.com/polarsource/polar-go"
"github.com/polarsource/polar-go/models/components"
"log"
)
func main() {
ctx := context.Background()
s := polargo.New(
polargo.WithSecurity(os.Getenv("POLAR_ACCESS_TOKEN")),
)
res, err := s.CustomerPortal.BenefitGrants.Update(ctx, "<value>", components.CreateCustomerBenefitGrantUpdateCustomerBenefitGrantDownloadablesUpdate(
components.CustomerBenefitGrantDownloadablesUpdate{},
))
if err != nil {
log.Fatal(err)
}
if res.CustomerBenefitGrant != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
id |
string | ✔️ | The benefit grant ID. |
customerBenefitGrantUpdate |
components.CustomerBenefitGrantUpdate | ✔️ | N/A |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.CustomerPortalBenefitGrantsUpdateResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.NotPermitted | 403 | application/json |
apierrors.ResourceNotFound | 404 | application/json |
apierrors.HTTPValidationError | 422 | application/json |
apierrors.APIError | 4XX, 5XX | */* |