All URIs are relative to https://connto.getopenpay.com
| Method | HTTP request | Description |
|---|---|---|
| CreateCoupon | Post /coupons/ | Create Coupon |
| DeleteCoupon | Delete /coupons/{coupon_id} | Delete Coupon |
| GetCoupon | Get /coupons/{coupon_id} | Get Coupon |
| ListCoupons | Post /coupons/list | List Coupons |
| UpdateCoupon | Put /coupons/{coupon_id} | Update Coupon |
CouponExternal CreateCoupon(ctx).CreateCouponRequest(createCouponRequest).Execute()
Create Coupon
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/getopenpay/getopenpay-go"
)
func main() {
createCouponRequest := *openapiclient.NewCreateCouponRequest("Name_example") // CreateCouponRequest |
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.CouponsAPI.CreateCoupon(context.Background()).CreateCouponRequest(createCouponRequest).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `CouponsAPI.CreateCoupon``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `CreateCoupon`: CouponExternal
fmt.Fprintf(os.Stdout, "Response from `CouponsAPI.CreateCoupon`: %v\n", resp)
}Other parameters are passed through a pointer to a apiCreateCouponRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|---|---|---|
| createCouponRequest | CreateCouponRequest |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
interface{} DeleteCoupon(ctx, couponId).Execute()
Delete Coupon
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/getopenpay/getopenpay-go"
)
func main() {
couponId := "coupon_dev_abc123" // string | Unique identifier of the Coupon.
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.CouponsAPI.DeleteCoupon(context.Background(), couponId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `CouponsAPI.DeleteCoupon``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `DeleteCoupon`: interface{}
fmt.Fprintf(os.Stdout, "Response from `CouponsAPI.DeleteCoupon`: %v\n", resp)
}| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| couponId | string | Unique identifier of the Coupon. |
Other parameters are passed through a pointer to a apiDeleteCouponRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|
interface{}
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
CouponExternal GetCoupon(ctx, couponId).Execute()
Get Coupon
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/getopenpay/getopenpay-go"
)
func main() {
couponId := "coupon_dev_abc123" // string | Unique identifier of the Coupon.
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.CouponsAPI.GetCoupon(context.Background(), couponId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `CouponsAPI.GetCoupon``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetCoupon`: CouponExternal
fmt.Fprintf(os.Stdout, "Response from `CouponsAPI.GetCoupon`: %v\n", resp)
}| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| couponId | string | Unique identifier of the Coupon. |
Other parameters are passed through a pointer to a apiGetCouponRequest 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 Model list] [Back to README]
ListResponseCouponExternal ListCoupons(ctx).CouponQueryParams(couponQueryParams).Execute()
List Coupons
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/getopenpay/getopenpay-go"
)
func main() {
couponQueryParams := *openapiclient.NewCouponQueryParams() // CouponQueryParams |
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.CouponsAPI.ListCoupons(context.Background()).CouponQueryParams(couponQueryParams).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `CouponsAPI.ListCoupons``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `ListCoupons`: ListResponseCouponExternal
fmt.Fprintf(os.Stdout, "Response from `CouponsAPI.ListCoupons`: %v\n", resp)
}Other parameters are passed through a pointer to a apiListCouponsRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|---|---|---|
| couponQueryParams | CouponQueryParams |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
CouponExternal UpdateCoupon(ctx, couponId).UpdateCouponRequest(updateCouponRequest).Execute()
Update Coupon
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/getopenpay/getopenpay-go"
)
func main() {
couponId := "coupon_dev_abc123" // string | Unique identifier of the Coupon.
updateCouponRequest := *openapiclient.NewUpdateCouponRequest() // UpdateCouponRequest |
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.CouponsAPI.UpdateCoupon(context.Background(), couponId).UpdateCouponRequest(updateCouponRequest).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `CouponsAPI.UpdateCoupon``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `UpdateCoupon`: CouponExternal
fmt.Fprintf(os.Stdout, "Response from `CouponsAPI.UpdateCoupon`: %v\n", resp)
}| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| couponId | string | Unique identifier of the Coupon. |
Other parameters are passed through a pointer to a apiUpdateCouponRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|
updateCouponRequest | UpdateCouponRequest | |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]