mirror of
https://github.com/rocky-linux/peridot.git
synced 2024-11-05 06:21:24 +00:00
496b60ba44
Signed-off-by: Mustafa Gezen <mustafa@ctrliq.com>
162 lines
4.7 KiB
Go
162 lines
4.7 KiB
Go
/*
|
|
* peridot/proto/v1/batch.proto
|
|
*
|
|
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
*
|
|
* API version: version not set
|
|
*/
|
|
|
|
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
|
|
|
package peridotopenapi
|
|
|
|
import (
|
|
"bytes"
|
|
_context "context"
|
|
_ioutil "io/ioutil"
|
|
_nethttp "net/http"
|
|
_neturl "net/url"
|
|
)
|
|
|
|
// Linger please
|
|
var (
|
|
_ _context.Context
|
|
)
|
|
|
|
type SearchServiceApi interface {
|
|
|
|
/*
|
|
* Search Method for Search
|
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
* @return ApiSearchRequest
|
|
*/
|
|
Search(ctx _context.Context) ApiSearchRequest
|
|
|
|
/*
|
|
* SearchExecute executes the request
|
|
* @return StreamResultOfV1SearchResponse
|
|
*/
|
|
SearchExecute(r ApiSearchRequest) (StreamResultOfV1SearchResponse, *_nethttp.Response, error)
|
|
}
|
|
|
|
// SearchServiceApiService SearchServiceApi service
|
|
type SearchServiceApiService service
|
|
|
|
type ApiSearchRequest struct {
|
|
ctx _context.Context
|
|
ApiService SearchServiceApi
|
|
body *V1SearchRequest
|
|
}
|
|
|
|
func (r ApiSearchRequest) Body(body V1SearchRequest) ApiSearchRequest {
|
|
r.body = &body
|
|
return r
|
|
}
|
|
|
|
func (r ApiSearchRequest) Execute() (StreamResultOfV1SearchResponse, *_nethttp.Response, error) {
|
|
return r.ApiService.SearchExecute(r)
|
|
}
|
|
|
|
/*
|
|
* Search Method for Search
|
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
* @return ApiSearchRequest
|
|
*/
|
|
func (a *SearchServiceApiService) Search(ctx _context.Context) ApiSearchRequest {
|
|
return ApiSearchRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
/*
|
|
* Execute executes the request
|
|
* @return StreamResultOfV1SearchResponse
|
|
*/
|
|
func (a *SearchServiceApiService) SearchExecute(r ApiSearchRequest) (StreamResultOfV1SearchResponse, *_nethttp.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = _nethttp.MethodPost
|
|
localVarPostBody interface{}
|
|
localVarFormFileName string
|
|
localVarFileName string
|
|
localVarFileBytes []byte
|
|
localVarReturnValue StreamResultOfV1SearchResponse
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SearchServiceApiService.Search")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/search"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := _neturl.Values{}
|
|
localVarFormParams := _neturl.Values{}
|
|
if r.body == nil {
|
|
return localVarReturnValue, nil, reportError("body is required and must be specified")
|
|
}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{"application/json"}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
// body params
|
|
localVarPostBody = r.body
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v RpcStatus
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|