Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 {
Expand Down
18 changes: 18 additions & 0 deletions models.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,omitempty"`
Coupons int `json:"coupons"`
}

type Child struct {
Name string `json:"name,omitempty"`
Birthdate string `json:"birthdate,omitempty"`
Expand Down
Loading