github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/mono/mono_client/trials/trials_client.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package trials 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 "fmt" 10 11 "github.com/go-openapi/runtime" 12 "github.com/go-openapi/strfmt" 13 ) 14 15 // New creates a new trials API client. 16 func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { 17 return &Client{transport: transport, formats: formats} 18 } 19 20 /* 21 Client for trials API 22 */ 23 type Client struct { 24 transport runtime.ClientTransport 25 formats strfmt.Registry 26 } 27 28 // ClientOption is the option for Client methods 29 type ClientOption func(*runtime.ClientOperation) 30 31 // ClientService is the interface for Client methods 32 type ClientService interface { 33 PostOrganizationTrial(params *PostOrganizationTrialParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostOrganizationTrialOK, error) 34 35 SetTransport(transport runtime.ClientTransport) 36 } 37 38 /* 39 PostOrganizationTrial organizations team tier trial 40 41 Starts the org on a (fake) team-tier trial. 42 */ 43 func (a *Client) PostOrganizationTrial(params *PostOrganizationTrialParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostOrganizationTrialOK, error) { 44 // TODO: Validate the params before sending 45 if params == nil { 46 params = NewPostOrganizationTrialParams() 47 } 48 op := &runtime.ClientOperation{ 49 ID: "postOrganizationTrial", 50 Method: "POST", 51 PathPattern: "/organizations/{organizationIdentifier}/trial", 52 ProducesMediaTypes: []string{"application/json"}, 53 ConsumesMediaTypes: []string{"application/json"}, 54 Schemes: []string{"http", "https"}, 55 Params: params, 56 Reader: &PostOrganizationTrialReader{formats: a.formats}, 57 AuthInfo: authInfo, 58 Context: params.Context, 59 Client: params.HTTPClient, 60 } 61 for _, opt := range opts { 62 opt(op) 63 } 64 65 result, err := a.transport.Submit(op) 66 if err != nil { 67 return nil, err 68 } 69 success, ok := result.(*PostOrganizationTrialOK) 70 if ok { 71 return success, nil 72 } 73 // unexpected success response 74 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 75 msg := fmt.Sprintf("unexpected success response for postOrganizationTrial: API contract not enforced by server. Client expected to get an error, but got: %T", result) 76 panic(msg) 77 } 78 79 // SetTransport changes the transport on the client 80 func (a *Client) SetTransport(transport runtime.ClientTransport) { 81 a.transport = transport 82 }