mirror of https://github.com/vernonkeenan/lib
parent
e6365d539a
commit
8ced08e0b0
|
|
@ -36,6 +36,11 @@ or PR number is invented.
|
||||||
IndustryCompany, IndustryProduct, and IndustryService read/create operations.
|
IndustryCompany, IndustryProduct, and IndustryService read/create operations.
|
||||||
Contract tests pin the generated HTTP methods and paths and prevent an
|
Contract tests pin the generated HTTP methods and paths and prevent an
|
||||||
unsupported `IndustryService.HTML` field from entering the shared model.
|
unsupported `IndustryService.HTML` field from entering the shared model.
|
||||||
|
- Regenerated the Research Go client from the deployed v0.7.16 contract for
|
||||||
|
governed Topic, Factor, FinancialStatement, and Observation list/get/create/
|
||||||
|
update workflows. Contract tests pin the source spec, generated operations,
|
||||||
|
ID-filtered reads, optimistic-conflict responses, and the absence of invented
|
||||||
|
Topic delete, bulk, Salesforce, or credential-literal behavior.
|
||||||
|
|
||||||
## [v0.7.5] — 2026-07-12
|
## [v0.7.5] — 2026-07-12
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -72,10 +72,10 @@ type ClientService interface {
|
||||||
// GetFactorsContext get a list of factors.
|
// GetFactorsContext get a list of factors.
|
||||||
GetFactorsContext(ctx context.Context, params *GetFactorsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetFactorsOK, error)
|
GetFactorsContext(ctx context.Context, params *GetFactorsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetFactorsOK, error)
|
||||||
|
|
||||||
// PostFactors add a new factor to salesforce devops net.
|
// PostFactors add a new factor.
|
||||||
PostFactors(params *PostFactorsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostFactorsOK, error)
|
PostFactors(params *PostFactorsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostFactorsOK, error)
|
||||||
|
|
||||||
// PostFactorsContext add a new factor to salesforce devops net.
|
// PostFactorsContext add a new factor.
|
||||||
PostFactorsContext(ctx context.Context, params *PostFactorsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostFactorsOK, error)
|
PostFactorsContext(ctx context.Context, params *PostFactorsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostFactorsOK, error)
|
||||||
|
|
||||||
// PutFactor update factor records.
|
// PutFactor update factor records.
|
||||||
|
|
@ -221,7 +221,7 @@ func (a *Client) GetFactorsContext(ctx context.Context, params *GetFactorsParams
|
||||||
panic(msg)
|
panic(msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
// PostFactors adds a new factor to salesforce devops net.
|
// PostFactors adds a new factor.
|
||||||
//
|
//
|
||||||
// Factor records to be added.
|
// Factor records to be added.
|
||||||
//
|
//
|
||||||
|
|
@ -240,7 +240,7 @@ func (a *Client) PostFactors(params *PostFactorsParams, authInfo runtime.ClientA
|
||||||
return a.PostFactorsContext(ctx, params, authInfo, opts...)
|
return a.PostFactorsContext(ctx, params, authInfo, opts...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// PostFactorsContext adds a new factor to salesforce devops net.
|
// PostFactorsContext adds a new factor.
|
||||||
//
|
//
|
||||||
// Factor records to be added.
|
// Factor records to be added.
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,12 @@ func (o *PutFactorReader) ReadResponse(response runtime.ClientResponse, consumer
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return nil, result
|
return nil, result
|
||||||
|
case 409:
|
||||||
|
result := NewPutFactorConflict()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
case 422:
|
case 422:
|
||||||
result := NewPutFactorUnprocessableEntity()
|
result := NewPutFactorUnprocessableEntity()
|
||||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
|
@ -365,6 +371,74 @@ func (o *PutFactorNotFound) readResponse(response runtime.ClientResponse, consum
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewPutFactorConflict creates a PutFactorConflict with default headers values
|
||||||
|
func NewPutFactorConflict() *PutFactorConflict {
|
||||||
|
return &PutFactorConflict{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// PutFactorConflict describes a response with status code 409, with default header values.
|
||||||
|
//
|
||||||
|
// Optimistic version conflict
|
||||||
|
type PutFactorConflict struct {
|
||||||
|
Payload *research_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this put factor conflict response has a 2xx status code
|
||||||
|
func (o *PutFactorConflict) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this put factor conflict response has a 3xx status code
|
||||||
|
func (o *PutFactorConflict) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this put factor conflict response has a 4xx status code
|
||||||
|
func (o *PutFactorConflict) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this put factor conflict response has a 5xx status code
|
||||||
|
func (o *PutFactorConflict) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this put factor conflict response a status code equal to that given
|
||||||
|
func (o *PutFactorConflict) IsCode(code int) bool {
|
||||||
|
return code == 409
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the put factor conflict response
|
||||||
|
func (o *PutFactorConflict) Code() int {
|
||||||
|
return 409
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutFactorConflict) Error() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[PUT /factors][%d] putFactorConflict %s", 409, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutFactorConflict) String() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[PUT /factors][%d] putFactorConflict %s", 409, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutFactorConflict) GetPayload() *research_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutFactorConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(research_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// NewPutFactorUnprocessableEntity creates a PutFactorUnprocessableEntity with default headers values
|
// NewPutFactorUnprocessableEntity creates a PutFactorUnprocessableEntity with default headers values
|
||||||
func NewPutFactorUnprocessableEntity() *PutFactorUnprocessableEntity {
|
func NewPutFactorUnprocessableEntity() *PutFactorUnprocessableEntity {
|
||||||
return &PutFactorUnprocessableEntity{}
|
return &PutFactorUnprocessableEntity{}
|
||||||
|
|
|
||||||
|
|
@ -72,10 +72,10 @@ type ClientService interface {
|
||||||
// GetFinancialStatementsContext get a list of financial statements.
|
// GetFinancialStatementsContext get a list of financial statements.
|
||||||
GetFinancialStatementsContext(ctx context.Context, params *GetFinancialStatementsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetFinancialStatementsOK, error)
|
GetFinancialStatementsContext(ctx context.Context, params *GetFinancialStatementsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetFinancialStatementsOK, error)
|
||||||
|
|
||||||
// PostFinancialStatements add a new financial statement to salesforce devops net.
|
// PostFinancialStatements add a new financial statement.
|
||||||
PostFinancialStatements(params *PostFinancialStatementsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostFinancialStatementsOK, error)
|
PostFinancialStatements(params *PostFinancialStatementsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostFinancialStatementsOK, error)
|
||||||
|
|
||||||
// PostFinancialStatementsContext add a new financial statement to salesforce devops net.
|
// PostFinancialStatementsContext add a new financial statement.
|
||||||
PostFinancialStatementsContext(ctx context.Context, params *PostFinancialStatementsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostFinancialStatementsOK, error)
|
PostFinancialStatementsContext(ctx context.Context, params *PostFinancialStatementsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostFinancialStatementsOK, error)
|
||||||
|
|
||||||
// PutFinancialStatement update financial statement records.
|
// PutFinancialStatement update financial statement records.
|
||||||
|
|
@ -221,7 +221,7 @@ func (a *Client) GetFinancialStatementsContext(ctx context.Context, params *GetF
|
||||||
panic(msg)
|
panic(msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
// PostFinancialStatements adds a new financial statement to salesforce devops net.
|
// PostFinancialStatements adds a new financial statement.
|
||||||
//
|
//
|
||||||
// FinancialStatement records to be added.
|
// FinancialStatement records to be added.
|
||||||
//
|
//
|
||||||
|
|
@ -240,7 +240,7 @@ func (a *Client) PostFinancialStatements(params *PostFinancialStatementsParams,
|
||||||
return a.PostFinancialStatementsContext(ctx, params, authInfo, opts...)
|
return a.PostFinancialStatementsContext(ctx, params, authInfo, opts...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// PostFinancialStatementsContext adds a new financial statement to salesforce devops net.
|
// PostFinancialStatementsContext adds a new financial statement.
|
||||||
//
|
//
|
||||||
// FinancialStatement records to be added.
|
// FinancialStatement records to be added.
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,12 @@ func (o *PutFinancialStatementReader) ReadResponse(response runtime.ClientRespon
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return nil, result
|
return nil, result
|
||||||
|
case 409:
|
||||||
|
result := NewPutFinancialStatementConflict()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
case 422:
|
case 422:
|
||||||
result := NewPutFinancialStatementUnprocessableEntity()
|
result := NewPutFinancialStatementUnprocessableEntity()
|
||||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
|
@ -365,6 +371,74 @@ func (o *PutFinancialStatementNotFound) readResponse(response runtime.ClientResp
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewPutFinancialStatementConflict creates a PutFinancialStatementConflict with default headers values
|
||||||
|
func NewPutFinancialStatementConflict() *PutFinancialStatementConflict {
|
||||||
|
return &PutFinancialStatementConflict{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// PutFinancialStatementConflict describes a response with status code 409, with default header values.
|
||||||
|
//
|
||||||
|
// Optimistic version conflict
|
||||||
|
type PutFinancialStatementConflict struct {
|
||||||
|
Payload *research_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this put financial statement conflict response has a 2xx status code
|
||||||
|
func (o *PutFinancialStatementConflict) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this put financial statement conflict response has a 3xx status code
|
||||||
|
func (o *PutFinancialStatementConflict) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this put financial statement conflict response has a 4xx status code
|
||||||
|
func (o *PutFinancialStatementConflict) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this put financial statement conflict response has a 5xx status code
|
||||||
|
func (o *PutFinancialStatementConflict) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this put financial statement conflict response a status code equal to that given
|
||||||
|
func (o *PutFinancialStatementConflict) IsCode(code int) bool {
|
||||||
|
return code == 409
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the put financial statement conflict response
|
||||||
|
func (o *PutFinancialStatementConflict) Code() int {
|
||||||
|
return 409
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutFinancialStatementConflict) Error() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[PUT /financialstatements][%d] putFinancialStatementConflict %s", 409, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutFinancialStatementConflict) String() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[PUT /financialstatements][%d] putFinancialStatementConflict %s", 409, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutFinancialStatementConflict) GetPayload() *research_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutFinancialStatementConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(research_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// NewPutFinancialStatementUnprocessableEntity creates a PutFinancialStatementUnprocessableEntity with default headers values
|
// NewPutFinancialStatementUnprocessableEntity creates a PutFinancialStatementUnprocessableEntity with default headers values
|
||||||
func NewPutFinancialStatementUnprocessableEntity() *PutFinancialStatementUnprocessableEntity {
|
func NewPutFinancialStatementUnprocessableEntity() *PutFinancialStatementUnprocessableEntity {
|
||||||
return &PutFinancialStatementUnprocessableEntity{}
|
return &PutFinancialStatementUnprocessableEntity{}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,321 @@
|
||||||
|
package research_client_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"context"
|
||||||
|
"crypto/sha256"
|
||||||
|
"encoding/hex"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"reflect"
|
||||||
|
"regexp"
|
||||||
|
"runtime"
|
||||||
|
"strings"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"code.tnxs.net/vernonkeenan/lib/api/research/research_client/factors"
|
||||||
|
"code.tnxs.net/vernonkeenan/lib/api/research/research_client/financial_statements"
|
||||||
|
"code.tnxs.net/vernonkeenan/lib/api/research/research_client/observations"
|
||||||
|
"code.tnxs.net/vernonkeenan/lib/api/research/research_client/topics"
|
||||||
|
openapiruntime "github.com/go-openapi/runtime"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
const researchV0716SpecSHA256 = "e7739ece74245709a8af8eab7bcffdbf1ab3e1be5763bc71a4c633b699d4df14"
|
||||||
|
|
||||||
|
type insightCaptureTransport struct {
|
||||||
|
operation *openapiruntime.ClientOperation
|
||||||
|
}
|
||||||
|
|
||||||
|
func (transport *insightCaptureTransport) Submit(operation *openapiruntime.ClientOperation) (any, error) {
|
||||||
|
return transport.SubmitContext(context.Background(), operation)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (transport *insightCaptureTransport) SubmitContext(_ context.Context, operation *openapiruntime.ClientOperation) (any, error) {
|
||||||
|
transport.operation = operation
|
||||||
|
|
||||||
|
switch operation.ID {
|
||||||
|
case "getTopics":
|
||||||
|
return topics.NewGetTopicsOK(), nil
|
||||||
|
case "postTopics":
|
||||||
|
return topics.NewPostTopicsOK(), nil
|
||||||
|
case "putTopic":
|
||||||
|
return topics.NewPutTopicOK(), nil
|
||||||
|
case "getFactors":
|
||||||
|
return factors.NewGetFactorsOK(), nil
|
||||||
|
case "postFactors":
|
||||||
|
return factors.NewPostFactorsOK(), nil
|
||||||
|
case "putFactor":
|
||||||
|
return factors.NewPutFactorOK(), nil
|
||||||
|
case "getFinancialStatements":
|
||||||
|
return financial_statements.NewGetFinancialStatementsOK(), nil
|
||||||
|
case "postFinancialStatements":
|
||||||
|
return financial_statements.NewPostFinancialStatementsOK(), nil
|
||||||
|
case "putFinancialStatement":
|
||||||
|
return financial_statements.NewPutFinancialStatementOK(), nil
|
||||||
|
case "getObservations":
|
||||||
|
return observations.NewGetObservationsOK(), nil
|
||||||
|
case "postObservations":
|
||||||
|
return observations.NewPostObservationsOK(), nil
|
||||||
|
case "putObservation":
|
||||||
|
return observations.NewPutObservationOK(), nil
|
||||||
|
default:
|
||||||
|
panic("unexpected generated insight operation: " + operation.ID)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestGeneratedInsightOperationContract(t *testing.T) {
|
||||||
|
type operationCall func(openapiruntime.ContextualTransport) error
|
||||||
|
|
||||||
|
tests := []struct {
|
||||||
|
name string
|
||||||
|
wantID string
|
||||||
|
wantMethod string
|
||||||
|
wantPath string
|
||||||
|
call operationCall
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
name: "list topics", wantID: "getTopics", wantMethod: "GET", wantPath: "/topics",
|
||||||
|
call: func(transport openapiruntime.ContextualTransport) error {
|
||||||
|
_, err := topics.New(transport, strfmt.Default).GetTopics(topics.NewGetTopicsParams(), nil)
|
||||||
|
return err
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "create topic", wantID: "postTopics", wantMethod: "POST", wantPath: "/topics",
|
||||||
|
call: func(transport openapiruntime.ContextualTransport) error {
|
||||||
|
_, err := topics.New(transport, strfmt.Default).PostTopics(topics.NewPostTopicsParams(), nil)
|
||||||
|
return err
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "update topic", wantID: "putTopic", wantMethod: "PUT", wantPath: "/topics",
|
||||||
|
call: func(transport openapiruntime.ContextualTransport) error {
|
||||||
|
_, err := topics.New(transport, strfmt.Default).PutTopic(topics.NewPutTopicParams(), nil)
|
||||||
|
return err
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "list factors", wantID: "getFactors", wantMethod: "GET", wantPath: "/factors",
|
||||||
|
call: func(transport openapiruntime.ContextualTransport) error {
|
||||||
|
_, err := factors.New(transport, strfmt.Default).GetFactors(factors.NewGetFactorsParams(), nil)
|
||||||
|
return err
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "create factor", wantID: "postFactors", wantMethod: "POST", wantPath: "/factors",
|
||||||
|
call: func(transport openapiruntime.ContextualTransport) error {
|
||||||
|
_, err := factors.New(transport, strfmt.Default).PostFactors(factors.NewPostFactorsParams(), nil)
|
||||||
|
return err
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "update factor", wantID: "putFactor", wantMethod: "PUT", wantPath: "/factors",
|
||||||
|
call: func(transport openapiruntime.ContextualTransport) error {
|
||||||
|
_, err := factors.New(transport, strfmt.Default).PutFactor(factors.NewPutFactorParams(), nil)
|
||||||
|
return err
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "list financial statements", wantID: "getFinancialStatements", wantMethod: "GET", wantPath: "/financialstatements",
|
||||||
|
call: func(transport openapiruntime.ContextualTransport) error {
|
||||||
|
_, err := financial_statements.New(transport, strfmt.Default).GetFinancialStatements(financial_statements.NewGetFinancialStatementsParams(), nil)
|
||||||
|
return err
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "create financial statement", wantID: "postFinancialStatements", wantMethod: "POST", wantPath: "/financialstatements",
|
||||||
|
call: func(transport openapiruntime.ContextualTransport) error {
|
||||||
|
_, err := financial_statements.New(transport, strfmt.Default).PostFinancialStatements(financial_statements.NewPostFinancialStatementsParams(), nil)
|
||||||
|
return err
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "update financial statement", wantID: "putFinancialStatement", wantMethod: "PUT", wantPath: "/financialstatements",
|
||||||
|
call: func(transport openapiruntime.ContextualTransport) error {
|
||||||
|
_, err := financial_statements.New(transport, strfmt.Default).PutFinancialStatement(financial_statements.NewPutFinancialStatementParams(), nil)
|
||||||
|
return err
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "list observations", wantID: "getObservations", wantMethod: "GET", wantPath: "/observations",
|
||||||
|
call: func(transport openapiruntime.ContextualTransport) error {
|
||||||
|
_, err := observations.New(transport, strfmt.Default).GetObservations(observations.NewGetObservationsParams(), nil)
|
||||||
|
return err
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "create observation", wantID: "postObservations", wantMethod: "POST", wantPath: "/observations",
|
||||||
|
call: func(transport openapiruntime.ContextualTransport) error {
|
||||||
|
_, err := observations.New(transport, strfmt.Default).PostObservations(observations.NewPostObservationsParams(), nil)
|
||||||
|
return err
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "update observation", wantID: "putObservation", wantMethod: "PUT", wantPath: "/observations",
|
||||||
|
call: func(transport openapiruntime.ContextualTransport) error {
|
||||||
|
_, err := observations.New(transport, strfmt.Default).PutObservation(observations.NewPutObservationParams(), nil)
|
||||||
|
return err
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, test := range tests {
|
||||||
|
t.Run(test.name, func(t *testing.T) {
|
||||||
|
transport := &insightCaptureTransport{}
|
||||||
|
if err := test.call(transport); err != nil {
|
||||||
|
t.Fatalf("generated client operation failed: %v", err)
|
||||||
|
}
|
||||||
|
if transport.operation == nil {
|
||||||
|
t.Fatal("generated client did not submit an operation")
|
||||||
|
}
|
||||||
|
if transport.operation.ID != test.wantID {
|
||||||
|
t.Errorf("operation ID = %q, want %q", transport.operation.ID, test.wantID)
|
||||||
|
}
|
||||||
|
if transport.operation.Method != test.wantMethod {
|
||||||
|
t.Errorf("method = %q, want %q", transport.operation.Method, test.wantMethod)
|
||||||
|
}
|
||||||
|
if transport.operation.PathPattern != test.wantPath {
|
||||||
|
t.Errorf("path = %q, want %q", transport.operation.PathPattern, test.wantPath)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestGeneratedInsightGetByIDFiltersAndConflictResponses(t *testing.T) {
|
||||||
|
recordID := "record-id"
|
||||||
|
if got := topics.NewGetTopicsParams().WithTopicID(&recordID).TopicID; got == nil || *got != recordID {
|
||||||
|
t.Fatal("Topic get-by-ID filter is absent")
|
||||||
|
}
|
||||||
|
if got := factors.NewGetFactorsParams().WithFactorID(&recordID).FactorID; got == nil || *got != recordID {
|
||||||
|
t.Fatal("Factor get-by-ID filter is absent")
|
||||||
|
}
|
||||||
|
if got := financial_statements.NewGetFinancialStatementsParams().WithFinancialStatementID(&recordID).FinancialStatementID; got == nil || *got != recordID {
|
||||||
|
t.Fatal("FinancialStatement get-by-ID filter is absent")
|
||||||
|
}
|
||||||
|
if got := observations.NewGetObservationsParams().WithObservationID(&recordID).ObservationID; got == nil || *got != recordID {
|
||||||
|
t.Fatal("Observation get-by-ID filter is absent")
|
||||||
|
}
|
||||||
|
|
||||||
|
conflicts := []interface{ IsCode(int) bool }{
|
||||||
|
topics.NewPutTopicConflict(),
|
||||||
|
factors.NewPutFactorConflict(),
|
||||||
|
financial_statements.NewPutFinancialStatementConflict(),
|
||||||
|
observations.NewPutObservationConflict(),
|
||||||
|
}
|
||||||
|
for _, conflict := range conflicts {
|
||||||
|
if !conflict.IsCode(409) {
|
||||||
|
t.Errorf("%T does not preserve the optimistic-conflict response", conflict)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestGeneratedInsightSurfaceDoesNotInventUnsupportedOperations(t *testing.T) {
|
||||||
|
contracts := []reflect.Type{
|
||||||
|
reflect.TypeOf((*topics.ClientService)(nil)).Elem(),
|
||||||
|
reflect.TypeOf((*factors.ClientService)(nil)).Elem(),
|
||||||
|
reflect.TypeOf((*financial_statements.ClientService)(nil)).Elem(),
|
||||||
|
reflect.TypeOf((*observations.ClientService)(nil)).Elem(),
|
||||||
|
}
|
||||||
|
for _, contract := range contracts {
|
||||||
|
for index := 0; index < contract.NumMethod(); index++ {
|
||||||
|
method := contract.Method(index).Name
|
||||||
|
if strings.Contains(strings.ToLower(method), "bulk") {
|
||||||
|
t.Errorf("%s invented unsupported bulk operation %s", contract, method)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
topicContract := reflect.TypeOf((*topics.ClientService)(nil)).Elem()
|
||||||
|
for _, method := range []string{"DeleteTopic", "DeleteTopicContext", "DeleteTopics", "DeleteTopicsContext"} {
|
||||||
|
if _, exists := topicContract.MethodByName(method); exists {
|
||||||
|
t.Errorf("Topic client invented unsupported operation %s", method)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestResearchSpecIsPinnedToDeployedV0716Contract(t *testing.T) {
|
||||||
|
repoRoot := insightRepoRoot(t)
|
||||||
|
mainSpec, err := os.ReadFile(filepath.Join(repoRoot, "swagger", "research-vernonkeenan.yaml"))
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("read Research spec: %v", err)
|
||||||
|
}
|
||||||
|
sum := sha256.Sum256(mainSpec)
|
||||||
|
if got := hex.EncodeToString(sum[:]); got != researchV0716SpecSHA256 {
|
||||||
|
t.Fatalf("Research spec drifted from deployed v0.7.16: SHA-256 = %s, want %s", got, researchV0716SpecSHA256)
|
||||||
|
}
|
||||||
|
|
||||||
|
externalSpec, err := os.ReadFile(filepath.Join(repoRoot, "swagger", "external", "research-vernonkeenan.yaml"))
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("read external Research spec: %v", err)
|
||||||
|
}
|
||||||
|
normalized := bytes.ReplaceAll(externalSpec, []byte(`"https"`), []byte(`"http"`))
|
||||||
|
normalized = bytes.ReplaceAll(normalized, []byte("gw.tnxs.net"), []byte("research.vernonkeenan.com:8080"))
|
||||||
|
normalized = bytes.ReplaceAll(normalized, []byte(`"/vk/research/v1"`), []byte(`"/v1"`))
|
||||||
|
if !bytes.Equal(normalized, mainSpec) {
|
||||||
|
t.Fatal("external Research spec differs from the conventional host/scheme/base-path rewrite")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestGeneratedInsightSurfaceHasNoSalesforceOrEmbeddedSecrets(t *testing.T) {
|
||||||
|
repoRoot := insightRepoRoot(t)
|
||||||
|
clientRoot := filepath.Join(repoRoot, "api", "research", "research_client")
|
||||||
|
modelRoot := filepath.Join(repoRoot, "api", "research", "research_models")
|
||||||
|
targets := []string{
|
||||||
|
filepath.Join(clientRoot, "topics"),
|
||||||
|
filepath.Join(clientRoot, "factors"),
|
||||||
|
filepath.Join(clientRoot, "financial_statements"),
|
||||||
|
filepath.Join(clientRoot, "observations"),
|
||||||
|
filepath.Join(modelRoot, "topic.go"),
|
||||||
|
filepath.Join(modelRoot, "topic_request.go"),
|
||||||
|
filepath.Join(modelRoot, "topic_response.go"),
|
||||||
|
filepath.Join(modelRoot, "factor.go"),
|
||||||
|
filepath.Join(modelRoot, "factor_request.go"),
|
||||||
|
filepath.Join(modelRoot, "factor_response.go"),
|
||||||
|
filepath.Join(modelRoot, "financial_statement.go"),
|
||||||
|
filepath.Join(modelRoot, "financial_statement_request.go"),
|
||||||
|
filepath.Join(modelRoot, "financial_statement_response.go"),
|
||||||
|
filepath.Join(modelRoot, "observation.go"),
|
||||||
|
filepath.Join(modelRoot, "observation_request.go"),
|
||||||
|
filepath.Join(modelRoot, "observation_response.go"),
|
||||||
|
}
|
||||||
|
credentialLiteral := regexp.MustCompile(`(?i)(api[_-]?key|password|secret)\s*[:=]\s*["'][^"']+["']`)
|
||||||
|
|
||||||
|
for _, target := range targets {
|
||||||
|
err := filepath.WalkDir(target, func(path string, entry os.DirEntry, walkErr error) error {
|
||||||
|
if walkErr != nil {
|
||||||
|
return walkErr
|
||||||
|
}
|
||||||
|
if entry.IsDir() || !strings.HasSuffix(path, ".go") || strings.HasSuffix(path, "_test.go") {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
content, err := os.ReadFile(path)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
lower := strings.ToLower(string(content))
|
||||||
|
for _, forbidden := range []string{"salesforce", "sf-gate", "go-force", "private key-----"} {
|
||||||
|
if strings.Contains(lower, forbidden) {
|
||||||
|
t.Errorf("%s contains forbidden boundary %q", path, forbidden)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if credentialLiteral.Match(content) {
|
||||||
|
t.Errorf("%s contains a credential-shaped literal", path)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("scan generated contract target %s: %v", target, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func insightRepoRoot(t *testing.T) string {
|
||||||
|
t.Helper()
|
||||||
|
_, testFile, _, ok := runtime.Caller(0)
|
||||||
|
if !ok {
|
||||||
|
t.Fatal("resolve test source path")
|
||||||
|
}
|
||||||
|
return filepath.Clean(filepath.Join(filepath.Dir(testFile), "..", "..", ".."))
|
||||||
|
}
|
||||||
|
|
@ -72,10 +72,10 @@ type ClientService interface {
|
||||||
// GetObservationsContext get a list of observations.
|
// GetObservationsContext get a list of observations.
|
||||||
GetObservationsContext(ctx context.Context, params *GetObservationsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetObservationsOK, error)
|
GetObservationsContext(ctx context.Context, params *GetObservationsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetObservationsOK, error)
|
||||||
|
|
||||||
// PostObservations add a new observation to salesforce devops net.
|
// PostObservations add a new observation.
|
||||||
PostObservations(params *PostObservationsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostObservationsOK, error)
|
PostObservations(params *PostObservationsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostObservationsOK, error)
|
||||||
|
|
||||||
// PostObservationsContext add a new observation to salesforce devops net.
|
// PostObservationsContext add a new observation.
|
||||||
PostObservationsContext(ctx context.Context, params *PostObservationsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostObservationsOK, error)
|
PostObservationsContext(ctx context.Context, params *PostObservationsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostObservationsOK, error)
|
||||||
|
|
||||||
// PutObservation update a single observation.
|
// PutObservation update a single observation.
|
||||||
|
|
@ -221,7 +221,7 @@ func (a *Client) GetObservationsContext(ctx context.Context, params *GetObservat
|
||||||
panic(msg)
|
panic(msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
// PostObservations adds a new observation to salesforce devops net.
|
// PostObservations adds a new observation.
|
||||||
//
|
//
|
||||||
// Observation record to be added.
|
// Observation record to be added.
|
||||||
//
|
//
|
||||||
|
|
@ -240,7 +240,7 @@ func (a *Client) PostObservations(params *PostObservationsParams, authInfo runti
|
||||||
return a.PostObservationsContext(ctx, params, authInfo, opts...)
|
return a.PostObservationsContext(ctx, params, authInfo, opts...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// PostObservationsContext adds a new observation to salesforce devops net.
|
// PostObservationsContext adds a new observation.
|
||||||
//
|
//
|
||||||
// Observation record to be added.
|
// Observation record to be added.
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,12 @@ func (o *PutObservationReader) ReadResponse(response runtime.ClientResponse, con
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return nil, result
|
return nil, result
|
||||||
|
case 409:
|
||||||
|
result := NewPutObservationConflict()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
case 422:
|
case 422:
|
||||||
result := NewPutObservationUnprocessableEntity()
|
result := NewPutObservationUnprocessableEntity()
|
||||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
|
@ -365,6 +371,74 @@ func (o *PutObservationNotFound) readResponse(response runtime.ClientResponse, c
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewPutObservationConflict creates a PutObservationConflict with default headers values
|
||||||
|
func NewPutObservationConflict() *PutObservationConflict {
|
||||||
|
return &PutObservationConflict{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// PutObservationConflict describes a response with status code 409, with default header values.
|
||||||
|
//
|
||||||
|
// Optimistic version conflict
|
||||||
|
type PutObservationConflict struct {
|
||||||
|
Payload *research_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this put observation conflict response has a 2xx status code
|
||||||
|
func (o *PutObservationConflict) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this put observation conflict response has a 3xx status code
|
||||||
|
func (o *PutObservationConflict) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this put observation conflict response has a 4xx status code
|
||||||
|
func (o *PutObservationConflict) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this put observation conflict response has a 5xx status code
|
||||||
|
func (o *PutObservationConflict) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this put observation conflict response a status code equal to that given
|
||||||
|
func (o *PutObservationConflict) IsCode(code int) bool {
|
||||||
|
return code == 409
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the put observation conflict response
|
||||||
|
func (o *PutObservationConflict) Code() int {
|
||||||
|
return 409
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutObservationConflict) Error() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[PUT /observations][%d] putObservationConflict %s", 409, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutObservationConflict) String() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[PUT /observations][%d] putObservationConflict %s", 409, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutObservationConflict) GetPayload() *research_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutObservationConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(research_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// NewPutObservationUnprocessableEntity creates a PutObservationUnprocessableEntity with default headers values
|
// NewPutObservationUnprocessableEntity creates a PutObservationUnprocessableEntity with default headers values
|
||||||
func NewPutObservationUnprocessableEntity() *PutObservationUnprocessableEntity {
|
func NewPutObservationUnprocessableEntity() *PutObservationUnprocessableEntity {
|
||||||
return &PutObservationUnprocessableEntity{}
|
return &PutObservationUnprocessableEntity{}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,159 @@
|
||||||
|
// 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 topics
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"code.tnxs.net/vernonkeenan/lib/api/research/research_models"
|
||||||
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
cr "github.com/go-openapi/runtime/client"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewPutTopicParams creates a new PutTopicParams object,
|
||||||
|
// with the default timeout for this client.
|
||||||
|
//
|
||||||
|
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||||
|
//
|
||||||
|
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||||
|
func NewPutTopicParams() *PutTopicParams {
|
||||||
|
return NewPutTopicParamsWithTimeout(cr.DefaultTimeout)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutTopicParamsWithTimeout creates a new PutTopicParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewPutTopicParamsWithTimeout(timeout time.Duration) *PutTopicParams {
|
||||||
|
return &PutTopicParams{
|
||||||
|
inner: innerParams{
|
||||||
|
timeout: timeout,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutTopicParamsWithContext creates a new PutTopicParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
//
|
||||||
|
// Deprecated: use the operation call with context to pass the context instead of [PutTopicParams].
|
||||||
|
func NewPutTopicParamsWithContext(ctx context.Context) *PutTopicParams {
|
||||||
|
return &PutTopicParams{
|
||||||
|
inner: innerParams{
|
||||||
|
ctx: ctx,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutTopicParamsWithHTTPClient creates a new PutTopicParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewPutTopicParamsWithHTTPClient(client *http.Client) *PutTopicParams {
|
||||||
|
return &PutTopicParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
PutTopicParams contains all the parameters to send to the API endpoint
|
||||||
|
|
||||||
|
for the put topic operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type PutTopicParams struct {
|
||||||
|
|
||||||
|
// TopicRequest.
|
||||||
|
//
|
||||||
|
// An array of new Topic records
|
||||||
|
TopicRequest *research_models.TopicRequest
|
||||||
|
|
||||||
|
HTTPClient *http.Client
|
||||||
|
|
||||||
|
inner innerParams
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the put topic params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *PutTopicParams) WithDefaults() *PutTopicParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the put topic params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *PutTopicParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the put topic params.
|
||||||
|
func (o *PutTopicParams) WithTimeout(timeout time.Duration) *PutTopicParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the put topic params.
|
||||||
|
func (o *PutTopicParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.inner.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the put topic params.
|
||||||
|
//
|
||||||
|
// Deprecated: use the operation call with context to pass the context instead of [PutTopicParams].
|
||||||
|
func (o *PutTopicParams) WithContext(ctx context.Context) *PutTopicParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the put topic params.
|
||||||
|
//
|
||||||
|
// Deprecated: use the operation call with context to pass the context instead of [PutTopicParams].
|
||||||
|
func (o *PutTopicParams) SetContext(ctx context.Context) {
|
||||||
|
o.inner.ctx = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the put topic params.
|
||||||
|
func (o *PutTopicParams) WithHTTPClient(client *http.Client) *PutTopicParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the put topic params.
|
||||||
|
func (o *PutTopicParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTopicRequest adds the topicRequest to the put topic params.
|
||||||
|
func (o *PutTopicParams) WithTopicRequest(topicRequest *research_models.TopicRequest) *PutTopicParams {
|
||||||
|
o.SetTopicRequest(topicRequest)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTopicRequest adds the topicRequest to the put topic params.
|
||||||
|
func (o *PutTopicParams) SetTopicRequest(topicRequest *research_models.TopicRequest) {
|
||||||
|
o.TopicRequest = topicRequest
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a [runtime.ClientRequest].
|
||||||
|
func (o *PutTopicParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
if err := r.SetTimeout(o.inner.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
if o.TopicRequest != nil {
|
||||||
|
if err := r.SetBodyParam(o.TopicRequest); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,594 @@
|
||||||
|
// 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 topics
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
stderrors "errors"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
|
||||||
|
"code.tnxs.net/vernonkeenan/lib/api/research/research_models"
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
// PutTopicReader is a Reader for the PutTopic structure.
|
||||||
|
type PutTopicReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *PutTopicReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewPutTopicOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 401:
|
||||||
|
result := NewPutTopicUnauthorized()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 403:
|
||||||
|
result := NewPutTopicForbidden()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 404:
|
||||||
|
result := NewPutTopicNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 409:
|
||||||
|
result := NewPutTopicConflict()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 422:
|
||||||
|
result := NewPutTopicUnprocessableEntity()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 500:
|
||||||
|
result := NewPutTopicInternalServerError()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("[PUT /topics] putTopic", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutTopicOK creates a PutTopicOK with default headers values
|
||||||
|
func NewPutTopicOK() *PutTopicOK {
|
||||||
|
return &PutTopicOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// PutTopicOK describes a response with status code 200, with default header values.
|
||||||
|
//
|
||||||
|
// Response with Topic objects
|
||||||
|
type PutTopicOK struct {
|
||||||
|
Payload *research_models.TopicResponse
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this put topic o k response has a 2xx status code
|
||||||
|
func (o *PutTopicOK) IsSuccess() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this put topic o k response has a 3xx status code
|
||||||
|
func (o *PutTopicOK) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this put topic o k response has a 4xx status code
|
||||||
|
func (o *PutTopicOK) IsClientError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this put topic o k response has a 5xx status code
|
||||||
|
func (o *PutTopicOK) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this put topic o k response a status code equal to that given
|
||||||
|
func (o *PutTopicOK) IsCode(code int) bool {
|
||||||
|
return code == 200
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the put topic o k response
|
||||||
|
func (o *PutTopicOK) Code() int {
|
||||||
|
return 200
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutTopicOK) Error() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[PUT /topics][%d] putTopicOK %s", 200, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutTopicOK) String() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[PUT /topics][%d] putTopicOK %s", 200, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutTopicOK) GetPayload() *research_models.TopicResponse {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutTopicOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(research_models.TopicResponse)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutTopicUnauthorized creates a PutTopicUnauthorized with default headers values
|
||||||
|
func NewPutTopicUnauthorized() *PutTopicUnauthorized {
|
||||||
|
return &PutTopicUnauthorized{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// PutTopicUnauthorized describes a response with status code 401, with default header values.
|
||||||
|
//
|
||||||
|
// Access unauthorized, invalid API-KEY was used
|
||||||
|
type PutTopicUnauthorized struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *research_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this put topic unauthorized response has a 2xx status code
|
||||||
|
func (o *PutTopicUnauthorized) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this put topic unauthorized response has a 3xx status code
|
||||||
|
func (o *PutTopicUnauthorized) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this put topic unauthorized response has a 4xx status code
|
||||||
|
func (o *PutTopicUnauthorized) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this put topic unauthorized response has a 5xx status code
|
||||||
|
func (o *PutTopicUnauthorized) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this put topic unauthorized response a status code equal to that given
|
||||||
|
func (o *PutTopicUnauthorized) IsCode(code int) bool {
|
||||||
|
return code == 401
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the put topic unauthorized response
|
||||||
|
func (o *PutTopicUnauthorized) Code() int {
|
||||||
|
return 401
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutTopicUnauthorized) Error() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[PUT /topics][%d] putTopicUnauthorized %s", 401, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutTopicUnauthorized) String() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[PUT /topics][%d] putTopicUnauthorized %s", 401, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutTopicUnauthorized) GetPayload() *research_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutTopicUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(research_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutTopicForbidden creates a PutTopicForbidden with default headers values
|
||||||
|
func NewPutTopicForbidden() *PutTopicForbidden {
|
||||||
|
return &PutTopicForbidden{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// PutTopicForbidden describes a response with status code 403, with default header values.
|
||||||
|
//
|
||||||
|
// Access forbidden, account lacks access
|
||||||
|
type PutTopicForbidden struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *research_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this put topic forbidden response has a 2xx status code
|
||||||
|
func (o *PutTopicForbidden) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this put topic forbidden response has a 3xx status code
|
||||||
|
func (o *PutTopicForbidden) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this put topic forbidden response has a 4xx status code
|
||||||
|
func (o *PutTopicForbidden) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this put topic forbidden response has a 5xx status code
|
||||||
|
func (o *PutTopicForbidden) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this put topic forbidden response a status code equal to that given
|
||||||
|
func (o *PutTopicForbidden) IsCode(code int) bool {
|
||||||
|
return code == 403
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the put topic forbidden response
|
||||||
|
func (o *PutTopicForbidden) Code() int {
|
||||||
|
return 403
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutTopicForbidden) Error() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[PUT /topics][%d] putTopicForbidden %s", 403, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutTopicForbidden) String() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[PUT /topics][%d] putTopicForbidden %s", 403, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutTopicForbidden) GetPayload() *research_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutTopicForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(research_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutTopicNotFound creates a PutTopicNotFound with default headers values
|
||||||
|
func NewPutTopicNotFound() *PutTopicNotFound {
|
||||||
|
return &PutTopicNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// PutTopicNotFound describes a response with status code 404, with default header values.
|
||||||
|
//
|
||||||
|
// Resource was not found
|
||||||
|
type PutTopicNotFound struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *research_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this put topic not found response has a 2xx status code
|
||||||
|
func (o *PutTopicNotFound) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this put topic not found response has a 3xx status code
|
||||||
|
func (o *PutTopicNotFound) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this put topic not found response has a 4xx status code
|
||||||
|
func (o *PutTopicNotFound) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this put topic not found response has a 5xx status code
|
||||||
|
func (o *PutTopicNotFound) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this put topic not found response a status code equal to that given
|
||||||
|
func (o *PutTopicNotFound) IsCode(code int) bool {
|
||||||
|
return code == 404
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the put topic not found response
|
||||||
|
func (o *PutTopicNotFound) Code() int {
|
||||||
|
return 404
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutTopicNotFound) Error() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[PUT /topics][%d] putTopicNotFound %s", 404, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutTopicNotFound) String() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[PUT /topics][%d] putTopicNotFound %s", 404, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutTopicNotFound) GetPayload() *research_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutTopicNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(research_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutTopicConflict creates a PutTopicConflict with default headers values
|
||||||
|
func NewPutTopicConflict() *PutTopicConflict {
|
||||||
|
return &PutTopicConflict{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// PutTopicConflict describes a response with status code 409, with default header values.
|
||||||
|
//
|
||||||
|
// Optimistic version conflict
|
||||||
|
type PutTopicConflict struct {
|
||||||
|
Payload *research_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this put topic conflict response has a 2xx status code
|
||||||
|
func (o *PutTopicConflict) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this put topic conflict response has a 3xx status code
|
||||||
|
func (o *PutTopicConflict) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this put topic conflict response has a 4xx status code
|
||||||
|
func (o *PutTopicConflict) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this put topic conflict response has a 5xx status code
|
||||||
|
func (o *PutTopicConflict) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this put topic conflict response a status code equal to that given
|
||||||
|
func (o *PutTopicConflict) IsCode(code int) bool {
|
||||||
|
return code == 409
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the put topic conflict response
|
||||||
|
func (o *PutTopicConflict) Code() int {
|
||||||
|
return 409
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutTopicConflict) Error() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[PUT /topics][%d] putTopicConflict %s", 409, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutTopicConflict) String() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[PUT /topics][%d] putTopicConflict %s", 409, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutTopicConflict) GetPayload() *research_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutTopicConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(research_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutTopicUnprocessableEntity creates a PutTopicUnprocessableEntity with default headers values
|
||||||
|
func NewPutTopicUnprocessableEntity() *PutTopicUnprocessableEntity {
|
||||||
|
return &PutTopicUnprocessableEntity{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// PutTopicUnprocessableEntity describes a response with status code 422, with default header values.
|
||||||
|
//
|
||||||
|
// Unprocessable Entity, likely a bad parameter
|
||||||
|
type PutTopicUnprocessableEntity struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *research_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this put topic unprocessable entity response has a 2xx status code
|
||||||
|
func (o *PutTopicUnprocessableEntity) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this put topic unprocessable entity response has a 3xx status code
|
||||||
|
func (o *PutTopicUnprocessableEntity) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this put topic unprocessable entity response has a 4xx status code
|
||||||
|
func (o *PutTopicUnprocessableEntity) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this put topic unprocessable entity response has a 5xx status code
|
||||||
|
func (o *PutTopicUnprocessableEntity) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this put topic unprocessable entity response a status code equal to that given
|
||||||
|
func (o *PutTopicUnprocessableEntity) IsCode(code int) bool {
|
||||||
|
return code == 422
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the put topic unprocessable entity response
|
||||||
|
func (o *PutTopicUnprocessableEntity) Code() int {
|
||||||
|
return 422
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutTopicUnprocessableEntity) Error() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[PUT /topics][%d] putTopicUnprocessableEntity %s", 422, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutTopicUnprocessableEntity) String() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[PUT /topics][%d] putTopicUnprocessableEntity %s", 422, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutTopicUnprocessableEntity) GetPayload() *research_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutTopicUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(research_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutTopicInternalServerError creates a PutTopicInternalServerError with default headers values
|
||||||
|
func NewPutTopicInternalServerError() *PutTopicInternalServerError {
|
||||||
|
return &PutTopicInternalServerError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// PutTopicInternalServerError describes a response with status code 500, with default header values.
|
||||||
|
//
|
||||||
|
// Server Internal Error
|
||||||
|
type PutTopicInternalServerError struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *research_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this put topic internal server error response has a 2xx status code
|
||||||
|
func (o *PutTopicInternalServerError) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this put topic internal server error response has a 3xx status code
|
||||||
|
func (o *PutTopicInternalServerError) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this put topic internal server error response has a 4xx status code
|
||||||
|
func (o *PutTopicInternalServerError) IsClientError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this put topic internal server error response has a 5xx status code
|
||||||
|
func (o *PutTopicInternalServerError) IsServerError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this put topic internal server error response a status code equal to that given
|
||||||
|
func (o *PutTopicInternalServerError) IsCode(code int) bool {
|
||||||
|
return code == 500
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the put topic internal server error response
|
||||||
|
func (o *PutTopicInternalServerError) Code() int {
|
||||||
|
return 500
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutTopicInternalServerError) Error() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[PUT /topics][%d] putTopicInternalServerError %s", 500, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutTopicInternalServerError) String() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[PUT /topics][%d] putTopicInternalServerError %s", 500, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutTopicInternalServerError) GetPayload() *research_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutTopicInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(research_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -72,6 +72,12 @@ type ClientService interface {
|
||||||
// PostTopicsContext add new topics.
|
// PostTopicsContext add new topics.
|
||||||
PostTopicsContext(ctx context.Context, params *PostTopicsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostTopicsOK, error)
|
PostTopicsContext(ctx context.Context, params *PostTopicsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostTopicsOK, error)
|
||||||
|
|
||||||
|
// PutTopic update one topic record.
|
||||||
|
PutTopic(params *PutTopicParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutTopicOK, error)
|
||||||
|
|
||||||
|
// PutTopicContext update one topic record.
|
||||||
|
PutTopicContext(ctx context.Context, params *PutTopicParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutTopicOK, error)
|
||||||
|
|
||||||
SetTransport(transport runtime.ContextualTransport)
|
SetTransport(transport runtime.ContextualTransport)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -209,6 +215,73 @@ func (a *Client) PostTopicsContext(ctx context.Context, params *PostTopicsParams
|
||||||
panic(msg)
|
panic(msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PutTopic updates one topic record.
|
||||||
|
//
|
||||||
|
// Update one Topic record using optimistic concurrency.
|
||||||
|
//
|
||||||
|
// 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.PutTopicContext] instead.
|
||||||
|
func (a *Client) PutTopic(params *PutTopicParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutTopicOK, error) {
|
||||||
|
var ctx context.Context
|
||||||
|
if params.inner.ctx != nil {
|
||||||
|
ctx = params.inner.ctx
|
||||||
|
} else {
|
||||||
|
ctx = context.Background()
|
||||||
|
}
|
||||||
|
|
||||||
|
return a.PutTopicContext(ctx, params, authInfo, opts...)
|
||||||
|
}
|
||||||
|
|
||||||
|
// PutTopicContext updates one topic record.
|
||||||
|
//
|
||||||
|
// Update one Topic record using optimistic concurrency.
|
||||||
|
//
|
||||||
|
// Do not use the deprecated [PutTopicParams.Context] with this method: it would be ignored.
|
||||||
|
func (a *Client) PutTopicContext(ctx context.Context, params *PutTopicParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutTopicOK, error) {
|
||||||
|
// NOTE: parameters are not validated before sending
|
||||||
|
if params == nil {
|
||||||
|
params = NewPutTopicParams()
|
||||||
|
}
|
||||||
|
|
||||||
|
op := &runtime.ClientOperation{
|
||||||
|
ID: "putTopic",
|
||||||
|
Method: "PUT",
|
||||||
|
PathPattern: "/topics",
|
||||||
|
ProducesMediaTypes: []string{"application/json"},
|
||||||
|
ConsumesMediaTypes: []string{"application/json"},
|
||||||
|
Schemes: []string{"http"},
|
||||||
|
Params: params,
|
||||||
|
Reader: &PutTopicReader{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.(*PutTopicOK)
|
||||||
|
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 putTopic: 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
|
// SetTransport changes the transport on the client
|
||||||
func (a *Client) SetTransport(transport runtime.ContextualTransport) {
|
func (a *Client) SetTransport(transport runtime.ContextualTransport) {
|
||||||
a.transport = transport
|
a.transport = transport
|
||||||
|
|
|
||||||
|
|
@ -790,7 +790,8 @@ paths:
|
||||||
$ref: "#/responses/ServerError"
|
$ref: "#/responses/ServerError"
|
||||||
security:
|
security:
|
||||||
- ApiKeyAuth: []
|
- ApiKeyAuth: []
|
||||||
summary: Add a new factor to SalesforceDevops.net
|
kvSessionCookie: []
|
||||||
|
summary: Add a new factor
|
||||||
tags:
|
tags:
|
||||||
- Factors
|
- Factors
|
||||||
put:
|
put:
|
||||||
|
|
@ -807,12 +808,17 @@ paths:
|
||||||
$ref: "#/responses/AccessForbidden"
|
$ref: "#/responses/AccessForbidden"
|
||||||
"404":
|
"404":
|
||||||
$ref: "#/responses/NotFound"
|
$ref: "#/responses/NotFound"
|
||||||
|
"409":
|
||||||
|
description: Optimistic version conflict
|
||||||
|
schema:
|
||||||
|
$ref: "#/definitions/Error"
|
||||||
"422":
|
"422":
|
||||||
$ref: "#/responses/UnprocessableEntity"
|
$ref: "#/responses/UnprocessableEntity"
|
||||||
"500":
|
"500":
|
||||||
$ref: "#/responses/ServerError"
|
$ref: "#/responses/ServerError"
|
||||||
security:
|
security:
|
||||||
- ApiKeyAuth: []
|
- ApiKeyAuth: []
|
||||||
|
kvSessionCookie: []
|
||||||
summary: Update factor records
|
summary: Update factor records
|
||||||
tags:
|
tags:
|
||||||
- Factors
|
- Factors
|
||||||
|
|
@ -887,7 +893,8 @@ paths:
|
||||||
$ref: "#/responses/ServerError"
|
$ref: "#/responses/ServerError"
|
||||||
security:
|
security:
|
||||||
- ApiKeyAuth: []
|
- ApiKeyAuth: []
|
||||||
summary: Add a new financialStatement to SalesforceDevops.net
|
kvSessionCookie: []
|
||||||
|
summary: Add a new financial statement
|
||||||
tags:
|
tags:
|
||||||
- FinancialStatements
|
- FinancialStatements
|
||||||
put:
|
put:
|
||||||
|
|
@ -904,12 +911,17 @@ paths:
|
||||||
$ref: "#/responses/AccessForbidden"
|
$ref: "#/responses/AccessForbidden"
|
||||||
"404":
|
"404":
|
||||||
$ref: "#/responses/NotFound"
|
$ref: "#/responses/NotFound"
|
||||||
|
"409":
|
||||||
|
description: Optimistic version conflict
|
||||||
|
schema:
|
||||||
|
$ref: "#/definitions/Error"
|
||||||
"422":
|
"422":
|
||||||
$ref: "#/responses/UnprocessableEntity"
|
$ref: "#/responses/UnprocessableEntity"
|
||||||
"500":
|
"500":
|
||||||
$ref: "#/responses/ServerError"
|
$ref: "#/responses/ServerError"
|
||||||
security:
|
security:
|
||||||
- ApiKeyAuth: []
|
- ApiKeyAuth: []
|
||||||
|
kvSessionCookie: []
|
||||||
summary: Update financialStatement records
|
summary: Update financialStatement records
|
||||||
tags:
|
tags:
|
||||||
- FinancialStatements
|
- FinancialStatements
|
||||||
|
|
@ -1292,7 +1304,8 @@ paths:
|
||||||
$ref: "#/responses/ServerError"
|
$ref: "#/responses/ServerError"
|
||||||
security:
|
security:
|
||||||
- ApiKeyAuth: []
|
- ApiKeyAuth: []
|
||||||
summary: Add a new observation to SalesforceDevops.net
|
kvSessionCookie: []
|
||||||
|
summary: Add a new observation
|
||||||
tags:
|
tags:
|
||||||
- Observations
|
- Observations
|
||||||
put:
|
put:
|
||||||
|
|
@ -1309,12 +1322,17 @@ paths:
|
||||||
$ref: "#/responses/AccessForbidden"
|
$ref: "#/responses/AccessForbidden"
|
||||||
"404":
|
"404":
|
||||||
$ref: "#/responses/NotFound"
|
$ref: "#/responses/NotFound"
|
||||||
|
"409":
|
||||||
|
description: Optimistic version conflict
|
||||||
|
schema:
|
||||||
|
$ref: "#/definitions/Error"
|
||||||
"422":
|
"422":
|
||||||
$ref: "#/responses/UnprocessableEntity"
|
$ref: "#/responses/UnprocessableEntity"
|
||||||
"500":
|
"500":
|
||||||
$ref: "#/responses/ServerError"
|
$ref: "#/responses/ServerError"
|
||||||
security:
|
security:
|
||||||
- ApiKeyAuth: []
|
- ApiKeyAuth: []
|
||||||
|
kvSessionCookie: []
|
||||||
summary: Update a single observation
|
summary: Update a single observation
|
||||||
tags:
|
tags:
|
||||||
- Observations
|
- Observations
|
||||||
|
|
@ -1364,9 +1382,38 @@ paths:
|
||||||
$ref: "#/responses/ServerError"
|
$ref: "#/responses/ServerError"
|
||||||
security:
|
security:
|
||||||
- ApiKeyAuth: []
|
- ApiKeyAuth: []
|
||||||
|
kvSessionCookie: []
|
||||||
summary: Add new topics
|
summary: Add new topics
|
||||||
tags:
|
tags:
|
||||||
- Topics
|
- Topics
|
||||||
|
put:
|
||||||
|
description: Update one Topic record using optimistic concurrency
|
||||||
|
operationId: putTopic
|
||||||
|
parameters:
|
||||||
|
- $ref: "#/parameters/topicRequest"
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
$ref: "#/responses/TopicResponse"
|
||||||
|
"401":
|
||||||
|
$ref: "#/responses/Unauthorized"
|
||||||
|
"403":
|
||||||
|
$ref: "#/responses/AccessForbidden"
|
||||||
|
"404":
|
||||||
|
$ref: "#/responses/NotFound"
|
||||||
|
"409":
|
||||||
|
description: Optimistic version conflict
|
||||||
|
schema:
|
||||||
|
$ref: "#/definitions/Error"
|
||||||
|
"422":
|
||||||
|
$ref: "#/responses/UnprocessableEntity"
|
||||||
|
"500":
|
||||||
|
$ref: "#/responses/ServerError"
|
||||||
|
security:
|
||||||
|
- ApiKeyAuth: []
|
||||||
|
kvSessionCookie: []
|
||||||
|
summary: Update one Topic record
|
||||||
|
tags:
|
||||||
|
- Topics
|
||||||
|
|
||||||
definitions:
|
definitions:
|
||||||
Address:
|
Address:
|
||||||
|
|
|
||||||
|
|
@ -790,7 +790,8 @@ paths:
|
||||||
$ref: "#/responses/ServerError"
|
$ref: "#/responses/ServerError"
|
||||||
security:
|
security:
|
||||||
- ApiKeyAuth: []
|
- ApiKeyAuth: []
|
||||||
summary: Add a new factor to SalesforceDevops.net
|
kvSessionCookie: []
|
||||||
|
summary: Add a new factor
|
||||||
tags:
|
tags:
|
||||||
- Factors
|
- Factors
|
||||||
put:
|
put:
|
||||||
|
|
@ -807,12 +808,17 @@ paths:
|
||||||
$ref: "#/responses/AccessForbidden"
|
$ref: "#/responses/AccessForbidden"
|
||||||
"404":
|
"404":
|
||||||
$ref: "#/responses/NotFound"
|
$ref: "#/responses/NotFound"
|
||||||
|
"409":
|
||||||
|
description: Optimistic version conflict
|
||||||
|
schema:
|
||||||
|
$ref: "#/definitions/Error"
|
||||||
"422":
|
"422":
|
||||||
$ref: "#/responses/UnprocessableEntity"
|
$ref: "#/responses/UnprocessableEntity"
|
||||||
"500":
|
"500":
|
||||||
$ref: "#/responses/ServerError"
|
$ref: "#/responses/ServerError"
|
||||||
security:
|
security:
|
||||||
- ApiKeyAuth: []
|
- ApiKeyAuth: []
|
||||||
|
kvSessionCookie: []
|
||||||
summary: Update factor records
|
summary: Update factor records
|
||||||
tags:
|
tags:
|
||||||
- Factors
|
- Factors
|
||||||
|
|
@ -887,7 +893,8 @@ paths:
|
||||||
$ref: "#/responses/ServerError"
|
$ref: "#/responses/ServerError"
|
||||||
security:
|
security:
|
||||||
- ApiKeyAuth: []
|
- ApiKeyAuth: []
|
||||||
summary: Add a new financialStatement to SalesforceDevops.net
|
kvSessionCookie: []
|
||||||
|
summary: Add a new financial statement
|
||||||
tags:
|
tags:
|
||||||
- FinancialStatements
|
- FinancialStatements
|
||||||
put:
|
put:
|
||||||
|
|
@ -904,12 +911,17 @@ paths:
|
||||||
$ref: "#/responses/AccessForbidden"
|
$ref: "#/responses/AccessForbidden"
|
||||||
"404":
|
"404":
|
||||||
$ref: "#/responses/NotFound"
|
$ref: "#/responses/NotFound"
|
||||||
|
"409":
|
||||||
|
description: Optimistic version conflict
|
||||||
|
schema:
|
||||||
|
$ref: "#/definitions/Error"
|
||||||
"422":
|
"422":
|
||||||
$ref: "#/responses/UnprocessableEntity"
|
$ref: "#/responses/UnprocessableEntity"
|
||||||
"500":
|
"500":
|
||||||
$ref: "#/responses/ServerError"
|
$ref: "#/responses/ServerError"
|
||||||
security:
|
security:
|
||||||
- ApiKeyAuth: []
|
- ApiKeyAuth: []
|
||||||
|
kvSessionCookie: []
|
||||||
summary: Update financialStatement records
|
summary: Update financialStatement records
|
||||||
tags:
|
tags:
|
||||||
- FinancialStatements
|
- FinancialStatements
|
||||||
|
|
@ -1292,7 +1304,8 @@ paths:
|
||||||
$ref: "#/responses/ServerError"
|
$ref: "#/responses/ServerError"
|
||||||
security:
|
security:
|
||||||
- ApiKeyAuth: []
|
- ApiKeyAuth: []
|
||||||
summary: Add a new observation to SalesforceDevops.net
|
kvSessionCookie: []
|
||||||
|
summary: Add a new observation
|
||||||
tags:
|
tags:
|
||||||
- Observations
|
- Observations
|
||||||
put:
|
put:
|
||||||
|
|
@ -1309,12 +1322,17 @@ paths:
|
||||||
$ref: "#/responses/AccessForbidden"
|
$ref: "#/responses/AccessForbidden"
|
||||||
"404":
|
"404":
|
||||||
$ref: "#/responses/NotFound"
|
$ref: "#/responses/NotFound"
|
||||||
|
"409":
|
||||||
|
description: Optimistic version conflict
|
||||||
|
schema:
|
||||||
|
$ref: "#/definitions/Error"
|
||||||
"422":
|
"422":
|
||||||
$ref: "#/responses/UnprocessableEntity"
|
$ref: "#/responses/UnprocessableEntity"
|
||||||
"500":
|
"500":
|
||||||
$ref: "#/responses/ServerError"
|
$ref: "#/responses/ServerError"
|
||||||
security:
|
security:
|
||||||
- ApiKeyAuth: []
|
- ApiKeyAuth: []
|
||||||
|
kvSessionCookie: []
|
||||||
summary: Update a single observation
|
summary: Update a single observation
|
||||||
tags:
|
tags:
|
||||||
- Observations
|
- Observations
|
||||||
|
|
@ -1364,9 +1382,38 @@ paths:
|
||||||
$ref: "#/responses/ServerError"
|
$ref: "#/responses/ServerError"
|
||||||
security:
|
security:
|
||||||
- ApiKeyAuth: []
|
- ApiKeyAuth: []
|
||||||
|
kvSessionCookie: []
|
||||||
summary: Add new topics
|
summary: Add new topics
|
||||||
tags:
|
tags:
|
||||||
- Topics
|
- Topics
|
||||||
|
put:
|
||||||
|
description: Update one Topic record using optimistic concurrency
|
||||||
|
operationId: putTopic
|
||||||
|
parameters:
|
||||||
|
- $ref: "#/parameters/topicRequest"
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
$ref: "#/responses/TopicResponse"
|
||||||
|
"401":
|
||||||
|
$ref: "#/responses/Unauthorized"
|
||||||
|
"403":
|
||||||
|
$ref: "#/responses/AccessForbidden"
|
||||||
|
"404":
|
||||||
|
$ref: "#/responses/NotFound"
|
||||||
|
"409":
|
||||||
|
description: Optimistic version conflict
|
||||||
|
schema:
|
||||||
|
$ref: "#/definitions/Error"
|
||||||
|
"422":
|
||||||
|
$ref: "#/responses/UnprocessableEntity"
|
||||||
|
"500":
|
||||||
|
$ref: "#/responses/ServerError"
|
||||||
|
security:
|
||||||
|
- ApiKeyAuth: []
|
||||||
|
kvSessionCookie: []
|
||||||
|
summary: Update one Topic record
|
||||||
|
tags:
|
||||||
|
- Topics
|
||||||
|
|
||||||
definitions:
|
definitions:
|
||||||
Address:
|
Address:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue