// Code generated by go-swagger; DO NOT EDIT. // (c) 2012-2020 by Taxnexus, Inc. // All rights reserved worldwide. // Proprietary product; unlicensed use is not allowed package document_parameters import ( "context" "fmt" "time" "github.com/go-openapi/runtime" httptransport "github.com/go-openapi/runtime/client" "github.com/go-openapi/strfmt" ) // New creates a new document parameters API client. func New(transport runtime.ContextualTransport, formats strfmt.Registry) ClientService { return &Client{transport: transport, formats: formats} } // New creates a new document parameters API client with basic auth credentials. // // It takes the following parameters: // - host: http host (github.com). // - basePath: any base path for the API client ("/v1", "/v3"). // - scheme: http scheme ("http", "https"). // - user: user for basic authentication header. // - password: password for basic authentication header. func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { transport := httptransport.New(host, basePath, []string{scheme}) transport.DefaultAuthentication = httptransport.BasicAuth(user, password) return &Client{transport: transport, formats: strfmt.Default} } // New creates a new document parameters API client with a bearer token for authentication. // // It takes the following parameters: // - host: http host (github.com). // - basePath: any base path for the API client ("/v1", "/v3"). // - scheme: http scheme ("http", "https"). // - bearerToken: bearer token for Bearer authentication header. func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { transport := httptransport.New(host, basePath, []string{scheme}) transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) return &Client{transport: transport, formats: strfmt.Default} } // Client for document parameters API. type Client struct { transport runtime.ContextualTransport formats strfmt.Registry } // ClientOption may be used to customize the behavior of Client methods. type ClientOption func(*runtime.ClientOperation) // ClientService is the interface for Client methods. type ClientService interface { // GetDocumentParameters get document parameters. GetDocumentParameters(params *GetDocumentParametersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetDocumentParametersOK, error) // GetDocumentParametersContext get document parameters. GetDocumentParametersContext(ctx context.Context, params *GetDocumentParametersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetDocumentParametersOK, error) // PostDocumentParameters create document parameters. PostDocumentParameters(params *PostDocumentParametersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostDocumentParametersOK, error) // PostDocumentParametersContext create document parameters. PostDocumentParametersContext(ctx context.Context, params *PostDocumentParametersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostDocumentParametersOK, error) // PutDocumentParameters update document parameters. PutDocumentParameters(params *PutDocumentParametersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutDocumentParametersOK, error) // PutDocumentParametersContext update document parameters. PutDocumentParametersContext(ctx context.Context, params *PutDocumentParametersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutDocumentParametersOK, error) SetTransport(transport runtime.ContextualTransport) } // GetDocumentParameters gets document parameters. // // Tenant- and user-scoped DocumentParameter read. Requires members:document-parameter:read and an active human session. Contributors can read only their own records; Owners and Managers can read the tenant.. // // This method does not support injected context. // However, timeout and opentracing contexts are honored whenever enabled. // // If you need to pass a specific context, use [Client.GetDocumentParametersContext] instead. func (a *Client) GetDocumentParameters(params *GetDocumentParametersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetDocumentParametersOK, error) { var ctx context.Context if params.inner.ctx != nil { ctx = params.inner.ctx } else { ctx = context.Background() } return a.GetDocumentParametersContext(ctx, params, authInfo, opts...) } // GetDocumentParametersContext gets document parameters. // // Tenant- and user-scoped DocumentParameter read. Requires members:document-parameter:read and an active human session. Contributors can read only their own records; Owners and Managers can read the tenant.. // // Do not use the deprecated [GetDocumentParametersParams.Context] with this method: it would be ignored. func (a *Client) GetDocumentParametersContext(ctx context.Context, params *GetDocumentParametersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetDocumentParametersOK, error) { // NOTE: parameters are not validated before sending if params == nil { params = NewGetDocumentParametersParams() } op := &runtime.ClientOperation{ ID: "getDocumentParameters", Method: "GET", PathPattern: "/documentparameters", ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, Reader: &GetDocumentParametersReader{formats: a.formats}, AuthInfo: authInfo, Client: params.HTTPClient, } for _, opt := range opts { opt(op) } result, err := a.transport.SubmitContext(ctx, op) if err != nil { return nil, err } // only one success response has to be checked success, ok := result.(*GetDocumentParametersOK) if ok { return success, nil } // unexpected success response. // no default response is defined. // // safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue msg := fmt.Sprintf("unexpected success response for getDocumentParameters: API contract not enforced by server. Client expected to get an error, but got: %T", result) panic(msg) } // PostDocumentParameters creates document parameters. // // Tenant-scoped DocumentParameter create. Requires members:document-parameter:create, an active human session, and Owner or Manager authority.. // // This method does not support injected context. // However, timeout and opentracing contexts are honored whenever enabled. // // If you need to pass a specific context, use [Client.PostDocumentParametersContext] instead. func (a *Client) PostDocumentParameters(params *PostDocumentParametersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostDocumentParametersOK, error) { var ctx context.Context if params.inner.ctx != nil { ctx = params.inner.ctx } else { ctx = context.Background() } return a.PostDocumentParametersContext(ctx, params, authInfo, opts...) } // PostDocumentParametersContext creates document parameters. // // Tenant-scoped DocumentParameter create. Requires members:document-parameter:create, an active human session, and Owner or Manager authority.. // // Do not use the deprecated [PostDocumentParametersParams.Context] with this method: it would be ignored. func (a *Client) PostDocumentParametersContext(ctx context.Context, params *PostDocumentParametersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostDocumentParametersOK, error) { // NOTE: parameters are not validated before sending if params == nil { params = NewPostDocumentParametersParams() } op := &runtime.ClientOperation{ ID: "postDocumentParameters", Method: "POST", PathPattern: "/documentparameters", ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, Reader: &PostDocumentParametersReader{formats: a.formats}, AuthInfo: authInfo, Client: params.HTTPClient, } for _, opt := range opts { opt(op) } result, err := a.transport.SubmitContext(ctx, op) if err != nil { return nil, err } // only one success response has to be checked success, ok := result.(*PostDocumentParametersOK) if ok { return success, nil } // unexpected success response. // no default response is defined. // // safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue msg := fmt.Sprintf("unexpected success response for postDocumentParameters: API contract not enforced by server. Client expected to get an error, but got: %T", result) panic(msg) } // PutDocumentParameters updates document parameters. // // Tenant-scoped DocumentParameter CAS update. Requires members:document-parameter:update, an active human session, and Owner or Manager authority.. // // This method does not support injected context. // However, timeout and opentracing contexts are honored whenever enabled. // // If you need to pass a specific context, use [Client.PutDocumentParametersContext] instead. func (a *Client) PutDocumentParameters(params *PutDocumentParametersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutDocumentParametersOK, error) { var ctx context.Context if params.inner.ctx != nil { ctx = params.inner.ctx } else { ctx = context.Background() } return a.PutDocumentParametersContext(ctx, params, authInfo, opts...) } // PutDocumentParametersContext updates document parameters. // // Tenant-scoped DocumentParameter CAS update. Requires members:document-parameter:update, an active human session, and Owner or Manager authority.. // // Do not use the deprecated [PutDocumentParametersParams.Context] with this method: it would be ignored. func (a *Client) PutDocumentParametersContext(ctx context.Context, params *PutDocumentParametersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutDocumentParametersOK, error) { // NOTE: parameters are not validated before sending if params == nil { params = NewPutDocumentParametersParams() } op := &runtime.ClientOperation{ ID: "putDocumentParameters", Method: "PUT", PathPattern: "/documentparameters", ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, Reader: &PutDocumentParametersReader{formats: a.formats}, AuthInfo: authInfo, Client: params.HTTPClient, } for _, opt := range opts { opt(op) } result, err := a.transport.SubmitContext(ctx, op) if err != nil { return nil, err } // only one success response has to be checked success, ok := result.(*PutDocumentParametersOK) if ok { return success, nil } // unexpected success response. // no default response is defined. // // safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue msg := fmt.Sprintf("unexpected success response for putDocumentParameters: 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.ContextualTransport) { a.transport = transport } // innerParams captures internal fields so they don't conflict with user-supplied parameters. type innerParams struct { timeout time.Duration // Deprecated: use the operation call with context to pass the context instead of [DocumentParametersParams]. ctx context.Context }