mirror of https://github.com/vernonkeenan/lib
feat(members): add generated Track clients (#20)
Publish generated Track list/get/create/CAS-update clients while keeping Ticket and Track relationship clients absent.agent/lib-stash-pdf-metadata-client v0.7.17
parent
36a1e8b9f8
commit
e512c18849
|
|
@ -23,7 +23,7 @@ import (
|
|||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
const membersProviderSpecSHA256 = "9a62406c00a8591e5a29abee4ceab9108461438b0a1729d8ce5a846fdb614af5"
|
||||
const membersProviderSpecSHA256 = "091a5ea132ea076ecfd391a02458e4a2445aa16dee89487b0aef977631766c4c"
|
||||
|
||||
var learningTestAuth = openapiruntime.ClientAuthInfoWriterFunc(func(openapiruntime.ClientRequest, strfmt.Registry) error {
|
||||
return nil
|
||||
|
|
@ -517,7 +517,7 @@ func TestMembersSpecIsPinnedToProviderSource(t *testing.T) {
|
|||
}
|
||||
sum := sha256.Sum256(mainSpec)
|
||||
if got := hex.EncodeToString(sum[:]); got != membersProviderSpecSHA256 {
|
||||
t.Fatalf("Members spec drifted from provider commit c0f7905: SHA-256 = %s, want %s", got, membersProviderSpecSHA256)
|
||||
t.Fatalf("Members spec drifted from integrated Track provider commit 6bfdcbe: SHA-256 = %s, want %s", got, membersProviderSpecSHA256)
|
||||
}
|
||||
|
||||
externalSpec, err := os.ReadFile(filepath.Join(repoRoot, "swagger", "external", "members-vernonkeenan.yaml"))
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ import (
|
|||
"code.tnxs.net/vernonkeenan/lib/api/members/members_client/sessions"
|
||||
"code.tnxs.net/vernonkeenan/lib/api/members/members_client/templates"
|
||||
"code.tnxs.net/vernonkeenan/lib/api/members/members_client/tenants"
|
||||
"code.tnxs.net/vernonkeenan/lib/api/members/members_client/tracks"
|
||||
"code.tnxs.net/vernonkeenan/lib/api/members/members_client/transactions"
|
||||
"code.tnxs.net/vernonkeenan/lib/api/members/members_client/users"
|
||||
"github.com/go-openapi/runtime"
|
||||
|
|
@ -109,6 +110,7 @@ func New(transport runtime.ContextualTransport, formats strfmt.Registry) *Member
|
|||
cli.Sessions = sessions.New(transport, formats)
|
||||
cli.Templates = templates.New(transport, formats)
|
||||
cli.Tenants = tenants.New(transport, formats)
|
||||
cli.Tracks = tracks.New(transport, formats)
|
||||
cli.Transactions = transactions.New(transport, formats)
|
||||
cli.Users = users.New(transport, formats)
|
||||
|
||||
|
|
@ -220,6 +222,8 @@ type Members struct {
|
|||
|
||||
Tenants tenants.ClientService
|
||||
|
||||
Tracks tracks.ClientService
|
||||
|
||||
Transactions transactions.ClientService
|
||||
|
||||
Users users.ClientService
|
||||
|
|
@ -255,6 +259,7 @@ func (c *Members) SetTransport(transport runtime.ContextualTransport) {
|
|||
c.Sessions.SetTransport(transport)
|
||||
c.Templates.SetTransport(transport)
|
||||
c.Tenants.SetTransport(transport)
|
||||
c.Tracks.SetTransport(transport)
|
||||
c.Transactions.SetTransport(transport)
|
||||
c.Users.SetTransport(transport)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,302 @@
|
|||
package members_client_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"code.tnxs.net/vernonkeenan/lib/api/members/members_client"
|
||||
"code.tnxs.net/vernonkeenan/lib/api/members/members_client/tracks"
|
||||
"code.tnxs.net/vernonkeenan/lib/api/members/members_models"
|
||||
openapiruntime "github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
const membersTrackSpecSHA256 = "091a5ea132ea076ecfd391a02458e4a2445aa16dee89487b0aef977631766c4c"
|
||||
|
||||
var trackTestAuth = openapiruntime.ClientAuthInfoWriterFunc(
|
||||
func(openapiruntime.ClientRequest, strfmt.Registry) error { return nil },
|
||||
)
|
||||
|
||||
type trackCaptureTransport struct {
|
||||
operation *openapiruntime.ClientOperation
|
||||
}
|
||||
|
||||
func (transport *trackCaptureTransport) Submit(
|
||||
operation *openapiruntime.ClientOperation,
|
||||
) (any, error) {
|
||||
return transport.SubmitContext(context.Background(), operation)
|
||||
}
|
||||
|
||||
func (transport *trackCaptureTransport) SubmitContext(
|
||||
_ context.Context,
|
||||
operation *openapiruntime.ClientOperation,
|
||||
) (any, error) {
|
||||
transport.operation = operation
|
||||
switch operation.ID {
|
||||
case "getTracks":
|
||||
return tracks.NewGetTracksOK(), nil
|
||||
case "postTracks":
|
||||
return tracks.NewPostTracksOK(), nil
|
||||
case "putTracks":
|
||||
return tracks.NewPutTracksOK(), nil
|
||||
default:
|
||||
panic("unexpected generated Track operation: " + operation.ID)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGeneratedTrackOperationContract(t *testing.T) {
|
||||
type operationCall func(openapiruntime.ContextualTransport) error
|
||||
tests := []struct {
|
||||
name, wantID, wantMethod, wantPath string
|
||||
call operationCall
|
||||
}{
|
||||
{
|
||||
name: "list or get Track", wantID: "getTracks",
|
||||
wantMethod: "GET", wantPath: "/tracks",
|
||||
call: func(transport openapiruntime.ContextualTransport) error {
|
||||
_, err := tracks.New(transport, strfmt.Default).GetTracks(
|
||||
tracks.NewGetTracksParams(), trackTestAuth,
|
||||
)
|
||||
return err
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "create Track", wantID: "postTracks",
|
||||
wantMethod: "POST", wantPath: "/tracks",
|
||||
call: func(transport openapiruntime.ContextualTransport) error {
|
||||
_, err := tracks.New(transport, strfmt.Default).PostTracks(
|
||||
tracks.NewPostTracksParams(), trackTestAuth,
|
||||
)
|
||||
return err
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "CAS update Track", wantID: "putTracks",
|
||||
wantMethod: "PUT", wantPath: "/tracks",
|
||||
call: func(transport openapiruntime.ContextualTransport) error {
|
||||
_, err := tracks.New(transport, strfmt.Default).PutTracks(
|
||||
tracks.NewPutTracksParams(), trackTestAuth,
|
||||
)
|
||||
return err
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
transport := &trackCaptureTransport{}
|
||||
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)
|
||||
}
|
||||
if transport.operation.AuthInfo == nil {
|
||||
t.Error("generated operation discarded its compound auth-info writer")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestTrackSpecPreservesExactScopesCompoundAuthAndCAS(t *testing.T) {
|
||||
specText := readMembersLearningSpec(t)
|
||||
pathBlock := learningSpecPathBlock(t, specText, "/tracks")
|
||||
for _, forbidden := range []string{" delete:", " patch:"} {
|
||||
if strings.Contains(pathBlock, forbidden) {
|
||||
t.Errorf("/tracks exposes unsupported %s", strings.TrimSpace(forbidden))
|
||||
}
|
||||
}
|
||||
operations := map[string]struct {
|
||||
id, scope string
|
||||
}{
|
||||
"get": {id: "getTracks", scope: "members:track:read"},
|
||||
"post": {id: "postTracks", scope: "members:track:create"},
|
||||
"put": {id: "putTracks", scope: "members:track:update"},
|
||||
}
|
||||
const compoundSecurity = " security:\n - ApiKeyAuth: []\n kvSessionCookie: []"
|
||||
for method, expected := range operations {
|
||||
block := learningSpecOperationBlock(t, specText, "/tracks", method)
|
||||
if !strings.Contains(block, " operationId: "+expected.id+"\n") {
|
||||
t.Errorf("%s /tracks lost operationId %q", strings.ToUpper(method), expected.id)
|
||||
}
|
||||
if strings.Count(block, compoundSecurity) != 1 {
|
||||
t.Errorf("%s /tracks does not preserve compound authentication", strings.ToUpper(method))
|
||||
}
|
||||
if !strings.Contains(block, expected.scope) {
|
||||
t.Errorf("%s /tracks lost exact scope %q", strings.ToUpper(method), expected.scope)
|
||||
}
|
||||
}
|
||||
if !tracks.NewPutTracksConflict().IsCode(409) {
|
||||
t.Fatal("Track update client lost the optimistic concurrency response")
|
||||
}
|
||||
recordID := "track-id"
|
||||
if got := tracks.NewGetTracksParams().WithID(&recordID).ID; got == nil || *got != recordID {
|
||||
t.Fatal("Track list/get client lost its ID filter")
|
||||
}
|
||||
}
|
||||
|
||||
func TestTrackModelAndSingleRecordRequestAreBounded(t *testing.T) {
|
||||
assertExactModelFields(t, members_models.Track{}, map[string]string{
|
||||
"CreatedByID": "*string", "CreatedDate": "*string", "Description": "*string",
|
||||
"ID": "string", "ImageAltText": "*string", "ImageURL": "*string",
|
||||
"LastModifiedByID": "*string", "LastModifiedDate": "*string",
|
||||
"Logo": "*string", "Name": "string", "Slug": "string",
|
||||
})
|
||||
request := &members_models.TrackRequest{
|
||||
Data: []*members_models.Track{{Name: "One", Slug: "one"}, {Name: "Two", Slug: "two"}},
|
||||
}
|
||||
if err := request.Validate(strfmt.Default); err == nil {
|
||||
t.Fatal("generated Track request accepted a bulk payload")
|
||||
}
|
||||
}
|
||||
|
||||
func TestTrackSurfaceOmitsRelationshipsDeleteAndUnsafeAliases(t *testing.T) {
|
||||
contract := reflect.TypeOf((*tracks.ClientService)(nil)).Elem()
|
||||
for index := 0; index < contract.NumMethod(); index++ {
|
||||
method := contract.Method(index).Name
|
||||
for _, forbidden := range []string{"Delete", "TrackEvent", "TrackTopic", "TrackUser"} {
|
||||
if strings.Contains(method, forbidden) {
|
||||
t.Errorf("Track client exposes unsafe method %s", method)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
root := reflect.TypeOf(members_client.Members{})
|
||||
if _, exists := root.FieldByName("Tracks"); !exists {
|
||||
t.Fatal("root Members client does not expose governed Tracks")
|
||||
}
|
||||
for _, forbidden := range []string{
|
||||
"TrackEvent", "TrackEvents", "TrackTopic", "TrackTopics", "TrackUser", "TrackUsers",
|
||||
} {
|
||||
if _, exists := root.FieldByName(forbidden); exists {
|
||||
t.Errorf("root Members client exposes provider-pending %s", forbidden)
|
||||
}
|
||||
}
|
||||
|
||||
repoRoot := learningRepoRoot(t)
|
||||
for _, path := range []string{
|
||||
"/trackevents", "/tracktopics", "/trackusers",
|
||||
} {
|
||||
if strings.Contains(readMembersLearningSpec(t), "\n "+path+":") {
|
||||
t.Errorf("authoritative spec exposes provider-pending %s", path)
|
||||
}
|
||||
}
|
||||
for _, artifact := range []string{
|
||||
"trackevent.go", "trackevent_request.go", "trackevent_response.go",
|
||||
"track_event.go", "track_event_request.go", "track_event_response.go",
|
||||
"tracktopic.go", "tracktopic_request.go", "tracktopic_response.go",
|
||||
"track_topic.go", "track_topic_request.go", "track_topic_response.go",
|
||||
"trackuser.go", "trackuser_request.go", "trackuser_response.go",
|
||||
"track_user.go", "track_user_request.go", "track_user_response.go",
|
||||
} {
|
||||
if _, err := os.Stat(filepath.Join(
|
||||
repoRoot, "api", "members", "members_models", artifact,
|
||||
)); !os.IsNotExist(err) {
|
||||
t.Errorf("provider-pending generated artifact exists: %s", artifact)
|
||||
}
|
||||
}
|
||||
for _, clientDir := range []string{
|
||||
"trackevents", "track_events", "tracktopics", "track_topics", "trackusers", "track_users",
|
||||
} {
|
||||
path := filepath.Join(repoRoot, "api", "members", "members_client", clientDir)
|
||||
if _, err := os.Stat(path); !os.IsNotExist(err) {
|
||||
t.Errorf("provider-pending generated client directory exists: %s", clientDir)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestMembersSpecIsPinnedToTrackProviderCommit(t *testing.T) {
|
||||
repoRoot := learningRepoRoot(t)
|
||||
mainSpec, err := os.ReadFile(filepath.Join(
|
||||
repoRoot, "swagger", "members-vernonkeenan.yaml",
|
||||
))
|
||||
if err != nil {
|
||||
t.Fatalf("read Members spec: %v", err)
|
||||
}
|
||||
sum := sha256.Sum256(mainSpec)
|
||||
if got := hex.EncodeToString(sum[:]); got != membersTrackSpecSHA256 {
|
||||
t.Fatalf(
|
||||
"Members spec drifted from integrated Track provider commit 6bfdcbe: SHA-256 = %s, want %s",
|
||||
got, membersTrackSpecSHA256,
|
||||
)
|
||||
}
|
||||
|
||||
externalSpec, err := os.ReadFile(filepath.Join(
|
||||
repoRoot, "swagger", "external", "members-vernonkeenan.yaml",
|
||||
))
|
||||
if err != nil {
|
||||
t.Fatalf("read external Members spec: %v", err)
|
||||
}
|
||||
normalized := bytes.ReplaceAll(externalSpec, []byte(`"https"`), []byte(`"http"`))
|
||||
normalized = bytes.ReplaceAll(
|
||||
normalized, []byte("gw.tnxs.net"), []byte("members.vernonkeenan.com:8080"),
|
||||
)
|
||||
normalized = bytes.ReplaceAll(
|
||||
normalized, []byte(`"/vk/members/v1"`), []byte(`"/v1"`),
|
||||
)
|
||||
if !bytes.Equal(normalized, mainSpec) {
|
||||
t.Fatal("external Members spec differs from the conventional gateway rewrite")
|
||||
}
|
||||
}
|
||||
|
||||
func TestGeneratedTrackSurfaceHasNoExternalBypassOrSecrets(t *testing.T) {
|
||||
repoRoot := learningRepoRoot(t)
|
||||
targets := []string{
|
||||
filepath.Join(repoRoot, "api", "members", "members_client", "tracks"),
|
||||
filepath.Join(repoRoot, "api", "members", "members_models", "track.go"),
|
||||
filepath.Join(repoRoot, "api", "members", "members_models", "track_request.go"),
|
||||
filepath.Join(repoRoot, "api", "members", "members_models", "track_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 Track target %s: %v", target, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,241 @@
|
|||
// 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 tracks
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag/conv"
|
||||
)
|
||||
|
||||
// NewGetTracksParams creates a new GetTracksParams 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 NewGetTracksParams() *GetTracksParams {
|
||||
return NewGetTracksParamsWithTimeout(cr.DefaultTimeout)
|
||||
}
|
||||
|
||||
// NewGetTracksParamsWithTimeout creates a new GetTracksParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewGetTracksParamsWithTimeout(timeout time.Duration) *GetTracksParams {
|
||||
return &GetTracksParams{
|
||||
inner: innerParams{
|
||||
timeout: timeout,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetTracksParamsWithContext creates a new GetTracksParams object
|
||||
// with the ability to set a context for a request.
|
||||
//
|
||||
// Deprecated: use the operation call with context to pass the context instead of [GetTracksParams].
|
||||
func NewGetTracksParamsWithContext(ctx context.Context) *GetTracksParams {
|
||||
return &GetTracksParams{
|
||||
inner: innerParams{
|
||||
ctx: ctx,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetTracksParamsWithHTTPClient creates a new GetTracksParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewGetTracksParamsWithHTTPClient(client *http.Client) *GetTracksParams {
|
||||
return &GetTracksParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
GetTracksParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the get tracks operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type GetTracksParams struct {
|
||||
|
||||
// ID.
|
||||
//
|
||||
// Unique Record ID
|
||||
ID *string
|
||||
|
||||
// Limit.
|
||||
//
|
||||
// How many objects to return at one time
|
||||
//
|
||||
// Format: int64
|
||||
Limit *int64
|
||||
|
||||
// Offset.
|
||||
//
|
||||
// How many objects to skip?
|
||||
//
|
||||
// Format: int64
|
||||
Offset *int64
|
||||
|
||||
HTTPClient *http.Client
|
||||
|
||||
inner innerParams
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the get tracks params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *GetTracksParams) WithDefaults() *GetTracksParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the get tracks params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *GetTracksParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the get tracks params.
|
||||
func (o *GetTracksParams) WithTimeout(timeout time.Duration) *GetTracksParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the get tracks params.
|
||||
func (o *GetTracksParams) SetTimeout(timeout time.Duration) {
|
||||
o.inner.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the get tracks params.
|
||||
//
|
||||
// Deprecated: use the operation call with context to pass the context instead of [GetTracksParams].
|
||||
func (o *GetTracksParams) WithContext(ctx context.Context) *GetTracksParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the get tracks params.
|
||||
//
|
||||
// Deprecated: use the operation call with context to pass the context instead of [GetTracksParams].
|
||||
func (o *GetTracksParams) SetContext(ctx context.Context) {
|
||||
o.inner.ctx = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the get tracks params.
|
||||
func (o *GetTracksParams) WithHTTPClient(client *http.Client) *GetTracksParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the get tracks params.
|
||||
func (o *GetTracksParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithID adds the id to the get tracks params.
|
||||
func (o *GetTracksParams) WithID(id *string) *GetTracksParams {
|
||||
o.SetID(id)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetID adds the id to the get tracks params.
|
||||
func (o *GetTracksParams) SetID(id *string) {
|
||||
o.ID = id
|
||||
}
|
||||
|
||||
// WithLimit adds the limit to the get tracks params.
|
||||
func (o *GetTracksParams) WithLimit(limit *int64) *GetTracksParams {
|
||||
o.SetLimit(limit)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetLimit adds the limit to the get tracks params.
|
||||
func (o *GetTracksParams) SetLimit(limit *int64) {
|
||||
o.Limit = limit
|
||||
}
|
||||
|
||||
// WithOffset adds the offset to the get tracks params.
|
||||
func (o *GetTracksParams) WithOffset(offset *int64) *GetTracksParams {
|
||||
o.SetOffset(offset)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOffset adds the offset to the get tracks params.
|
||||
func (o *GetTracksParams) SetOffset(offset *int64) {
|
||||
o.Offset = offset
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a [runtime.ClientRequest].
|
||||
func (o *GetTracksParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
if err := r.SetTimeout(o.inner.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
if o.ID != nil {
|
||||
|
||||
// query param id
|
||||
var qrID string
|
||||
|
||||
if o.ID != nil {
|
||||
qrID = *o.ID
|
||||
}
|
||||
qID := qrID
|
||||
if qID != "" {
|
||||
|
||||
if err := r.SetQueryParam("id", qID); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if o.Limit != nil {
|
||||
|
||||
// query param limit
|
||||
var qrLimit int64
|
||||
|
||||
if o.Limit != nil {
|
||||
qrLimit = *o.Limit
|
||||
}
|
||||
qLimit := conv.FormatInteger(qrLimit)
|
||||
if qLimit != "" {
|
||||
|
||||
if err := r.SetQueryParam("limit", qLimit); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if o.Offset != nil {
|
||||
|
||||
// query param offset
|
||||
var qrOffset int64
|
||||
|
||||
if o.Offset != nil {
|
||||
qrOffset = *o.Offset
|
||||
}
|
||||
qOffset := conv.FormatInteger(qrOffset)
|
||||
if qOffset != "" {
|
||||
|
||||
if err := r.SetQueryParam("offset", qOffset); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
@ -0,0 +1,484 @@
|
|||
// 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 tracks
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
stderrors "errors"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"code.tnxs.net/vernonkeenan/lib/api/members/members_models"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// GetTracksReader is a Reader for the GetTracks structure.
|
||||
type GetTracksReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *GetTracksReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewGetTracksOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
case 401:
|
||||
result := NewGetTracksUnauthorized()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
case 403:
|
||||
result := NewGetTracksForbidden()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
case 404:
|
||||
result := NewGetTracksNotFound()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
case 422:
|
||||
result := NewGetTracksUnprocessableEntity()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
case 500:
|
||||
result := NewGetTracksInternalServerError()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
default:
|
||||
return nil, runtime.NewAPIError("[GET /tracks] getTracks", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetTracksOK creates a GetTracksOK with default headers values
|
||||
func NewGetTracksOK() *GetTracksOK {
|
||||
return &GetTracksOK{}
|
||||
}
|
||||
|
||||
// GetTracksOK describes a response with status code 200, with default header values.
|
||||
//
|
||||
// Governed Track response
|
||||
type GetTracksOK struct {
|
||||
Payload *members_models.TrackResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get tracks o k response has a 2xx status code
|
||||
func (o *GetTracksOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get tracks o k response has a 3xx status code
|
||||
func (o *GetTracksOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get tracks o k response has a 4xx status code
|
||||
func (o *GetTracksOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get tracks o k response has a 5xx status code
|
||||
func (o *GetTracksOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this get tracks o k response a status code equal to that given
|
||||
func (o *GetTracksOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the get tracks o k response
|
||||
func (o *GetTracksOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *GetTracksOK) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /tracks][%d] getTracksOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *GetTracksOK) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /tracks][%d] getTracksOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *GetTracksOK) GetPayload() *members_models.TrackResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *GetTracksOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(members_models.TrackResponse)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewGetTracksUnauthorized creates a GetTracksUnauthorized with default headers values
|
||||
func NewGetTracksUnauthorized() *GetTracksUnauthorized {
|
||||
return &GetTracksUnauthorized{}
|
||||
}
|
||||
|
||||
// GetTracksUnauthorized describes a response with status code 401, with default header values.
|
||||
//
|
||||
// Access Unauthorized, invalid API-KEY was used
|
||||
type GetTracksUnauthorized struct {
|
||||
Payload *members_models.Error
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get tracks unauthorized response has a 2xx status code
|
||||
func (o *GetTracksUnauthorized) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get tracks unauthorized response has a 3xx status code
|
||||
func (o *GetTracksUnauthorized) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get tracks unauthorized response has a 4xx status code
|
||||
func (o *GetTracksUnauthorized) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get tracks unauthorized response has a 5xx status code
|
||||
func (o *GetTracksUnauthorized) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this get tracks unauthorized response a status code equal to that given
|
||||
func (o *GetTracksUnauthorized) IsCode(code int) bool {
|
||||
return code == 401
|
||||
}
|
||||
|
||||
// Code gets the status code for the get tracks unauthorized response
|
||||
func (o *GetTracksUnauthorized) Code() int {
|
||||
return 401
|
||||
}
|
||||
|
||||
func (o *GetTracksUnauthorized) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /tracks][%d] getTracksUnauthorized %s", 401, payload)
|
||||
}
|
||||
|
||||
func (o *GetTracksUnauthorized) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /tracks][%d] getTracksUnauthorized %s", 401, payload)
|
||||
}
|
||||
|
||||
func (o *GetTracksUnauthorized) GetPayload() *members_models.Error {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *GetTracksUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(members_models.Error)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewGetTracksForbidden creates a GetTracksForbidden with default headers values
|
||||
func NewGetTracksForbidden() *GetTracksForbidden {
|
||||
return &GetTracksForbidden{}
|
||||
}
|
||||
|
||||
// GetTracksForbidden describes a response with status code 403, with default header values.
|
||||
//
|
||||
// Access forbidden, account lacks access
|
||||
type GetTracksForbidden struct {
|
||||
AccessControlAllowOrigin string
|
||||
|
||||
Payload *members_models.Error
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get tracks forbidden response has a 2xx status code
|
||||
func (o *GetTracksForbidden) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get tracks forbidden response has a 3xx status code
|
||||
func (o *GetTracksForbidden) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get tracks forbidden response has a 4xx status code
|
||||
func (o *GetTracksForbidden) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get tracks forbidden response has a 5xx status code
|
||||
func (o *GetTracksForbidden) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this get tracks forbidden response a status code equal to that given
|
||||
func (o *GetTracksForbidden) IsCode(code int) bool {
|
||||
return code == 403
|
||||
}
|
||||
|
||||
// Code gets the status code for the get tracks forbidden response
|
||||
func (o *GetTracksForbidden) Code() int {
|
||||
return 403
|
||||
}
|
||||
|
||||
func (o *GetTracksForbidden) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /tracks][%d] getTracksForbidden %s", 403, payload)
|
||||
}
|
||||
|
||||
func (o *GetTracksForbidden) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /tracks][%d] getTracksForbidden %s", 403, payload)
|
||||
}
|
||||
|
||||
func (o *GetTracksForbidden) GetPayload() *members_models.Error {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *GetTracksForbidden) 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(members_models.Error)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewGetTracksNotFound creates a GetTracksNotFound with default headers values
|
||||
func NewGetTracksNotFound() *GetTracksNotFound {
|
||||
return &GetTracksNotFound{}
|
||||
}
|
||||
|
||||
// GetTracksNotFound describes a response with status code 404, with default header values.
|
||||
//
|
||||
// Resource was not found
|
||||
type GetTracksNotFound struct {
|
||||
Payload *members_models.Error
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get tracks not found response has a 2xx status code
|
||||
func (o *GetTracksNotFound) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get tracks not found response has a 3xx status code
|
||||
func (o *GetTracksNotFound) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get tracks not found response has a 4xx status code
|
||||
func (o *GetTracksNotFound) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get tracks not found response has a 5xx status code
|
||||
func (o *GetTracksNotFound) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this get tracks not found response a status code equal to that given
|
||||
func (o *GetTracksNotFound) IsCode(code int) bool {
|
||||
return code == 404
|
||||
}
|
||||
|
||||
// Code gets the status code for the get tracks not found response
|
||||
func (o *GetTracksNotFound) Code() int {
|
||||
return 404
|
||||
}
|
||||
|
||||
func (o *GetTracksNotFound) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /tracks][%d] getTracksNotFound %s", 404, payload)
|
||||
}
|
||||
|
||||
func (o *GetTracksNotFound) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /tracks][%d] getTracksNotFound %s", 404, payload)
|
||||
}
|
||||
|
||||
func (o *GetTracksNotFound) GetPayload() *members_models.Error {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *GetTracksNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(members_models.Error)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewGetTracksUnprocessableEntity creates a GetTracksUnprocessableEntity with default headers values
|
||||
func NewGetTracksUnprocessableEntity() *GetTracksUnprocessableEntity {
|
||||
return &GetTracksUnprocessableEntity{}
|
||||
}
|
||||
|
||||
// GetTracksUnprocessableEntity describes a response with status code 422, with default header values.
|
||||
//
|
||||
// Unprocessable Entity, likely a bad parameter
|
||||
type GetTracksUnprocessableEntity struct {
|
||||
Payload *members_models.Error
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get tracks unprocessable entity response has a 2xx status code
|
||||
func (o *GetTracksUnprocessableEntity) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get tracks unprocessable entity response has a 3xx status code
|
||||
func (o *GetTracksUnprocessableEntity) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get tracks unprocessable entity response has a 4xx status code
|
||||
func (o *GetTracksUnprocessableEntity) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get tracks unprocessable entity response has a 5xx status code
|
||||
func (o *GetTracksUnprocessableEntity) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this get tracks unprocessable entity response a status code equal to that given
|
||||
func (o *GetTracksUnprocessableEntity) IsCode(code int) bool {
|
||||
return code == 422
|
||||
}
|
||||
|
||||
// Code gets the status code for the get tracks unprocessable entity response
|
||||
func (o *GetTracksUnprocessableEntity) Code() int {
|
||||
return 422
|
||||
}
|
||||
|
||||
func (o *GetTracksUnprocessableEntity) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /tracks][%d] getTracksUnprocessableEntity %s", 422, payload)
|
||||
}
|
||||
|
||||
func (o *GetTracksUnprocessableEntity) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /tracks][%d] getTracksUnprocessableEntity %s", 422, payload)
|
||||
}
|
||||
|
||||
func (o *GetTracksUnprocessableEntity) GetPayload() *members_models.Error {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *GetTracksUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(members_models.Error)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewGetTracksInternalServerError creates a GetTracksInternalServerError with default headers values
|
||||
func NewGetTracksInternalServerError() *GetTracksInternalServerError {
|
||||
return &GetTracksInternalServerError{}
|
||||
}
|
||||
|
||||
// GetTracksInternalServerError describes a response with status code 500, with default header values.
|
||||
//
|
||||
// Server Internal Error
|
||||
type GetTracksInternalServerError struct {
|
||||
Payload *members_models.Error
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get tracks internal server error response has a 2xx status code
|
||||
func (o *GetTracksInternalServerError) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get tracks internal server error response has a 3xx status code
|
||||
func (o *GetTracksInternalServerError) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get tracks internal server error response has a 4xx status code
|
||||
func (o *GetTracksInternalServerError) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get tracks internal server error response has a 5xx status code
|
||||
func (o *GetTracksInternalServerError) IsServerError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsCode returns true when this get tracks internal server error response a status code equal to that given
|
||||
func (o *GetTracksInternalServerError) IsCode(code int) bool {
|
||||
return code == 500
|
||||
}
|
||||
|
||||
// Code gets the status code for the get tracks internal server error response
|
||||
func (o *GetTracksInternalServerError) Code() int {
|
||||
return 500
|
||||
}
|
||||
|
||||
func (o *GetTracksInternalServerError) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /tracks][%d] getTracksInternalServerError %s", 500, payload)
|
||||
}
|
||||
|
||||
func (o *GetTracksInternalServerError) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /tracks][%d] getTracksInternalServerError %s", 500, payload)
|
||||
}
|
||||
|
||||
func (o *GetTracksInternalServerError) GetPayload() *members_models.Error {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *GetTracksInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(members_models.Error)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
@ -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 tracks
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"code.tnxs.net/vernonkeenan/lib/api/members/members_models"
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewPostTracksParams creates a new PostTracksParams 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 NewPostTracksParams() *PostTracksParams {
|
||||
return NewPostTracksParamsWithTimeout(cr.DefaultTimeout)
|
||||
}
|
||||
|
||||
// NewPostTracksParamsWithTimeout creates a new PostTracksParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewPostTracksParamsWithTimeout(timeout time.Duration) *PostTracksParams {
|
||||
return &PostTracksParams{
|
||||
inner: innerParams{
|
||||
timeout: timeout,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// NewPostTracksParamsWithContext creates a new PostTracksParams object
|
||||
// with the ability to set a context for a request.
|
||||
//
|
||||
// Deprecated: use the operation call with context to pass the context instead of [PostTracksParams].
|
||||
func NewPostTracksParamsWithContext(ctx context.Context) *PostTracksParams {
|
||||
return &PostTracksParams{
|
||||
inner: innerParams{
|
||||
ctx: ctx,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// NewPostTracksParamsWithHTTPClient creates a new PostTracksParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewPostTracksParamsWithHTTPClient(client *http.Client) *PostTracksParams {
|
||||
return &PostTracksParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
PostTracksParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the post tracks operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type PostTracksParams struct {
|
||||
|
||||
// TrackRequest.
|
||||
//
|
||||
// Exactly one governed Track record
|
||||
TrackRequest *members_models.TrackRequest
|
||||
|
||||
HTTPClient *http.Client
|
||||
|
||||
inner innerParams
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the post tracks params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *PostTracksParams) WithDefaults() *PostTracksParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the post tracks params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *PostTracksParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the post tracks params.
|
||||
func (o *PostTracksParams) WithTimeout(timeout time.Duration) *PostTracksParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the post tracks params.
|
||||
func (o *PostTracksParams) SetTimeout(timeout time.Duration) {
|
||||
o.inner.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the post tracks params.
|
||||
//
|
||||
// Deprecated: use the operation call with context to pass the context instead of [PostTracksParams].
|
||||
func (o *PostTracksParams) WithContext(ctx context.Context) *PostTracksParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the post tracks params.
|
||||
//
|
||||
// Deprecated: use the operation call with context to pass the context instead of [PostTracksParams].
|
||||
func (o *PostTracksParams) SetContext(ctx context.Context) {
|
||||
o.inner.ctx = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the post tracks params.
|
||||
func (o *PostTracksParams) WithHTTPClient(client *http.Client) *PostTracksParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the post tracks params.
|
||||
func (o *PostTracksParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithTrackRequest adds the trackRequest to the post tracks params.
|
||||
func (o *PostTracksParams) WithTrackRequest(trackRequest *members_models.TrackRequest) *PostTracksParams {
|
||||
o.SetTrackRequest(trackRequest)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTrackRequest adds the trackRequest to the post tracks params.
|
||||
func (o *PostTracksParams) SetTrackRequest(trackRequest *members_models.TrackRequest) {
|
||||
o.TrackRequest = trackRequest
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a [runtime.ClientRequest].
|
||||
func (o *PostTracksParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
if err := r.SetTimeout(o.inner.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if o.TrackRequest != nil {
|
||||
if err := r.SetBodyParam(o.TrackRequest); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
@ -0,0 +1,484 @@
|
|||
// 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 tracks
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
stderrors "errors"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"code.tnxs.net/vernonkeenan/lib/api/members/members_models"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// PostTracksReader is a Reader for the PostTracks structure.
|
||||
type PostTracksReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *PostTracksReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewPostTracksOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
case 401:
|
||||
result := NewPostTracksUnauthorized()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
case 403:
|
||||
result := NewPostTracksForbidden()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
case 404:
|
||||
result := NewPostTracksNotFound()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
case 422:
|
||||
result := NewPostTracksUnprocessableEntity()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
case 500:
|
||||
result := NewPostTracksInternalServerError()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
default:
|
||||
return nil, runtime.NewAPIError("[POST /tracks] postTracks", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
// NewPostTracksOK creates a PostTracksOK with default headers values
|
||||
func NewPostTracksOK() *PostTracksOK {
|
||||
return &PostTracksOK{}
|
||||
}
|
||||
|
||||
// PostTracksOK describes a response with status code 200, with default header values.
|
||||
//
|
||||
// Governed Track response
|
||||
type PostTracksOK struct {
|
||||
Payload *members_models.TrackResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this post tracks o k response has a 2xx status code
|
||||
func (o *PostTracksOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this post tracks o k response has a 3xx status code
|
||||
func (o *PostTracksOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this post tracks o k response has a 4xx status code
|
||||
func (o *PostTracksOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this post tracks o k response has a 5xx status code
|
||||
func (o *PostTracksOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this post tracks o k response a status code equal to that given
|
||||
func (o *PostTracksOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the post tracks o k response
|
||||
func (o *PostTracksOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *PostTracksOK) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /tracks][%d] postTracksOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *PostTracksOK) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /tracks][%d] postTracksOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *PostTracksOK) GetPayload() *members_models.TrackResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *PostTracksOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(members_models.TrackResponse)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewPostTracksUnauthorized creates a PostTracksUnauthorized with default headers values
|
||||
func NewPostTracksUnauthorized() *PostTracksUnauthorized {
|
||||
return &PostTracksUnauthorized{}
|
||||
}
|
||||
|
||||
// PostTracksUnauthorized describes a response with status code 401, with default header values.
|
||||
//
|
||||
// Access Unauthorized, invalid API-KEY was used
|
||||
type PostTracksUnauthorized struct {
|
||||
Payload *members_models.Error
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this post tracks unauthorized response has a 2xx status code
|
||||
func (o *PostTracksUnauthorized) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this post tracks unauthorized response has a 3xx status code
|
||||
func (o *PostTracksUnauthorized) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this post tracks unauthorized response has a 4xx status code
|
||||
func (o *PostTracksUnauthorized) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this post tracks unauthorized response has a 5xx status code
|
||||
func (o *PostTracksUnauthorized) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this post tracks unauthorized response a status code equal to that given
|
||||
func (o *PostTracksUnauthorized) IsCode(code int) bool {
|
||||
return code == 401
|
||||
}
|
||||
|
||||
// Code gets the status code for the post tracks unauthorized response
|
||||
func (o *PostTracksUnauthorized) Code() int {
|
||||
return 401
|
||||
}
|
||||
|
||||
func (o *PostTracksUnauthorized) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /tracks][%d] postTracksUnauthorized %s", 401, payload)
|
||||
}
|
||||
|
||||
func (o *PostTracksUnauthorized) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /tracks][%d] postTracksUnauthorized %s", 401, payload)
|
||||
}
|
||||
|
||||
func (o *PostTracksUnauthorized) GetPayload() *members_models.Error {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *PostTracksUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(members_models.Error)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewPostTracksForbidden creates a PostTracksForbidden with default headers values
|
||||
func NewPostTracksForbidden() *PostTracksForbidden {
|
||||
return &PostTracksForbidden{}
|
||||
}
|
||||
|
||||
// PostTracksForbidden describes a response with status code 403, with default header values.
|
||||
//
|
||||
// Access forbidden, account lacks access
|
||||
type PostTracksForbidden struct {
|
||||
AccessControlAllowOrigin string
|
||||
|
||||
Payload *members_models.Error
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this post tracks forbidden response has a 2xx status code
|
||||
func (o *PostTracksForbidden) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this post tracks forbidden response has a 3xx status code
|
||||
func (o *PostTracksForbidden) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this post tracks forbidden response has a 4xx status code
|
||||
func (o *PostTracksForbidden) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this post tracks forbidden response has a 5xx status code
|
||||
func (o *PostTracksForbidden) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this post tracks forbidden response a status code equal to that given
|
||||
func (o *PostTracksForbidden) IsCode(code int) bool {
|
||||
return code == 403
|
||||
}
|
||||
|
||||
// Code gets the status code for the post tracks forbidden response
|
||||
func (o *PostTracksForbidden) Code() int {
|
||||
return 403
|
||||
}
|
||||
|
||||
func (o *PostTracksForbidden) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /tracks][%d] postTracksForbidden %s", 403, payload)
|
||||
}
|
||||
|
||||
func (o *PostTracksForbidden) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /tracks][%d] postTracksForbidden %s", 403, payload)
|
||||
}
|
||||
|
||||
func (o *PostTracksForbidden) GetPayload() *members_models.Error {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *PostTracksForbidden) 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(members_models.Error)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewPostTracksNotFound creates a PostTracksNotFound with default headers values
|
||||
func NewPostTracksNotFound() *PostTracksNotFound {
|
||||
return &PostTracksNotFound{}
|
||||
}
|
||||
|
||||
// PostTracksNotFound describes a response with status code 404, with default header values.
|
||||
//
|
||||
// Resource was not found
|
||||
type PostTracksNotFound struct {
|
||||
Payload *members_models.Error
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this post tracks not found response has a 2xx status code
|
||||
func (o *PostTracksNotFound) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this post tracks not found response has a 3xx status code
|
||||
func (o *PostTracksNotFound) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this post tracks not found response has a 4xx status code
|
||||
func (o *PostTracksNotFound) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this post tracks not found response has a 5xx status code
|
||||
func (o *PostTracksNotFound) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this post tracks not found response a status code equal to that given
|
||||
func (o *PostTracksNotFound) IsCode(code int) bool {
|
||||
return code == 404
|
||||
}
|
||||
|
||||
// Code gets the status code for the post tracks not found response
|
||||
func (o *PostTracksNotFound) Code() int {
|
||||
return 404
|
||||
}
|
||||
|
||||
func (o *PostTracksNotFound) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /tracks][%d] postTracksNotFound %s", 404, payload)
|
||||
}
|
||||
|
||||
func (o *PostTracksNotFound) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /tracks][%d] postTracksNotFound %s", 404, payload)
|
||||
}
|
||||
|
||||
func (o *PostTracksNotFound) GetPayload() *members_models.Error {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *PostTracksNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(members_models.Error)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewPostTracksUnprocessableEntity creates a PostTracksUnprocessableEntity with default headers values
|
||||
func NewPostTracksUnprocessableEntity() *PostTracksUnprocessableEntity {
|
||||
return &PostTracksUnprocessableEntity{}
|
||||
}
|
||||
|
||||
// PostTracksUnprocessableEntity describes a response with status code 422, with default header values.
|
||||
//
|
||||
// Unprocessable Entity, likely a bad parameter
|
||||
type PostTracksUnprocessableEntity struct {
|
||||
Payload *members_models.Error
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this post tracks unprocessable entity response has a 2xx status code
|
||||
func (o *PostTracksUnprocessableEntity) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this post tracks unprocessable entity response has a 3xx status code
|
||||
func (o *PostTracksUnprocessableEntity) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this post tracks unprocessable entity response has a 4xx status code
|
||||
func (o *PostTracksUnprocessableEntity) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this post tracks unprocessable entity response has a 5xx status code
|
||||
func (o *PostTracksUnprocessableEntity) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this post tracks unprocessable entity response a status code equal to that given
|
||||
func (o *PostTracksUnprocessableEntity) IsCode(code int) bool {
|
||||
return code == 422
|
||||
}
|
||||
|
||||
// Code gets the status code for the post tracks unprocessable entity response
|
||||
func (o *PostTracksUnprocessableEntity) Code() int {
|
||||
return 422
|
||||
}
|
||||
|
||||
func (o *PostTracksUnprocessableEntity) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /tracks][%d] postTracksUnprocessableEntity %s", 422, payload)
|
||||
}
|
||||
|
||||
func (o *PostTracksUnprocessableEntity) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /tracks][%d] postTracksUnprocessableEntity %s", 422, payload)
|
||||
}
|
||||
|
||||
func (o *PostTracksUnprocessableEntity) GetPayload() *members_models.Error {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *PostTracksUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(members_models.Error)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewPostTracksInternalServerError creates a PostTracksInternalServerError with default headers values
|
||||
func NewPostTracksInternalServerError() *PostTracksInternalServerError {
|
||||
return &PostTracksInternalServerError{}
|
||||
}
|
||||
|
||||
// PostTracksInternalServerError describes a response with status code 500, with default header values.
|
||||
//
|
||||
// Server Internal Error
|
||||
type PostTracksInternalServerError struct {
|
||||
Payload *members_models.Error
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this post tracks internal server error response has a 2xx status code
|
||||
func (o *PostTracksInternalServerError) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this post tracks internal server error response has a 3xx status code
|
||||
func (o *PostTracksInternalServerError) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this post tracks internal server error response has a 4xx status code
|
||||
func (o *PostTracksInternalServerError) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this post tracks internal server error response has a 5xx status code
|
||||
func (o *PostTracksInternalServerError) IsServerError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsCode returns true when this post tracks internal server error response a status code equal to that given
|
||||
func (o *PostTracksInternalServerError) IsCode(code int) bool {
|
||||
return code == 500
|
||||
}
|
||||
|
||||
// Code gets the status code for the post tracks internal server error response
|
||||
func (o *PostTracksInternalServerError) Code() int {
|
||||
return 500
|
||||
}
|
||||
|
||||
func (o *PostTracksInternalServerError) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /tracks][%d] postTracksInternalServerError %s", 500, payload)
|
||||
}
|
||||
|
||||
func (o *PostTracksInternalServerError) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /tracks][%d] postTracksInternalServerError %s", 500, payload)
|
||||
}
|
||||
|
||||
func (o *PostTracksInternalServerError) GetPayload() *members_models.Error {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *PostTracksInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(members_models.Error)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
@ -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 tracks
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"code.tnxs.net/vernonkeenan/lib/api/members/members_models"
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewPutTracksParams creates a new PutTracksParams 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 NewPutTracksParams() *PutTracksParams {
|
||||
return NewPutTracksParamsWithTimeout(cr.DefaultTimeout)
|
||||
}
|
||||
|
||||
// NewPutTracksParamsWithTimeout creates a new PutTracksParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewPutTracksParamsWithTimeout(timeout time.Duration) *PutTracksParams {
|
||||
return &PutTracksParams{
|
||||
inner: innerParams{
|
||||
timeout: timeout,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// NewPutTracksParamsWithContext creates a new PutTracksParams object
|
||||
// with the ability to set a context for a request.
|
||||
//
|
||||
// Deprecated: use the operation call with context to pass the context instead of [PutTracksParams].
|
||||
func NewPutTracksParamsWithContext(ctx context.Context) *PutTracksParams {
|
||||
return &PutTracksParams{
|
||||
inner: innerParams{
|
||||
ctx: ctx,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// NewPutTracksParamsWithHTTPClient creates a new PutTracksParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewPutTracksParamsWithHTTPClient(client *http.Client) *PutTracksParams {
|
||||
return &PutTracksParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
PutTracksParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the put tracks operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type PutTracksParams struct {
|
||||
|
||||
// TrackRequest.
|
||||
//
|
||||
// Exactly one governed Track record
|
||||
TrackRequest *members_models.TrackRequest
|
||||
|
||||
HTTPClient *http.Client
|
||||
|
||||
inner innerParams
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the put tracks params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *PutTracksParams) WithDefaults() *PutTracksParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the put tracks params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *PutTracksParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the put tracks params.
|
||||
func (o *PutTracksParams) WithTimeout(timeout time.Duration) *PutTracksParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the put tracks params.
|
||||
func (o *PutTracksParams) SetTimeout(timeout time.Duration) {
|
||||
o.inner.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the put tracks params.
|
||||
//
|
||||
// Deprecated: use the operation call with context to pass the context instead of [PutTracksParams].
|
||||
func (o *PutTracksParams) WithContext(ctx context.Context) *PutTracksParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the put tracks params.
|
||||
//
|
||||
// Deprecated: use the operation call with context to pass the context instead of [PutTracksParams].
|
||||
func (o *PutTracksParams) SetContext(ctx context.Context) {
|
||||
o.inner.ctx = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the put tracks params.
|
||||
func (o *PutTracksParams) WithHTTPClient(client *http.Client) *PutTracksParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the put tracks params.
|
||||
func (o *PutTracksParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithTrackRequest adds the trackRequest to the put tracks params.
|
||||
func (o *PutTracksParams) WithTrackRequest(trackRequest *members_models.TrackRequest) *PutTracksParams {
|
||||
o.SetTrackRequest(trackRequest)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTrackRequest adds the trackRequest to the put tracks params.
|
||||
func (o *PutTracksParams) SetTrackRequest(trackRequest *members_models.TrackRequest) {
|
||||
o.TrackRequest = trackRequest
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a [runtime.ClientRequest].
|
||||
func (o *PutTracksParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
if err := r.SetTimeout(o.inner.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if o.TrackRequest != nil {
|
||||
if err := r.SetBodyParam(o.TrackRequest); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
@ -0,0 +1,558 @@
|
|||
// 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 tracks
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
stderrors "errors"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"code.tnxs.net/vernonkeenan/lib/api/members/members_models"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// PutTracksReader is a Reader for the PutTracks structure.
|
||||
type PutTracksReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *PutTracksReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewPutTracksOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
case 401:
|
||||
result := NewPutTracksUnauthorized()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
case 403:
|
||||
result := NewPutTracksForbidden()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
case 404:
|
||||
result := NewPutTracksNotFound()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
case 409:
|
||||
result := NewPutTracksConflict()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
case 422:
|
||||
result := NewPutTracksUnprocessableEntity()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
case 500:
|
||||
result := NewPutTracksInternalServerError()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
default:
|
||||
return nil, runtime.NewAPIError("[PUT /tracks] putTracks", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
// NewPutTracksOK creates a PutTracksOK with default headers values
|
||||
func NewPutTracksOK() *PutTracksOK {
|
||||
return &PutTracksOK{}
|
||||
}
|
||||
|
||||
// PutTracksOK describes a response with status code 200, with default header values.
|
||||
//
|
||||
// Governed Track response
|
||||
type PutTracksOK struct {
|
||||
Payload *members_models.TrackResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this put tracks o k response has a 2xx status code
|
||||
func (o *PutTracksOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this put tracks o k response has a 3xx status code
|
||||
func (o *PutTracksOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this put tracks o k response has a 4xx status code
|
||||
func (o *PutTracksOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this put tracks o k response has a 5xx status code
|
||||
func (o *PutTracksOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this put tracks o k response a status code equal to that given
|
||||
func (o *PutTracksOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the put tracks o k response
|
||||
func (o *PutTracksOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *PutTracksOK) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PUT /tracks][%d] putTracksOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *PutTracksOK) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PUT /tracks][%d] putTracksOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *PutTracksOK) GetPayload() *members_models.TrackResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *PutTracksOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(members_models.TrackResponse)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewPutTracksUnauthorized creates a PutTracksUnauthorized with default headers values
|
||||
func NewPutTracksUnauthorized() *PutTracksUnauthorized {
|
||||
return &PutTracksUnauthorized{}
|
||||
}
|
||||
|
||||
// PutTracksUnauthorized describes a response with status code 401, with default header values.
|
||||
//
|
||||
// Access Unauthorized, invalid API-KEY was used
|
||||
type PutTracksUnauthorized struct {
|
||||
Payload *members_models.Error
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this put tracks unauthorized response has a 2xx status code
|
||||
func (o *PutTracksUnauthorized) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this put tracks unauthorized response has a 3xx status code
|
||||
func (o *PutTracksUnauthorized) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this put tracks unauthorized response has a 4xx status code
|
||||
func (o *PutTracksUnauthorized) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this put tracks unauthorized response has a 5xx status code
|
||||
func (o *PutTracksUnauthorized) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this put tracks unauthorized response a status code equal to that given
|
||||
func (o *PutTracksUnauthorized) IsCode(code int) bool {
|
||||
return code == 401
|
||||
}
|
||||
|
||||
// Code gets the status code for the put tracks unauthorized response
|
||||
func (o *PutTracksUnauthorized) Code() int {
|
||||
return 401
|
||||
}
|
||||
|
||||
func (o *PutTracksUnauthorized) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PUT /tracks][%d] putTracksUnauthorized %s", 401, payload)
|
||||
}
|
||||
|
||||
func (o *PutTracksUnauthorized) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PUT /tracks][%d] putTracksUnauthorized %s", 401, payload)
|
||||
}
|
||||
|
||||
func (o *PutTracksUnauthorized) GetPayload() *members_models.Error {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *PutTracksUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(members_models.Error)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewPutTracksForbidden creates a PutTracksForbidden with default headers values
|
||||
func NewPutTracksForbidden() *PutTracksForbidden {
|
||||
return &PutTracksForbidden{}
|
||||
}
|
||||
|
||||
// PutTracksForbidden describes a response with status code 403, with default header values.
|
||||
//
|
||||
// Access forbidden, account lacks access
|
||||
type PutTracksForbidden struct {
|
||||
AccessControlAllowOrigin string
|
||||
|
||||
Payload *members_models.Error
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this put tracks forbidden response has a 2xx status code
|
||||
func (o *PutTracksForbidden) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this put tracks forbidden response has a 3xx status code
|
||||
func (o *PutTracksForbidden) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this put tracks forbidden response has a 4xx status code
|
||||
func (o *PutTracksForbidden) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this put tracks forbidden response has a 5xx status code
|
||||
func (o *PutTracksForbidden) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this put tracks forbidden response a status code equal to that given
|
||||
func (o *PutTracksForbidden) IsCode(code int) bool {
|
||||
return code == 403
|
||||
}
|
||||
|
||||
// Code gets the status code for the put tracks forbidden response
|
||||
func (o *PutTracksForbidden) Code() int {
|
||||
return 403
|
||||
}
|
||||
|
||||
func (o *PutTracksForbidden) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PUT /tracks][%d] putTracksForbidden %s", 403, payload)
|
||||
}
|
||||
|
||||
func (o *PutTracksForbidden) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PUT /tracks][%d] putTracksForbidden %s", 403, payload)
|
||||
}
|
||||
|
||||
func (o *PutTracksForbidden) GetPayload() *members_models.Error {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *PutTracksForbidden) 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(members_models.Error)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewPutTracksNotFound creates a PutTracksNotFound with default headers values
|
||||
func NewPutTracksNotFound() *PutTracksNotFound {
|
||||
return &PutTracksNotFound{}
|
||||
}
|
||||
|
||||
// PutTracksNotFound describes a response with status code 404, with default header values.
|
||||
//
|
||||
// Resource was not found
|
||||
type PutTracksNotFound struct {
|
||||
Payload *members_models.Error
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this put tracks not found response has a 2xx status code
|
||||
func (o *PutTracksNotFound) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this put tracks not found response has a 3xx status code
|
||||
func (o *PutTracksNotFound) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this put tracks not found response has a 4xx status code
|
||||
func (o *PutTracksNotFound) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this put tracks not found response has a 5xx status code
|
||||
func (o *PutTracksNotFound) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this put tracks not found response a status code equal to that given
|
||||
func (o *PutTracksNotFound) IsCode(code int) bool {
|
||||
return code == 404
|
||||
}
|
||||
|
||||
// Code gets the status code for the put tracks not found response
|
||||
func (o *PutTracksNotFound) Code() int {
|
||||
return 404
|
||||
}
|
||||
|
||||
func (o *PutTracksNotFound) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PUT /tracks][%d] putTracksNotFound %s", 404, payload)
|
||||
}
|
||||
|
||||
func (o *PutTracksNotFound) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PUT /tracks][%d] putTracksNotFound %s", 404, payload)
|
||||
}
|
||||
|
||||
func (o *PutTracksNotFound) GetPayload() *members_models.Error {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *PutTracksNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(members_models.Error)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewPutTracksConflict creates a PutTracksConflict with default headers values
|
||||
func NewPutTracksConflict() *PutTracksConflict {
|
||||
return &PutTracksConflict{}
|
||||
}
|
||||
|
||||
// PutTracksConflict describes a response with status code 409, with default header values.
|
||||
//
|
||||
// The supplied LastModifiedDate is stale; reload the record before retrying.
|
||||
type PutTracksConflict struct {
|
||||
Payload *members_models.Error
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this put tracks conflict response has a 2xx status code
|
||||
func (o *PutTracksConflict) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this put tracks conflict response has a 3xx status code
|
||||
func (o *PutTracksConflict) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this put tracks conflict response has a 4xx status code
|
||||
func (o *PutTracksConflict) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this put tracks conflict response has a 5xx status code
|
||||
func (o *PutTracksConflict) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this put tracks conflict response a status code equal to that given
|
||||
func (o *PutTracksConflict) IsCode(code int) bool {
|
||||
return code == 409
|
||||
}
|
||||
|
||||
// Code gets the status code for the put tracks conflict response
|
||||
func (o *PutTracksConflict) Code() int {
|
||||
return 409
|
||||
}
|
||||
|
||||
func (o *PutTracksConflict) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PUT /tracks][%d] putTracksConflict %s", 409, payload)
|
||||
}
|
||||
|
||||
func (o *PutTracksConflict) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PUT /tracks][%d] putTracksConflict %s", 409, payload)
|
||||
}
|
||||
|
||||
func (o *PutTracksConflict) GetPayload() *members_models.Error {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *PutTracksConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(members_models.Error)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewPutTracksUnprocessableEntity creates a PutTracksUnprocessableEntity with default headers values
|
||||
func NewPutTracksUnprocessableEntity() *PutTracksUnprocessableEntity {
|
||||
return &PutTracksUnprocessableEntity{}
|
||||
}
|
||||
|
||||
// PutTracksUnprocessableEntity describes a response with status code 422, with default header values.
|
||||
//
|
||||
// Unprocessable Entity, likely a bad parameter
|
||||
type PutTracksUnprocessableEntity struct {
|
||||
Payload *members_models.Error
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this put tracks unprocessable entity response has a 2xx status code
|
||||
func (o *PutTracksUnprocessableEntity) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this put tracks unprocessable entity response has a 3xx status code
|
||||
func (o *PutTracksUnprocessableEntity) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this put tracks unprocessable entity response has a 4xx status code
|
||||
func (o *PutTracksUnprocessableEntity) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this put tracks unprocessable entity response has a 5xx status code
|
||||
func (o *PutTracksUnprocessableEntity) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this put tracks unprocessable entity response a status code equal to that given
|
||||
func (o *PutTracksUnprocessableEntity) IsCode(code int) bool {
|
||||
return code == 422
|
||||
}
|
||||
|
||||
// Code gets the status code for the put tracks unprocessable entity response
|
||||
func (o *PutTracksUnprocessableEntity) Code() int {
|
||||
return 422
|
||||
}
|
||||
|
||||
func (o *PutTracksUnprocessableEntity) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PUT /tracks][%d] putTracksUnprocessableEntity %s", 422, payload)
|
||||
}
|
||||
|
||||
func (o *PutTracksUnprocessableEntity) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PUT /tracks][%d] putTracksUnprocessableEntity %s", 422, payload)
|
||||
}
|
||||
|
||||
func (o *PutTracksUnprocessableEntity) GetPayload() *members_models.Error {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *PutTracksUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(members_models.Error)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewPutTracksInternalServerError creates a PutTracksInternalServerError with default headers values
|
||||
func NewPutTracksInternalServerError() *PutTracksInternalServerError {
|
||||
return &PutTracksInternalServerError{}
|
||||
}
|
||||
|
||||
// PutTracksInternalServerError describes a response with status code 500, with default header values.
|
||||
//
|
||||
// Server Internal Error
|
||||
type PutTracksInternalServerError struct {
|
||||
Payload *members_models.Error
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this put tracks internal server error response has a 2xx status code
|
||||
func (o *PutTracksInternalServerError) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this put tracks internal server error response has a 3xx status code
|
||||
func (o *PutTracksInternalServerError) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this put tracks internal server error response has a 4xx status code
|
||||
func (o *PutTracksInternalServerError) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this put tracks internal server error response has a 5xx status code
|
||||
func (o *PutTracksInternalServerError) IsServerError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsCode returns true when this put tracks internal server error response a status code equal to that given
|
||||
func (o *PutTracksInternalServerError) IsCode(code int) bool {
|
||||
return code == 500
|
||||
}
|
||||
|
||||
// Code gets the status code for the put tracks internal server error response
|
||||
func (o *PutTracksInternalServerError) Code() int {
|
||||
return 500
|
||||
}
|
||||
|
||||
func (o *PutTracksInternalServerError) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PUT /tracks][%d] putTracksInternalServerError %s", 500, payload)
|
||||
}
|
||||
|
||||
func (o *PutTracksInternalServerError) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PUT /tracks][%d] putTracksInternalServerError %s", 500, payload)
|
||||
}
|
||||
|
||||
func (o *PutTracksInternalServerError) GetPayload() *members_models.Error {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *PutTracksInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(members_models.Error)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
@ -0,0 +1,296 @@
|
|||
// 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 tracks
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
httptransport "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// New creates a new tracks API client.
|
||||
func New(transport runtime.ContextualTransport, formats strfmt.Registry) ClientService {
|
||||
return &Client{transport: transport, formats: formats}
|
||||
}
|
||||
|
||||
// New creates a new tracks 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 tracks 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 tracks API.
|
||||
type Client struct {
|
||||
transport runtime.ContextualTransport
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ClientOption may be used to customize the behavior of Client methods.
|
||||
type ClientOption func(*runtime.ClientOperation)
|
||||
|
||||
// ClientService is the interface for Client methods.
|
||||
type ClientService interface {
|
||||
|
||||
// GetTracks get governed tracks.
|
||||
GetTracks(params *GetTracksParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTracksOK, error)
|
||||
|
||||
// GetTracksContext get governed tracks.
|
||||
GetTracksContext(ctx context.Context, params *GetTracksParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTracksOK, error)
|
||||
|
||||
// PostTracks create a governed track.
|
||||
PostTracks(params *PostTracksParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostTracksOK, error)
|
||||
|
||||
// PostTracksContext create a governed track.
|
||||
PostTracksContext(ctx context.Context, params *PostTracksParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostTracksOK, error)
|
||||
|
||||
// PutTracks update a governed track.
|
||||
PutTracks(params *PutTracksParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutTracksOK, error)
|
||||
|
||||
// PutTracksContext update a governed track.
|
||||
PutTracksContext(ctx context.Context, params *PutTracksParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutTracksOK, error)
|
||||
|
||||
SetTransport(transport runtime.ContextualTransport)
|
||||
}
|
||||
|
||||
// GetTracks gets governed tracks.
|
||||
//
|
||||
// Reads Tracks whose creator is an active member of the configured Keenan Vision tenant. Owners and Managers may read all such Tracks; Contributors may read only Tracks they created. Requires members:track:read and an active native member session..
|
||||
//
|
||||
// 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.GetTracksContext] instead.
|
||||
func (a *Client) GetTracks(params *GetTracksParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTracksOK, error) {
|
||||
var ctx context.Context
|
||||
if params.inner.ctx != nil {
|
||||
ctx = params.inner.ctx
|
||||
} else {
|
||||
ctx = context.Background()
|
||||
}
|
||||
|
||||
return a.GetTracksContext(ctx, params, authInfo, opts...)
|
||||
}
|
||||
|
||||
// GetTracksContext gets governed tracks.
|
||||
//
|
||||
// Reads Tracks whose creator is an active member of the configured Keenan Vision tenant. Owners and Managers may read all such Tracks; Contributors may read only Tracks they created. Requires members:track:read and an active native member session..
|
||||
//
|
||||
// Do not use the deprecated [GetTracksParams.Context] with this method: it would be ignored.
|
||||
func (a *Client) GetTracksContext(ctx context.Context, params *GetTracksParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTracksOK, error) {
|
||||
// NOTE: parameters are not validated before sending
|
||||
if params == nil {
|
||||
params = NewGetTracksParams()
|
||||
}
|
||||
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "getTracks",
|
||||
Method: "GET",
|
||||
PathPattern: "/tracks",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &GetTracksReader{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.(*GetTracksOK)
|
||||
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 getTracks: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
// PostTracks creates a governed track.
|
||||
//
|
||||
// Creates one Track for the configured Keenan Vision tenant. Requires members:track:create, an active native Owner or Manager session, and server-owned identity and audit fields..
|
||||
//
|
||||
// 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.PostTracksContext] instead.
|
||||
func (a *Client) PostTracks(params *PostTracksParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostTracksOK, error) {
|
||||
var ctx context.Context
|
||||
if params.inner.ctx != nil {
|
||||
ctx = params.inner.ctx
|
||||
} else {
|
||||
ctx = context.Background()
|
||||
}
|
||||
|
||||
return a.PostTracksContext(ctx, params, authInfo, opts...)
|
||||
}
|
||||
|
||||
// PostTracksContext creates a governed track.
|
||||
//
|
||||
// Creates one Track for the configured Keenan Vision tenant. Requires members:track:create, an active native Owner or Manager session, and server-owned identity and audit fields..
|
||||
//
|
||||
// Do not use the deprecated [PostTracksParams.Context] with this method: it would be ignored.
|
||||
func (a *Client) PostTracksContext(ctx context.Context, params *PostTracksParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostTracksOK, error) {
|
||||
// NOTE: parameters are not validated before sending
|
||||
if params == nil {
|
||||
params = NewPostTracksParams()
|
||||
}
|
||||
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "postTracks",
|
||||
Method: "POST",
|
||||
PathPattern: "/tracks",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &PostTracksReader{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.(*PostTracksOK)
|
||||
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 postTracks: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
// PutTracks updates a governed track.
|
||||
//
|
||||
// CAS-updates one governed Track. Requires members:track:update, an active native Owner or Manager session, and the current LastModifiedDate. Creator identity and audit fields remain server-owned..
|
||||
//
|
||||
// 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.PutTracksContext] instead.
|
||||
func (a *Client) PutTracks(params *PutTracksParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutTracksOK, error) {
|
||||
var ctx context.Context
|
||||
if params.inner.ctx != nil {
|
||||
ctx = params.inner.ctx
|
||||
} else {
|
||||
ctx = context.Background()
|
||||
}
|
||||
|
||||
return a.PutTracksContext(ctx, params, authInfo, opts...)
|
||||
}
|
||||
|
||||
// PutTracksContext updates a governed track.
|
||||
//
|
||||
// CAS-updates one governed Track. Requires members:track:update, an active native Owner or Manager session, and the current LastModifiedDate. Creator identity and audit fields remain server-owned..
|
||||
//
|
||||
// Do not use the deprecated [PutTracksParams.Context] with this method: it would be ignored.
|
||||
func (a *Client) PutTracksContext(ctx context.Context, params *PutTracksParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutTracksOK, error) {
|
||||
// NOTE: parameters are not validated before sending
|
||||
if params == nil {
|
||||
params = NewPutTracksParams()
|
||||
}
|
||||
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "putTracks",
|
||||
Method: "PUT",
|
||||
PathPattern: "/tracks",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &PutTracksReader{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.(*PutTracksOK)
|
||||
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 putTracks: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
// SetTransport changes the transport on the client
|
||||
func (a *Client) SetTransport(transport runtime.ContextualTransport) {
|
||||
a.transport = transport
|
||||
}
|
||||
|
||||
// innerParams captures internal fields so they don't conflict with user-supplied parameters.
|
||||
type innerParams struct {
|
||||
timeout time.Duration
|
||||
|
||||
// Deprecated: use the operation call with context to pass the context instead of [TracksParams].
|
||||
ctx context.Context
|
||||
}
|
||||
|
|
@ -0,0 +1,174 @@
|
|||
// 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 members_models
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag/jsonutils"
|
||||
"github.com/go-openapi/swag/typeutils"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// Track A governed Track root. The schema has no tenant key, so Members derives ownership from the server-owned creator and active Keenan Vision tenant membership.
|
||||
//
|
||||
// swagger:model Track
|
||||
type Track struct {
|
||||
|
||||
// created by ID
|
||||
CreatedByID *string `json:"CreatedByID,omitempty"`
|
||||
|
||||
// created date
|
||||
CreatedDate *string `json:"CreatedDate,omitempty"`
|
||||
|
||||
// description
|
||||
Description *string `json:"Description,omitempty"`
|
||||
|
||||
// ID
|
||||
ID string `json:"ID,omitempty"`
|
||||
|
||||
// image alt text
|
||||
// Max Length: 250
|
||||
ImageAltText *string `json:"ImageAltText,omitempty"`
|
||||
|
||||
// image URL
|
||||
// Max Length: 255
|
||||
ImageURL *string `json:"ImageURL,omitempty"`
|
||||
|
||||
// last modified by ID
|
||||
LastModifiedByID *string `json:"LastModifiedByID,omitempty"`
|
||||
|
||||
// last modified date
|
||||
LastModifiedDate *string `json:"LastModifiedDate,omitempty"`
|
||||
|
||||
// logo
|
||||
// Max Length: 255
|
||||
Logo *string `json:"Logo,omitempty"`
|
||||
|
||||
// name
|
||||
// Max Length: 80
|
||||
Name string `json:"Name,omitempty"`
|
||||
|
||||
// slug
|
||||
// Max Length: 80
|
||||
Slug string `json:"Slug,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this track
|
||||
func (m *Track) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateImageAltText(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateImageURL(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateLogo(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateName(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateSlug(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Track) validateImageAltText(formats strfmt.Registry) error {
|
||||
if typeutils.IsZero(m.ImageAltText) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := validate.MaxLength("ImageAltText", "body", *m.ImageAltText, 250); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Track) validateImageURL(formats strfmt.Registry) error {
|
||||
if typeutils.IsZero(m.ImageURL) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := validate.MaxLength("ImageURL", "body", *m.ImageURL, 255); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Track) validateLogo(formats strfmt.Registry) error {
|
||||
if typeutils.IsZero(m.Logo) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := validate.MaxLength("Logo", "body", *m.Logo, 255); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Track) validateName(formats strfmt.Registry) error {
|
||||
if typeutils.IsZero(m.Name) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := validate.MaxLength("Name", "body", m.Name, 80); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Track) validateSlug(formats strfmt.Registry) error {
|
||||
if typeutils.IsZero(m.Slug) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := validate.MaxLength("Slug", "body", m.Slug, 80); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this track based on context it is used
|
||||
func (m *Track) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *Track) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return jsonutils.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *Track) UnmarshalBinary(b []byte) error {
|
||||
var res Track
|
||||
if err := jsonutils.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
|
|
@ -0,0 +1,145 @@
|
|||
// 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 members_models
|
||||
|
||||
import (
|
||||
"context"
|
||||
stderrors "errors"
|
||||
"strconv"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag/jsonutils"
|
||||
"github.com/go-openapi/swag/typeutils"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// TrackRequest Exactly one Track record
|
||||
//
|
||||
// swagger:model TrackRequest
|
||||
type TrackRequest struct {
|
||||
|
||||
// data
|
||||
// Max Items: 1
|
||||
// Min Items: 1
|
||||
Data []*Track `json:"Data"`
|
||||
}
|
||||
|
||||
// Validate validates this track request
|
||||
func (m *TrackRequest) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateData(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TrackRequest) validateData(formats strfmt.Registry) error {
|
||||
if typeutils.IsZero(m.Data) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
iDataSize := int64(len(m.Data))
|
||||
|
||||
if err := validate.MinItems("Data", "body", iDataSize, 1); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := validate.MaxItems("Data", "body", iDataSize, 1); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for i := 0; i < len(m.Data); i++ {
|
||||
if typeutils.IsZero(m.Data[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m.Data[i] != nil {
|
||||
if err := m.Data[i].Validate(formats); err != nil {
|
||||
ve := new(errors.Validation)
|
||||
if stderrors.As(err, &ve) {
|
||||
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
|
||||
}
|
||||
ce := new(errors.CompositeError)
|
||||
if stderrors.As(err, &ce) {
|
||||
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this track request based on the context it is used
|
||||
func (m *TrackRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidateData(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TrackRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
for i := 0; i < len(m.Data); i++ {
|
||||
|
||||
if m.Data[i] != nil {
|
||||
|
||||
if typeutils.IsZero(m.Data[i]) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := m.Data[i].ContextValidate(ctx, formats); err != nil {
|
||||
ve := new(errors.Validation)
|
||||
if stderrors.As(err, &ve) {
|
||||
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
|
||||
}
|
||||
ce := new(errors.CompositeError)
|
||||
if stderrors.As(err, &ce) {
|
||||
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *TrackRequest) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return jsonutils.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *TrackRequest) UnmarshalBinary(b []byte) error {
|
||||
var res TrackRequest
|
||||
if err := jsonutils.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
|
|
@ -0,0 +1,191 @@
|
|||
// 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 members_models
|
||||
|
||||
import (
|
||||
"context"
|
||||
stderrors "errors"
|
||||
"strconv"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag/jsonutils"
|
||||
"github.com/go-openapi/swag/typeutils"
|
||||
)
|
||||
|
||||
// TrackResponse An array of governed Track records
|
||||
//
|
||||
// swagger:model TrackResponse
|
||||
type TrackResponse struct {
|
||||
|
||||
// data
|
||||
Data []*Track `json:"Data"`
|
||||
|
||||
// meta
|
||||
Meta *ResponseMeta `json:"Meta,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this track response
|
||||
func (m *TrackResponse) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateData(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateMeta(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TrackResponse) validateData(formats strfmt.Registry) error {
|
||||
if typeutils.IsZero(m.Data) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < len(m.Data); i++ {
|
||||
if typeutils.IsZero(m.Data[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m.Data[i] != nil {
|
||||
if err := m.Data[i].Validate(formats); err != nil {
|
||||
ve := new(errors.Validation)
|
||||
if stderrors.As(err, &ve) {
|
||||
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
|
||||
}
|
||||
ce := new(errors.CompositeError)
|
||||
if stderrors.As(err, &ce) {
|
||||
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TrackResponse) validateMeta(formats strfmt.Registry) error {
|
||||
if typeutils.IsZero(m.Meta) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if m.Meta != nil {
|
||||
if err := m.Meta.Validate(formats); err != nil {
|
||||
ve := new(errors.Validation)
|
||||
if stderrors.As(err, &ve) {
|
||||
return ve.ValidateName("Meta")
|
||||
}
|
||||
ce := new(errors.CompositeError)
|
||||
if stderrors.As(err, &ce) {
|
||||
return ce.ValidateName("Meta")
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this track response based on the context it is used
|
||||
func (m *TrackResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidateData(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.contextValidateMeta(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TrackResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
for i := 0; i < len(m.Data); i++ {
|
||||
|
||||
if m.Data[i] != nil {
|
||||
|
||||
if typeutils.IsZero(m.Data[i]) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := m.Data[i].ContextValidate(ctx, formats); err != nil {
|
||||
ve := new(errors.Validation)
|
||||
if stderrors.As(err, &ve) {
|
||||
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
|
||||
}
|
||||
ce := new(errors.CompositeError)
|
||||
if stderrors.As(err, &ce) {
|
||||
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TrackResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if m.Meta != nil {
|
||||
|
||||
if typeutils.IsZero(m.Meta) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := m.Meta.ContextValidate(ctx, formats); err != nil {
|
||||
ve := new(errors.Validation)
|
||||
if stderrors.As(err, &ve) {
|
||||
return ve.ValidateName("Meta")
|
||||
}
|
||||
ce := new(errors.CompositeError)
|
||||
if stderrors.As(err, &ce) {
|
||||
return ce.ValidateName("Meta")
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *TrackResponse) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return jsonutils.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *TrackResponse) UnmarshalBinary(b []byte) error {
|
||||
var res TrackResponse
|
||||
if err := jsonutils.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
|
|
@ -203,6 +203,13 @@ parameters:
|
|||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/EventCategoryRequest"
|
||||
TrackRequest:
|
||||
description: Exactly one governed Track record
|
||||
in: body
|
||||
name: trackRequest
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/TrackRequest"
|
||||
FavoriteRequest:
|
||||
description: An array of new Favorite records
|
||||
in: body
|
||||
|
|
@ -565,6 +572,10 @@ responses:
|
|||
description: Event Response Object
|
||||
schema:
|
||||
$ref: "#/definitions/EventCategoryResponse"
|
||||
TrackResponse:
|
||||
description: Governed Track response
|
||||
schema:
|
||||
$ref: "#/definitions/TrackResponse"
|
||||
FavoriteResponse:
|
||||
description: Favorite Response Object
|
||||
schema:
|
||||
|
|
@ -4101,6 +4112,83 @@ paths:
|
|||
summary: Update Ticket
|
||||
tags:
|
||||
- Tickets
|
||||
/tracks:
|
||||
get:
|
||||
description: Reads Tracks whose creator is an active member of the configured Keenan Vision tenant. Owners and Managers may read all such Tracks; Contributors may read only Tracks they created. Requires members:track:read and an active native member session.
|
||||
operationId: getTracks
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
kvSessionCookie: []
|
||||
parameters:
|
||||
- $ref: "#/parameters/idQuery"
|
||||
- $ref: "#/parameters/limitQuery"
|
||||
- $ref: "#/parameters/offsetQuery"
|
||||
responses:
|
||||
"200":
|
||||
$ref: "#/responses/TrackResponse"
|
||||
"401":
|
||||
$ref: "#/responses/Unauthorized"
|
||||
"403":
|
||||
$ref: "#/responses/AccessForbidden"
|
||||
"404":
|
||||
$ref: "#/responses/NotFound"
|
||||
"422":
|
||||
$ref: "#/responses/UnprocessableEntity"
|
||||
"500":
|
||||
$ref: "#/responses/ServerError"
|
||||
summary: Get governed Tracks
|
||||
tags:
|
||||
- Tracks
|
||||
post:
|
||||
description: Creates one Track for the configured Keenan Vision tenant. Requires members:track:create, an active native Owner or Manager session, and server-owned identity and audit fields.
|
||||
operationId: postTracks
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
kvSessionCookie: []
|
||||
parameters:
|
||||
- $ref: "#/parameters/TrackRequest"
|
||||
responses:
|
||||
"200":
|
||||
$ref: "#/responses/TrackResponse"
|
||||
"401":
|
||||
$ref: "#/responses/Unauthorized"
|
||||
"403":
|
||||
$ref: "#/responses/AccessForbidden"
|
||||
"404":
|
||||
$ref: "#/responses/NotFound"
|
||||
"422":
|
||||
$ref: "#/responses/UnprocessableEntity"
|
||||
"500":
|
||||
$ref: "#/responses/ServerError"
|
||||
summary: Create a governed Track
|
||||
tags:
|
||||
- Tracks
|
||||
put:
|
||||
description: CAS-updates one governed Track. Requires members:track:update, an active native Owner or Manager session, and the current LastModifiedDate. Creator identity and audit fields remain server-owned.
|
||||
operationId: putTracks
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
kvSessionCookie: []
|
||||
parameters:
|
||||
- $ref: "#/parameters/TrackRequest"
|
||||
responses:
|
||||
"200":
|
||||
$ref: "#/responses/TrackResponse"
|
||||
"401":
|
||||
$ref: "#/responses/Unauthorized"
|
||||
"403":
|
||||
$ref: "#/responses/AccessForbidden"
|
||||
"404":
|
||||
$ref: "#/responses/NotFound"
|
||||
"409":
|
||||
$ref: "#/responses/Conflict"
|
||||
"422":
|
||||
$ref: "#/responses/UnprocessableEntity"
|
||||
"500":
|
||||
$ref: "#/responses/ServerError"
|
||||
summary: Update a governed Track
|
||||
tags:
|
||||
- Tracks
|
||||
/transactions:
|
||||
get:
|
||||
description: Return a list of Transaction records from the datastore
|
||||
|
|
@ -4275,6 +4363,66 @@ paths:
|
|||
tags:
|
||||
- Users
|
||||
definitions:
|
||||
Track:
|
||||
description: A governed Track root. The schema has no tenant key, so Members derives ownership from the server-owned creator and active Keenan Vision tenant membership.
|
||||
type: object
|
||||
properties:
|
||||
ID:
|
||||
type: string
|
||||
CreatedByID:
|
||||
type: string
|
||||
x-nullable: true
|
||||
CreatedDate:
|
||||
type: string
|
||||
x-nullable: true
|
||||
Description:
|
||||
type: string
|
||||
x-nullable: true
|
||||
ImageAltText:
|
||||
type: string
|
||||
maxLength: 250
|
||||
x-nullable: true
|
||||
ImageURL:
|
||||
type: string
|
||||
maxLength: 255
|
||||
x-nullable: true
|
||||
LastModifiedByID:
|
||||
type: string
|
||||
x-nullable: true
|
||||
LastModifiedDate:
|
||||
type: string
|
||||
x-nullable: true
|
||||
Logo:
|
||||
type: string
|
||||
maxLength: 255
|
||||
x-nullable: true
|
||||
Name:
|
||||
type: string
|
||||
maxLength: 80
|
||||
Slug:
|
||||
type: string
|
||||
maxLength: 80
|
||||
x-provider-ownership: creator-active-in-configured-keenan-vision-tenant
|
||||
TrackRequest:
|
||||
description: Exactly one Track record
|
||||
type: object
|
||||
properties:
|
||||
Data:
|
||||
type: array
|
||||
minItems: 1
|
||||
maxItems: 1
|
||||
items:
|
||||
$ref: "#/definitions/Track"
|
||||
TrackResponse:
|
||||
description: An array of governed Track records
|
||||
type: object
|
||||
properties:
|
||||
Data:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/definitions/Track"
|
||||
Meta:
|
||||
$ref: "#/definitions/ResponseMeta"
|
||||
AuditFields:
|
||||
type: object
|
||||
properties:
|
||||
|
|
|
|||
|
|
@ -203,6 +203,13 @@ parameters:
|
|||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/EventCategoryRequest"
|
||||
TrackRequest:
|
||||
description: Exactly one governed Track record
|
||||
in: body
|
||||
name: trackRequest
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/TrackRequest"
|
||||
FavoriteRequest:
|
||||
description: An array of new Favorite records
|
||||
in: body
|
||||
|
|
@ -565,6 +572,10 @@ responses:
|
|||
description: Event Response Object
|
||||
schema:
|
||||
$ref: "#/definitions/EventCategoryResponse"
|
||||
TrackResponse:
|
||||
description: Governed Track response
|
||||
schema:
|
||||
$ref: "#/definitions/TrackResponse"
|
||||
FavoriteResponse:
|
||||
description: Favorite Response Object
|
||||
schema:
|
||||
|
|
@ -4101,6 +4112,83 @@ paths:
|
|||
summary: Update Ticket
|
||||
tags:
|
||||
- Tickets
|
||||
/tracks:
|
||||
get:
|
||||
description: Reads Tracks whose creator is an active member of the configured Keenan Vision tenant. Owners and Managers may read all such Tracks; Contributors may read only Tracks they created. Requires members:track:read and an active native member session.
|
||||
operationId: getTracks
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
kvSessionCookie: []
|
||||
parameters:
|
||||
- $ref: "#/parameters/idQuery"
|
||||
- $ref: "#/parameters/limitQuery"
|
||||
- $ref: "#/parameters/offsetQuery"
|
||||
responses:
|
||||
"200":
|
||||
$ref: "#/responses/TrackResponse"
|
||||
"401":
|
||||
$ref: "#/responses/Unauthorized"
|
||||
"403":
|
||||
$ref: "#/responses/AccessForbidden"
|
||||
"404":
|
||||
$ref: "#/responses/NotFound"
|
||||
"422":
|
||||
$ref: "#/responses/UnprocessableEntity"
|
||||
"500":
|
||||
$ref: "#/responses/ServerError"
|
||||
summary: Get governed Tracks
|
||||
tags:
|
||||
- Tracks
|
||||
post:
|
||||
description: Creates one Track for the configured Keenan Vision tenant. Requires members:track:create, an active native Owner or Manager session, and server-owned identity and audit fields.
|
||||
operationId: postTracks
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
kvSessionCookie: []
|
||||
parameters:
|
||||
- $ref: "#/parameters/TrackRequest"
|
||||
responses:
|
||||
"200":
|
||||
$ref: "#/responses/TrackResponse"
|
||||
"401":
|
||||
$ref: "#/responses/Unauthorized"
|
||||
"403":
|
||||
$ref: "#/responses/AccessForbidden"
|
||||
"404":
|
||||
$ref: "#/responses/NotFound"
|
||||
"422":
|
||||
$ref: "#/responses/UnprocessableEntity"
|
||||
"500":
|
||||
$ref: "#/responses/ServerError"
|
||||
summary: Create a governed Track
|
||||
tags:
|
||||
- Tracks
|
||||
put:
|
||||
description: CAS-updates one governed Track. Requires members:track:update, an active native Owner or Manager session, and the current LastModifiedDate. Creator identity and audit fields remain server-owned.
|
||||
operationId: putTracks
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
kvSessionCookie: []
|
||||
parameters:
|
||||
- $ref: "#/parameters/TrackRequest"
|
||||
responses:
|
||||
"200":
|
||||
$ref: "#/responses/TrackResponse"
|
||||
"401":
|
||||
$ref: "#/responses/Unauthorized"
|
||||
"403":
|
||||
$ref: "#/responses/AccessForbidden"
|
||||
"404":
|
||||
$ref: "#/responses/NotFound"
|
||||
"409":
|
||||
$ref: "#/responses/Conflict"
|
||||
"422":
|
||||
$ref: "#/responses/UnprocessableEntity"
|
||||
"500":
|
||||
$ref: "#/responses/ServerError"
|
||||
summary: Update a governed Track
|
||||
tags:
|
||||
- Tracks
|
||||
/transactions:
|
||||
get:
|
||||
description: Return a list of Transaction records from the datastore
|
||||
|
|
@ -4275,6 +4363,66 @@ paths:
|
|||
tags:
|
||||
- Users
|
||||
definitions:
|
||||
Track:
|
||||
description: A governed Track root. The schema has no tenant key, so Members derives ownership from the server-owned creator and active Keenan Vision tenant membership.
|
||||
type: object
|
||||
properties:
|
||||
ID:
|
||||
type: string
|
||||
CreatedByID:
|
||||
type: string
|
||||
x-nullable: true
|
||||
CreatedDate:
|
||||
type: string
|
||||
x-nullable: true
|
||||
Description:
|
||||
type: string
|
||||
x-nullable: true
|
||||
ImageAltText:
|
||||
type: string
|
||||
maxLength: 250
|
||||
x-nullable: true
|
||||
ImageURL:
|
||||
type: string
|
||||
maxLength: 255
|
||||
x-nullable: true
|
||||
LastModifiedByID:
|
||||
type: string
|
||||
x-nullable: true
|
||||
LastModifiedDate:
|
||||
type: string
|
||||
x-nullable: true
|
||||
Logo:
|
||||
type: string
|
||||
maxLength: 255
|
||||
x-nullable: true
|
||||
Name:
|
||||
type: string
|
||||
maxLength: 80
|
||||
Slug:
|
||||
type: string
|
||||
maxLength: 80
|
||||
x-provider-ownership: creator-active-in-configured-keenan-vision-tenant
|
||||
TrackRequest:
|
||||
description: Exactly one Track record
|
||||
type: object
|
||||
properties:
|
||||
Data:
|
||||
type: array
|
||||
minItems: 1
|
||||
maxItems: 1
|
||||
items:
|
||||
$ref: "#/definitions/Track"
|
||||
TrackResponse:
|
||||
description: An array of governed Track records
|
||||
type: object
|
||||
properties:
|
||||
Data:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/definitions/Track"
|
||||
Meta:
|
||||
$ref: "#/definitions/ResponseMeta"
|
||||
AuditFields:
|
||||
type: object
|
||||
properties:
|
||||
|
|
|
|||
Loading…
Reference in New Issue