Files
opencloud/vendor/github.com/opencloud-eu/libre-graph-api-go/api_search.go
Dominik Schmidt 0aa8fc56f4 chore(vendor): regenerate libre-graph-api-go with search query + aggregations
Rebased dschmidt/libre-graph-api feat/graph-search-full (PR #34) onto
opencloud-eu main and regenerated via the repo's woodpecker build-go recipe
(openapi-generator v7.23.0, --api-name-suffix Api).
2026-07-30 22:00:45 +02:00

157 lines
4.8 KiB
Go

/*
Libre Graph API
Libre Graph is a free API for cloud collaboration inspired by the MS Graph API.
API version: v1.0.8
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package libregraph
import (
"bytes"
"context"
"io"
"net/http"
"net/url"
)
// SearchApiService SearchApi service
type SearchApiService service
type ApiSearchQueryRequest struct {
ctx context.Context
ApiService *SearchApiService
searchQueryRequest *SearchQueryRequest
}
func (r ApiSearchQueryRequest) SearchQueryRequest(searchQueryRequest SearchQueryRequest) ApiSearchQueryRequest {
r.searchQueryRequest = &searchQueryRequest
return r
}
func (r ApiSearchQueryRequest) Execute() (*SearchQuery200Response, *http.Response, error) {
return r.ApiService.SearchQueryExecute(r)
}
/*
SearchQuery Search for resources
Run a specified search query. Search results are provided in the response.
The search endpoint allows clients to search for resources across all
accessible spaces and retrieve aggregated metadata (facets) about the
result set.
Aggregations can be used to group results by properties such as file type,
author, or any indexed metadata field. This is useful for building faceted
search UIs or computing statistics about the result set.
The query string uses KQL (Keyword Query Language) syntax for filtering.
This endpoint is inspired by the
[MS Graph Search API](https://learn.microsoft.com/en-us/graph/api/search-query)
and follows the same request/response structure for compatibility.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ApiSearchQueryRequest
*/
func (a *SearchApiService) SearchQuery(ctx context.Context) ApiSearchQueryRequest {
return ApiSearchQueryRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
// @return SearchQuery200Response
func (a *SearchApiService) SearchQueryExecute(r ApiSearchQueryRequest) (*SearchQuery200Response, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPost
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *SearchQuery200Response
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SearchApiService.SearchQuery")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1beta1/search/query"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.searchQueryRequest == nil {
return localVarReturnValue, nil, reportError("searchQueryRequest 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.searchQueryRequest
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
var v OdataError
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
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
}