...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package pubkey
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 GetPublicKey(params *GetPublicKeyParams, opts ...ClientOption) (*GetPublicKeyOK, error)
48
49 SetTransport(transport runtime.ClientTransport)
50 }
51
52
57 func (a *Client) GetPublicKey(params *GetPublicKeyParams, opts ...ClientOption) (*GetPublicKeyOK, error) {
58
59 if params == nil {
60 params = NewGetPublicKeyParams()
61 }
62 op := &runtime.ClientOperation{
63 ID: "getPublicKey",
64 Method: "GET",
65 PathPattern: "/api/v1/log/publicKey",
66 ProducesMediaTypes: []string{"application/x-pem-file"},
67 ConsumesMediaTypes: []string{"application/json"},
68 Schemes: []string{"http"},
69 Params: params,
70 Reader: &GetPublicKeyReader{formats: a.formats},
71 Context: params.Context,
72 Client: params.HTTPClient,
73 }
74 for _, opt := range opts {
75 opt(op)
76 }
77
78 result, err := a.transport.Submit(op)
79 if err != nil {
80 return nil, err
81 }
82 success, ok := result.(*GetPublicKeyOK)
83 if ok {
84 return success, nil
85 }
86
87 unexpectedSuccess := result.(*GetPublicKeyDefault)
88 return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
89 }
90
91
92 func (a *Client) SetTransport(transport runtime.ClientTransport) {
93 a.transport = transport
94 }
95
View as plain text