github.com/djarvur/go-swagger@v0.18.0/examples/authentication/client/customers/customers_client.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package customers
     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 customers 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 customers API
    21  */
    22  type Client struct {
    23  	transport runtime.ClientTransport
    24  	formats   strfmt.Registry
    25  }
    26  
    27  /*
    28  Create creates a new customer to track
    29  */
    30  func (a *Client) Create(params *CreateParams, authInfo runtime.ClientAuthInfoWriter) (*CreateCreated, error) {
    31  	// TODO: Validate the params before sending
    32  	if params == nil {
    33  		params = NewCreateParams()
    34  	}
    35  
    36  	result, err := a.transport.Submit(&runtime.ClientOperation{
    37  		ID:                 "create",
    38  		Method:             "POST",
    39  		PathPattern:        "/customers",
    40  		ProducesMediaTypes: []string{"application/keyauth.api.v1+json"},
    41  		ConsumesMediaTypes: []string{"application/keyauth.api.v1+json"},
    42  		Schemes:            []string{"http"},
    43  		Params:             params,
    44  		Reader:             &CreateReader{formats: a.formats},
    45  		AuthInfo:           authInfo,
    46  		Context:            params.Context,
    47  		Client:             params.HTTPClient,
    48  	})
    49  	if err != nil {
    50  		return nil, err
    51  	}
    52  	return result.(*CreateCreated), nil
    53  
    54  }
    55  
    56  /*
    57  GetID gets a customer Id given an s s n
    58  */
    59  func (a *Client) GetID(params *GetIDParams, authInfo runtime.ClientAuthInfoWriter) (*GetIDOK, error) {
    60  	// TODO: Validate the params before sending
    61  	if params == nil {
    62  		params = NewGetIDParams()
    63  	}
    64  
    65  	result, err := a.transport.Submit(&runtime.ClientOperation{
    66  		ID:                 "getId",
    67  		Method:             "GET",
    68  		PathPattern:        "/customers",
    69  		ProducesMediaTypes: []string{"application/keyauth.api.v1+json"},
    70  		ConsumesMediaTypes: []string{"application/keyauth.api.v1+json"},
    71  		Schemes:            []string{"http"},
    72  		Params:             params,
    73  		Reader:             &GetIDReader{formats: a.formats},
    74  		AuthInfo:           authInfo,
    75  		Context:            params.Context,
    76  		Client:             params.HTTPClient,
    77  	})
    78  	if err != nil {
    79  		return nil, err
    80  	}
    81  	return result.(*GetIDOK), nil
    82  
    83  }
    84  
    85  // SetTransport changes the transport on the client
    86  func (a *Client) SetTransport(transport runtime.ClientTransport) {
    87  	a.transport = transport
    88  }