lib/api/crm/crm_client/leads/leads_client.go

370 lines
12 KiB
Go
Raw Normal View History

2021-07-31 03:05:02 +00:00
// Code generated by go-swagger; DO NOT EDIT.
2021-08-05 19:37:53 +00:00
// (c) 2012-2020 by Taxnexus, Inc.
2021-07-31 03:05:02 +00:00
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed
package leads
import (
"context"
2021-07-31 03:05:02 +00:00
"fmt"
"time"
2021-07-31 03:05:02 +00:00
"github.com/go-openapi/runtime"
httptransport "github.com/go-openapi/runtime/client"
2021-07-31 03:05:02 +00:00
"github.com/go-openapi/strfmt"
)
// New creates a new leads API client.
func New(transport runtime.ContextualTransport, formats strfmt.Registry) ClientService {
2021-07-31 03:05:02 +00:00
return &Client{transport: transport, formats: formats}
}
// New creates a new leads 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 leads 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 leads API.
2021-07-31 03:05:02 +00:00
type Client struct {
transport runtime.ContextualTransport
2021-07-31 03:05:02 +00:00
formats strfmt.Registry
}
// ClientOption may be used to customize the behavior of Client methods.
2021-07-31 03:05:02 +00:00
type ClientOption func(*runtime.ClientOperation)
// ClientService is the interface for Client methods.
2021-07-31 03:05:02 +00:00
type ClientService interface {
// DeleteLead delete a contact.
2021-07-31 03:05:02 +00:00
DeleteLead(params *DeleteLeadParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteLeadOK, error)
// DeleteLeadContext delete a contact.
DeleteLeadContext(ctx context.Context, params *DeleteLeadParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteLeadOK, error)
// GetLeads get a list of contacts.
2021-07-31 03:05:02 +00:00
GetLeads(params *GetLeadsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLeadsOK, error)
// GetLeadsContext get a list of contacts.
GetLeadsContext(ctx context.Context, params *GetLeadsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLeadsOK, error)
// PostLeads add new leads.
2021-07-31 03:05:02 +00:00
PostLeads(params *PostLeadsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostLeadsOK, error)
// PostLeadsContext add new leads.
PostLeadsContext(ctx context.Context, params *PostLeadsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostLeadsOK, error)
// PutLeads update leads.
2021-07-31 03:05:02 +00:00
PutLeads(params *PutLeadsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutLeadsOK, error)
// PutLeadsContext update leads.
PutLeadsContext(ctx context.Context, params *PutLeadsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutLeadsOK, error)
2021-07-31 03:05:02 +00:00
SetTransport(transport runtime.ContextualTransport)
}
2021-07-31 03:05:02 +00:00
// DeleteLead deletes a contact.
//
// Delete SalesforceDevops.net Lead record.
//
// 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.DeleteLeadContext] instead.
2021-07-31 03:05:02 +00:00
func (a *Client) DeleteLead(params *DeleteLeadParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteLeadOK, error) {
var ctx context.Context
if params.inner.ctx != nil {
ctx = params.inner.ctx
} else {
ctx = context.Background()
}
return a.DeleteLeadContext(ctx, params, authInfo, opts...)
}
// DeleteLeadContext deletes a contact.
//
// Delete SalesforceDevops.net Lead record.
//
// Do not use the deprecated [DeleteLeadParams.Context] with this method: it would be ignored.
func (a *Client) DeleteLeadContext(ctx context.Context, params *DeleteLeadParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteLeadOK, error) {
// NOTE: parameters are not validated before sending
2021-07-31 03:05:02 +00:00
if params == nil {
params = NewDeleteLeadParams()
}
2021-07-31 03:05:02 +00:00
op := &runtime.ClientOperation{
ID: "deleteLead",
Method: "DELETE",
PathPattern: "/leads",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &DeleteLeadReader{formats: a.formats},
AuthInfo: authInfo,
Client: params.HTTPClient,
}
2021-07-31 03:05:02 +00:00
for _, opt := range opts {
opt(op)
}
result, err := a.transport.SubmitContext(ctx, op)
2021-07-31 03:05:02 +00:00
if err != nil {
return nil, err
}
// only one success response has to be checked
2021-07-31 03:05:02 +00:00
success, ok := result.(*DeleteLeadOK)
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
2021-07-31 03:05:02 +00:00
msg := fmt.Sprintf("unexpected success response for deleteLead: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// GetLeads gets a list of contacts.
//
// Return a list of all available Leads.
//
// 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.GetLeadsContext] instead.
2021-07-31 03:05:02 +00:00
func (a *Client) GetLeads(params *GetLeadsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLeadsOK, error) {
var ctx context.Context
if params.inner.ctx != nil {
ctx = params.inner.ctx
} else {
ctx = context.Background()
}
return a.GetLeadsContext(ctx, params, authInfo, opts...)
}
// GetLeadsContext gets a list of contacts.
//
// Return a list of all available Leads.
//
// Do not use the deprecated [GetLeadsParams.Context] with this method: it would be ignored.
func (a *Client) GetLeadsContext(ctx context.Context, params *GetLeadsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLeadsOK, error) {
// NOTE: parameters are not validated before sending
2021-07-31 03:05:02 +00:00
if params == nil {
params = NewGetLeadsParams()
}
2021-07-31 03:05:02 +00:00
op := &runtime.ClientOperation{
ID: "getLeads",
Method: "GET",
PathPattern: "/leads",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &GetLeadsReader{formats: a.formats},
AuthInfo: authInfo,
Client: params.HTTPClient,
}
2021-07-31 03:05:02 +00:00
for _, opt := range opts {
opt(op)
}
result, err := a.transport.SubmitContext(ctx, op)
2021-07-31 03:05:02 +00:00
if err != nil {
return nil, err
}
// only one success response has to be checked
2021-07-31 03:05:02 +00:00
success, ok := result.(*GetLeadsOK)
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
2021-07-31 03:05:02 +00:00
msg := fmt.Sprintf("unexpected success response for getLeads: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// PostLeads adds new leads.
//
// Lead records to be added.
//
// 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.PostLeadsContext] instead.
2021-07-31 03:05:02 +00:00
func (a *Client) PostLeads(params *PostLeadsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostLeadsOK, error) {
var ctx context.Context
if params.inner.ctx != nil {
ctx = params.inner.ctx
} else {
ctx = context.Background()
}
return a.PostLeadsContext(ctx, params, authInfo, opts...)
}
// PostLeadsContext adds new leads.
//
// Lead records to be added.
//
// Do not use the deprecated [PostLeadsParams.Context] with this method: it would be ignored.
func (a *Client) PostLeadsContext(ctx context.Context, params *PostLeadsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostLeadsOK, error) {
// NOTE: parameters are not validated before sending
2021-07-31 03:05:02 +00:00
if params == nil {
params = NewPostLeadsParams()
}
2021-07-31 03:05:02 +00:00
op := &runtime.ClientOperation{
ID: "postLeads",
Method: "POST",
PathPattern: "/leads",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PostLeadsReader{formats: a.formats},
AuthInfo: authInfo,
Client: params.HTTPClient,
}
2021-07-31 03:05:02 +00:00
for _, opt := range opts {
opt(op)
}
result, err := a.transport.SubmitContext(ctx, op)
2021-07-31 03:05:02 +00:00
if err != nil {
return nil, err
}
// only one success response has to be checked
2021-07-31 03:05:02 +00:00
success, ok := result.(*PostLeadsOK)
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
2021-07-31 03:05:02 +00:00
msg := fmt.Sprintf("unexpected success response for postLeads: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// PutLeads updates leads.
//
// Update Lead records.
//
// 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.PutLeadsContext] instead.
2021-07-31 03:05:02 +00:00
func (a *Client) PutLeads(params *PutLeadsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutLeadsOK, error) {
var ctx context.Context
if params.inner.ctx != nil {
ctx = params.inner.ctx
} else {
ctx = context.Background()
}
return a.PutLeadsContext(ctx, params, authInfo, opts...)
}
// PutLeadsContext updates leads.
//
// Update Lead records.
//
// Do not use the deprecated [PutLeadsParams.Context] with this method: it would be ignored.
func (a *Client) PutLeadsContext(ctx context.Context, params *PutLeadsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutLeadsOK, error) {
// NOTE: parameters are not validated before sending
2021-07-31 03:05:02 +00:00
if params == nil {
params = NewPutLeadsParams()
}
2021-07-31 03:05:02 +00:00
op := &runtime.ClientOperation{
ID: "putLeads",
Method: "PUT",
PathPattern: "/leads",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PutLeadsReader{formats: a.formats},
AuthInfo: authInfo,
Client: params.HTTPClient,
}
2021-07-31 03:05:02 +00:00
for _, opt := range opts {
opt(op)
}
result, err := a.transport.SubmitContext(ctx, op)
2021-07-31 03:05:02 +00:00
if err != nil {
return nil, err
}
// only one success response has to be checked
2021-07-31 03:05:02 +00:00
success, ok := result.(*PutLeadsOK)
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
2021-07-31 03:05:02 +00:00
msg := fmt.Sprintf("unexpected success response for putLeads: 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) {
2021-07-31 03:05:02 +00:00
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 [LeadsParams].
ctx context.Context
}