Documentation
¶
Index ¶
- type Client
- func (c *Client) Create(ctx context.Context, request *loyalty.CreateLoyaltyRewardRequest, ...) (*squaregosdk.CreateLoyaltyRewardResponse, error)
- func (c *Client) Delete(ctx context.Context, request *loyalty.RewardsDeleteRequest, ...) (*squaregosdk.DeleteLoyaltyRewardResponse, error)
- func (c *Client) Get(ctx context.Context, request *loyalty.RewardsGetRequest, ...) (*squaregosdk.GetLoyaltyRewardResponse, error)
- func (c *Client) Redeem(ctx context.Context, request *loyalty.RedeemLoyaltyRewardRequest, ...) (*squaregosdk.RedeemLoyaltyRewardResponse, error)
- func (c *Client) Search(ctx context.Context, request *loyalty.SearchLoyaltyRewardsRequest, ...) (*squaregosdk.SearchLoyaltyRewardsResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(opts ...option.RequestOption) *Client
func (*Client) Create ¶
func (c *Client) Create( ctx context.Context, request *loyalty.CreateLoyaltyRewardRequest, opts ...option.RequestOption, ) (*squaregosdk.CreateLoyaltyRewardResponse, error)
Creates a loyalty reward. In the process, the endpoint does following:
- Uses the `reward_tier_id` in the request to determine the number of points to lock for this reward. - If the request includes `order_id`, it adds the reward and related discount to the order.
After a reward is created, the points are locked and not available for the buyer to redeem another reward.
func (*Client) Delete ¶
func (c *Client) Delete( ctx context.Context, request *loyalty.RewardsDeleteRequest, opts ...option.RequestOption, ) (*squaregosdk.DeleteLoyaltyRewardResponse, error)
Deletes a loyalty reward by doing the following:
- Returns the loyalty points back to the loyalty account. - If an order ID was specified when the reward was created (see [CreateLoyaltyReward](api-endpoint:Loyalty-CreateLoyaltyReward)), it updates the order by removing the reward and related discounts.
You cannot delete a reward that has reached the terminal state (REDEEMED).
func (*Client) Get ¶
func (c *Client) Get( ctx context.Context, request *loyalty.RewardsGetRequest, opts ...option.RequestOption, ) (*squaregosdk.GetLoyaltyRewardResponse, error)
Retrieves a loyalty reward.
func (*Client) Redeem ¶
func (c *Client) Redeem( ctx context.Context, request *loyalty.RedeemLoyaltyRewardRequest, opts ...option.RequestOption, ) (*squaregosdk.RedeemLoyaltyRewardResponse, error)
Redeems a loyalty reward.
The endpoint sets the reward to the `REDEEMED` terminal state.
If you are using your own order processing system (not using the Orders API), you call this endpoint after the buyer paid for the purchase.
After the reward reaches the terminal state, it cannot be deleted. In other words, points used for the reward cannot be returned to the account.
func (*Client) Search ¶
func (c *Client) Search( ctx context.Context, request *loyalty.SearchLoyaltyRewardsRequest, opts ...option.RequestOption, ) (*squaregosdk.SearchLoyaltyRewardsResponse, error)
Searches for loyalty rewards. This endpoint accepts a request with no query filters and returns results for all loyalty accounts. If you include a `query` object, `loyalty_account_id` is required and `status` is optional.
If you know a reward ID, use the [RetrieveLoyaltyReward](api-endpoint:Loyalty-RetrieveLoyaltyReward) endpoint.
Search results are sorted by `updated_at` in descending order.