1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package tlog
20
21
22
23
24 import (
25 "github.com/go-openapi/runtime"
26 "github.com/go-openapi/strfmt"
27 )
28
29
30 func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
31 return &Client{transport: transport, formats: formats}
32 }
33
34
37 type Client struct {
38 transport runtime.ClientTransport
39 formats strfmt.Registry
40 }
41
42
43 type ClientOption func(*runtime.ClientOperation)
44
45
46 type ClientService interface {
47 GetLogInfo(params *GetLogInfoParams, opts ...ClientOption) (*GetLogInfoOK, error)
48
49 GetLogProof(params *GetLogProofParams, opts ...ClientOption) (*GetLogProofOK, error)
50
51 SetTransport(transport runtime.ClientTransport)
52 }
53
54
59 func (a *Client) GetLogInfo(params *GetLogInfoParams, opts ...ClientOption) (*GetLogInfoOK, error) {
60
61 if params == nil {
62 params = NewGetLogInfoParams()
63 }
64 op := &runtime.ClientOperation{
65 ID: "getLogInfo",
66 Method: "GET",
67 PathPattern: "/api/v1/log",
68 ProducesMediaTypes: []string{"application/json"},
69 ConsumesMediaTypes: []string{"application/json"},
70 Schemes: []string{"http"},
71 Params: params,
72 Reader: &GetLogInfoReader{formats: a.formats},
73 Context: params.Context,
74 Client: params.HTTPClient,
75 }
76 for _, opt := range opts {
77 opt(op)
78 }
79
80 result, err := a.transport.Submit(op)
81 if err != nil {
82 return nil, err
83 }
84 success, ok := result.(*GetLogInfoOK)
85 if ok {
86 return success, nil
87 }
88
89 unexpectedSuccess := result.(*GetLogInfoDefault)
90 return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
91 }
92
93
98 func (a *Client) GetLogProof(params *GetLogProofParams, opts ...ClientOption) (*GetLogProofOK, error) {
99
100 if params == nil {
101 params = NewGetLogProofParams()
102 }
103 op := &runtime.ClientOperation{
104 ID: "getLogProof",
105 Method: "GET",
106 PathPattern: "/api/v1/log/proof",
107 ProducesMediaTypes: []string{"application/json"},
108 ConsumesMediaTypes: []string{"application/json"},
109 Schemes: []string{"http"},
110 Params: params,
111 Reader: &GetLogProofReader{formats: a.formats},
112 Context: params.Context,
113 Client: params.HTTPClient,
114 }
115 for _, opt := range opts {
116 opt(op)
117 }
118
119 result, err := a.transport.Submit(op)
120 if err != nil {
121 return nil, err
122 }
123 success, ok := result.(*GetLogProofOK)
124 if ok {
125 return success, nil
126 }
127
128 unexpectedSuccess := result.(*GetLogProofDefault)
129 return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
130 }
131
132
133 func (a *Client) SetTransport(transport runtime.ClientTransport) {
134 a.transport = transport
135 }
136
View as plain text