github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/mono/mono_client/invoices/invoices_client.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package invoices
     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 invoices 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 invoices 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  	CalculateTax(params *CalculateTaxParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CalculateTaxOK, error)
    34  
    35  	CancelSubscription(params *CancelSubscriptionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CancelSubscriptionOK, error)
    36  
    37  	CreateInvoice(params *CreateInvoiceParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateInvoiceOK, error)
    38  
    39  	SetTransport(transport runtime.ClientTransport)
    40  }
    41  
    42  /*
    43    CalculateTax calculates the tax for the given address and options
    44  */
    45  func (a *Client) CalculateTax(params *CalculateTaxParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CalculateTaxOK, error) {
    46  	// TODO: Validate the params before sending
    47  	if params == nil {
    48  		params = NewCalculateTaxParams()
    49  	}
    50  	op := &runtime.ClientOperation{
    51  		ID:                 "calculateTax",
    52  		Method:             "POST",
    53  		PathPattern:        "/taxes",
    54  		ProducesMediaTypes: []string{"application/json"},
    55  		ConsumesMediaTypes: []string{"application/json"},
    56  		Schemes:            []string{"http", "https"},
    57  		Params:             params,
    58  		Reader:             &CalculateTaxReader{formats: a.formats},
    59  		AuthInfo:           authInfo,
    60  		Context:            params.Context,
    61  		Client:             params.HTTPClient,
    62  	}
    63  	for _, opt := range opts {
    64  		opt(op)
    65  	}
    66  
    67  	result, err := a.transport.Submit(op)
    68  	if err != nil {
    69  		return nil, err
    70  	}
    71  	success, ok := result.(*CalculateTaxOK)
    72  	if ok {
    73  		return success, nil
    74  	}
    75  	// unexpected success response
    76  	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
    77  	msg := fmt.Sprintf("unexpected success response for calculateTax: API contract not enforced by server. Client expected to get an error, but got: %T", result)
    78  	panic(msg)
    79  }
    80  
    81  /*
    82    CancelSubscription cancels trial
    83  
    84    Cancels the organization's paid tier trial; at the end of the trial period, paid tier access will end instead of starting a paid subscription.
    85  */
    86  func (a *Client) CancelSubscription(params *CancelSubscriptionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CancelSubscriptionOK, error) {
    87  	// TODO: Validate the params before sending
    88  	if params == nil {
    89  		params = NewCancelSubscriptionParams()
    90  	}
    91  	op := &runtime.ClientOperation{
    92  		ID:                 "cancelSubscription",
    93  		Method:             "POST",
    94  		PathPattern:        "/organizations/{organizationIdentifier}/invoices/cancel",
    95  		ProducesMediaTypes: []string{"application/json"},
    96  		ConsumesMediaTypes: []string{"application/json"},
    97  		Schemes:            []string{"http", "https"},
    98  		Params:             params,
    99  		Reader:             &CancelSubscriptionReader{formats: a.formats},
   100  		AuthInfo:           authInfo,
   101  		Context:            params.Context,
   102  		Client:             params.HTTPClient,
   103  	}
   104  	for _, opt := range opts {
   105  		opt(op)
   106  	}
   107  
   108  	result, err := a.transport.Submit(op)
   109  	if err != nil {
   110  		return nil, err
   111  	}
   112  	success, ok := result.(*CancelSubscriptionOK)
   113  	if ok {
   114  		return success, nil
   115  	}
   116  	// unexpected success response
   117  	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
   118  	msg := fmt.Sprintf("unexpected success response for cancelSubscription: API contract not enforced by server. Client expected to get an error, but got: %T", result)
   119  	panic(msg)
   120  }
   121  
   122  /*
   123    CreateInvoice creates new invoice
   124  
   125    Creates a new invoice for the organization
   126  */
   127  func (a *Client) CreateInvoice(params *CreateInvoiceParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateInvoiceOK, error) {
   128  	// TODO: Validate the params before sending
   129  	if params == nil {
   130  		params = NewCreateInvoiceParams()
   131  	}
   132  	op := &runtime.ClientOperation{
   133  		ID:                 "createInvoice",
   134  		Method:             "POST",
   135  		PathPattern:        "/organizations/{organizationIdentifier}/invoices",
   136  		ProducesMediaTypes: []string{"application/json"},
   137  		ConsumesMediaTypes: []string{"application/json"},
   138  		Schemes:            []string{"http", "https"},
   139  		Params:             params,
   140  		Reader:             &CreateInvoiceReader{formats: a.formats},
   141  		AuthInfo:           authInfo,
   142  		Context:            params.Context,
   143  		Client:             params.HTTPClient,
   144  	}
   145  	for _, opt := range opts {
   146  		opt(op)
   147  	}
   148  
   149  	result, err := a.transport.Submit(op)
   150  	if err != nil {
   151  		return nil, err
   152  	}
   153  	success, ok := result.(*CreateInvoiceOK)
   154  	if ok {
   155  		return success, nil
   156  	}
   157  	// unexpected success response
   158  	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
   159  	msg := fmt.Sprintf("unexpected success response for createInvoice: API contract not enforced by server. Client expected to get an error, but got: %T", result)
   160  	panic(msg)
   161  }
   162  
   163  // SetTransport changes the transport on the client
   164  func (a *Client) SetTransport(transport runtime.ClientTransport) {
   165  	a.transport = transport
   166  }