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