...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package general
18
19
20
21
22 import (
23 "fmt"
24
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 GetStatus(params *GetStatusParams, opts ...ClientOption) (*GetStatusOK, error)
48
49 SetTransport(transport runtime.ClientTransport)
50 }
51
52
55 func (a *Client) GetStatus(params *GetStatusParams, opts ...ClientOption) (*GetStatusOK, error) {
56
57 if params == nil {
58 params = NewGetStatusParams()
59 }
60 op := &runtime.ClientOperation{
61 ID: "getStatus",
62 Method: "GET",
63 PathPattern: "/status",
64 ProducesMediaTypes: []string{"application/json"},
65 ConsumesMediaTypes: []string{"application/json"},
66 Schemes: []string{"http"},
67 Params: params,
68 Reader: &GetStatusReader{formats: a.formats},
69 Context: params.Context,
70 Client: params.HTTPClient,
71 }
72 for _, opt := range opts {
73 opt(op)
74 }
75
76 result, err := a.transport.Submit(op)
77 if err != nil {
78 return nil, err
79 }
80 success, ok := result.(*GetStatusOK)
81 if ok {
82 return success, nil
83 }
84
85
86 msg := fmt.Sprintf("unexpected success response for getStatus: API contract not enforced by server. Client expected to get an error, but got: %T", result)
87 panic(msg)
88 }
89
90
91 func (a *Client) SetTransport(transport runtime.ClientTransport) {
92 a.transport = transport
93 }
94
View as plain text