You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@milagro.apache.org by ki...@apache.org on 2019/10/15 14:58:17 UTC

[incubator-milagro-dta] 01/01: orderlist doesn't get params

This is an automated email from the ASF dual-hosted git repository.

kittohoward pushed a commit to branch orderList
in repository https://gitbox.apache.org/repos/asf/incubator-milagro-dta.git

commit 2cf96245bdcbabbb004ca9eb229e525c931c1d5c
Author: howardkitto <ki...@gmail.com>
AuthorDate: Tue Oct 15 15:56:44 2019 +0100

    orderlist doesn't get params
---
 pkg/api/client.go | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/pkg/api/client.go b/pkg/api/client.go
index 4d3ab6d..83893d5 100644
--- a/pkg/api/client.go
+++ b/pkg/api/client.go
@@ -35,6 +35,7 @@ var (
 // ClientService interface
 type ClientService interface {
 	Order(token string, req *OrderRequest) (*OrderResponse, error)
+	OrderList(token string, req *OrderListRequest) (*OrderListResponse, error)
 	OrderSecret(token string, req *OrderSecretRequest) (*OrderSecretResponse, error)
 	Status(token string) (*StatusResponse, error)
 }
@@ -64,6 +65,12 @@ func ClientEndpoints() transport.HTTPEndpoints {
 			Method:      http.MethodGet,
 			NewResponse: func() interface{} { return &StatusResponse{} },
 		},
+		"OrderList": {
+			Path:        "/" + apiVersion + "/order",
+			Method:      http.MethodGet,
+			NewRequest:  func() interface{} { return &OrderListRequest{} },
+			NewResponse: func() interface{} { return &OrderListResponse{} },
+		},
 	}
 }
 
@@ -88,6 +95,20 @@ func (c MilagroClientService) Order(token string, req *OrderRequest) (*OrderResp
 	return resp.(*OrderResponse), nil
 }
 
+//OrderList - returns a paginated list of orders
+func (c MilagroClientService) OrderList(token string, req *OrderListRequest) (*OrderListResponse, error) {
+	endpoint := c.endpoints["OrderList"]
+	ctx := context.Background()
+	ctx = transport.SetJWTAuthHeader(ctx, token)
+
+	resp, err := endpoint(ctx, req)
+	if err != nil {
+		return nil, err
+	}
+
+	return resp.(*OrderListResponse), nil
+}
+
 // OrderSecret makes a request for initiate the order secret
 func (c MilagroClientService) OrderSecret(token string, req *OrderSecretRequest) (*OrderSecretResponse, error) {
 	endpoint := c.endpoints["OrderSecret"]