...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package index
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 SearchIndex(params *SearchIndexParams, opts ...ClientOption) (*SearchIndexOK, error)
48
49 SetTransport(transport runtime.ClientTransport)
50 }
51
52
59 func (a *Client) SearchIndex(params *SearchIndexParams, opts ...ClientOption) (*SearchIndexOK, error) {
60
61 if params == nil {
62 params = NewSearchIndexParams()
63 }
64 op := &runtime.ClientOperation{
65 ID: "searchIndex",
66 Method: "POST",
67 PathPattern: "/api/v1/index/retrieve",
68 ProducesMediaTypes: []string{"application/json"},
69 ConsumesMediaTypes: []string{"application/json"},
70 Schemes: []string{"http"},
71 Params: params,
72 Reader: &SearchIndexReader{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.(*SearchIndexOK)
85 if ok {
86 return success, nil
87 }
88
89 unexpectedSuccess := result.(*SearchIndexDefault)
90 return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
91 }
92
93
94 func (a *Client) SetTransport(transport runtime.ClientTransport) {
95 a.transport = transport
96 }
97
View as plain text