bjerkio/crayon-api-go

View on GitHub
client/invoice_profiles/invoice_profiles_client.go

Summary

Maintainability
D
2 days
Test Coverage
// Code generated by go-swagger; DO NOT EDIT.

package invoice_profiles

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
    "fmt"

    "github.com/go-openapi/runtime"
    "github.com/go-openapi/strfmt"
)

// New creates a new invoice profiles API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
    return &Client{transport: transport, formats: formats}
}

/*
Client for invoice profiles API
*/
type Client struct {
    transport runtime.ClientTransport
    formats   strfmt.Registry
}

// ClientService is the interface for Client methods
type ClientService interface {
    CreateInvoiceProfiles(params *CreateInvoiceProfilesParams, authInfo runtime.ClientAuthInfoWriter) (*CreateInvoiceProfilesOK, error)

    DeleteInvoiceProfiles(params *DeleteInvoiceProfilesParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteInvoiceProfilesOK, error)

    GetInvoiceProfiles(params *GetInvoiceProfilesParams, authInfo runtime.ClientAuthInfoWriter) (*GetInvoiceProfilesOK, error)

    UpdateInvoiceProfiles(params *UpdateInvoiceProfilesParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateInvoiceProfilesOK, error)

    SetTransport(transport runtime.ClientTransport)
}

/*
  CreateInvoiceProfiles create invoice profiles API
*/
func (a *Client) CreateInvoiceProfiles(params *CreateInvoiceProfilesParams, authInfo runtime.ClientAuthInfoWriter) (*CreateInvoiceProfilesOK, error) {
    // TODO: Validate the params before sending
    if params == nil {
        params = NewCreateInvoiceProfilesParams()
    }

    result, err := a.transport.Submit(&runtime.ClientOperation{
        ID:                 "CreateInvoiceProfiles",
        Method:             "POST",
        PathPattern:        "/api/v1/InvoiceProfiles",
        ProducesMediaTypes: []string{"application/json", "text/json", "text/plain"},
        ConsumesMediaTypes: []string{"application/*+json", "application/json", "application/json-patch+json", "text/json"},
        Schemes:            []string{"https"},
        Params:             params,
        Reader:             &CreateInvoiceProfilesReader{formats: a.formats},
        AuthInfo:           authInfo,
        Context:            params.Context,
        Client:             params.HTTPClient,
    })
    if err != nil {
        return nil, err
    }
    success, ok := result.(*CreateInvoiceProfilesOK)
    if ok {
        return success, nil
    }
    // unexpected success response
    // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
    msg := fmt.Sprintf("unexpected success response for CreateInvoiceProfiles: API contract not enforced by server. Client expected to get an error, but got: %T", result)
    panic(msg)
}

/*
  DeleteInvoiceProfiles delete invoice profiles API
*/
func (a *Client) DeleteInvoiceProfiles(params *DeleteInvoiceProfilesParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteInvoiceProfilesOK, error) {
    // TODO: Validate the params before sending
    if params == nil {
        params = NewDeleteInvoiceProfilesParams()
    }

    result, err := a.transport.Submit(&runtime.ClientOperation{
        ID:                 "DeleteInvoiceProfiles",
        Method:             "DELETE",
        PathPattern:        "/api/v1/InvoiceProfiles/{id}",
        ProducesMediaTypes: []string{"application/json", "text/json", "text/plain"},
        ConsumesMediaTypes: []string{"application/json"},
        Schemes:            []string{"https"},
        Params:             params,
        Reader:             &DeleteInvoiceProfilesReader{formats: a.formats},
        AuthInfo:           authInfo,
        Context:            params.Context,
        Client:             params.HTTPClient,
    })
    if err != nil {
        return nil, err
    }
    success, ok := result.(*DeleteInvoiceProfilesOK)
    if ok {
        return success, nil
    }
    // unexpected success response
    // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
    msg := fmt.Sprintf("unexpected success response for DeleteInvoiceProfiles: API contract not enforced by server. Client expected to get an error, but got: %T", result)
    panic(msg)
}

/*
  GetInvoiceProfiles get invoice profiles API
*/
func (a *Client) GetInvoiceProfiles(params *GetInvoiceProfilesParams, authInfo runtime.ClientAuthInfoWriter) (*GetInvoiceProfilesOK, error) {
    // TODO: Validate the params before sending
    if params == nil {
        params = NewGetInvoiceProfilesParams()
    }

    result, err := a.transport.Submit(&runtime.ClientOperation{
        ID:                 "GetInvoiceProfiles",
        Method:             "GET",
        PathPattern:        "/api/v1/InvoiceProfiles",
        ProducesMediaTypes: []string{"application/json", "text/json", "text/plain"},
        ConsumesMediaTypes: []string{"application/json"},
        Schemes:            []string{"https"},
        Params:             params,
        Reader:             &GetInvoiceProfilesReader{formats: a.formats},
        AuthInfo:           authInfo,
        Context:            params.Context,
        Client:             params.HTTPClient,
    })
    if err != nil {
        return nil, err
    }
    success, ok := result.(*GetInvoiceProfilesOK)
    if ok {
        return success, nil
    }
    // unexpected success response
    // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
    msg := fmt.Sprintf("unexpected success response for GetInvoiceProfiles: API contract not enforced by server. Client expected to get an error, but got: %T", result)
    panic(msg)
}

/*
  UpdateInvoiceProfiles update invoice profiles API
*/
func (a *Client) UpdateInvoiceProfiles(params *UpdateInvoiceProfilesParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateInvoiceProfilesOK, error) {
    // TODO: Validate the params before sending
    if params == nil {
        params = NewUpdateInvoiceProfilesParams()
    }

    result, err := a.transport.Submit(&runtime.ClientOperation{
        ID:                 "UpdateInvoiceProfiles",
        Method:             "PUT",
        PathPattern:        "/api/v1/InvoiceProfiles/{id}",
        ProducesMediaTypes: []string{"application/json", "text/json", "text/plain"},
        ConsumesMediaTypes: []string{"application/*+json", "application/json", "application/json-patch+json", "text/json"},
        Schemes:            []string{"https"},
        Params:             params,
        Reader:             &UpdateInvoiceProfilesReader{formats: a.formats},
        AuthInfo:           authInfo,
        Context:            params.Context,
        Client:             params.HTTPClient,
    })
    if err != nil {
        return nil, err
    }
    success, ok := result.(*UpdateInvoiceProfilesOK)
    if ok {
        return success, nil
    }
    // unexpected success response
    // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
    msg := fmt.Sprintf("unexpected success response for UpdateInvoiceProfiles: API contract not enforced by server. Client expected to get an error, but got: %T", result)
    panic(msg)
}

// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ClientTransport) {
    a.transport = transport
}