All URIs are relative to https://connto.getopenpay.com
| Method | HTTP request | Description |
|---|---|---|
| CreatePromoCode | Post /promotion-codes/ | Create Promo Code |
| GetPromoCode | Get /promotion-codes/{promo_code_id} | Get Promo Code |
| GetPromoCodeByCode | Get /promotion-codes/code/{promo_code} | Get Promo Code By Code |
| ListPromoCodes | Post /promotion-codes/list | List Promo Codes |
| UpdatePromoCode | Put /promotion-codes/{promo_code_id} | Update Promo Code |
PromotionCodeExternal CreatePromoCode(ctx).CreatePromoCodeRequest(createPromoCodeRequest).Execute()
Create Promo Code
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/getopenpay/getopenpay-go"
)
func main() {
createPromoCodeRequest := *openapiclient.NewCreatePromoCodeRequest("Code_example", "CouponId_example") // CreatePromoCodeRequest |
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.PromotionCodesAPI.CreatePromoCode(context.Background()).CreatePromoCodeRequest(createPromoCodeRequest).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `PromotionCodesAPI.CreatePromoCode``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `CreatePromoCode`: PromotionCodeExternal
fmt.Fprintf(os.Stdout, "Response from `PromotionCodesAPI.CreatePromoCode`: %v\n", resp)
}Other parameters are passed through a pointer to a apiCreatePromoCodeRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|---|---|---|
| createPromoCodeRequest | CreatePromoCodeRequest |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
PromotionCodeExternal GetPromoCode(ctx, promoCodeId).Execute()
Get Promo Code
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/getopenpay/getopenpay-go"
)
func main() {
promoCodeId := "promo_dev_abc123" // string | Unique identifier of the PromotionCode.
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.PromotionCodesAPI.GetPromoCode(context.Background(), promoCodeId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `PromotionCodesAPI.GetPromoCode``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetPromoCode`: PromotionCodeExternal
fmt.Fprintf(os.Stdout, "Response from `PromotionCodesAPI.GetPromoCode`: %v\n", resp)
}| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| promoCodeId | string | Unique identifier of the PromotionCode. |
Other parameters are passed through a pointer to a apiGetPromoCodeRequest 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]
PromotionCodeExternal GetPromoCodeByCode(ctx, promoCode).Execute()
Get Promo Code By Code
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/getopenpay/getopenpay-go"
)
func main() {
promoCode := "promoCode_example" // string | Unique PromotionCode code.
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.PromotionCodesAPI.GetPromoCodeByCode(context.Background(), promoCode).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `PromotionCodesAPI.GetPromoCodeByCode``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetPromoCodeByCode`: PromotionCodeExternal
fmt.Fprintf(os.Stdout, "Response from `PromotionCodesAPI.GetPromoCodeByCode`: %v\n", resp)
}| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| promoCode | string | Unique PromotionCode code. |
Other parameters are passed through a pointer to a apiGetPromoCodeByCodeRequest 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]
ListResponsePromotionCodeExternal ListPromoCodes(ctx).PromoCodeQueryParams(promoCodeQueryParams).Execute()
List Promo Codes
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/getopenpay/getopenpay-go"
)
func main() {
promoCodeQueryParams := *openapiclient.NewPromoCodeQueryParams() // PromoCodeQueryParams |
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.PromotionCodesAPI.ListPromoCodes(context.Background()).PromoCodeQueryParams(promoCodeQueryParams).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `PromotionCodesAPI.ListPromoCodes``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `ListPromoCodes`: ListResponsePromotionCodeExternal
fmt.Fprintf(os.Stdout, "Response from `PromotionCodesAPI.ListPromoCodes`: %v\n", resp)
}Other parameters are passed through a pointer to a apiListPromoCodesRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|---|---|---|
| promoCodeQueryParams | PromoCodeQueryParams |
ListResponsePromotionCodeExternal
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
PromotionCodeExternal UpdatePromoCode(ctx, promoCodeId).UpdatePromoCodeRequest(updatePromoCodeRequest).Execute()
Update Promo Code
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/getopenpay/getopenpay-go"
)
func main() {
promoCodeId := "promo_dev_abc123" // string | Unique identifier of the PromotionCode.
updatePromoCodeRequest := *openapiclient.NewUpdatePromoCodeRequest(false) // UpdatePromoCodeRequest |
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.PromotionCodesAPI.UpdatePromoCode(context.Background(), promoCodeId).UpdatePromoCodeRequest(updatePromoCodeRequest).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `PromotionCodesAPI.UpdatePromoCode``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `UpdatePromoCode`: PromotionCodeExternal
fmt.Fprintf(os.Stdout, "Response from `PromotionCodesAPI.UpdatePromoCode`: %v\n", resp)
}| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| promoCodeId | string | Unique identifier of the PromotionCode. |
Other parameters are passed through a pointer to a apiUpdatePromoCodeRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|
updatePromoCodeRequest | UpdatePromoCodeRequest | |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]