From 7157f11c8d5fdceed118425e643e15583addf8ae Mon Sep 17 00:00:00 2001 From: "stepanov.v" Date: Mon, 4 May 2026 07:42:28 +0300 Subject: [PATCH 1/2] DEV-1913: added get_client_offers functionality --- client.go | 13 +++++++++++++ models.go | 18 ++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/client.go b/client.go index 4ef23af..d47ce2e 100644 --- a/client.go +++ b/client.go @@ -35,6 +35,7 @@ type TransportError struct { type ClientInterface interface { GetBalance(ctx context.Context, req *GetBalanceQuery) (*GetBalanceReply, error) + GetClientOffers(ctx context.Context, req *GetClientOffersQuery) (*GetClientOffersReply, error) NewClient(ctx context.Context, req *NewClientQuery) (*NewClientReply, error) UpdateClient(ctx context.Context, req *UpdateClientQuery) (*UpdateClientReply, error) DeleteClient(ctx context.Context, req *DeleteClientQuery) (*DeleteClientReply, error) @@ -153,6 +154,18 @@ func (c *Client) GetBalance(ctx context.Context, req *GetBalanceQuery) (*GetBala return &resp, nil } +func (c *Client) GetClientOffers(ctx context.Context, req *GetClientOffersQuery) (*GetClientOffersReply, error) { + respBody, err := c.request(ctx, "/get-client-offers", req) + if err != nil { + return nil, err + } + var resp GetClientOffersReply + if err = json.Unmarshal(respBody, &resp); err != nil { + return nil, err + } + return &resp, nil +} + func (c *Client) NewClient(ctx context.Context, req *NewClientQuery) (*NewClientReply, error) { respBody, err := c.request(ctx, "/new-client", req) if err != nil { diff --git a/models.go b/models.go index f11d2b8..20c28f7 100644 --- a/models.go +++ b/models.go @@ -95,6 +95,24 @@ type GetBalanceReplyLevel struct { ProgressPercent *int `json:"progressPercent,omitempty"` } +// get-client-offers + +type GetClientOffersQuery struct { + Client ClientQuery `json:"client"` +} + +type GetClientOffersReply struct { + Counters []GetClientOffersReplyCounter `json:"counters"` +} + +type GetClientOffersReplyCounter struct { + Name string `json:"name"` + Value int `json:"value"` + TargetValue int `json:"targetValue"` + TargetDate *time.Time `json:"targetDate"` + Coupons int `json:"coupons"` +} + type Child struct { Name string `json:"name,omitempty"` Birthdate string `json:"birthdate,omitempty"` From e387b6f86a61ab1c3e2c9adf2e869dc918ff6610 Mon Sep 17 00:00:00 2001 From: "stepanov.v" Date: Wed, 6 May 2026 12:45:22 +0300 Subject: [PATCH 2/2] DEV-1913: omitempty for TargetDate --- models.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models.go b/models.go index 20c28f7..fb06505 100644 --- a/models.go +++ b/models.go @@ -109,7 +109,7 @@ type GetClientOffersReplyCounter struct { Name string `json:"name"` Value int `json:"value"` TargetValue int `json:"targetValue"` - TargetDate *time.Time `json:"targetDate"` + TargetDate *time.Time `json:"targetDate,omitempty"` Coupons int `json:"coupons"` }