diff --git a/CHANGELOG.md b/CHANGELOG.md index 8788ec5..68605ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,11 @@ or PR number is invented. update workflows. Contract tests pin the source spec, generated operations, ID-filtered reads, optimistic-conflict responses, and the absence of invented Topic delete, bulk, Salesforce, or credential-literal behavior. +- Synchronized the Research provider projection from draft PR #32 and generated + compound-auth CompanyProduct and CompanyService list/detail/create clients + plus CompanyService optimistic update. Contract tests preserve Product's + proposal-only update boundary, remove both catalog deletes, pin negative + mutation responses, and prevent Salesforce, Cache, or credential coupling. ## [v0.7.5] — 2026-07-12 diff --git a/README.md b/README.md index 0ce3ef4..82b670f 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ pins the same module, a `lib` bump is a constellation-wide rebuild (KV-C6a). | `app/service-helpers.go` | Pointer helpers (`String`/`Bool`/`Int64`/…), `GetFieldsAndValues` reflection helper (unit-tested) | | `app/user.go`, `user-helpers.go`, `tenantuser.go`, `userrole.go`, `address.go` | Compatibility principal/domain structs. ADR-KV-024 adds `PrincipalKey`, `PrincipalType`, exact `Scopes`, `HasScope`, and `IsServicePrincipal`; no native response carries its bearer secret. | | `app/logger/logger.go` | Thin `zap.SugaredLogger` wrapper (`New(level)`, level constants) | -| `api/{auth,crm,members,plex,research,sfgate,stash}/` | go-swagger–generated typed clients + models, one directory per sibling service. Stash is intentionally generated from the read-only PDF metadata projection described below. | +| `api/{auth,crm,members,plex,research,sfgate,stash}/` | go-swagger–generated typed clients + models, one directory per sibling service. Stash is intentionally generated from the read-only PDF metadata projection described below. Research CompanyProduct/CompanyService operations are pinned to provider PR #32 as documented in `docs/RESEARCH_COMPANY_CATALOG_CLIENT.md`. | | `swagger/*.yaml`, `swagger/defs/`, `swagger/external/` | Copies of each sibling service's spec (the KV-C6b spec-copy problem — no sync mechanism besides `make regen`), shared component defs, and host/path-rewritten copies for external doc publishing; also carries legacy vendored Kazoo/Clerk specs from `lib`'s pre-mesh history | ## Build, run, test @@ -89,6 +89,14 @@ fields; it cannot generate the provider's deprecated, fail-closed create compatibility route. See `docs/STASH_PDF_METADATA_CLIENT.md` for the provider commit and release blockers. +The Research specification is synchronized from provider PR #32 at commit +`ca6a2911ce79d053f9aa338e6d9bcfe3357b0c77`. Its generated company catalog +surface exposes Product and Service list/detail/create plus Service CAS update. +Product direct update remains proposal-only, and both catalog deletes are +absent. See `docs/RESEARCH_COMPANY_CATALOG_CLIENT.md` for the pinned spec hash, +exact scope requirements, database assumptions, and Research-before-Lib-before- +Studio release gate. + **Known gap (resolved for the current spec set, but can recur):** if any sibling spec has an operation with no top-level `tags:`, go-swagger routes it into a fallback `operations` package whose import path in diff --git a/api/research/research_client/company_catalog_contract_test.go b/api/research/research_client/company_catalog_contract_test.go new file mode 100644 index 0000000..bf617c9 --- /dev/null +++ b/api/research/research_client/company_catalog_contract_test.go @@ -0,0 +1,298 @@ +package research_client_test + +import ( + "context" + "os" + "path/filepath" + "reflect" + "regexp" + "runtime" + "strings" + "testing" + + "code.tnxs.net/vernonkeenan/lib/api/research/research_client/company_products" + "code.tnxs.net/vernonkeenan/lib/api/research/research_client/company_services" + "code.tnxs.net/vernonkeenan/lib/api/research/research_models" + "github.com/go-openapi/loads" + openapiruntime "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +type catalogCaptureTransport struct { + operation *openapiruntime.ClientOperation +} + +func (transport *catalogCaptureTransport) Submit(operation *openapiruntime.ClientOperation) (any, error) { + return transport.SubmitContext(context.Background(), operation) +} + +func (transport *catalogCaptureTransport) SubmitContext( + _ context.Context, + operation *openapiruntime.ClientOperation, +) (any, error) { + transport.operation = operation + switch operation.ID { + case "getCompanyProducts": + return company_products.NewGetCompanyProductsOK(), nil + case "postCompanyProducts": + return company_products.NewPostCompanyProductsOK(), nil + case "getCompanyServices": + return company_services.NewGetCompanyServicesOK(), nil + case "postCompanyServices": + return company_services.NewPostCompanyServicesOK(), nil + case "putCompanyService": + return company_services.NewPutCompanyServiceOK(), nil + default: + panic("unexpected generated company catalog operation: " + operation.ID) + } +} + +func TestGeneratedCompanyCatalogOperationContract(t *testing.T) { + type operationCall func(openapiruntime.ContextualTransport) error + tests := []struct { + name string + wantID string + wantMethod string + wantPath string + call operationCall + }{ + { + name: "list or get product", wantID: "getCompanyProducts", + wantMethod: "GET", wantPath: "/companyproducts", + call: func(transport openapiruntime.ContextualTransport) error { + _, err := company_products.New(transport, strfmt.Default). + GetCompanyProducts(company_products.NewGetCompanyProductsParams(), nil) + return err + }, + }, + { + name: "create product", wantID: "postCompanyProducts", + wantMethod: "POST", wantPath: "/companyproducts", + call: func(transport openapiruntime.ContextualTransport) error { + _, err := company_products.New(transport, strfmt.Default). + PostCompanyProducts(company_products.NewPostCompanyProductsParams(), nil) + return err + }, + }, + { + name: "list or get service", wantID: "getCompanyServices", + wantMethod: "GET", wantPath: "/companyservices", + call: func(transport openapiruntime.ContextualTransport) error { + _, err := company_services.New(transport, strfmt.Default). + GetCompanyServices(company_services.NewGetCompanyServicesParams(), nil) + return err + }, + }, + { + name: "create service", wantID: "postCompanyServices", + wantMethod: "POST", wantPath: "/companyservices", + call: func(transport openapiruntime.ContextualTransport) error { + _, err := company_services.New(transport, strfmt.Default). + PostCompanyServices(company_services.NewPostCompanyServicesParams(), nil) + return err + }, + }, + { + name: "CAS update service", wantID: "putCompanyService", + wantMethod: "PUT", wantPath: "/companyservices", + call: func(transport openapiruntime.ContextualTransport) error { + _, err := company_services.New(transport, strfmt.Default). + PutCompanyService(company_services.NewPutCompanyServiceParams(), nil) + return err + }, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + transport := &catalogCaptureTransport{} + if err := test.call(transport); err != nil { + t.Fatalf("generated client operation failed: %v", err) + } + if transport.operation == nil { + t.Fatal("generated client did not submit an operation") + } + if transport.operation.ID != test.wantID { + t.Errorf("operation ID = %q, want %q", transport.operation.ID, test.wantID) + } + if transport.operation.Method != test.wantMethod { + t.Errorf("method = %q, want %q", transport.operation.Method, test.wantMethod) + } + if transport.operation.PathPattern != test.wantPath { + t.Errorf("path = %q, want %q", transport.operation.PathPattern, test.wantPath) + } + }) + } +} + +func TestGeneratedCompanyCatalogListGetAndMutationShapes(t *testing.T) { + productID, serviceID := "product-id", "service-id" + if got := company_products.NewGetCompanyProductsParams(). + WithCompanyProductID(&productID).CompanyProductID; got == nil || *got != productID { + t.Fatal("CompanyProduct get-by-ID filter is absent") + } + if got := company_services.NewGetCompanyServicesParams(). + WithCompanyServiceID(&serviceID).CompanyServiceID; got == nil || *got != serviceID { + t.Fatal("CompanyService get-by-ID filter is absent") + } + + productRequest := &research_models.CompanyProductRequest{ + Data: []*research_models.CompanyProduct{{ID: "ignored-client-id"}}, + } + if got := company_products.NewPostCompanyProductsParams(). + WithCompanyProductRequest(productRequest).CompanyProductRequest; got != productRequest { + t.Fatal("CompanyProduct create request body is absent") + } + + serviceRequest := &research_models.CompanyServiceRequest{ + Data: []*research_models.CompanyService{{ + ID: "service-id", LastModifiedDate: stringPointer("2026-07-24T12:00:00Z"), + }}, + } + if got := company_services.NewPostCompanyServicesParams(). + WithCompanyServiceRequest(serviceRequest).CompanyServiceRequest; got != serviceRequest { + t.Fatal("CompanyService create request body is absent") + } + if got := company_services.NewPutCompanyServiceParams(). + WithCompanyServiceRequest(serviceRequest).CompanyServiceRequest; got != serviceRequest { + t.Fatal("CompanyService CAS update request body is absent") + } +} + +func TestGeneratedCompanyCatalogNegativeMutationResponses(t *testing.T) { + for name, response := range map[string]interface{ IsCode(int) bool }{ + "product unauthorized": company_products.NewPostCompanyProductsUnauthorized(), + "product forbidden": company_products.NewPostCompanyProductsForbidden(), + "product not found": company_products.NewPostCompanyProductsNotFound(), + "product invalid": company_products.NewPostCompanyProductsUnprocessableEntity(), + "service unauthorized": company_services.NewPostCompanyServicesUnauthorized(), + "service forbidden": company_services.NewPostCompanyServicesForbidden(), + "service invalid": company_services.NewPostCompanyServicesUnprocessableEntity(), + "update unauthorized": company_services.NewPutCompanyServiceUnauthorized(), + "update forbidden": company_services.NewPutCompanyServiceForbidden(), + "update not found": company_services.NewPutCompanyServiceNotFound(), + "update conflict": company_services.NewPutCompanyServiceConflict(), + "update invalid": company_services.NewPutCompanyServiceUnprocessableEntity(), + } { + t.Run(name, func(t *testing.T) { + expected := map[string]int{ + "product unauthorized": 401, "product forbidden": 403, + "product not found": 404, "product invalid": 422, + "service unauthorized": 401, "service forbidden": 403, + "service invalid": 422, "update unauthorized": 401, + "update forbidden": 403, "update not found": 404, + "update conflict": 409, "update invalid": 422, + }[name] + if !response.IsCode(expected) { + t.Errorf("%T does not preserve status %d", response, expected) + } + }) + } +} + +func TestGeneratedCompanyCatalogDoesNotExposeUnsafeMutations(t *testing.T) { + productContract := reflect.TypeOf((*company_products.ClientService)(nil)).Elem() + for _, method := range []string{ + "PutCompanyProduct", "PutCompanyProductContext", + "DeleteCompanyProduct", "DeleteCompanyProductContext", + } { + if _, exists := productContract.MethodByName(method); exists { + t.Errorf("CompanyProduct client exposes forbidden mutation %s", method) + } + } + + serviceContract := reflect.TypeOf((*company_services.ClientService)(nil)).Elem() + for _, method := range []string{"DeleteCompanyService", "DeleteCompanyServiceContext"} { + if _, exists := serviceContract.MethodByName(method); exists { + t.Errorf("CompanyService client exposes forbidden mutation %s", method) + } + } +} + +func TestCompanyCatalogProviderProjectionRequiresCompoundAuth(t *testing.T) { + repoRoot := companyCatalogRepoRoot(t) + document, err := loads.Spec(filepath.Join(repoRoot, "swagger", "research-vernonkeenan.yaml")) + if err != nil { + t.Fatalf("load Research provider projection: %v", err) + } + products := document.Spec().Paths.Paths["/companyproducts"] + services := document.Spec().Paths.Paths["/companyservices"] + operations := []*struct { + Security []map[string][]string + }{ + {Security: products.Get.Security}, + {Security: products.Post.Security}, + {Security: services.Get.Security}, + {Security: services.Post.Security}, + {Security: services.Put.Security}, + } + for _, operation := range operations { + if len(operation.Security) != 1 { + t.Fatalf("catalog operation security alternatives = %d, want exactly one compound alternative", len(operation.Security)) + } + if _, ok := operation.Security[0]["ApiKeyAuth"]; !ok { + t.Fatal("catalog operation is missing ApiKeyAuth") + } + if _, ok := operation.Security[0]["kvSessionCookie"]; !ok { + t.Fatal("catalog operation is missing kvSessionCookie") + } + } + if products.Put != nil || products.Delete != nil || services.Delete != nil { + t.Fatal("provider projection reintroduced Product PUT or a catalog DELETE") + } +} + +func TestGeneratedCompanyCatalogHasNoProviderRuntimeOrEmbeddedSecrets(t *testing.T) { + repoRoot := companyCatalogRepoRoot(t) + targets := []string{ + filepath.Join(repoRoot, "api", "research", "research_client", "company_products"), + filepath.Join(repoRoot, "api", "research", "research_client", "company_services"), + } + 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_api", "simple_salesforce", "sf-gate", + "go-force", "soql", "/services/apex", "cache.", + } { + if strings.Contains(lower, forbidden) { + t.Errorf("%s contains forbidden provider 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 catalog target %s: %v", target, err) + } + } +} + +func companyCatalogRepoRoot(t *testing.T) string { + t.Helper() + _, testFile, _, ok := runtime.Caller(0) + if !ok { + t.Fatal("resolve test source path") + } + return filepath.Clean(filepath.Join(filepath.Dir(testFile), "..", "..", "..")) +} + +func stringPointer(value string) *string { + return &value +} diff --git a/api/research/research_client/company_products/company_products_client.go b/api/research/research_client/company_products/company_products_client.go index c41b347..a745958 100644 --- a/api/research/research_client/company_products/company_products_client.go +++ b/api/research/research_client/company_products/company_products_client.go @@ -60,103 +60,24 @@ type ClientOption func(*runtime.ClientOperation) // ClientService is the interface for Client methods. type ClientService interface { - // DeleteCompanyProduct delete a company product. - DeleteCompanyProduct(params *DeleteCompanyProductParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteCompanyProductOK, error) - - // DeleteCompanyProductContext delete a company product. - DeleteCompanyProductContext(ctx context.Context, params *DeleteCompanyProductParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteCompanyProductOK, error) - // GetCompanyProducts get a list of companyproducts. GetCompanyProducts(params *GetCompanyProductsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCompanyProductsOK, error) // GetCompanyProductsContext get a list of companyproducts. GetCompanyProductsContext(ctx context.Context, params *GetCompanyProductsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCompanyProductsOK, error) - // PostCompanyProducts add a new companyproduct to salesforce devops net. + // PostCompanyProducts create one tenant owned company product. PostCompanyProducts(params *PostCompanyProductsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCompanyProductsOK, error) - // PostCompanyProductsContext add a new companyproduct to salesforce devops net. + // PostCompanyProductsContext create one tenant owned company product. PostCompanyProductsContext(ctx context.Context, params *PostCompanyProductsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCompanyProductsOK, error) - // PutCompanyProduct update a single companyproduct. - PutCompanyProduct(params *PutCompanyProductParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutCompanyProductOK, error) - - // PutCompanyProductContext update a single companyproduct. - PutCompanyProductContext(ctx context.Context, params *PutCompanyProductParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutCompanyProductOK, error) - SetTransport(transport runtime.ContextualTransport) } -// DeleteCompanyProduct deletes a company product. -// -// Delete CompanyProduct record. -// -// This method does not support injected context. -// However, timeout and opentracing contexts are honored whenever enabled. -// -// If you need to pass a specific context, use [Client.DeleteCompanyProductContext] instead. -func (a *Client) DeleteCompanyProduct(params *DeleteCompanyProductParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteCompanyProductOK, error) { - var ctx context.Context - if params.inner.ctx != nil { - ctx = params.inner.ctx - } else { - ctx = context.Background() - } - - return a.DeleteCompanyProductContext(ctx, params, authInfo, opts...) -} - -// DeleteCompanyProductContext deletes a company product. -// -// Delete CompanyProduct record. -// -// Do not use the deprecated [DeleteCompanyProductParams.Context] with this method: it would be ignored. -func (a *Client) DeleteCompanyProductContext(ctx context.Context, params *DeleteCompanyProductParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteCompanyProductOK, error) { - // NOTE: parameters are not validated before sending - if params == nil { - params = NewDeleteCompanyProductParams() - } - - op := &runtime.ClientOperation{ - ID: "deleteCompanyProduct", - Method: "DELETE", - PathPattern: "/companyproducts", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &DeleteCompanyProductReader{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.(*DeleteCompanyProductOK) - 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 deleteCompanyProduct: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - // GetCompanyProducts gets a list of companyproducts. // -// Return a list of all available CompanyProducts. +// Return CompanyProducts under compound native service and same-tenant human authentication; requires research:company-product:read. // // This method does not support injected context. // However, timeout and opentracing contexts are honored whenever enabled. @@ -175,7 +96,7 @@ func (a *Client) GetCompanyProducts(params *GetCompanyProductsParams, authInfo r // GetCompanyProductsContext gets a list of companyproducts. // -// Return a list of all available CompanyProducts. +// Return CompanyProducts under compound native service and same-tenant human authentication; requires research:company-product:read. // // Do not use the deprecated [GetCompanyProductsParams.Context] with this method: it would be ignored. func (a *Client) GetCompanyProductsContext(ctx context.Context, params *GetCompanyProductsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCompanyProductsOK, error) { @@ -221,9 +142,9 @@ func (a *Client) GetCompanyProductsContext(ctx context.Context, params *GetCompa panic(msg) } -// PostCompanyProducts adds a new companyproduct to salesforce devops net. +// PostCompanyProducts creates one tenant owned company product. // -// CompanyProduct record to be added. +// Create one unpublished CompanyProduct beneath an Account owned by the machine tenant; requires research:company-product:create and same-tenant Owner or Manager. Existing Product updates remain proposal-only.. // // This method does not support injected context. // However, timeout and opentracing contexts are honored whenever enabled. @@ -240,9 +161,9 @@ func (a *Client) PostCompanyProducts(params *PostCompanyProductsParams, authInfo return a.PostCompanyProductsContext(ctx, params, authInfo, opts...) } -// PostCompanyProductsContext adds a new companyproduct to salesforce devops net. +// PostCompanyProductsContext creates one tenant owned company product. // -// CompanyProduct record to be added. +// Create one unpublished CompanyProduct beneath an Account owned by the machine tenant; requires research:company-product:create and same-tenant Owner or Manager. Existing Product updates remain proposal-only.. // // Do not use the deprecated [PostCompanyProductsParams.Context] with this method: it would be ignored. func (a *Client) PostCompanyProductsContext(ctx context.Context, params *PostCompanyProductsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCompanyProductsOK, error) { @@ -288,73 +209,6 @@ func (a *Client) PostCompanyProductsContext(ctx context.Context, params *PostCom panic(msg) } -// PutCompanyProduct updates a single companyproduct. -// -// Update companyproduct records. -// -// This method does not support injected context. -// However, timeout and opentracing contexts are honored whenever enabled. -// -// If you need to pass a specific context, use [Client.PutCompanyProductContext] instead. -func (a *Client) PutCompanyProduct(params *PutCompanyProductParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutCompanyProductOK, error) { - var ctx context.Context - if params.inner.ctx != nil { - ctx = params.inner.ctx - } else { - ctx = context.Background() - } - - return a.PutCompanyProductContext(ctx, params, authInfo, opts...) -} - -// PutCompanyProductContext updates a single companyproduct. -// -// Update companyproduct records. -// -// Do not use the deprecated [PutCompanyProductParams.Context] with this method: it would be ignored. -func (a *Client) PutCompanyProductContext(ctx context.Context, params *PutCompanyProductParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutCompanyProductOK, error) { - // NOTE: parameters are not validated before sending - if params == nil { - params = NewPutCompanyProductParams() - } - - op := &runtime.ClientOperation{ - ID: "putCompanyProduct", - Method: "PUT", - PathPattern: "/companyproducts", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PutCompanyProductReader{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.(*PutCompanyProductOK) - 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 putCompanyProduct: 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 diff --git a/api/research/research_client/company_products/delete_company_product_parameters.go b/api/research/research_client/company_products/delete_company_product_parameters.go deleted file mode 100644 index 4ec9370..0000000 --- a/api/research/research_client/company_products/delete_company_product_parameters.go +++ /dev/null @@ -1,170 +0,0 @@ -// 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 company_products - -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" -) - -// NewDeleteCompanyProductParams creates a new DeleteCompanyProductParams 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 NewDeleteCompanyProductParams() *DeleteCompanyProductParams { - return NewDeleteCompanyProductParamsWithTimeout(cr.DefaultTimeout) -} - -// NewDeleteCompanyProductParamsWithTimeout creates a new DeleteCompanyProductParams object -// with the ability to set a timeout on a request. -func NewDeleteCompanyProductParamsWithTimeout(timeout time.Duration) *DeleteCompanyProductParams { - return &DeleteCompanyProductParams{ - inner: innerParams{ - timeout: timeout, - }, - } -} - -// NewDeleteCompanyProductParamsWithContext creates a new DeleteCompanyProductParams object -// with the ability to set a context for a request. -// -// Deprecated: use the operation call with context to pass the context instead of [DeleteCompanyProductParams]. -func NewDeleteCompanyProductParamsWithContext(ctx context.Context) *DeleteCompanyProductParams { - return &DeleteCompanyProductParams{ - inner: innerParams{ - ctx: ctx, - }, - } -} - -// NewDeleteCompanyProductParamsWithHTTPClient creates a new DeleteCompanyProductParams object -// with the ability to set a custom HTTPClient for a request. -func NewDeleteCompanyProductParamsWithHTTPClient(client *http.Client) *DeleteCompanyProductParams { - return &DeleteCompanyProductParams{ - HTTPClient: client, - } -} - -/* -DeleteCompanyProductParams contains all the parameters to send to the API endpoint - - for the delete company product operation. - - Typically these are written to a http.Request. -*/ -type DeleteCompanyProductParams struct { - - // CompanyProductID. - // - // CompanyProduct record ID - CompanyProductID *string - - HTTPClient *http.Client - - inner innerParams -} - -// WithDefaults hydrates default values in the delete company product params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *DeleteCompanyProductParams) WithDefaults() *DeleteCompanyProductParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the delete company product params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *DeleteCompanyProductParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the delete company product params. -func (o *DeleteCompanyProductParams) WithTimeout(timeout time.Duration) *DeleteCompanyProductParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the delete company product params. -func (o *DeleteCompanyProductParams) SetTimeout(timeout time.Duration) { - o.inner.timeout = timeout -} - -// WithContext adds the context to the delete company product params. -// -// Deprecated: use the operation call with context to pass the context instead of [DeleteCompanyProductParams]. -func (o *DeleteCompanyProductParams) WithContext(ctx context.Context) *DeleteCompanyProductParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the delete company product params. -// -// Deprecated: use the operation call with context to pass the context instead of [DeleteCompanyProductParams]. -func (o *DeleteCompanyProductParams) SetContext(ctx context.Context) { - o.inner.ctx = ctx -} - -// WithHTTPClient adds the HTTPClient to the delete company product params. -func (o *DeleteCompanyProductParams) WithHTTPClient(client *http.Client) *DeleteCompanyProductParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the delete company product params. -func (o *DeleteCompanyProductParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithCompanyProductID adds the companyProductID to the delete company product params. -func (o *DeleteCompanyProductParams) WithCompanyProductID(companyProductID *string) *DeleteCompanyProductParams { - o.SetCompanyProductID(companyProductID) - return o -} - -// SetCompanyProductID adds the companyProductId to the delete company product params. -func (o *DeleteCompanyProductParams) SetCompanyProductID(companyProductID *string) { - o.CompanyProductID = companyProductID -} - -// WriteToRequest writes these params to a [runtime.ClientRequest]. -func (o *DeleteCompanyProductParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - if err := r.SetTimeout(o.inner.timeout); err != nil { - return err - } - var res []error - - if o.CompanyProductID != nil { - - // query param companyProductId - var qrCompanyProductID string - - if o.CompanyProductID != nil { - qrCompanyProductID = *o.CompanyProductID - } - qCompanyProductID := qrCompanyProductID - if qCompanyProductID != "" { - - if err := r.SetQueryParam("companyProductId", qCompanyProductID); err != nil { - return err - } - } - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/api/research/research_client/company_products/delete_company_product_responses.go b/api/research/research_client/company_products/delete_company_product_responses.go deleted file mode 100644 index 050b76c..0000000 --- a/api/research/research_client/company_products/delete_company_product_responses.go +++ /dev/null @@ -1,529 +0,0 @@ -// 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 company_products - -import ( - "encoding/json" - stderrors "errors" - "fmt" - "io" - - "code.tnxs.net/vernonkeenan/lib/api/research/research_models" - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" -) - -// DeleteCompanyProductReader is a Reader for the DeleteCompanyProduct structure. -type DeleteCompanyProductReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *DeleteCompanyProductReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) { - switch response.Code() { - case 200: - result := NewDeleteCompanyProductOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 401: - result := NewDeleteCompanyProductUnauthorized() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 403: - result := NewDeleteCompanyProductForbidden() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 404: - result := NewDeleteCompanyProductNotFound() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 422: - result := NewDeleteCompanyProductUnprocessableEntity() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 500: - result := NewDeleteCompanyProductInternalServerError() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[DELETE /companyproducts] deleteCompanyProduct", response, response.Code()) - } -} - -// NewDeleteCompanyProductOK creates a DeleteCompanyProductOK with default headers values -func NewDeleteCompanyProductOK() *DeleteCompanyProductOK { - return &DeleteCompanyProductOK{} -} - -// DeleteCompanyProductOK describes a response with status code 200, with default header values. -// -// Response with Message Objects with Delete Status -type DeleteCompanyProductOK struct { - AccessControlAllowOrigin string - - Payload *research_models.DeleteResponse -} - -// IsSuccess returns true when this delete company product o k response has a 2xx status code -func (o *DeleteCompanyProductOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this delete company product o k response has a 3xx status code -func (o *DeleteCompanyProductOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete company product o k response has a 4xx status code -func (o *DeleteCompanyProductOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this delete company product o k response has a 5xx status code -func (o *DeleteCompanyProductOK) IsServerError() bool { - return false -} - -// IsCode returns true when this delete company product o k response a status code equal to that given -func (o *DeleteCompanyProductOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the delete company product o k response -func (o *DeleteCompanyProductOK) Code() int { - return 200 -} - -func (o *DeleteCompanyProductOK) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[DELETE /companyproducts][%d] deleteCompanyProductOK %s", 200, payload) -} - -func (o *DeleteCompanyProductOK) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[DELETE /companyproducts][%d] deleteCompanyProductOK %s", 200, payload) -} - -func (o *DeleteCompanyProductOK) GetPayload() *research_models.DeleteResponse { - return o.Payload -} - -func (o *DeleteCompanyProductOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // hydrates response header Access-Control-Allow-Origin - hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - - if hdrAccessControlAllowOrigin != "" { - o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin - } - - o.Payload = new(research_models.DeleteResponse) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} - -// NewDeleteCompanyProductUnauthorized creates a DeleteCompanyProductUnauthorized with default headers values -func NewDeleteCompanyProductUnauthorized() *DeleteCompanyProductUnauthorized { - return &DeleteCompanyProductUnauthorized{} -} - -// DeleteCompanyProductUnauthorized describes a response with status code 401, with default header values. -// -// Access unauthorized, invalid API-KEY was used -type DeleteCompanyProductUnauthorized struct { - AccessControlAllowOrigin string - - Payload *research_models.Error -} - -// IsSuccess returns true when this delete company product unauthorized response has a 2xx status code -func (o *DeleteCompanyProductUnauthorized) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this delete company product unauthorized response has a 3xx status code -func (o *DeleteCompanyProductUnauthorized) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete company product unauthorized response has a 4xx status code -func (o *DeleteCompanyProductUnauthorized) IsClientError() bool { - return true -} - -// IsServerError returns true when this delete company product unauthorized response has a 5xx status code -func (o *DeleteCompanyProductUnauthorized) IsServerError() bool { - return false -} - -// IsCode returns true when this delete company product unauthorized response a status code equal to that given -func (o *DeleteCompanyProductUnauthorized) IsCode(code int) bool { - return code == 401 -} - -// Code gets the status code for the delete company product unauthorized response -func (o *DeleteCompanyProductUnauthorized) Code() int { - return 401 -} - -func (o *DeleteCompanyProductUnauthorized) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[DELETE /companyproducts][%d] deleteCompanyProductUnauthorized %s", 401, payload) -} - -func (o *DeleteCompanyProductUnauthorized) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[DELETE /companyproducts][%d] deleteCompanyProductUnauthorized %s", 401, payload) -} - -func (o *DeleteCompanyProductUnauthorized) GetPayload() *research_models.Error { - return o.Payload -} - -func (o *DeleteCompanyProductUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // hydrates response header Access-Control-Allow-Origin - hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - - if hdrAccessControlAllowOrigin != "" { - o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin - } - - o.Payload = new(research_models.Error) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} - -// NewDeleteCompanyProductForbidden creates a DeleteCompanyProductForbidden with default headers values -func NewDeleteCompanyProductForbidden() *DeleteCompanyProductForbidden { - return &DeleteCompanyProductForbidden{} -} - -// DeleteCompanyProductForbidden describes a response with status code 403, with default header values. -// -// Access forbidden, account lacks access -type DeleteCompanyProductForbidden struct { - AccessControlAllowOrigin string - - Payload *research_models.Error -} - -// IsSuccess returns true when this delete company product forbidden response has a 2xx status code -func (o *DeleteCompanyProductForbidden) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this delete company product forbidden response has a 3xx status code -func (o *DeleteCompanyProductForbidden) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete company product forbidden response has a 4xx status code -func (o *DeleteCompanyProductForbidden) IsClientError() bool { - return true -} - -// IsServerError returns true when this delete company product forbidden response has a 5xx status code -func (o *DeleteCompanyProductForbidden) IsServerError() bool { - return false -} - -// IsCode returns true when this delete company product forbidden response a status code equal to that given -func (o *DeleteCompanyProductForbidden) IsCode(code int) bool { - return code == 403 -} - -// Code gets the status code for the delete company product forbidden response -func (o *DeleteCompanyProductForbidden) Code() int { - return 403 -} - -func (o *DeleteCompanyProductForbidden) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[DELETE /companyproducts][%d] deleteCompanyProductForbidden %s", 403, payload) -} - -func (o *DeleteCompanyProductForbidden) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[DELETE /companyproducts][%d] deleteCompanyProductForbidden %s", 403, payload) -} - -func (o *DeleteCompanyProductForbidden) GetPayload() *research_models.Error { - return o.Payload -} - -func (o *DeleteCompanyProductForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // hydrates response header Access-Control-Allow-Origin - hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - - if hdrAccessControlAllowOrigin != "" { - o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin - } - - o.Payload = new(research_models.Error) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} - -// NewDeleteCompanyProductNotFound creates a DeleteCompanyProductNotFound with default headers values -func NewDeleteCompanyProductNotFound() *DeleteCompanyProductNotFound { - return &DeleteCompanyProductNotFound{} -} - -// DeleteCompanyProductNotFound describes a response with status code 404, with default header values. -// -// Resource was not found -type DeleteCompanyProductNotFound struct { - AccessControlAllowOrigin string - - Payload *research_models.Error -} - -// IsSuccess returns true when this delete company product not found response has a 2xx status code -func (o *DeleteCompanyProductNotFound) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this delete company product not found response has a 3xx status code -func (o *DeleteCompanyProductNotFound) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete company product not found response has a 4xx status code -func (o *DeleteCompanyProductNotFound) IsClientError() bool { - return true -} - -// IsServerError returns true when this delete company product not found response has a 5xx status code -func (o *DeleteCompanyProductNotFound) IsServerError() bool { - return false -} - -// IsCode returns true when this delete company product not found response a status code equal to that given -func (o *DeleteCompanyProductNotFound) IsCode(code int) bool { - return code == 404 -} - -// Code gets the status code for the delete company product not found response -func (o *DeleteCompanyProductNotFound) Code() int { - return 404 -} - -func (o *DeleteCompanyProductNotFound) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[DELETE /companyproducts][%d] deleteCompanyProductNotFound %s", 404, payload) -} - -func (o *DeleteCompanyProductNotFound) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[DELETE /companyproducts][%d] deleteCompanyProductNotFound %s", 404, payload) -} - -func (o *DeleteCompanyProductNotFound) GetPayload() *research_models.Error { - return o.Payload -} - -func (o *DeleteCompanyProductNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // hydrates response header Access-Control-Allow-Origin - hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - - if hdrAccessControlAllowOrigin != "" { - o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin - } - - o.Payload = new(research_models.Error) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} - -// NewDeleteCompanyProductUnprocessableEntity creates a DeleteCompanyProductUnprocessableEntity with default headers values -func NewDeleteCompanyProductUnprocessableEntity() *DeleteCompanyProductUnprocessableEntity { - return &DeleteCompanyProductUnprocessableEntity{} -} - -// DeleteCompanyProductUnprocessableEntity describes a response with status code 422, with default header values. -// -// Unprocessable Entity, likely a bad parameter -type DeleteCompanyProductUnprocessableEntity struct { - AccessControlAllowOrigin string - - Payload *research_models.Error -} - -// IsSuccess returns true when this delete company product unprocessable entity response has a 2xx status code -func (o *DeleteCompanyProductUnprocessableEntity) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this delete company product unprocessable entity response has a 3xx status code -func (o *DeleteCompanyProductUnprocessableEntity) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete company product unprocessable entity response has a 4xx status code -func (o *DeleteCompanyProductUnprocessableEntity) IsClientError() bool { - return true -} - -// IsServerError returns true when this delete company product unprocessable entity response has a 5xx status code -func (o *DeleteCompanyProductUnprocessableEntity) IsServerError() bool { - return false -} - -// IsCode returns true when this delete company product unprocessable entity response a status code equal to that given -func (o *DeleteCompanyProductUnprocessableEntity) IsCode(code int) bool { - return code == 422 -} - -// Code gets the status code for the delete company product unprocessable entity response -func (o *DeleteCompanyProductUnprocessableEntity) Code() int { - return 422 -} - -func (o *DeleteCompanyProductUnprocessableEntity) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[DELETE /companyproducts][%d] deleteCompanyProductUnprocessableEntity %s", 422, payload) -} - -func (o *DeleteCompanyProductUnprocessableEntity) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[DELETE /companyproducts][%d] deleteCompanyProductUnprocessableEntity %s", 422, payload) -} - -func (o *DeleteCompanyProductUnprocessableEntity) GetPayload() *research_models.Error { - return o.Payload -} - -func (o *DeleteCompanyProductUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // hydrates response header Access-Control-Allow-Origin - hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - - if hdrAccessControlAllowOrigin != "" { - o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin - } - - o.Payload = new(research_models.Error) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} - -// NewDeleteCompanyProductInternalServerError creates a DeleteCompanyProductInternalServerError with default headers values -func NewDeleteCompanyProductInternalServerError() *DeleteCompanyProductInternalServerError { - return &DeleteCompanyProductInternalServerError{} -} - -// DeleteCompanyProductInternalServerError describes a response with status code 500, with default header values. -// -// Server Internal Error -type DeleteCompanyProductInternalServerError struct { - AccessControlAllowOrigin string - - Payload *research_models.Error -} - -// IsSuccess returns true when this delete company product internal server error response has a 2xx status code -func (o *DeleteCompanyProductInternalServerError) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this delete company product internal server error response has a 3xx status code -func (o *DeleteCompanyProductInternalServerError) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete company product internal server error response has a 4xx status code -func (o *DeleteCompanyProductInternalServerError) IsClientError() bool { - return false -} - -// IsServerError returns true when this delete company product internal server error response has a 5xx status code -func (o *DeleteCompanyProductInternalServerError) IsServerError() bool { - return true -} - -// IsCode returns true when this delete company product internal server error response a status code equal to that given -func (o *DeleteCompanyProductInternalServerError) IsCode(code int) bool { - return code == 500 -} - -// Code gets the status code for the delete company product internal server error response -func (o *DeleteCompanyProductInternalServerError) Code() int { - return 500 -} - -func (o *DeleteCompanyProductInternalServerError) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[DELETE /companyproducts][%d] deleteCompanyProductInternalServerError %s", 500, payload) -} - -func (o *DeleteCompanyProductInternalServerError) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[DELETE /companyproducts][%d] deleteCompanyProductInternalServerError %s", 500, payload) -} - -func (o *DeleteCompanyProductInternalServerError) GetPayload() *research_models.Error { - return o.Payload -} - -func (o *DeleteCompanyProductInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // hydrates response header Access-Control-Allow-Origin - hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - - if hdrAccessControlAllowOrigin != "" { - o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin - } - - o.Payload = new(research_models.Error) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} diff --git a/api/research/research_client/company_products/put_company_product_parameters.go b/api/research/research_client/company_products/put_company_product_parameters.go deleted file mode 100644 index 3ef96f6..0000000 --- a/api/research/research_client/company_products/put_company_product_parameters.go +++ /dev/null @@ -1,159 +0,0 @@ -// 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 company_products - -import ( - "context" - "net/http" - "time" - - "code.tnxs.net/vernonkeenan/lib/api/research/research_models" - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewPutCompanyProductParams creates a new PutCompanyProductParams 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 NewPutCompanyProductParams() *PutCompanyProductParams { - return NewPutCompanyProductParamsWithTimeout(cr.DefaultTimeout) -} - -// NewPutCompanyProductParamsWithTimeout creates a new PutCompanyProductParams object -// with the ability to set a timeout on a request. -func NewPutCompanyProductParamsWithTimeout(timeout time.Duration) *PutCompanyProductParams { - return &PutCompanyProductParams{ - inner: innerParams{ - timeout: timeout, - }, - } -} - -// NewPutCompanyProductParamsWithContext creates a new PutCompanyProductParams object -// with the ability to set a context for a request. -// -// Deprecated: use the operation call with context to pass the context instead of [PutCompanyProductParams]. -func NewPutCompanyProductParamsWithContext(ctx context.Context) *PutCompanyProductParams { - return &PutCompanyProductParams{ - inner: innerParams{ - ctx: ctx, - }, - } -} - -// NewPutCompanyProductParamsWithHTTPClient creates a new PutCompanyProductParams object -// with the ability to set a custom HTTPClient for a request. -func NewPutCompanyProductParamsWithHTTPClient(client *http.Client) *PutCompanyProductParams { - return &PutCompanyProductParams{ - HTTPClient: client, - } -} - -/* -PutCompanyProductParams contains all the parameters to send to the API endpoint - - for the put company product operation. - - Typically these are written to a http.Request. -*/ -type PutCompanyProductParams struct { - - // CompanyProductRequest. - // - // An array of new CompanyProduct records - CompanyProductRequest *research_models.CompanyProductRequest - - HTTPClient *http.Client - - inner innerParams -} - -// WithDefaults hydrates default values in the put company product params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *PutCompanyProductParams) WithDefaults() *PutCompanyProductParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the put company product params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *PutCompanyProductParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the put company product params. -func (o *PutCompanyProductParams) WithTimeout(timeout time.Duration) *PutCompanyProductParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the put company product params. -func (o *PutCompanyProductParams) SetTimeout(timeout time.Duration) { - o.inner.timeout = timeout -} - -// WithContext adds the context to the put company product params. -// -// Deprecated: use the operation call with context to pass the context instead of [PutCompanyProductParams]. -func (o *PutCompanyProductParams) WithContext(ctx context.Context) *PutCompanyProductParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the put company product params. -// -// Deprecated: use the operation call with context to pass the context instead of [PutCompanyProductParams]. -func (o *PutCompanyProductParams) SetContext(ctx context.Context) { - o.inner.ctx = ctx -} - -// WithHTTPClient adds the HTTPClient to the put company product params. -func (o *PutCompanyProductParams) WithHTTPClient(client *http.Client) *PutCompanyProductParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the put company product params. -func (o *PutCompanyProductParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithCompanyProductRequest adds the companyProductRequest to the put company product params. -func (o *PutCompanyProductParams) WithCompanyProductRequest(companyProductRequest *research_models.CompanyProductRequest) *PutCompanyProductParams { - o.SetCompanyProductRequest(companyProductRequest) - return o -} - -// SetCompanyProductRequest adds the companyProductRequest to the put company product params. -func (o *PutCompanyProductParams) SetCompanyProductRequest(companyProductRequest *research_models.CompanyProductRequest) { - o.CompanyProductRequest = companyProductRequest -} - -// WriteToRequest writes these params to a [runtime.ClientRequest]. -func (o *PutCompanyProductParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - if err := r.SetTimeout(o.inner.timeout); err != nil { - return err - } - var res []error - if o.CompanyProductRequest != nil { - if err := r.SetBodyParam(o.CompanyProductRequest); err != nil { - return err - } - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/api/research/research_client/company_products/put_company_product_responses.go b/api/research/research_client/company_products/put_company_product_responses.go deleted file mode 100644 index ab41cad..0000000 --- a/api/research/research_client/company_products/put_company_product_responses.go +++ /dev/null @@ -1,520 +0,0 @@ -// 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 company_products - -import ( - "encoding/json" - stderrors "errors" - "fmt" - "io" - - "code.tnxs.net/vernonkeenan/lib/api/research/research_models" - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" -) - -// PutCompanyProductReader is a Reader for the PutCompanyProduct structure. -type PutCompanyProductReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *PutCompanyProductReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) { - switch response.Code() { - case 200: - result := NewPutCompanyProductOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 401: - result := NewPutCompanyProductUnauthorized() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 403: - result := NewPutCompanyProductForbidden() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 404: - result := NewPutCompanyProductNotFound() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 422: - result := NewPutCompanyProductUnprocessableEntity() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 500: - result := NewPutCompanyProductInternalServerError() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[PUT /companyproducts] putCompanyProduct", response, response.Code()) - } -} - -// NewPutCompanyProductOK creates a PutCompanyProductOK with default headers values -func NewPutCompanyProductOK() *PutCompanyProductOK { - return &PutCompanyProductOK{} -} - -// PutCompanyProductOK describes a response with status code 200, with default header values. -// -// Response with CompanyProduct objects -type PutCompanyProductOK struct { - Payload *research_models.CompanyProductResponse -} - -// IsSuccess returns true when this put company product o k response has a 2xx status code -func (o *PutCompanyProductOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this put company product o k response has a 3xx status code -func (o *PutCompanyProductOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this put company product o k response has a 4xx status code -func (o *PutCompanyProductOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this put company product o k response has a 5xx status code -func (o *PutCompanyProductOK) IsServerError() bool { - return false -} - -// IsCode returns true when this put company product o k response a status code equal to that given -func (o *PutCompanyProductOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the put company product o k response -func (o *PutCompanyProductOK) Code() int { - return 200 -} - -func (o *PutCompanyProductOK) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[PUT /companyproducts][%d] putCompanyProductOK %s", 200, payload) -} - -func (o *PutCompanyProductOK) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[PUT /companyproducts][%d] putCompanyProductOK %s", 200, payload) -} - -func (o *PutCompanyProductOK) GetPayload() *research_models.CompanyProductResponse { - return o.Payload -} - -func (o *PutCompanyProductOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(research_models.CompanyProductResponse) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} - -// NewPutCompanyProductUnauthorized creates a PutCompanyProductUnauthorized with default headers values -func NewPutCompanyProductUnauthorized() *PutCompanyProductUnauthorized { - return &PutCompanyProductUnauthorized{} -} - -// PutCompanyProductUnauthorized describes a response with status code 401, with default header values. -// -// Access unauthorized, invalid API-KEY was used -type PutCompanyProductUnauthorized struct { - AccessControlAllowOrigin string - - Payload *research_models.Error -} - -// IsSuccess returns true when this put company product unauthorized response has a 2xx status code -func (o *PutCompanyProductUnauthorized) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this put company product unauthorized response has a 3xx status code -func (o *PutCompanyProductUnauthorized) IsRedirect() bool { - return false -} - -// IsClientError returns true when this put company product unauthorized response has a 4xx status code -func (o *PutCompanyProductUnauthorized) IsClientError() bool { - return true -} - -// IsServerError returns true when this put company product unauthorized response has a 5xx status code -func (o *PutCompanyProductUnauthorized) IsServerError() bool { - return false -} - -// IsCode returns true when this put company product unauthorized response a status code equal to that given -func (o *PutCompanyProductUnauthorized) IsCode(code int) bool { - return code == 401 -} - -// Code gets the status code for the put company product unauthorized response -func (o *PutCompanyProductUnauthorized) Code() int { - return 401 -} - -func (o *PutCompanyProductUnauthorized) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[PUT /companyproducts][%d] putCompanyProductUnauthorized %s", 401, payload) -} - -func (o *PutCompanyProductUnauthorized) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[PUT /companyproducts][%d] putCompanyProductUnauthorized %s", 401, payload) -} - -func (o *PutCompanyProductUnauthorized) GetPayload() *research_models.Error { - return o.Payload -} - -func (o *PutCompanyProductUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // hydrates response header Access-Control-Allow-Origin - hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - - if hdrAccessControlAllowOrigin != "" { - o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin - } - - o.Payload = new(research_models.Error) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} - -// NewPutCompanyProductForbidden creates a PutCompanyProductForbidden with default headers values -func NewPutCompanyProductForbidden() *PutCompanyProductForbidden { - return &PutCompanyProductForbidden{} -} - -// PutCompanyProductForbidden describes a response with status code 403, with default header values. -// -// Access forbidden, account lacks access -type PutCompanyProductForbidden struct { - AccessControlAllowOrigin string - - Payload *research_models.Error -} - -// IsSuccess returns true when this put company product forbidden response has a 2xx status code -func (o *PutCompanyProductForbidden) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this put company product forbidden response has a 3xx status code -func (o *PutCompanyProductForbidden) IsRedirect() bool { - return false -} - -// IsClientError returns true when this put company product forbidden response has a 4xx status code -func (o *PutCompanyProductForbidden) IsClientError() bool { - return true -} - -// IsServerError returns true when this put company product forbidden response has a 5xx status code -func (o *PutCompanyProductForbidden) IsServerError() bool { - return false -} - -// IsCode returns true when this put company product forbidden response a status code equal to that given -func (o *PutCompanyProductForbidden) IsCode(code int) bool { - return code == 403 -} - -// Code gets the status code for the put company product forbidden response -func (o *PutCompanyProductForbidden) Code() int { - return 403 -} - -func (o *PutCompanyProductForbidden) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[PUT /companyproducts][%d] putCompanyProductForbidden %s", 403, payload) -} - -func (o *PutCompanyProductForbidden) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[PUT /companyproducts][%d] putCompanyProductForbidden %s", 403, payload) -} - -func (o *PutCompanyProductForbidden) GetPayload() *research_models.Error { - return o.Payload -} - -func (o *PutCompanyProductForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // hydrates response header Access-Control-Allow-Origin - hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - - if hdrAccessControlAllowOrigin != "" { - o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin - } - - o.Payload = new(research_models.Error) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} - -// NewPutCompanyProductNotFound creates a PutCompanyProductNotFound with default headers values -func NewPutCompanyProductNotFound() *PutCompanyProductNotFound { - return &PutCompanyProductNotFound{} -} - -// PutCompanyProductNotFound describes a response with status code 404, with default header values. -// -// Resource was not found -type PutCompanyProductNotFound struct { - AccessControlAllowOrigin string - - Payload *research_models.Error -} - -// IsSuccess returns true when this put company product not found response has a 2xx status code -func (o *PutCompanyProductNotFound) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this put company product not found response has a 3xx status code -func (o *PutCompanyProductNotFound) IsRedirect() bool { - return false -} - -// IsClientError returns true when this put company product not found response has a 4xx status code -func (o *PutCompanyProductNotFound) IsClientError() bool { - return true -} - -// IsServerError returns true when this put company product not found response has a 5xx status code -func (o *PutCompanyProductNotFound) IsServerError() bool { - return false -} - -// IsCode returns true when this put company product not found response a status code equal to that given -func (o *PutCompanyProductNotFound) IsCode(code int) bool { - return code == 404 -} - -// Code gets the status code for the put company product not found response -func (o *PutCompanyProductNotFound) Code() int { - return 404 -} - -func (o *PutCompanyProductNotFound) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[PUT /companyproducts][%d] putCompanyProductNotFound %s", 404, payload) -} - -func (o *PutCompanyProductNotFound) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[PUT /companyproducts][%d] putCompanyProductNotFound %s", 404, payload) -} - -func (o *PutCompanyProductNotFound) GetPayload() *research_models.Error { - return o.Payload -} - -func (o *PutCompanyProductNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // hydrates response header Access-Control-Allow-Origin - hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - - if hdrAccessControlAllowOrigin != "" { - o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin - } - - o.Payload = new(research_models.Error) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} - -// NewPutCompanyProductUnprocessableEntity creates a PutCompanyProductUnprocessableEntity with default headers values -func NewPutCompanyProductUnprocessableEntity() *PutCompanyProductUnprocessableEntity { - return &PutCompanyProductUnprocessableEntity{} -} - -// PutCompanyProductUnprocessableEntity describes a response with status code 422, with default header values. -// -// Unprocessable Entity, likely a bad parameter -type PutCompanyProductUnprocessableEntity struct { - AccessControlAllowOrigin string - - Payload *research_models.Error -} - -// IsSuccess returns true when this put company product unprocessable entity response has a 2xx status code -func (o *PutCompanyProductUnprocessableEntity) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this put company product unprocessable entity response has a 3xx status code -func (o *PutCompanyProductUnprocessableEntity) IsRedirect() bool { - return false -} - -// IsClientError returns true when this put company product unprocessable entity response has a 4xx status code -func (o *PutCompanyProductUnprocessableEntity) IsClientError() bool { - return true -} - -// IsServerError returns true when this put company product unprocessable entity response has a 5xx status code -func (o *PutCompanyProductUnprocessableEntity) IsServerError() bool { - return false -} - -// IsCode returns true when this put company product unprocessable entity response a status code equal to that given -func (o *PutCompanyProductUnprocessableEntity) IsCode(code int) bool { - return code == 422 -} - -// Code gets the status code for the put company product unprocessable entity response -func (o *PutCompanyProductUnprocessableEntity) Code() int { - return 422 -} - -func (o *PutCompanyProductUnprocessableEntity) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[PUT /companyproducts][%d] putCompanyProductUnprocessableEntity %s", 422, payload) -} - -func (o *PutCompanyProductUnprocessableEntity) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[PUT /companyproducts][%d] putCompanyProductUnprocessableEntity %s", 422, payload) -} - -func (o *PutCompanyProductUnprocessableEntity) GetPayload() *research_models.Error { - return o.Payload -} - -func (o *PutCompanyProductUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // hydrates response header Access-Control-Allow-Origin - hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - - if hdrAccessControlAllowOrigin != "" { - o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin - } - - o.Payload = new(research_models.Error) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} - -// NewPutCompanyProductInternalServerError creates a PutCompanyProductInternalServerError with default headers values -func NewPutCompanyProductInternalServerError() *PutCompanyProductInternalServerError { - return &PutCompanyProductInternalServerError{} -} - -// PutCompanyProductInternalServerError describes a response with status code 500, with default header values. -// -// Server Internal Error -type PutCompanyProductInternalServerError struct { - AccessControlAllowOrigin string - - Payload *research_models.Error -} - -// IsSuccess returns true when this put company product internal server error response has a 2xx status code -func (o *PutCompanyProductInternalServerError) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this put company product internal server error response has a 3xx status code -func (o *PutCompanyProductInternalServerError) IsRedirect() bool { - return false -} - -// IsClientError returns true when this put company product internal server error response has a 4xx status code -func (o *PutCompanyProductInternalServerError) IsClientError() bool { - return false -} - -// IsServerError returns true when this put company product internal server error response has a 5xx status code -func (o *PutCompanyProductInternalServerError) IsServerError() bool { - return true -} - -// IsCode returns true when this put company product internal server error response a status code equal to that given -func (o *PutCompanyProductInternalServerError) IsCode(code int) bool { - return code == 500 -} - -// Code gets the status code for the put company product internal server error response -func (o *PutCompanyProductInternalServerError) Code() int { - return 500 -} - -func (o *PutCompanyProductInternalServerError) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[PUT /companyproducts][%d] putCompanyProductInternalServerError %s", 500, payload) -} - -func (o *PutCompanyProductInternalServerError) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[PUT /companyproducts][%d] putCompanyProductInternalServerError %s", 500, payload) -} - -func (o *PutCompanyProductInternalServerError) GetPayload() *research_models.Error { - return o.Payload -} - -func (o *PutCompanyProductInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // hydrates response header Access-Control-Allow-Origin - hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - - if hdrAccessControlAllowOrigin != "" { - o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin - } - - o.Payload = new(research_models.Error) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} diff --git a/api/research/research_client/company_services/company_services_client.go b/api/research/research_client/company_services/company_services_client.go index 7ab230f..64dd7da 100644 --- a/api/research/research_client/company_services/company_services_client.go +++ b/api/research/research_client/company_services/company_services_client.go @@ -60,12 +60,6 @@ type ClientOption func(*runtime.ClientOperation) // ClientService is the interface for Client methods. type ClientService interface { - // DeleteCompanyService delete a company service. - DeleteCompanyService(params *DeleteCompanyServiceParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteCompanyServiceOK, error) - - // DeleteCompanyServiceContext delete a company service. - DeleteCompanyServiceContext(ctx context.Context, params *DeleteCompanyServiceParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteCompanyServiceOK, error) - // GetCompanyServices get a list of company services. GetCompanyServices(params *GetCompanyServicesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCompanyServicesOK, error) @@ -78,79 +72,18 @@ type ClientService interface { // PostCompanyServicesContext create a new company service. PostCompanyServicesContext(ctx context.Context, params *PostCompanyServicesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCompanyServicesOK, error) + // PutCompanyService update one tenant owned company service. + PutCompanyService(params *PutCompanyServiceParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutCompanyServiceOK, error) + + // PutCompanyServiceContext update one tenant owned company service. + PutCompanyServiceContext(ctx context.Context, params *PutCompanyServiceParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutCompanyServiceOK, error) + SetTransport(transport runtime.ContextualTransport) } -// DeleteCompanyService deletes a company service. -// -// Delete CompanyService record. -// -// This method does not support injected context. -// However, timeout and opentracing contexts are honored whenever enabled. -// -// If you need to pass a specific context, use [Client.DeleteCompanyServiceContext] instead. -func (a *Client) DeleteCompanyService(params *DeleteCompanyServiceParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteCompanyServiceOK, error) { - var ctx context.Context - if params.inner.ctx != nil { - ctx = params.inner.ctx - } else { - ctx = context.Background() - } - - return a.DeleteCompanyServiceContext(ctx, params, authInfo, opts...) -} - -// DeleteCompanyServiceContext deletes a company service. -// -// Delete CompanyService record. -// -// Do not use the deprecated [DeleteCompanyServiceParams.Context] with this method: it would be ignored. -func (a *Client) DeleteCompanyServiceContext(ctx context.Context, params *DeleteCompanyServiceParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteCompanyServiceOK, error) { - // NOTE: parameters are not validated before sending - if params == nil { - params = NewDeleteCompanyServiceParams() - } - - op := &runtime.ClientOperation{ - ID: "deleteCompanyService", - Method: "DELETE", - PathPattern: "/companyservices", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &DeleteCompanyServiceReader{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.(*DeleteCompanyServiceOK) - 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 deleteCompanyService: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - // GetCompanyServices gets a list of company services. // -// Return a list of all available CompanyServices. +// Return CompanyServices under compound native service and same-tenant human authentication; requires research:company-service:read. // // This method does not support injected context. // However, timeout and opentracing contexts are honored whenever enabled. @@ -169,7 +102,7 @@ func (a *Client) GetCompanyServices(params *GetCompanyServicesParams, authInfo r // GetCompanyServicesContext gets a list of company services. // -// Return a list of all available CompanyServices. +// Return CompanyServices under compound native service and same-tenant human authentication; requires research:company-service:read. // // Do not use the deprecated [GetCompanyServicesParams.Context] with this method: it would be ignored. func (a *Client) GetCompanyServicesContext(ctx context.Context, params *GetCompanyServicesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCompanyServicesOK, error) { @@ -217,7 +150,7 @@ func (a *Client) GetCompanyServicesContext(ctx context.Context, params *GetCompa // PostCompanyServices creates a new company service. // -// Create a new CompanyService record. +// Create one unpublished CompanyService beneath an Account owned by the machine tenant; requires research:company-service:create and same-tenant Owner or Manager. // // This method does not support injected context. // However, timeout and opentracing contexts are honored whenever enabled. @@ -236,7 +169,7 @@ func (a *Client) PostCompanyServices(params *PostCompanyServicesParams, authInfo // PostCompanyServicesContext creates a new company service. // -// Create a new CompanyService record. +// Create one unpublished CompanyService beneath an Account owned by the machine tenant; requires research:company-service:create and same-tenant Owner or Manager. // // Do not use the deprecated [PostCompanyServicesParams.Context] with this method: it would be ignored. func (a *Client) PostCompanyServicesContext(ctx context.Context, params *PostCompanyServicesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCompanyServicesOK, error) { @@ -282,6 +215,73 @@ func (a *Client) PostCompanyServicesContext(ctx context.Context, params *PostCom panic(msg) } +// PutCompanyService updates one tenant owned company service. +// +// Replace the editable fields of one tenant-owned CompanyService using optimistic concurrency while preserving publication, enrichment audit, and media ownership; requires research:company-service:update and same-tenant Owner or Manager. +// +// 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.PutCompanyServiceContext] instead. +func (a *Client) PutCompanyService(params *PutCompanyServiceParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutCompanyServiceOK, error) { + var ctx context.Context + if params.inner.ctx != nil { + ctx = params.inner.ctx + } else { + ctx = context.Background() + } + + return a.PutCompanyServiceContext(ctx, params, authInfo, opts...) +} + +// PutCompanyServiceContext updates one tenant owned company service. +// +// Replace the editable fields of one tenant-owned CompanyService using optimistic concurrency while preserving publication, enrichment audit, and media ownership; requires research:company-service:update and same-tenant Owner or Manager. +// +// Do not use the deprecated [PutCompanyServiceParams.Context] with this method: it would be ignored. +func (a *Client) PutCompanyServiceContext(ctx context.Context, params *PutCompanyServiceParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutCompanyServiceOK, error) { + // NOTE: parameters are not validated before sending + if params == nil { + params = NewPutCompanyServiceParams() + } + + op := &runtime.ClientOperation{ + ID: "putCompanyService", + Method: "PUT", + PathPattern: "/companyservices", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PutCompanyServiceReader{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.(*PutCompanyServiceOK) + 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 putCompanyService: 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 diff --git a/api/research/research_client/company_services/delete_company_service_parameters.go b/api/research/research_client/company_services/delete_company_service_parameters.go deleted file mode 100644 index 9d823ba..0000000 --- a/api/research/research_client/company_services/delete_company_service_parameters.go +++ /dev/null @@ -1,170 +0,0 @@ -// 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 company_services - -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" -) - -// NewDeleteCompanyServiceParams creates a new DeleteCompanyServiceParams 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 NewDeleteCompanyServiceParams() *DeleteCompanyServiceParams { - return NewDeleteCompanyServiceParamsWithTimeout(cr.DefaultTimeout) -} - -// NewDeleteCompanyServiceParamsWithTimeout creates a new DeleteCompanyServiceParams object -// with the ability to set a timeout on a request. -func NewDeleteCompanyServiceParamsWithTimeout(timeout time.Duration) *DeleteCompanyServiceParams { - return &DeleteCompanyServiceParams{ - inner: innerParams{ - timeout: timeout, - }, - } -} - -// NewDeleteCompanyServiceParamsWithContext creates a new DeleteCompanyServiceParams object -// with the ability to set a context for a request. -// -// Deprecated: use the operation call with context to pass the context instead of [DeleteCompanyServiceParams]. -func NewDeleteCompanyServiceParamsWithContext(ctx context.Context) *DeleteCompanyServiceParams { - return &DeleteCompanyServiceParams{ - inner: innerParams{ - ctx: ctx, - }, - } -} - -// NewDeleteCompanyServiceParamsWithHTTPClient creates a new DeleteCompanyServiceParams object -// with the ability to set a custom HTTPClient for a request. -func NewDeleteCompanyServiceParamsWithHTTPClient(client *http.Client) *DeleteCompanyServiceParams { - return &DeleteCompanyServiceParams{ - HTTPClient: client, - } -} - -/* -DeleteCompanyServiceParams contains all the parameters to send to the API endpoint - - for the delete company service operation. - - Typically these are written to a http.Request. -*/ -type DeleteCompanyServiceParams struct { - - // CompanyServiceID. - // - // CompanyService record ID - CompanyServiceID *string - - HTTPClient *http.Client - - inner innerParams -} - -// WithDefaults hydrates default values in the delete company service params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *DeleteCompanyServiceParams) WithDefaults() *DeleteCompanyServiceParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the delete company service params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *DeleteCompanyServiceParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the delete company service params. -func (o *DeleteCompanyServiceParams) WithTimeout(timeout time.Duration) *DeleteCompanyServiceParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the delete company service params. -func (o *DeleteCompanyServiceParams) SetTimeout(timeout time.Duration) { - o.inner.timeout = timeout -} - -// WithContext adds the context to the delete company service params. -// -// Deprecated: use the operation call with context to pass the context instead of [DeleteCompanyServiceParams]. -func (o *DeleteCompanyServiceParams) WithContext(ctx context.Context) *DeleteCompanyServiceParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the delete company service params. -// -// Deprecated: use the operation call with context to pass the context instead of [DeleteCompanyServiceParams]. -func (o *DeleteCompanyServiceParams) SetContext(ctx context.Context) { - o.inner.ctx = ctx -} - -// WithHTTPClient adds the HTTPClient to the delete company service params. -func (o *DeleteCompanyServiceParams) WithHTTPClient(client *http.Client) *DeleteCompanyServiceParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the delete company service params. -func (o *DeleteCompanyServiceParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithCompanyServiceID adds the companyServiceID to the delete company service params. -func (o *DeleteCompanyServiceParams) WithCompanyServiceID(companyServiceID *string) *DeleteCompanyServiceParams { - o.SetCompanyServiceID(companyServiceID) - return o -} - -// SetCompanyServiceID adds the companyServiceId to the delete company service params. -func (o *DeleteCompanyServiceParams) SetCompanyServiceID(companyServiceID *string) { - o.CompanyServiceID = companyServiceID -} - -// WriteToRequest writes these params to a [runtime.ClientRequest]. -func (o *DeleteCompanyServiceParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - if err := r.SetTimeout(o.inner.timeout); err != nil { - return err - } - var res []error - - if o.CompanyServiceID != nil { - - // query param companyServiceId - var qrCompanyServiceID string - - if o.CompanyServiceID != nil { - qrCompanyServiceID = *o.CompanyServiceID - } - qCompanyServiceID := qrCompanyServiceID - if qCompanyServiceID != "" { - - if err := r.SetQueryParam("companyServiceId", qCompanyServiceID); err != nil { - return err - } - } - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/api/research/research_client/company_services/delete_company_service_responses.go b/api/research/research_client/company_services/delete_company_service_responses.go deleted file mode 100644 index 86a7179..0000000 --- a/api/research/research_client/company_services/delete_company_service_responses.go +++ /dev/null @@ -1,529 +0,0 @@ -// 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 company_services - -import ( - "encoding/json" - stderrors "errors" - "fmt" - "io" - - "code.tnxs.net/vernonkeenan/lib/api/research/research_models" - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" -) - -// DeleteCompanyServiceReader is a Reader for the DeleteCompanyService structure. -type DeleteCompanyServiceReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *DeleteCompanyServiceReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) { - switch response.Code() { - case 200: - result := NewDeleteCompanyServiceOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 401: - result := NewDeleteCompanyServiceUnauthorized() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 403: - result := NewDeleteCompanyServiceForbidden() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 404: - result := NewDeleteCompanyServiceNotFound() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 422: - result := NewDeleteCompanyServiceUnprocessableEntity() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 500: - result := NewDeleteCompanyServiceInternalServerError() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[DELETE /companyservices] deleteCompanyService", response, response.Code()) - } -} - -// NewDeleteCompanyServiceOK creates a DeleteCompanyServiceOK with default headers values -func NewDeleteCompanyServiceOK() *DeleteCompanyServiceOK { - return &DeleteCompanyServiceOK{} -} - -// DeleteCompanyServiceOK describes a response with status code 200, with default header values. -// -// Response with Message Objects with Delete Status -type DeleteCompanyServiceOK struct { - AccessControlAllowOrigin string - - Payload *research_models.DeleteResponse -} - -// IsSuccess returns true when this delete company service o k response has a 2xx status code -func (o *DeleteCompanyServiceOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this delete company service o k response has a 3xx status code -func (o *DeleteCompanyServiceOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete company service o k response has a 4xx status code -func (o *DeleteCompanyServiceOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this delete company service o k response has a 5xx status code -func (o *DeleteCompanyServiceOK) IsServerError() bool { - return false -} - -// IsCode returns true when this delete company service o k response a status code equal to that given -func (o *DeleteCompanyServiceOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the delete company service o k response -func (o *DeleteCompanyServiceOK) Code() int { - return 200 -} - -func (o *DeleteCompanyServiceOK) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[DELETE /companyservices][%d] deleteCompanyServiceOK %s", 200, payload) -} - -func (o *DeleteCompanyServiceOK) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[DELETE /companyservices][%d] deleteCompanyServiceOK %s", 200, payload) -} - -func (o *DeleteCompanyServiceOK) GetPayload() *research_models.DeleteResponse { - return o.Payload -} - -func (o *DeleteCompanyServiceOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // hydrates response header Access-Control-Allow-Origin - hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - - if hdrAccessControlAllowOrigin != "" { - o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin - } - - o.Payload = new(research_models.DeleteResponse) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} - -// NewDeleteCompanyServiceUnauthorized creates a DeleteCompanyServiceUnauthorized with default headers values -func NewDeleteCompanyServiceUnauthorized() *DeleteCompanyServiceUnauthorized { - return &DeleteCompanyServiceUnauthorized{} -} - -// DeleteCompanyServiceUnauthorized describes a response with status code 401, with default header values. -// -// Access unauthorized, invalid API-KEY was used -type DeleteCompanyServiceUnauthorized struct { - AccessControlAllowOrigin string - - Payload *research_models.Error -} - -// IsSuccess returns true when this delete company service unauthorized response has a 2xx status code -func (o *DeleteCompanyServiceUnauthorized) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this delete company service unauthorized response has a 3xx status code -func (o *DeleteCompanyServiceUnauthorized) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete company service unauthorized response has a 4xx status code -func (o *DeleteCompanyServiceUnauthorized) IsClientError() bool { - return true -} - -// IsServerError returns true when this delete company service unauthorized response has a 5xx status code -func (o *DeleteCompanyServiceUnauthorized) IsServerError() bool { - return false -} - -// IsCode returns true when this delete company service unauthorized response a status code equal to that given -func (o *DeleteCompanyServiceUnauthorized) IsCode(code int) bool { - return code == 401 -} - -// Code gets the status code for the delete company service unauthorized response -func (o *DeleteCompanyServiceUnauthorized) Code() int { - return 401 -} - -func (o *DeleteCompanyServiceUnauthorized) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[DELETE /companyservices][%d] deleteCompanyServiceUnauthorized %s", 401, payload) -} - -func (o *DeleteCompanyServiceUnauthorized) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[DELETE /companyservices][%d] deleteCompanyServiceUnauthorized %s", 401, payload) -} - -func (o *DeleteCompanyServiceUnauthorized) GetPayload() *research_models.Error { - return o.Payload -} - -func (o *DeleteCompanyServiceUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // hydrates response header Access-Control-Allow-Origin - hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - - if hdrAccessControlAllowOrigin != "" { - o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin - } - - o.Payload = new(research_models.Error) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} - -// NewDeleteCompanyServiceForbidden creates a DeleteCompanyServiceForbidden with default headers values -func NewDeleteCompanyServiceForbidden() *DeleteCompanyServiceForbidden { - return &DeleteCompanyServiceForbidden{} -} - -// DeleteCompanyServiceForbidden describes a response with status code 403, with default header values. -// -// Access forbidden, account lacks access -type DeleteCompanyServiceForbidden struct { - AccessControlAllowOrigin string - - Payload *research_models.Error -} - -// IsSuccess returns true when this delete company service forbidden response has a 2xx status code -func (o *DeleteCompanyServiceForbidden) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this delete company service forbidden response has a 3xx status code -func (o *DeleteCompanyServiceForbidden) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete company service forbidden response has a 4xx status code -func (o *DeleteCompanyServiceForbidden) IsClientError() bool { - return true -} - -// IsServerError returns true when this delete company service forbidden response has a 5xx status code -func (o *DeleteCompanyServiceForbidden) IsServerError() bool { - return false -} - -// IsCode returns true when this delete company service forbidden response a status code equal to that given -func (o *DeleteCompanyServiceForbidden) IsCode(code int) bool { - return code == 403 -} - -// Code gets the status code for the delete company service forbidden response -func (o *DeleteCompanyServiceForbidden) Code() int { - return 403 -} - -func (o *DeleteCompanyServiceForbidden) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[DELETE /companyservices][%d] deleteCompanyServiceForbidden %s", 403, payload) -} - -func (o *DeleteCompanyServiceForbidden) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[DELETE /companyservices][%d] deleteCompanyServiceForbidden %s", 403, payload) -} - -func (o *DeleteCompanyServiceForbidden) GetPayload() *research_models.Error { - return o.Payload -} - -func (o *DeleteCompanyServiceForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // hydrates response header Access-Control-Allow-Origin - hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - - if hdrAccessControlAllowOrigin != "" { - o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin - } - - o.Payload = new(research_models.Error) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} - -// NewDeleteCompanyServiceNotFound creates a DeleteCompanyServiceNotFound with default headers values -func NewDeleteCompanyServiceNotFound() *DeleteCompanyServiceNotFound { - return &DeleteCompanyServiceNotFound{} -} - -// DeleteCompanyServiceNotFound describes a response with status code 404, with default header values. -// -// Resource was not found -type DeleteCompanyServiceNotFound struct { - AccessControlAllowOrigin string - - Payload *research_models.Error -} - -// IsSuccess returns true when this delete company service not found response has a 2xx status code -func (o *DeleteCompanyServiceNotFound) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this delete company service not found response has a 3xx status code -func (o *DeleteCompanyServiceNotFound) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete company service not found response has a 4xx status code -func (o *DeleteCompanyServiceNotFound) IsClientError() bool { - return true -} - -// IsServerError returns true when this delete company service not found response has a 5xx status code -func (o *DeleteCompanyServiceNotFound) IsServerError() bool { - return false -} - -// IsCode returns true when this delete company service not found response a status code equal to that given -func (o *DeleteCompanyServiceNotFound) IsCode(code int) bool { - return code == 404 -} - -// Code gets the status code for the delete company service not found response -func (o *DeleteCompanyServiceNotFound) Code() int { - return 404 -} - -func (o *DeleteCompanyServiceNotFound) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[DELETE /companyservices][%d] deleteCompanyServiceNotFound %s", 404, payload) -} - -func (o *DeleteCompanyServiceNotFound) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[DELETE /companyservices][%d] deleteCompanyServiceNotFound %s", 404, payload) -} - -func (o *DeleteCompanyServiceNotFound) GetPayload() *research_models.Error { - return o.Payload -} - -func (o *DeleteCompanyServiceNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // hydrates response header Access-Control-Allow-Origin - hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - - if hdrAccessControlAllowOrigin != "" { - o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin - } - - o.Payload = new(research_models.Error) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} - -// NewDeleteCompanyServiceUnprocessableEntity creates a DeleteCompanyServiceUnprocessableEntity with default headers values -func NewDeleteCompanyServiceUnprocessableEntity() *DeleteCompanyServiceUnprocessableEntity { - return &DeleteCompanyServiceUnprocessableEntity{} -} - -// DeleteCompanyServiceUnprocessableEntity describes a response with status code 422, with default header values. -// -// Unprocessable Entity, likely a bad parameter -type DeleteCompanyServiceUnprocessableEntity struct { - AccessControlAllowOrigin string - - Payload *research_models.Error -} - -// IsSuccess returns true when this delete company service unprocessable entity response has a 2xx status code -func (o *DeleteCompanyServiceUnprocessableEntity) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this delete company service unprocessable entity response has a 3xx status code -func (o *DeleteCompanyServiceUnprocessableEntity) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete company service unprocessable entity response has a 4xx status code -func (o *DeleteCompanyServiceUnprocessableEntity) IsClientError() bool { - return true -} - -// IsServerError returns true when this delete company service unprocessable entity response has a 5xx status code -func (o *DeleteCompanyServiceUnprocessableEntity) IsServerError() bool { - return false -} - -// IsCode returns true when this delete company service unprocessable entity response a status code equal to that given -func (o *DeleteCompanyServiceUnprocessableEntity) IsCode(code int) bool { - return code == 422 -} - -// Code gets the status code for the delete company service unprocessable entity response -func (o *DeleteCompanyServiceUnprocessableEntity) Code() int { - return 422 -} - -func (o *DeleteCompanyServiceUnprocessableEntity) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[DELETE /companyservices][%d] deleteCompanyServiceUnprocessableEntity %s", 422, payload) -} - -func (o *DeleteCompanyServiceUnprocessableEntity) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[DELETE /companyservices][%d] deleteCompanyServiceUnprocessableEntity %s", 422, payload) -} - -func (o *DeleteCompanyServiceUnprocessableEntity) GetPayload() *research_models.Error { - return o.Payload -} - -func (o *DeleteCompanyServiceUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // hydrates response header Access-Control-Allow-Origin - hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - - if hdrAccessControlAllowOrigin != "" { - o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin - } - - o.Payload = new(research_models.Error) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} - -// NewDeleteCompanyServiceInternalServerError creates a DeleteCompanyServiceInternalServerError with default headers values -func NewDeleteCompanyServiceInternalServerError() *DeleteCompanyServiceInternalServerError { - return &DeleteCompanyServiceInternalServerError{} -} - -// DeleteCompanyServiceInternalServerError describes a response with status code 500, with default header values. -// -// Server Internal Error -type DeleteCompanyServiceInternalServerError struct { - AccessControlAllowOrigin string - - Payload *research_models.Error -} - -// IsSuccess returns true when this delete company service internal server error response has a 2xx status code -func (o *DeleteCompanyServiceInternalServerError) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this delete company service internal server error response has a 3xx status code -func (o *DeleteCompanyServiceInternalServerError) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete company service internal server error response has a 4xx status code -func (o *DeleteCompanyServiceInternalServerError) IsClientError() bool { - return false -} - -// IsServerError returns true when this delete company service internal server error response has a 5xx status code -func (o *DeleteCompanyServiceInternalServerError) IsServerError() bool { - return true -} - -// IsCode returns true when this delete company service internal server error response a status code equal to that given -func (o *DeleteCompanyServiceInternalServerError) IsCode(code int) bool { - return code == 500 -} - -// Code gets the status code for the delete company service internal server error response -func (o *DeleteCompanyServiceInternalServerError) Code() int { - return 500 -} - -func (o *DeleteCompanyServiceInternalServerError) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[DELETE /companyservices][%d] deleteCompanyServiceInternalServerError %s", 500, payload) -} - -func (o *DeleteCompanyServiceInternalServerError) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[DELETE /companyservices][%d] deleteCompanyServiceInternalServerError %s", 500, payload) -} - -func (o *DeleteCompanyServiceInternalServerError) GetPayload() *research_models.Error { - return o.Payload -} - -func (o *DeleteCompanyServiceInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // hydrates response header Access-Control-Allow-Origin - hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - - if hdrAccessControlAllowOrigin != "" { - o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin - } - - o.Payload = new(research_models.Error) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} diff --git a/api/research/research_client/company_services/put_company_service_parameters.go b/api/research/research_client/company_services/put_company_service_parameters.go new file mode 100644 index 0000000..a887a6c --- /dev/null +++ b/api/research/research_client/company_services/put_company_service_parameters.go @@ -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 company_services + +import ( + "context" + "net/http" + "time" + + "code.tnxs.net/vernonkeenan/lib/api/research/research_models" + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewPutCompanyServiceParams creates a new PutCompanyServiceParams 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 NewPutCompanyServiceParams() *PutCompanyServiceParams { + return NewPutCompanyServiceParamsWithTimeout(cr.DefaultTimeout) +} + +// NewPutCompanyServiceParamsWithTimeout creates a new PutCompanyServiceParams object +// with the ability to set a timeout on a request. +func NewPutCompanyServiceParamsWithTimeout(timeout time.Duration) *PutCompanyServiceParams { + return &PutCompanyServiceParams{ + inner: innerParams{ + timeout: timeout, + }, + } +} + +// NewPutCompanyServiceParamsWithContext creates a new PutCompanyServiceParams object +// with the ability to set a context for a request. +// +// Deprecated: use the operation call with context to pass the context instead of [PutCompanyServiceParams]. +func NewPutCompanyServiceParamsWithContext(ctx context.Context) *PutCompanyServiceParams { + return &PutCompanyServiceParams{ + inner: innerParams{ + ctx: ctx, + }, + } +} + +// NewPutCompanyServiceParamsWithHTTPClient creates a new PutCompanyServiceParams object +// with the ability to set a custom HTTPClient for a request. +func NewPutCompanyServiceParamsWithHTTPClient(client *http.Client) *PutCompanyServiceParams { + return &PutCompanyServiceParams{ + HTTPClient: client, + } +} + +/* +PutCompanyServiceParams contains all the parameters to send to the API endpoint + + for the put company service operation. + + Typically these are written to a http.Request. +*/ +type PutCompanyServiceParams struct { + + // CompanyServiceRequest. + // + // An array of new CompanyService records + CompanyServiceRequest *research_models.CompanyServiceRequest + + HTTPClient *http.Client + + inner innerParams +} + +// WithDefaults hydrates default values in the put company service params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutCompanyServiceParams) WithDefaults() *PutCompanyServiceParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put company service params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutCompanyServiceParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the put company service params. +func (o *PutCompanyServiceParams) WithTimeout(timeout time.Duration) *PutCompanyServiceParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the put company service params. +func (o *PutCompanyServiceParams) SetTimeout(timeout time.Duration) { + o.inner.timeout = timeout +} + +// WithContext adds the context to the put company service params. +// +// Deprecated: use the operation call with context to pass the context instead of [PutCompanyServiceParams]. +func (o *PutCompanyServiceParams) WithContext(ctx context.Context) *PutCompanyServiceParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the put company service params. +// +// Deprecated: use the operation call with context to pass the context instead of [PutCompanyServiceParams]. +func (o *PutCompanyServiceParams) SetContext(ctx context.Context) { + o.inner.ctx = ctx +} + +// WithHTTPClient adds the HTTPClient to the put company service params. +func (o *PutCompanyServiceParams) WithHTTPClient(client *http.Client) *PutCompanyServiceParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the put company service params. +func (o *PutCompanyServiceParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCompanyServiceRequest adds the companyServiceRequest to the put company service params. +func (o *PutCompanyServiceParams) WithCompanyServiceRequest(companyServiceRequest *research_models.CompanyServiceRequest) *PutCompanyServiceParams { + o.SetCompanyServiceRequest(companyServiceRequest) + return o +} + +// SetCompanyServiceRequest adds the companyServiceRequest to the put company service params. +func (o *PutCompanyServiceParams) SetCompanyServiceRequest(companyServiceRequest *research_models.CompanyServiceRequest) { + o.CompanyServiceRequest = companyServiceRequest +} + +// WriteToRequest writes these params to a [runtime.ClientRequest]. +func (o *PutCompanyServiceParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + if err := r.SetTimeout(o.inner.timeout); err != nil { + return err + } + var res []error + if o.CompanyServiceRequest != nil { + if err := r.SetBodyParam(o.CompanyServiceRequest); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/api/research/research_client/company_services/put_company_service_responses.go b/api/research/research_client/company_services/put_company_service_responses.go new file mode 100644 index 0000000..6bc0f00 --- /dev/null +++ b/api/research/research_client/company_services/put_company_service_responses.go @@ -0,0 +1,603 @@ +// 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 company_services + +import ( + "encoding/json" + stderrors "errors" + "fmt" + "io" + + "code.tnxs.net/vernonkeenan/lib/api/research/research_models" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// PutCompanyServiceReader is a Reader for the PutCompanyService structure. +type PutCompanyServiceReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PutCompanyServiceReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) { + switch response.Code() { + case 200: + result := NewPutCompanyServiceOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 401: + result := NewPutCompanyServiceUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPutCompanyServiceForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPutCompanyServiceNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewPutCompanyServiceConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPutCompanyServiceUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPutCompanyServiceInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[PUT /companyservices] putCompanyService", response, response.Code()) + } +} + +// NewPutCompanyServiceOK creates a PutCompanyServiceOK with default headers values +func NewPutCompanyServiceOK() *PutCompanyServiceOK { + return &PutCompanyServiceOK{} +} + +// PutCompanyServiceOK describes a response with status code 200, with default header values. +// +// Response with CompanyService objects +type PutCompanyServiceOK struct { + Payload *research_models.CompanyServiceResponse +} + +// IsSuccess returns true when this put company service o k response has a 2xx status code +func (o *PutCompanyServiceOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this put company service o k response has a 3xx status code +func (o *PutCompanyServiceOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this put company service o k response has a 4xx status code +func (o *PutCompanyServiceOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this put company service o k response has a 5xx status code +func (o *PutCompanyServiceOK) IsServerError() bool { + return false +} + +// IsCode returns true when this put company service o k response a status code equal to that given +func (o *PutCompanyServiceOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the put company service o k response +func (o *PutCompanyServiceOK) Code() int { + return 200 +} + +func (o *PutCompanyServiceOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /companyservices][%d] putCompanyServiceOK %s", 200, payload) +} + +func (o *PutCompanyServiceOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /companyservices][%d] putCompanyServiceOK %s", 200, payload) +} + +func (o *PutCompanyServiceOK) GetPayload() *research_models.CompanyServiceResponse { + return o.Payload +} + +func (o *PutCompanyServiceOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(research_models.CompanyServiceResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { + return err + } + + return nil +} + +// NewPutCompanyServiceUnauthorized creates a PutCompanyServiceUnauthorized with default headers values +func NewPutCompanyServiceUnauthorized() *PutCompanyServiceUnauthorized { + return &PutCompanyServiceUnauthorized{} +} + +// PutCompanyServiceUnauthorized describes a response with status code 401, with default header values. +// +// Access unauthorized, invalid API-KEY was used +type PutCompanyServiceUnauthorized struct { + AccessControlAllowOrigin string + + Payload *research_models.Error +} + +// IsSuccess returns true when this put company service unauthorized response has a 2xx status code +func (o *PutCompanyServiceUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this put company service unauthorized response has a 3xx status code +func (o *PutCompanyServiceUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this put company service unauthorized response has a 4xx status code +func (o *PutCompanyServiceUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this put company service unauthorized response has a 5xx status code +func (o *PutCompanyServiceUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this put company service unauthorized response a status code equal to that given +func (o *PutCompanyServiceUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the put company service unauthorized response +func (o *PutCompanyServiceUnauthorized) Code() int { + return 401 +} + +func (o *PutCompanyServiceUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /companyservices][%d] putCompanyServiceUnauthorized %s", 401, payload) +} + +func (o *PutCompanyServiceUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /companyservices][%d] putCompanyServiceUnauthorized %s", 401, payload) +} + +func (o *PutCompanyServiceUnauthorized) GetPayload() *research_models.Error { + return o.Payload +} + +func (o *PutCompanyServiceUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + o.Payload = new(research_models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { + return err + } + + return nil +} + +// NewPutCompanyServiceForbidden creates a PutCompanyServiceForbidden with default headers values +func NewPutCompanyServiceForbidden() *PutCompanyServiceForbidden { + return &PutCompanyServiceForbidden{} +} + +// PutCompanyServiceForbidden describes a response with status code 403, with default header values. +// +// Access forbidden, account lacks access +type PutCompanyServiceForbidden struct { + AccessControlAllowOrigin string + + Payload *research_models.Error +} + +// IsSuccess returns true when this put company service forbidden response has a 2xx status code +func (o *PutCompanyServiceForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this put company service forbidden response has a 3xx status code +func (o *PutCompanyServiceForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this put company service forbidden response has a 4xx status code +func (o *PutCompanyServiceForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this put company service forbidden response has a 5xx status code +func (o *PutCompanyServiceForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this put company service forbidden response a status code equal to that given +func (o *PutCompanyServiceForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the put company service forbidden response +func (o *PutCompanyServiceForbidden) Code() int { + return 403 +} + +func (o *PutCompanyServiceForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /companyservices][%d] putCompanyServiceForbidden %s", 403, payload) +} + +func (o *PutCompanyServiceForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /companyservices][%d] putCompanyServiceForbidden %s", 403, payload) +} + +func (o *PutCompanyServiceForbidden) GetPayload() *research_models.Error { + return o.Payload +} + +func (o *PutCompanyServiceForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + o.Payload = new(research_models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { + return err + } + + return nil +} + +// NewPutCompanyServiceNotFound creates a PutCompanyServiceNotFound with default headers values +func NewPutCompanyServiceNotFound() *PutCompanyServiceNotFound { + return &PutCompanyServiceNotFound{} +} + +// PutCompanyServiceNotFound describes a response with status code 404, with default header values. +// +// Resource was not found +type PutCompanyServiceNotFound struct { + AccessControlAllowOrigin string + + Payload *research_models.Error +} + +// IsSuccess returns true when this put company service not found response has a 2xx status code +func (o *PutCompanyServiceNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this put company service not found response has a 3xx status code +func (o *PutCompanyServiceNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this put company service not found response has a 4xx status code +func (o *PutCompanyServiceNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this put company service not found response has a 5xx status code +func (o *PutCompanyServiceNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this put company service not found response a status code equal to that given +func (o *PutCompanyServiceNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the put company service not found response +func (o *PutCompanyServiceNotFound) Code() int { + return 404 +} + +func (o *PutCompanyServiceNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /companyservices][%d] putCompanyServiceNotFound %s", 404, payload) +} + +func (o *PutCompanyServiceNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /companyservices][%d] putCompanyServiceNotFound %s", 404, payload) +} + +func (o *PutCompanyServiceNotFound) GetPayload() *research_models.Error { + return o.Payload +} + +func (o *PutCompanyServiceNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + o.Payload = new(research_models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { + return err + } + + return nil +} + +// NewPutCompanyServiceConflict creates a PutCompanyServiceConflict with default headers values +func NewPutCompanyServiceConflict() *PutCompanyServiceConflict { + return &PutCompanyServiceConflict{} +} + +// PutCompanyServiceConflict describes a response with status code 409, with default header values. +// +// Conflict +type PutCompanyServiceConflict struct { + AccessControlAllowOrigin string + + Payload *research_models.Error +} + +// IsSuccess returns true when this put company service conflict response has a 2xx status code +func (o *PutCompanyServiceConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this put company service conflict response has a 3xx status code +func (o *PutCompanyServiceConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this put company service conflict response has a 4xx status code +func (o *PutCompanyServiceConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this put company service conflict response has a 5xx status code +func (o *PutCompanyServiceConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this put company service conflict response a status code equal to that given +func (o *PutCompanyServiceConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the put company service conflict response +func (o *PutCompanyServiceConflict) Code() int { + return 409 +} + +func (o *PutCompanyServiceConflict) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /companyservices][%d] putCompanyServiceConflict %s", 409, payload) +} + +func (o *PutCompanyServiceConflict) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /companyservices][%d] putCompanyServiceConflict %s", 409, payload) +} + +func (o *PutCompanyServiceConflict) GetPayload() *research_models.Error { + return o.Payload +} + +func (o *PutCompanyServiceConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + o.Payload = new(research_models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { + return err + } + + return nil +} + +// NewPutCompanyServiceUnprocessableEntity creates a PutCompanyServiceUnprocessableEntity with default headers values +func NewPutCompanyServiceUnprocessableEntity() *PutCompanyServiceUnprocessableEntity { + return &PutCompanyServiceUnprocessableEntity{} +} + +// PutCompanyServiceUnprocessableEntity describes a response with status code 422, with default header values. +// +// Unprocessable Entity, likely a bad parameter +type PutCompanyServiceUnprocessableEntity struct { + AccessControlAllowOrigin string + + Payload *research_models.Error +} + +// IsSuccess returns true when this put company service unprocessable entity response has a 2xx status code +func (o *PutCompanyServiceUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this put company service unprocessable entity response has a 3xx status code +func (o *PutCompanyServiceUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this put company service unprocessable entity response has a 4xx status code +func (o *PutCompanyServiceUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this put company service unprocessable entity response has a 5xx status code +func (o *PutCompanyServiceUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this put company service unprocessable entity response a status code equal to that given +func (o *PutCompanyServiceUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the put company service unprocessable entity response +func (o *PutCompanyServiceUnprocessableEntity) Code() int { + return 422 +} + +func (o *PutCompanyServiceUnprocessableEntity) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /companyservices][%d] putCompanyServiceUnprocessableEntity %s", 422, payload) +} + +func (o *PutCompanyServiceUnprocessableEntity) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /companyservices][%d] putCompanyServiceUnprocessableEntity %s", 422, payload) +} + +func (o *PutCompanyServiceUnprocessableEntity) GetPayload() *research_models.Error { + return o.Payload +} + +func (o *PutCompanyServiceUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + o.Payload = new(research_models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { + return err + } + + return nil +} + +// NewPutCompanyServiceInternalServerError creates a PutCompanyServiceInternalServerError with default headers values +func NewPutCompanyServiceInternalServerError() *PutCompanyServiceInternalServerError { + return &PutCompanyServiceInternalServerError{} +} + +// PutCompanyServiceInternalServerError describes a response with status code 500, with default header values. +// +// Server Internal Error +type PutCompanyServiceInternalServerError struct { + AccessControlAllowOrigin string + + Payload *research_models.Error +} + +// IsSuccess returns true when this put company service internal server error response has a 2xx status code +func (o *PutCompanyServiceInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this put company service internal server error response has a 3xx status code +func (o *PutCompanyServiceInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this put company service internal server error response has a 4xx status code +func (o *PutCompanyServiceInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this put company service internal server error response has a 5xx status code +func (o *PutCompanyServiceInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this put company service internal server error response a status code equal to that given +func (o *PutCompanyServiceInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the put company service internal server error response +func (o *PutCompanyServiceInternalServerError) Code() int { + return 500 +} + +func (o *PutCompanyServiceInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /companyservices][%d] putCompanyServiceInternalServerError %s", 500, payload) +} + +func (o *PutCompanyServiceInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /companyservices][%d] putCompanyServiceInternalServerError %s", 500, payload) +} + +func (o *PutCompanyServiceInternalServerError) GetPayload() *research_models.Error { + return o.Payload +} + +func (o *PutCompanyServiceInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + o.Payload = new(research_models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { + return err + } + + return nil +} diff --git a/api/research/research_client/insight_contract_test.go b/api/research/research_client/insight_contract_test.go index d47e34b..a9cc240 100644 --- a/api/research/research_client/insight_contract_test.go +++ b/api/research/research_client/insight_contract_test.go @@ -21,7 +21,7 @@ import ( "github.com/go-openapi/strfmt" ) -const researchV0716SpecSHA256 = "e7739ece74245709a8af8eab7bcffdbf1ab3e1be5763bc71a4c633b699d4df14" +const researchPR32SpecSHA256 = "c213fe19077453fcdc8f8ce3f6d1671cbbb5074f348c9e4ee0739f64ab0ebba3" type insightCaptureTransport struct { operation *openapiruntime.ClientOperation @@ -234,15 +234,15 @@ func TestGeneratedInsightSurfaceDoesNotInventUnsupportedOperations(t *testing.T) } } -func TestResearchSpecIsPinnedToDeployedV0716Contract(t *testing.T) { +func TestResearchSpecIsPinnedToProviderPR32Contract(t *testing.T) { repoRoot := insightRepoRoot(t) mainSpec, err := os.ReadFile(filepath.Join(repoRoot, "swagger", "research-vernonkeenan.yaml")) if err != nil { t.Fatalf("read Research spec: %v", err) } sum := sha256.Sum256(mainSpec) - if got := hex.EncodeToString(sum[:]); got != researchV0716SpecSHA256 { - t.Fatalf("Research spec drifted from deployed v0.7.16: SHA-256 = %s, want %s", got, researchV0716SpecSHA256) + if got := hex.EncodeToString(sum[:]); got != researchPR32SpecSHA256 { + t.Fatalf("Research spec drifted from provider PR #32: SHA-256 = %s, want %s", got, researchPR32SpecSHA256) } externalSpec, err := os.ReadFile(filepath.Join(repoRoot, "swagger", "external", "research-vernonkeenan.yaml")) diff --git a/docs/RESEARCH_COMPANY_CATALOG_CLIENT.md b/docs/RESEARCH_COMPANY_CATALOG_CLIENT.md new file mode 100644 index 0000000..f124e7a --- /dev/null +++ b/docs/RESEARCH_COMPANY_CATALOG_CLIENT.md @@ -0,0 +1,57 @@ +# Research company catalog client + +This slice synchronizes the full Research provider specification from +`vernonkeenan/research` draft PR #32 at provider commit +`ca6a2911ce79d053f9aa338e6d9bcfe3357b0c77`. The pinned internal spec SHA-256 +is `c213fe19077453fcdc8f8ce3f6d1671cbbb5074f348c9e4ee0739f64ab0ebba3`; +the external copy differs only by Lib's conventional scheme, host, and base +path rewrite. + +The generated CompanyProduct surface contains: + +- shared list/detail through `GET /companyproducts`; +- safe tenant-attributed create through `POST /companyproducts`; and +- no direct update or delete. + +The generated CompanyService surface contains: + +- shared list/detail through `GET /companyservices`; +- safe tenant-owned create through `POST /companyservices`; +- optimistic-concurrency update through `PUT /companyservices`; and +- no delete. + +Every operation retains one compound security alternative containing both +`ApiKeyAuth` and `kvSessionCookie`. Callers supply one +`runtime.ClientAuthInfoWriter` that writes the native service credential and +forwards only the `kvSession` cookie. Credential values do not enter the +generated models, source, tests, or logs. + +Product update remains intentionally proposal-only. The separate generated +proposal client records, submits, and independently reviews Product changes; +review does not itself apply or publish the authoritative Product. This Lib +slice does not invent application, publication, bulk, media-ownership, or +delete operations. + +## Dependency and release gate + +This Lib PR may be reviewed while Research PR #32 is open, but it must not be +released until: + +1. Research PR #32 is merged, released, and deployed; +2. the KV Studio native service principal has the exact governed scopes + `research:company-product:read`, `research:company-product:create`, + `research:company-service:read`, `research:company-service:create`, and + `research:company-service:update`; +3. Research production smoke tests prove the native catalog paths and zero + Salesforce reads or writes; and +4. KV Studio is ready to pin the new Lib tag, preserve the Product proposal + workflow, and run its Playwright list/detail/create/Service-edit coverage. + +There is no database migration in this client slice. Research remains +responsible for proving ownership through the existing +`research.companyproduct`, `research.companyservice`, and +`crm.account.tenantid` contracts. Any future schema change must use the +governed database runner and its own recovery plan. + +This slice grants no scope, changes no credential, creates no Lib release, and +performs no deployment. diff --git a/go.mod b/go.mod index 19cd0e1..c319546 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,7 @@ go 1.25.0 require ( github.com/go-openapi/errors v0.22.8 + github.com/go-openapi/loads v0.24.0 github.com/go-openapi/runtime v0.32.4 github.com/go-openapi/strfmt v0.26.3 github.com/go-openapi/swag/conv v0.27.0 @@ -26,7 +27,6 @@ require ( github.com/go-openapi/analysis v0.25.2 // indirect github.com/go-openapi/jsonpointer v0.23.1 // indirect github.com/go-openapi/jsonreference v0.21.6 // indirect - github.com/go-openapi/loads v0.24.0 // indirect github.com/go-openapi/runtime/server-middleware v0.30.0 // indirect github.com/go-openapi/spec v0.22.6 // indirect github.com/go-openapi/swag/fileutils v0.26.1 // indirect diff --git a/swagger/external/research-vernonkeenan.yaml b/swagger/external/research-vernonkeenan.yaml index dfb4e14..ff8f585 100644 --- a/swagger/external/research-vernonkeenan.yaml +++ b/swagger/external/research-vernonkeenan.yaml @@ -399,31 +399,8 @@ paths: tags: - CompanyCategories /companyservices: - delete: - description: Delete CompanyService record - operationId: deleteCompanyService - parameters: - - $ref: "#/parameters/companyServiceIdQuery" - responses: - "200": - $ref: "#/responses/DeleteResponse" - "401": - $ref: "#/responses/Unauthorized" - "403": - $ref: "#/responses/AccessForbidden" - "404": - $ref: "#/responses/NotFound" - "422": - $ref: "#/responses/UnprocessableEntity" - "500": - $ref: "#/responses/ServerError" - security: - - ApiKeyAuth: [] - summary: Delete a CompanyService - tags: - - CompanyServices get: - description: Return a list of all available CompanyServices + description: Return CompanyServices under compound native service and same-tenant human authentication; requires research:company-service:read operationId: getCompanyServices parameters: - $ref: "#/parameters/limitQuery" @@ -446,11 +423,12 @@ paths: $ref: "#/responses/ServerError" security: - ApiKeyAuth: [] + kvSessionCookie: [] summary: Get a list of company services tags: - CompanyServices post: - description: Create a new CompanyService record + description: Create one unpublished CompanyService beneath an Account owned by the machine tenant; requires research:company-service:create and same-tenant Owner or Manager operationId: postCompanyServices parameters: - $ref: "#/parameters/companyServiceRequest" @@ -469,35 +447,39 @@ paths: $ref: "#/responses/ServerError" security: - ApiKeyAuth: [] + kvSessionCookie: [] summary: Create a new CompanyService tags: - CompanyServices - /companyproducts: - delete: - description: Delete CompanyProduct record - operationId: deleteCompanyProduct + put: + description: Replace the editable fields of one tenant-owned CompanyService using optimistic concurrency while preserving publication, enrichment audit, and media ownership; requires research:company-service:update and same-tenant Owner or Manager + operationId: putCompanyService parameters: - - $ref: "#/parameters/companyProductIdQuery" + - $ref: "#/parameters/companyServiceRequest" responses: "200": - $ref: "#/responses/DeleteResponse" + $ref: "#/responses/CompanyServiceResponse" "401": $ref: "#/responses/Unauthorized" "403": $ref: "#/responses/AccessForbidden" "404": $ref: "#/responses/NotFound" + "409": + $ref: "#/responses/Conflict" "422": $ref: "#/responses/UnprocessableEntity" "500": $ref: "#/responses/ServerError" security: - ApiKeyAuth: [] - summary: Delete a CompanyProduct + kvSessionCookie: [] + summary: Update one tenant-owned CompanyService tags: - - CompanyProducts + - CompanyServices + /companyproducts: get: - description: Return a list of all available CompanyProducts + description: Return CompanyProducts under compound native service and same-tenant human authentication; requires research:company-product:read operationId: getCompanyProducts parameters: - $ref: "#/parameters/limitQuery" @@ -521,11 +503,12 @@ paths: $ref: "#/responses/ServerError" security: - ApiKeyAuth: [] + kvSessionCookie: [] summary: Get a list of companyproducts tags: - CompanyProducts post: - description: CompanyProduct record to be added + description: Create one unpublished CompanyProduct beneath an Account owned by the machine tenant; requires research:company-product:create and same-tenant Owner or Manager. Existing Product updates remain proposal-only. operationId: postCompanyProducts parameters: - $ref: "#/parameters/companyProductRequest" @@ -544,30 +527,8 @@ paths: $ref: "#/responses/ServerError" security: - ApiKeyAuth: [] - summary: Add a new companyproduct to SalesforceDevops.net - tags: - - CompanyProducts - put: - description: Update companyproduct records - operationId: putCompanyProduct - parameters: - - $ref: "#/parameters/companyProductRequest" - responses: - "200": - $ref: "#/responses/CompanyProductResponse" - "401": - $ref: "#/responses/Unauthorized" - "403": - $ref: "#/responses/AccessForbidden" - "404": - $ref: "#/responses/NotFound" - "422": - $ref: "#/responses/UnprocessableEntity" - "500": - $ref: "#/responses/ServerError" - security: - - ApiKeyAuth: [] - summary: Update a single companyproduct + kvSessionCookie: [] + summary: Create one tenant-owned CompanyProduct tags: - CompanyProducts /companyproductproposals: diff --git a/swagger/research-vernonkeenan.yaml b/swagger/research-vernonkeenan.yaml index ceb98d0..02f068b 100644 --- a/swagger/research-vernonkeenan.yaml +++ b/swagger/research-vernonkeenan.yaml @@ -399,31 +399,8 @@ paths: tags: - CompanyCategories /companyservices: - delete: - description: Delete CompanyService record - operationId: deleteCompanyService - parameters: - - $ref: "#/parameters/companyServiceIdQuery" - responses: - "200": - $ref: "#/responses/DeleteResponse" - "401": - $ref: "#/responses/Unauthorized" - "403": - $ref: "#/responses/AccessForbidden" - "404": - $ref: "#/responses/NotFound" - "422": - $ref: "#/responses/UnprocessableEntity" - "500": - $ref: "#/responses/ServerError" - security: - - ApiKeyAuth: [] - summary: Delete a CompanyService - tags: - - CompanyServices get: - description: Return a list of all available CompanyServices + description: Return CompanyServices under compound native service and same-tenant human authentication; requires research:company-service:read operationId: getCompanyServices parameters: - $ref: "#/parameters/limitQuery" @@ -446,11 +423,12 @@ paths: $ref: "#/responses/ServerError" security: - ApiKeyAuth: [] + kvSessionCookie: [] summary: Get a list of company services tags: - CompanyServices post: - description: Create a new CompanyService record + description: Create one unpublished CompanyService beneath an Account owned by the machine tenant; requires research:company-service:create and same-tenant Owner or Manager operationId: postCompanyServices parameters: - $ref: "#/parameters/companyServiceRequest" @@ -469,35 +447,39 @@ paths: $ref: "#/responses/ServerError" security: - ApiKeyAuth: [] + kvSessionCookie: [] summary: Create a new CompanyService tags: - CompanyServices - /companyproducts: - delete: - description: Delete CompanyProduct record - operationId: deleteCompanyProduct + put: + description: Replace the editable fields of one tenant-owned CompanyService using optimistic concurrency while preserving publication, enrichment audit, and media ownership; requires research:company-service:update and same-tenant Owner or Manager + operationId: putCompanyService parameters: - - $ref: "#/parameters/companyProductIdQuery" + - $ref: "#/parameters/companyServiceRequest" responses: "200": - $ref: "#/responses/DeleteResponse" + $ref: "#/responses/CompanyServiceResponse" "401": $ref: "#/responses/Unauthorized" "403": $ref: "#/responses/AccessForbidden" "404": $ref: "#/responses/NotFound" + "409": + $ref: "#/responses/Conflict" "422": $ref: "#/responses/UnprocessableEntity" "500": $ref: "#/responses/ServerError" security: - ApiKeyAuth: [] - summary: Delete a CompanyProduct + kvSessionCookie: [] + summary: Update one tenant-owned CompanyService tags: - - CompanyProducts + - CompanyServices + /companyproducts: get: - description: Return a list of all available CompanyProducts + description: Return CompanyProducts under compound native service and same-tenant human authentication; requires research:company-product:read operationId: getCompanyProducts parameters: - $ref: "#/parameters/limitQuery" @@ -521,11 +503,12 @@ paths: $ref: "#/responses/ServerError" security: - ApiKeyAuth: [] + kvSessionCookie: [] summary: Get a list of companyproducts tags: - CompanyProducts post: - description: CompanyProduct record to be added + description: Create one unpublished CompanyProduct beneath an Account owned by the machine tenant; requires research:company-product:create and same-tenant Owner or Manager. Existing Product updates remain proposal-only. operationId: postCompanyProducts parameters: - $ref: "#/parameters/companyProductRequest" @@ -544,30 +527,8 @@ paths: $ref: "#/responses/ServerError" security: - ApiKeyAuth: [] - summary: Add a new companyproduct to SalesforceDevops.net - tags: - - CompanyProducts - put: - description: Update companyproduct records - operationId: putCompanyProduct - parameters: - - $ref: "#/parameters/companyProductRequest" - responses: - "200": - $ref: "#/responses/CompanyProductResponse" - "401": - $ref: "#/responses/Unauthorized" - "403": - $ref: "#/responses/AccessForbidden" - "404": - $ref: "#/responses/NotFound" - "422": - $ref: "#/responses/UnprocessableEntity" - "500": - $ref: "#/responses/ServerError" - security: - - ApiKeyAuth: [] - summary: Update a single companyproduct + kvSessionCookie: [] + summary: Create one tenant-owned CompanyProduct tags: - CompanyProducts /companyproductproposals: