github.com/circl-dev/go-swagger@v0.31.0/examples/contributed-templates/stratoscale/client/store/store_client.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package store
     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/circl-dev/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 store client
    19  type API interface {
    20  	/*
    21  	   InventoryGet returns pet inventories by status*/
    22  	InventoryGet(ctx context.Context, params *InventoryGetParams) (*InventoryGetOK, error)
    23  	/*
    24  	   OrderCreate places an order for a pet*/
    25  	OrderCreate(ctx context.Context, params *OrderCreateParams) (*OrderCreateOK, error)
    26  	/*
    27  	   OrderDelete deletes purchase order by ID
    28  
    29  	   For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors*/
    30  	OrderDelete(ctx context.Context, params *OrderDeleteParams) (*OrderDeleteNoContent, error)
    31  	/*
    32  	   OrderGet finds purchase order by ID
    33  
    34  	   For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions*/
    35  	OrderGet(ctx context.Context, params *OrderGetParams) (*OrderGetOK, error)
    36  }
    37  
    38  // New creates a new store API client.
    39  func New(transport runtime.ClientTransport, formats strfmt.Registry, authInfo runtime.ClientAuthInfoWriter) *Client {
    40  	return &Client{
    41  		transport: transport,
    42  		formats:   formats,
    43  		authInfo:  authInfo,
    44  	}
    45  }
    46  
    47  /*
    48  Client for store API
    49  */
    50  type Client struct {
    51  	transport runtime.ClientTransport
    52  	formats   strfmt.Registry
    53  	authInfo  runtime.ClientAuthInfoWriter
    54  }
    55  
    56  /*
    57  InventoryGet returns pet inventories by status
    58  */
    59  func (a *Client) InventoryGet(ctx context.Context, params *InventoryGetParams) (*InventoryGetOK, error) {
    60  
    61  	result, err := a.transport.Submit(&runtime.ClientOperation{
    62  		ID:                 "InventoryGet",
    63  		Method:             "GET",
    64  		PathPattern:        "/store/inventory",
    65  		ProducesMediaTypes: []string{"application/json"},
    66  		ConsumesMediaTypes: []string{"application/json"},
    67  		Schemes:            []string{"http"},
    68  		Params:             params,
    69  		Reader:             &InventoryGetReader{formats: a.formats},
    70  		AuthInfo:           a.authInfo,
    71  		Context:            ctx,
    72  		Client:             params.HTTPClient,
    73  	})
    74  	if err != nil {
    75  		return nil, err
    76  	}
    77  	return result.(*InventoryGetOK), nil
    78  
    79  }
    80  
    81  /*
    82  OrderCreate places an order for a pet
    83  */
    84  func (a *Client) OrderCreate(ctx context.Context, params *OrderCreateParams) (*OrderCreateOK, error) {
    85  
    86  	result, err := a.transport.Submit(&runtime.ClientOperation{
    87  		ID:                 "OrderCreate",
    88  		Method:             "POST",
    89  		PathPattern:        "/store/order",
    90  		ProducesMediaTypes: []string{"application/json"},
    91  		ConsumesMediaTypes: []string{"application/json"},
    92  		Schemes:            []string{"http"},
    93  		Params:             params,
    94  		Reader:             &OrderCreateReader{formats: a.formats},
    95  		AuthInfo:           a.authInfo,
    96  		Context:            ctx,
    97  		Client:             params.HTTPClient,
    98  	})
    99  	if err != nil {
   100  		return nil, err
   101  	}
   102  	return result.(*OrderCreateOK), nil
   103  
   104  }
   105  
   106  /*
   107  OrderDelete deletes purchase order by ID
   108  
   109  For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors
   110  */
   111  func (a *Client) OrderDelete(ctx context.Context, params *OrderDeleteParams) (*OrderDeleteNoContent, error) {
   112  
   113  	result, err := a.transport.Submit(&runtime.ClientOperation{
   114  		ID:                 "OrderDelete",
   115  		Method:             "DELETE",
   116  		PathPattern:        "/store/order/{orderId}",
   117  		ProducesMediaTypes: []string{"application/json"},
   118  		ConsumesMediaTypes: []string{"application/json"},
   119  		Schemes:            []string{"http"},
   120  		Params:             params,
   121  		Reader:             &OrderDeleteReader{formats: a.formats},
   122  		AuthInfo:           a.authInfo,
   123  		Context:            ctx,
   124  		Client:             params.HTTPClient,
   125  	})
   126  	if err != nil {
   127  		return nil, err
   128  	}
   129  	return result.(*OrderDeleteNoContent), nil
   130  
   131  }
   132  
   133  /*
   134  OrderGet finds purchase order by ID
   135  
   136  For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions
   137  */
   138  func (a *Client) OrderGet(ctx context.Context, params *OrderGetParams) (*OrderGetOK, error) {
   139  
   140  	result, err := a.transport.Submit(&runtime.ClientOperation{
   141  		ID:                 "OrderGet",
   142  		Method:             "GET",
   143  		PathPattern:        "/store/order/{orderId}",
   144  		ProducesMediaTypes: []string{"application/json"},
   145  		ConsumesMediaTypes: []string{"application/json"},
   146  		Schemes:            []string{"http"},
   147  		Params:             params,
   148  		Reader:             &OrderGetReader{formats: a.formats},
   149  		AuthInfo:           a.authInfo,
   150  		Context:            ctx,
   151  		Client:             params.HTTPClient,
   152  	})
   153  	if err != nil {
   154  		return nil, err
   155  	}
   156  	return result.(*OrderGetOK), nil
   157  
   158  }