github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/secrets/secrets_client/authentication/authentication_client.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package authentication 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 "github.com/go-openapi/runtime" 10 11 strfmt "github.com/go-openapi/strfmt" 12 ) 13 14 // New creates a new authentication API client. 15 func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { 16 return &Client{transport: transport, formats: formats} 17 } 18 19 /* 20 Client for authentication API 21 */ 22 type Client struct { 23 transport runtime.ClientTransport 24 formats strfmt.Registry 25 } 26 27 /* 28 GetWhoami checks the validity of the j w t and echo the user s uid 29 30 Check the validity of the JWT and echo the user's uid 31 */ 32 func (a *Client) GetWhoami(params *GetWhoamiParams, authInfo runtime.ClientAuthInfoWriter) (*GetWhoamiOK, error) { 33 // TODO: Validate the params before sending 34 if params == nil { 35 params = NewGetWhoamiParams() 36 } 37 38 result, err := a.transport.Submit(&runtime.ClientOperation{ 39 ID: "GetWhoami", 40 Method: "GET", 41 PathPattern: "/whoami", 42 ProducesMediaTypes: []string{"application/json"}, 43 ConsumesMediaTypes: []string{"application/json"}, 44 Schemes: []string{"http"}, 45 Params: params, 46 Reader: &GetWhoamiReader{formats: a.formats}, 47 AuthInfo: authInfo, 48 Context: params.Context, 49 Client: params.HTTPClient, 50 }) 51 if err != nil { 52 return nil, err 53 } 54 return result.(*GetWhoamiOK), nil 55 56 } 57 58 // SetTransport changes the transport on the client 59 func (a *Client) SetTransport(transport runtime.ClientTransport) { 60 a.transport = transport 61 }