github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/search/search_client.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package search
     4  
     5  // This file was generated by the swagger tool.
     6  // Editing this file might prove futile when you re-run the swagger generate command
     7  
     8  import (
     9  	"context"
    10  
    11  	"github.com/go-openapi/runtime"
    12  
    13  	strfmt "github.com/go-openapi/strfmt"
    14  )
    15  
    16  //go:generate mockery -name API -inpkg
    17  
    18  // API is the interface of the search client
    19  type API interface {
    20  	/*
    21  	   Search searches for projects and repositories
    22  
    23  	   The Search endpoint returns information about the projects and repositories offered at public status or related to the current logged in user. The response includes the project and repository list in a proper display order.*/
    24  	Search(ctx context.Context, params *SearchParams) (*SearchOK, error)
    25  }
    26  
    27  // New creates a new search API client.
    28  func New(transport runtime.ClientTransport, formats strfmt.Registry, authInfo runtime.ClientAuthInfoWriter) *Client {
    29  	return &Client{
    30  		transport: transport,
    31  		formats:   formats,
    32  		authInfo:  authInfo,
    33  	}
    34  }
    35  
    36  /*
    37  Client for search API
    38  */
    39  type Client struct {
    40  	transport runtime.ClientTransport
    41  	formats   strfmt.Registry
    42  	authInfo  runtime.ClientAuthInfoWriter
    43  }
    44  
    45  /*
    46  Search searches for projects and repositories
    47  
    48  The Search endpoint returns information about the projects and repositories offered at public status or related to the current logged in user. The response includes the project and repository list in a proper display order.
    49  */
    50  func (a *Client) Search(ctx context.Context, params *SearchParams) (*SearchOK, error) {
    51  
    52  	result, err := a.transport.Submit(&runtime.ClientOperation{
    53  		ID:                 "search",
    54  		Method:             "GET",
    55  		PathPattern:        "/search",
    56  		ProducesMediaTypes: []string{"application/json"},
    57  		ConsumesMediaTypes: []string{"application/json"},
    58  		Schemes:            []string{"http", "https"},
    59  		Params:             params,
    60  		Reader:             &SearchReader{formats: a.formats},
    61  		AuthInfo:           a.authInfo,
    62  		Context:            ctx,
    63  		Client:             params.HTTPClient,
    64  	})
    65  	if err != nil {
    66  		return nil, err
    67  	}
    68  	return result.(*SearchOK), nil
    69  
    70  }