feat(stash): add read-only PDF metadata clients (#21)

Add sanitized Stash PDF metadata list/get clients and remove stale mutation client artifacts. Release remains gated on DB tenancy, exact read scope, canonical tenant config, and no-write smoke.
agent/lib-research-company-catalog-clients
Vernon Keenan 2026-07-23 23:37:38 -07:00 committed by GitHub
parent e512c18849
commit 8e38232555
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
21 changed files with 2165 additions and 1062 deletions

View File

@ -24,6 +24,11 @@ or PR number is invented.
breaking release.
### Added
- Added a generated, read-only Stash PDF metadata client for bounded list and
tenant-scoped get operations from Stash draft PR #16. A pinned consumer
projection exposes only `ID`, `Filename`, `Title`, and `URI`, preserves
compound native-principal plus `kvSession` authentication, and omits all
create/render/update/delete operations and models.
- Regenerated the Members Go client and synchronized Members Swagger copies
for the governed shared-portal backend contract, including catalog, plan,
subscription, entitlement, authorized-client, scope, and effective-

View File

@ -13,9 +13,11 @@ install-swagger:
./scripts/release.sh install-swagger
# Regenerate api/ clients from the sibling service specs (../{auth,crm,stash,
# sf-gate,research,members,plex}/swagger/*.yaml). Requires the sibling repos
# to be cloned adjacently (same prerequisite the old README ritual had).
# Review and commit the result as its own PR before `make release`.
# sf-gate,research,members,plex}/swagger/*.yaml). Stash code is narrowed by
# swagger/client/stash-pdf-metadata.yaml to its governed read-only consumer
# surface. Requires the sibling repos to be cloned adjacently (same
# prerequisite the old README ritual had). Review and commit the result as
# its own PR before `make release`.
regen: install-swagger
./scripts/release.sh regen

View File

@ -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-swaggergenerated typed clients + models, one directory per sibling service, regenerated from that service's own spec |
| `api/{auth,crm,members,plex,research,sfgate,stash}/` | go-swaggergenerated typed clients + models, one directory per sibling service. Stash is intentionally generated from the read-only PDF metadata projection described below. |
| `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
@ -80,6 +80,15 @@ missing. Review `git status`/`git diff`, commit, open a PR, and merge it to
release step; `make regen` runs a non-fatal `go build ./...` at the end as
an early warning, but the real gate is CI on that PR.
Stash is the deliberate exception to full provider-spec client generation.
The complete provider spec is still synchronized for documentation, while
client code is generated from
`swagger/client/stash-pdf-metadata.yaml`. That projection exposes only the
tenant-scoped PDF metadata list/get operations and four sanitized response
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.
**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

View File

@ -0,0 +1,388 @@
package stash_client_test
import (
"context"
"encoding/json"
"net/http"
"net/url"
"os"
"path/filepath"
"reflect"
"regexp"
"runtime"
"strings"
"testing"
"time"
openapiruntime "github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/stash/stash_client/stash_pdf"
"code.tnxs.net/vernonkeenan/lib/api/stash/stash_models"
)
type pdfMetadataCaptureTransport struct {
operation *openapiruntime.ClientOperation
}
func (transport *pdfMetadataCaptureTransport) Submit(
operation *openapiruntime.ClientOperation,
) (any, error) {
return transport.SubmitContext(context.Background(), operation)
}
func (transport *pdfMetadataCaptureTransport) SubmitContext(
_ context.Context,
operation *openapiruntime.ClientOperation,
) (any, error) {
transport.operation = operation
switch operation.ID {
case "listPdfs":
return stash_pdf.NewListPdfsOK(), nil
case "getPdfs":
return stash_pdf.NewGetPdfsOK(), nil
default:
panic("unexpected generated Stash PDF operation: " + operation.ID)
}
}
type pdfMetadataRequest struct {
headers http.Header
query url.Values
path map[string]string
timeout time.Duration
}
func newPDFMetadataRequest() *pdfMetadataRequest {
return &pdfMetadataRequest{
headers: make(http.Header),
query: make(url.Values),
path: make(map[string]string),
}
}
func (request *pdfMetadataRequest) SetHeaderParam(name string, values ...string) error {
request.headers.Del(name)
for _, value := range values {
request.headers.Add(name, value)
}
return nil
}
func (request *pdfMetadataRequest) GetHeaderParams() http.Header {
return request.headers
}
func (request *pdfMetadataRequest) SetQueryParam(name string, values ...string) error {
request.query[name] = append([]string(nil), values...)
return nil
}
func (request *pdfMetadataRequest) SetFormParam(string, ...string) error {
return nil
}
func (request *pdfMetadataRequest) SetPathParam(name, value string) error {
request.path[name] = value
return nil
}
func (request *pdfMetadataRequest) GetQueryParams() url.Values {
return request.query
}
func (request *pdfMetadataRequest) SetFileParam(string, ...openapiruntime.NamedReadCloser) error {
return nil
}
func (request *pdfMetadataRequest) SetBodyParam(any) error {
return nil
}
func (request *pdfMetadataRequest) SetTimeout(timeout time.Duration) error {
request.timeout = timeout
return nil
}
func (request *pdfMetadataRequest) GetMethod() string {
return ""
}
func (request *pdfMetadataRequest) GetPath() string {
return ""
}
func (request *pdfMetadataRequest) GetBody() []byte {
return nil
}
func (request *pdfMetadataRequest) GetBodyParam() any {
return nil
}
func (request *pdfMetadataRequest) GetFileParam() map[string][]openapiruntime.NamedReadCloser {
return nil
}
func compoundPDFMetadataAuth(apiKey, session string) openapiruntime.ClientAuthInfoWriter {
return openapiruntime.ClientAuthInfoWriterFunc(
func(request openapiruntime.ClientRequest, _ strfmt.Registry) error {
if err := request.SetHeaderParam("X-API-Key", apiKey); err != nil {
return err
}
return request.SetHeaderParam("Cookie", "kvSession="+session)
},
)
}
func TestGeneratedPDFMetadataOperationContract(t *testing.T) {
auth := compoundPDFMetadataAuth("fixture-api-key", "fixture-session")
tests := []struct {
name string
wantID string
wantMethod string
wantPath string
call func(openapiruntime.ContextualTransport) error
}{
{
name: "list",
wantID: "listPdfs",
wantMethod: http.MethodGet,
wantPath: "/pdfs",
call: func(transport openapiruntime.ContextualTransport) error {
_, err := stash_pdf.New(transport, strfmt.Default).ListPdfs(
stash_pdf.NewListPdfsParams(), auth,
)
return err
},
},
{
name: "get",
wantID: "getPdfs",
wantMethod: http.MethodGet,
wantPath: "/pdfs/{pdfId}",
call: func(transport openapiruntime.ContextualTransport) error {
_, err := stash_pdf.New(transport, strfmt.Default).GetPdfs(
stash_pdf.NewGetPdfsParams().WithPdfID("pdf-fixture"), auth,
)
return err
},
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
transport := &pdfMetadataCaptureTransport{}
if err := test.call(transport); err != nil {
t.Fatalf("generated client operation failed: %v", err)
}
if transport.operation == nil {
t.Fatal("generated client did not submit an operation")
}
if transport.operation.ID != test.wantID {
t.Errorf("operation ID = %q, want %q", transport.operation.ID, test.wantID)
}
if transport.operation.Method != test.wantMethod {
t.Errorf("method = %q, want %q", transport.operation.Method, test.wantMethod)
}
if transport.operation.PathPattern != test.wantPath {
t.Errorf("path = %q, want %q", transport.operation.PathPattern, test.wantPath)
}
if transport.operation.AuthInfo == nil {
t.Fatal("generated operation discarded compound auth writer")
}
request := newPDFMetadataRequest()
if err := transport.operation.AuthInfo.AuthenticateRequest(request, strfmt.Default); err != nil {
t.Fatalf("authenticate request: %v", err)
}
if got := request.headers.Get("X-API-Key"); got != "fixture-api-key" {
t.Errorf("X-API-Key = %q, want fixture value", got)
}
if got := request.headers.Get("Cookie"); got != "kvSession=fixture-session" {
t.Errorf("Cookie = %q, want only kvSession", got)
}
if len(request.headers) != 2 {
t.Errorf("compound auth wrote unexpected headers: %v", request.headers)
}
})
}
}
func TestGeneratedPDFMetadataParameters(t *testing.T) {
limit, offset := int64(100), int64(10000)
listRequest := newPDFMetadataRequest()
if err := stash_pdf.NewListPdfsParams().
WithLimit(&limit).
WithOffset(&offset).
WriteToRequest(listRequest, strfmt.Default); err != nil {
t.Fatalf("write list params: %v", err)
}
if got := listRequest.query.Get("limit"); got != "100" {
t.Errorf("limit = %q, want 100", got)
}
if got := listRequest.query.Get("offset"); got != "10000" {
t.Errorf("offset = %q, want 10000", got)
}
getRequest := newPDFMetadataRequest()
if err := stash_pdf.NewGetPdfsParams().
WithPdfID("pdf-fixture").
WriteToRequest(getRequest, strfmt.Default); err != nil {
t.Fatalf("write get params: %v", err)
}
if got := getRequest.path["pdfId"]; got != "pdf-fixture" {
t.Errorf("pdfId = %q, want fixture value", got)
}
}
func TestPDFMetadataModelIsSanitized(t *testing.T) {
modelType := reflect.TypeOf(stash_models.Document{})
wantFields := map[string]string{
"Filename": "string",
"ID": "string",
"Title": "string",
"URI": "string",
}
if modelType.NumField() != len(wantFields) {
t.Fatalf("Document has %d fields, want %d", modelType.NumField(), len(wantFields))
}
for fieldName, wantType := range wantFields {
field, exists := modelType.FieldByName(fieldName)
if !exists {
t.Errorf("Document is missing %s", fieldName)
continue
}
if got := field.Type.String(); got != wantType {
t.Errorf("Document.%s type = %s, want %s", fieldName, got, wantType)
}
}
encoded, err := json.Marshal(stash_models.Document{
ID: "pdf-fixture",
Filename: "fixture.pdf",
Title: "Fixture",
URI: "/fixture.pdf",
})
if err != nil {
t.Fatalf("marshal Document: %v", err)
}
for _, forbidden := range []string{
"HTML", "PDF", "ParentID", "SagaType", "OwnerID", "CreatedByID", "TenantID",
} {
if strings.Contains(string(encoded), forbidden) {
t.Errorf("sanitized metadata encoded forbidden field %q: %s", forbidden, encoded)
}
}
}
func TestGeneratedPDFMetadataSurfaceIsReadOnly(t *testing.T) {
clientType := reflect.TypeOf((*stash_pdf.ClientService)(nil)).Elem()
for index := 0; index < clientType.NumMethod(); index++ {
method := clientType.Method(index).Name
for _, forbiddenPrefix := range []string{
"Post", "Put", "Patch", "Delete", "Create", "Render", "Update",
} {
if strings.HasPrefix(method, forbiddenPrefix) {
t.Errorf("Stash PDF metadata client exposes mutation method %s", method)
}
}
}
repoRoot := pdfMetadataRepoRoot(t)
removed := []string{
filepath.Join(repoRoot, "api", "stash", "stash_client", "stash_pdf", "post_pdfs_parameters.go"),
filepath.Join(repoRoot, "api", "stash", "stash_client", "stash_pdf", "post_pdfs_responses.go"),
filepath.Join(repoRoot, "api", "stash", "stash_models", "new_p_d_f.go"),
filepath.Join(repoRoot, "api", "stash", "stash_models", "p_d_f_request.go"),
filepath.Join(repoRoot, "api", "stash", "stash_models", "request_meta.go"),
}
for _, path := range removed {
if _, err := os.Stat(path); !os.IsNotExist(err) {
t.Errorf("legacy mutation artifact still exists: %s", path)
}
}
}
func TestPDFMetadataProjectionPinsCompoundAuthAndBounds(t *testing.T) {
specText := readPDFMetadataProjection(t)
required := []string{
"x-provider-pr: \"vernonkeenan/stash#16\"",
"x-provider-head: \"b2f5b4a6ae5ff507dfdc86bb7b9ee5a9bb924131\"",
"operationId: listPdfs",
"operationId: getPdfs",
"maximum: 100",
"maximum: 10000",
" - ApiKeyAuth: []\n kvSessionCookie: []",
}
for _, fragment := range required {
if !strings.Contains(specText, fragment) {
t.Errorf("client projection is missing %q", fragment)
}
}
for _, forbidden := range []string{
"\n post:", "\n put:", "\n patch:", "\n delete:",
"HTML:", "PDF:", "OwnerID:", "ParentID:", "SagaType:",
} {
if strings.Contains(specText, forbidden) {
t.Errorf("client projection exposes forbidden contract fragment %q", forbidden)
}
}
}
func TestGeneratedPDFMetadataSurfaceHasNoExternalBypassOrSecrets(t *testing.T) {
repoRoot := pdfMetadataRepoRoot(t)
target := filepath.Join(repoRoot, "api", "stash")
credentialLiteral := regexp.MustCompile(
`(?i)(api[_-]?key|password|secret)\s*[:=]\s*["'][^"']+["']`,
)
err := filepath.WalkDir(target, func(path string, entry os.DirEntry, walkErr error) error {
if walkErr != nil {
return walkErr
}
if entry.IsDir() || !strings.HasSuffix(path, ".go") ||
strings.HasSuffix(path, "_test.go") {
return nil
}
content, err := os.ReadFile(path)
if err != nil {
return err
}
lower := strings.ToLower(string(content))
for _, forbidden := range []string{
"salesforce", "sf-gate", "go-force", "private key-----",
"postpdf", "putpdf", "deletepdf", "renderpdf",
} {
if strings.Contains(lower, forbidden) {
t.Errorf("%s contains forbidden boundary %q", path, forbidden)
}
}
if credentialLiteral.Match(content) {
t.Errorf("%s contains a credential-shaped literal", path)
}
return nil
})
if err != nil {
t.Fatalf("scan generated Stash target: %v", err)
}
}
func pdfMetadataRepoRoot(t *testing.T) string {
t.Helper()
_, sourceFile, _, ok := runtime.Caller(0)
if !ok {
t.Fatal("resolve test source path")
}
return filepath.Clean(filepath.Join(filepath.Dir(sourceFile), "..", "..", ".."))
}
func readPDFMetadataProjection(t *testing.T) string {
t.Helper()
content, err := os.ReadFile(filepath.Join(
pdfMetadataRepoRoot(t), "swagger", "client", "stash-pdf-metadata.yaml",
))
if err != nil {
t.Fatalf("read Stash PDF metadata projection: %v", err)
}
return string(content)
}

View File

@ -0,0 +1,158 @@
// 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 stash_pdf
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"
)
// NewGetPdfsParams creates a new GetPdfsParams 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 NewGetPdfsParams() *GetPdfsParams {
return NewGetPdfsParamsWithTimeout(cr.DefaultTimeout)
}
// NewGetPdfsParamsWithTimeout creates a new GetPdfsParams object
// with the ability to set a timeout on a request.
func NewGetPdfsParamsWithTimeout(timeout time.Duration) *GetPdfsParams {
return &GetPdfsParams{
inner: innerParams{
timeout: timeout,
},
}
}
// NewGetPdfsParamsWithContext creates a new GetPdfsParams object
// with the ability to set a context for a request.
//
// Deprecated: use the operation call with context to pass the context instead of [GetPdfsParams].
func NewGetPdfsParamsWithContext(ctx context.Context) *GetPdfsParams {
return &GetPdfsParams{
inner: innerParams{
ctx: ctx,
},
}
}
// NewGetPdfsParamsWithHTTPClient creates a new GetPdfsParams object
// with the ability to set a custom HTTPClient for a request.
func NewGetPdfsParamsWithHTTPClient(client *http.Client) *GetPdfsParams {
return &GetPdfsParams{
HTTPClient: client,
}
}
/*
GetPdfsParams contains all the parameters to send to the API endpoint
for the get pdfs operation.
Typically these are written to a http.Request.
*/
type GetPdfsParams struct {
// PdfID.
//
// PDF record ID
PdfID string
HTTPClient *http.Client
inner innerParams
}
// WithDefaults hydrates default values in the get pdfs params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetPdfsParams) WithDefaults() *GetPdfsParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the get pdfs params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetPdfsParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the get pdfs params.
func (o *GetPdfsParams) WithTimeout(timeout time.Duration) *GetPdfsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get pdfs params.
func (o *GetPdfsParams) SetTimeout(timeout time.Duration) {
o.inner.timeout = timeout
}
// WithContext adds the context to the get pdfs params.
//
// Deprecated: use the operation call with context to pass the context instead of [GetPdfsParams].
func (o *GetPdfsParams) WithContext(ctx context.Context) *GetPdfsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get pdfs params.
//
// Deprecated: use the operation call with context to pass the context instead of [GetPdfsParams].
func (o *GetPdfsParams) SetContext(ctx context.Context) {
o.inner.ctx = ctx
}
// WithHTTPClient adds the HTTPClient to the get pdfs params.
func (o *GetPdfsParams) WithHTTPClient(client *http.Client) *GetPdfsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get pdfs params.
func (o *GetPdfsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithPdfID adds the pdfID to the get pdfs params.
func (o *GetPdfsParams) WithPdfID(pdfID string) *GetPdfsParams {
o.SetPdfID(pdfID)
return o
}
// SetPdfID adds the pdfId to the get pdfs params.
func (o *GetPdfsParams) SetPdfID(pdfID string) {
o.PdfID = pdfID
}
// WriteToRequest writes these params to a [runtime.ClientRequest].
func (o *GetPdfsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.inner.timeout); err != nil {
return err
}
var res []error
// path param pdfId
if err := r.SetPathParam("pdfId", o.PdfID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -0,0 +1,475 @@
// 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 stash_pdf
import (
"encoding/json"
stderrors "errors"
"fmt"
"io"
"code.tnxs.net/vernonkeenan/lib/api/stash/stash_models"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
)
// GetPdfsReader is a Reader for the GetPdfs structure.
type GetPdfsReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetPdfsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
switch response.Code() {
case 200:
result := NewGetPdfsOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 401:
result := NewGetPdfsUnauthorized()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 403:
result := NewGetPdfsForbidden()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewGetPdfsNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 422:
result := NewGetPdfsUnprocessableEntity()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewGetPdfsInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("[GET /pdfs/{pdfId}] getPdfs", response, response.Code())
}
}
// NewGetPdfsOK creates a GetPdfsOK with default headers values
func NewGetPdfsOK() *GetPdfsOK {
return &GetPdfsOK{}
}
// GetPdfsOK describes a response with status code 200, with default header values.
//
// Sanitized PDF metadata response
type GetPdfsOK struct {
Payload *stash_models.DocumentResponse
}
// IsSuccess returns true when this get pdfs o k response has a 2xx status code
func (o *GetPdfsOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this get pdfs o k response has a 3xx status code
func (o *GetPdfsOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this get pdfs o k response has a 4xx status code
func (o *GetPdfsOK) IsClientError() bool {
return false
}
// IsServerError returns true when this get pdfs o k response has a 5xx status code
func (o *GetPdfsOK) IsServerError() bool {
return false
}
// IsCode returns true when this get pdfs o k response a status code equal to that given
func (o *GetPdfsOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the get pdfs o k response
func (o *GetPdfsOK) Code() int {
return 200
}
func (o *GetPdfsOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /pdfs/{pdfId}][%d] getPdfsOK %s", 200, payload)
}
func (o *GetPdfsOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /pdfs/{pdfId}][%d] getPdfsOK %s", 200, payload)
}
func (o *GetPdfsOK) GetPayload() *stash_models.DocumentResponse {
return o.Payload
}
func (o *GetPdfsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(stash_models.DocumentResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
return nil
}
// NewGetPdfsUnauthorized creates a GetPdfsUnauthorized with default headers values
func NewGetPdfsUnauthorized() *GetPdfsUnauthorized {
return &GetPdfsUnauthorized{}
}
// GetPdfsUnauthorized describes a response with status code 401, with default header values.
//
// Access Unauthorized, invalid API-KEY was used
type GetPdfsUnauthorized struct {
Payload *stash_models.Error
}
// IsSuccess returns true when this get pdfs unauthorized response has a 2xx status code
func (o *GetPdfsUnauthorized) IsSuccess() bool {
return false
}
// IsRedirect returns true when this get pdfs unauthorized response has a 3xx status code
func (o *GetPdfsUnauthorized) IsRedirect() bool {
return false
}
// IsClientError returns true when this get pdfs unauthorized response has a 4xx status code
func (o *GetPdfsUnauthorized) IsClientError() bool {
return true
}
// IsServerError returns true when this get pdfs unauthorized response has a 5xx status code
func (o *GetPdfsUnauthorized) IsServerError() bool {
return false
}
// IsCode returns true when this get pdfs unauthorized response a status code equal to that given
func (o *GetPdfsUnauthorized) IsCode(code int) bool {
return code == 401
}
// Code gets the status code for the get pdfs unauthorized response
func (o *GetPdfsUnauthorized) Code() int {
return 401
}
func (o *GetPdfsUnauthorized) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /pdfs/{pdfId}][%d] getPdfsUnauthorized %s", 401, payload)
}
func (o *GetPdfsUnauthorized) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /pdfs/{pdfId}][%d] getPdfsUnauthorized %s", 401, payload)
}
func (o *GetPdfsUnauthorized) GetPayload() *stash_models.Error {
return o.Payload
}
func (o *GetPdfsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(stash_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
return nil
}
// NewGetPdfsForbidden creates a GetPdfsForbidden with default headers values
func NewGetPdfsForbidden() *GetPdfsForbidden {
return &GetPdfsForbidden{}
}
// GetPdfsForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
type GetPdfsForbidden struct {
Payload *stash_models.Error
}
// IsSuccess returns true when this get pdfs forbidden response has a 2xx status code
func (o *GetPdfsForbidden) IsSuccess() bool {
return false
}
// IsRedirect returns true when this get pdfs forbidden response has a 3xx status code
func (o *GetPdfsForbidden) IsRedirect() bool {
return false
}
// IsClientError returns true when this get pdfs forbidden response has a 4xx status code
func (o *GetPdfsForbidden) IsClientError() bool {
return true
}
// IsServerError returns true when this get pdfs forbidden response has a 5xx status code
func (o *GetPdfsForbidden) IsServerError() bool {
return false
}
// IsCode returns true when this get pdfs forbidden response a status code equal to that given
func (o *GetPdfsForbidden) IsCode(code int) bool {
return code == 403
}
// Code gets the status code for the get pdfs forbidden response
func (o *GetPdfsForbidden) Code() int {
return 403
}
func (o *GetPdfsForbidden) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /pdfs/{pdfId}][%d] getPdfsForbidden %s", 403, payload)
}
func (o *GetPdfsForbidden) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /pdfs/{pdfId}][%d] getPdfsForbidden %s", 403, payload)
}
func (o *GetPdfsForbidden) GetPayload() *stash_models.Error {
return o.Payload
}
func (o *GetPdfsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(stash_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
return nil
}
// NewGetPdfsNotFound creates a GetPdfsNotFound with default headers values
func NewGetPdfsNotFound() *GetPdfsNotFound {
return &GetPdfsNotFound{}
}
// GetPdfsNotFound describes a response with status code 404, with default header values.
//
// Resource was not found
type GetPdfsNotFound struct {
Payload *stash_models.Error
}
// IsSuccess returns true when this get pdfs not found response has a 2xx status code
func (o *GetPdfsNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this get pdfs not found response has a 3xx status code
func (o *GetPdfsNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this get pdfs not found response has a 4xx status code
func (o *GetPdfsNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this get pdfs not found response has a 5xx status code
func (o *GetPdfsNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this get pdfs not found response a status code equal to that given
func (o *GetPdfsNotFound) IsCode(code int) bool {
return code == 404
}
// Code gets the status code for the get pdfs not found response
func (o *GetPdfsNotFound) Code() int {
return 404
}
func (o *GetPdfsNotFound) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /pdfs/{pdfId}][%d] getPdfsNotFound %s", 404, payload)
}
func (o *GetPdfsNotFound) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /pdfs/{pdfId}][%d] getPdfsNotFound %s", 404, payload)
}
func (o *GetPdfsNotFound) GetPayload() *stash_models.Error {
return o.Payload
}
func (o *GetPdfsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(stash_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
return nil
}
// NewGetPdfsUnprocessableEntity creates a GetPdfsUnprocessableEntity with default headers values
func NewGetPdfsUnprocessableEntity() *GetPdfsUnprocessableEntity {
return &GetPdfsUnprocessableEntity{}
}
// GetPdfsUnprocessableEntity describes a response with status code 422, with default header values.
//
// Unprocessable Entity, likely a bad parameter
type GetPdfsUnprocessableEntity struct {
Payload *stash_models.Error
}
// IsSuccess returns true when this get pdfs unprocessable entity response has a 2xx status code
func (o *GetPdfsUnprocessableEntity) IsSuccess() bool {
return false
}
// IsRedirect returns true when this get pdfs unprocessable entity response has a 3xx status code
func (o *GetPdfsUnprocessableEntity) IsRedirect() bool {
return false
}
// IsClientError returns true when this get pdfs unprocessable entity response has a 4xx status code
func (o *GetPdfsUnprocessableEntity) IsClientError() bool {
return true
}
// IsServerError returns true when this get pdfs unprocessable entity response has a 5xx status code
func (o *GetPdfsUnprocessableEntity) IsServerError() bool {
return false
}
// IsCode returns true when this get pdfs unprocessable entity response a status code equal to that given
func (o *GetPdfsUnprocessableEntity) IsCode(code int) bool {
return code == 422
}
// Code gets the status code for the get pdfs unprocessable entity response
func (o *GetPdfsUnprocessableEntity) Code() int {
return 422
}
func (o *GetPdfsUnprocessableEntity) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /pdfs/{pdfId}][%d] getPdfsUnprocessableEntity %s", 422, payload)
}
func (o *GetPdfsUnprocessableEntity) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /pdfs/{pdfId}][%d] getPdfsUnprocessableEntity %s", 422, payload)
}
func (o *GetPdfsUnprocessableEntity) GetPayload() *stash_models.Error {
return o.Payload
}
func (o *GetPdfsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(stash_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
return nil
}
// NewGetPdfsInternalServerError creates a GetPdfsInternalServerError with default headers values
func NewGetPdfsInternalServerError() *GetPdfsInternalServerError {
return &GetPdfsInternalServerError{}
}
// GetPdfsInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
type GetPdfsInternalServerError struct {
Payload *stash_models.Error
}
// IsSuccess returns true when this get pdfs internal server error response has a 2xx status code
func (o *GetPdfsInternalServerError) IsSuccess() bool {
return false
}
// IsRedirect returns true when this get pdfs internal server error response has a 3xx status code
func (o *GetPdfsInternalServerError) IsRedirect() bool {
return false
}
// IsClientError returns true when this get pdfs internal server error response has a 4xx status code
func (o *GetPdfsInternalServerError) IsClientError() bool {
return false
}
// IsServerError returns true when this get pdfs internal server error response has a 5xx status code
func (o *GetPdfsInternalServerError) IsServerError() bool {
return true
}
// IsCode returns true when this get pdfs internal server error response a status code equal to that given
func (o *GetPdfsInternalServerError) IsCode(code int) bool {
return code == 500
}
// Code gets the status code for the get pdfs internal server error response
func (o *GetPdfsInternalServerError) Code() int {
return 500
}
func (o *GetPdfsInternalServerError) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /pdfs/{pdfId}][%d] getPdfsInternalServerError %s", 500, payload)
}
func (o *GetPdfsInternalServerError) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /pdfs/{pdfId}][%d] getPdfsInternalServerError %s", 500, payload)
}
func (o *GetPdfsInternalServerError) GetPayload() *stash_models.Error {
return o.Payload
}
func (o *GetPdfsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(stash_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
return nil
}

View File

@ -0,0 +1,223 @@
// 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 stash_pdf
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/conv"
)
// NewListPdfsParams creates a new ListPdfsParams 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 NewListPdfsParams() *ListPdfsParams {
return NewListPdfsParamsWithTimeout(cr.DefaultTimeout)
}
// NewListPdfsParamsWithTimeout creates a new ListPdfsParams object
// with the ability to set a timeout on a request.
func NewListPdfsParamsWithTimeout(timeout time.Duration) *ListPdfsParams {
return &ListPdfsParams{
inner: innerParams{
timeout: timeout,
},
}
}
// NewListPdfsParamsWithContext creates a new ListPdfsParams object
// with the ability to set a context for a request.
//
// Deprecated: use the operation call with context to pass the context instead of [ListPdfsParams].
func NewListPdfsParamsWithContext(ctx context.Context) *ListPdfsParams {
return &ListPdfsParams{
inner: innerParams{
ctx: ctx,
},
}
}
// NewListPdfsParamsWithHTTPClient creates a new ListPdfsParams object
// with the ability to set a custom HTTPClient for a request.
func NewListPdfsParamsWithHTTPClient(client *http.Client) *ListPdfsParams {
return &ListPdfsParams{
HTTPClient: client,
}
}
/*
ListPdfsParams contains all the parameters to send to the API endpoint
for the list pdfs operation.
Typically these are written to a http.Request.
*/
type ListPdfsParams struct {
// Limit.
//
// Maximum metadata records to return
//
// Format: int64
// Default: 25
Limit *int64
// Offset.
//
// Metadata records to skip
//
// Format: int64
Offset *int64
HTTPClient *http.Client
inner innerParams
}
// WithDefaults hydrates default values in the list pdfs params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ListPdfsParams) WithDefaults() *ListPdfsParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the list pdfs params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ListPdfsParams) SetDefaults() {
var (
limitDefault = int64(25)
offsetDefault = int64(0)
)
val := ListPdfsParams{
Limit: &limitDefault,
Offset: &offsetDefault,
}
val.inner.timeout = o.inner.timeout
val.inner.ctx = o.inner.ctx
val.HTTPClient = o.HTTPClient
*o = val
}
// WithTimeout adds the timeout to the list pdfs params.
func (o *ListPdfsParams) WithTimeout(timeout time.Duration) *ListPdfsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the list pdfs params.
func (o *ListPdfsParams) SetTimeout(timeout time.Duration) {
o.inner.timeout = timeout
}
// WithContext adds the context to the list pdfs params.
//
// Deprecated: use the operation call with context to pass the context instead of [ListPdfsParams].
func (o *ListPdfsParams) WithContext(ctx context.Context) *ListPdfsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the list pdfs params.
//
// Deprecated: use the operation call with context to pass the context instead of [ListPdfsParams].
func (o *ListPdfsParams) SetContext(ctx context.Context) {
o.inner.ctx = ctx
}
// WithHTTPClient adds the HTTPClient to the list pdfs params.
func (o *ListPdfsParams) WithHTTPClient(client *http.Client) *ListPdfsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the list pdfs params.
func (o *ListPdfsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithLimit adds the limit to the list pdfs params.
func (o *ListPdfsParams) WithLimit(limit *int64) *ListPdfsParams {
o.SetLimit(limit)
return o
}
// SetLimit adds the limit to the list pdfs params.
func (o *ListPdfsParams) SetLimit(limit *int64) {
o.Limit = limit
}
// WithOffset adds the offset to the list pdfs params.
func (o *ListPdfsParams) WithOffset(offset *int64) *ListPdfsParams {
o.SetOffset(offset)
return o
}
// SetOffset adds the offset to the list pdfs params.
func (o *ListPdfsParams) SetOffset(offset *int64) {
o.Offset = offset
}
// WriteToRequest writes these params to a [runtime.ClientRequest].
func (o *ListPdfsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.inner.timeout); err != nil {
return err
}
var res []error
if o.Limit != nil {
// query param limit
var qrLimit int64
if o.Limit != nil {
qrLimit = *o.Limit
}
qLimit := conv.FormatInteger(qrLimit)
if qLimit != "" {
if err := r.SetQueryParam("limit", qLimit); err != nil {
return err
}
}
}
if o.Offset != nil {
// query param offset
var qrOffset int64
if o.Offset != nil {
qrOffset = *o.Offset
}
qOffset := conv.FormatInteger(qrOffset)
if qOffset != "" {
if err := r.SetQueryParam("offset", qOffset); err != nil {
return err
}
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -0,0 +1,401 @@
// 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 stash_pdf
import (
"encoding/json"
stderrors "errors"
"fmt"
"io"
"code.tnxs.net/vernonkeenan/lib/api/stash/stash_models"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
)
// ListPdfsReader is a Reader for the ListPdfs structure.
type ListPdfsReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ListPdfsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
switch response.Code() {
case 200:
result := NewListPdfsOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 401:
result := NewListPdfsUnauthorized()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 403:
result := NewListPdfsForbidden()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 422:
result := NewListPdfsUnprocessableEntity()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewListPdfsInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("[GET /pdfs] listPdfs", response, response.Code())
}
}
// NewListPdfsOK creates a ListPdfsOK with default headers values
func NewListPdfsOK() *ListPdfsOK {
return &ListPdfsOK{}
}
// ListPdfsOK describes a response with status code 200, with default header values.
//
// Sanitized PDF metadata response
type ListPdfsOK struct {
Payload *stash_models.DocumentResponse
}
// IsSuccess returns true when this list pdfs o k response has a 2xx status code
func (o *ListPdfsOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this list pdfs o k response has a 3xx status code
func (o *ListPdfsOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this list pdfs o k response has a 4xx status code
func (o *ListPdfsOK) IsClientError() bool {
return false
}
// IsServerError returns true when this list pdfs o k response has a 5xx status code
func (o *ListPdfsOK) IsServerError() bool {
return false
}
// IsCode returns true when this list pdfs o k response a status code equal to that given
func (o *ListPdfsOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the list pdfs o k response
func (o *ListPdfsOK) Code() int {
return 200
}
func (o *ListPdfsOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /pdfs][%d] listPdfsOK %s", 200, payload)
}
func (o *ListPdfsOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /pdfs][%d] listPdfsOK %s", 200, payload)
}
func (o *ListPdfsOK) GetPayload() *stash_models.DocumentResponse {
return o.Payload
}
func (o *ListPdfsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(stash_models.DocumentResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
return nil
}
// NewListPdfsUnauthorized creates a ListPdfsUnauthorized with default headers values
func NewListPdfsUnauthorized() *ListPdfsUnauthorized {
return &ListPdfsUnauthorized{}
}
// ListPdfsUnauthorized describes a response with status code 401, with default header values.
//
// Access Unauthorized, invalid API-KEY was used
type ListPdfsUnauthorized struct {
Payload *stash_models.Error
}
// IsSuccess returns true when this list pdfs unauthorized response has a 2xx status code
func (o *ListPdfsUnauthorized) IsSuccess() bool {
return false
}
// IsRedirect returns true when this list pdfs unauthorized response has a 3xx status code
func (o *ListPdfsUnauthorized) IsRedirect() bool {
return false
}
// IsClientError returns true when this list pdfs unauthorized response has a 4xx status code
func (o *ListPdfsUnauthorized) IsClientError() bool {
return true
}
// IsServerError returns true when this list pdfs unauthorized response has a 5xx status code
func (o *ListPdfsUnauthorized) IsServerError() bool {
return false
}
// IsCode returns true when this list pdfs unauthorized response a status code equal to that given
func (o *ListPdfsUnauthorized) IsCode(code int) bool {
return code == 401
}
// Code gets the status code for the list pdfs unauthorized response
func (o *ListPdfsUnauthorized) Code() int {
return 401
}
func (o *ListPdfsUnauthorized) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /pdfs][%d] listPdfsUnauthorized %s", 401, payload)
}
func (o *ListPdfsUnauthorized) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /pdfs][%d] listPdfsUnauthorized %s", 401, payload)
}
func (o *ListPdfsUnauthorized) GetPayload() *stash_models.Error {
return o.Payload
}
func (o *ListPdfsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(stash_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
return nil
}
// NewListPdfsForbidden creates a ListPdfsForbidden with default headers values
func NewListPdfsForbidden() *ListPdfsForbidden {
return &ListPdfsForbidden{}
}
// ListPdfsForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
type ListPdfsForbidden struct {
Payload *stash_models.Error
}
// IsSuccess returns true when this list pdfs forbidden response has a 2xx status code
func (o *ListPdfsForbidden) IsSuccess() bool {
return false
}
// IsRedirect returns true when this list pdfs forbidden response has a 3xx status code
func (o *ListPdfsForbidden) IsRedirect() bool {
return false
}
// IsClientError returns true when this list pdfs forbidden response has a 4xx status code
func (o *ListPdfsForbidden) IsClientError() bool {
return true
}
// IsServerError returns true when this list pdfs forbidden response has a 5xx status code
func (o *ListPdfsForbidden) IsServerError() bool {
return false
}
// IsCode returns true when this list pdfs forbidden response a status code equal to that given
func (o *ListPdfsForbidden) IsCode(code int) bool {
return code == 403
}
// Code gets the status code for the list pdfs forbidden response
func (o *ListPdfsForbidden) Code() int {
return 403
}
func (o *ListPdfsForbidden) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /pdfs][%d] listPdfsForbidden %s", 403, payload)
}
func (o *ListPdfsForbidden) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /pdfs][%d] listPdfsForbidden %s", 403, payload)
}
func (o *ListPdfsForbidden) GetPayload() *stash_models.Error {
return o.Payload
}
func (o *ListPdfsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(stash_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
return nil
}
// NewListPdfsUnprocessableEntity creates a ListPdfsUnprocessableEntity with default headers values
func NewListPdfsUnprocessableEntity() *ListPdfsUnprocessableEntity {
return &ListPdfsUnprocessableEntity{}
}
// ListPdfsUnprocessableEntity describes a response with status code 422, with default header values.
//
// Unprocessable Entity, likely a bad parameter
type ListPdfsUnprocessableEntity struct {
Payload *stash_models.Error
}
// IsSuccess returns true when this list pdfs unprocessable entity response has a 2xx status code
func (o *ListPdfsUnprocessableEntity) IsSuccess() bool {
return false
}
// IsRedirect returns true when this list pdfs unprocessable entity response has a 3xx status code
func (o *ListPdfsUnprocessableEntity) IsRedirect() bool {
return false
}
// IsClientError returns true when this list pdfs unprocessable entity response has a 4xx status code
func (o *ListPdfsUnprocessableEntity) IsClientError() bool {
return true
}
// IsServerError returns true when this list pdfs unprocessable entity response has a 5xx status code
func (o *ListPdfsUnprocessableEntity) IsServerError() bool {
return false
}
// IsCode returns true when this list pdfs unprocessable entity response a status code equal to that given
func (o *ListPdfsUnprocessableEntity) IsCode(code int) bool {
return code == 422
}
// Code gets the status code for the list pdfs unprocessable entity response
func (o *ListPdfsUnprocessableEntity) Code() int {
return 422
}
func (o *ListPdfsUnprocessableEntity) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /pdfs][%d] listPdfsUnprocessableEntity %s", 422, payload)
}
func (o *ListPdfsUnprocessableEntity) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /pdfs][%d] listPdfsUnprocessableEntity %s", 422, payload)
}
func (o *ListPdfsUnprocessableEntity) GetPayload() *stash_models.Error {
return o.Payload
}
func (o *ListPdfsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(stash_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
return nil
}
// NewListPdfsInternalServerError creates a ListPdfsInternalServerError with default headers values
func NewListPdfsInternalServerError() *ListPdfsInternalServerError {
return &ListPdfsInternalServerError{}
}
// ListPdfsInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
type ListPdfsInternalServerError struct {
Payload *stash_models.Error
}
// IsSuccess returns true when this list pdfs internal server error response has a 2xx status code
func (o *ListPdfsInternalServerError) IsSuccess() bool {
return false
}
// IsRedirect returns true when this list pdfs internal server error response has a 3xx status code
func (o *ListPdfsInternalServerError) IsRedirect() bool {
return false
}
// IsClientError returns true when this list pdfs internal server error response has a 4xx status code
func (o *ListPdfsInternalServerError) IsClientError() bool {
return false
}
// IsServerError returns true when this list pdfs internal server error response has a 5xx status code
func (o *ListPdfsInternalServerError) IsServerError() bool {
return true
}
// IsCode returns true when this list pdfs internal server error response a status code equal to that given
func (o *ListPdfsInternalServerError) IsCode(code int) bool {
return code == 500
}
// Code gets the status code for the list pdfs internal server error response
func (o *ListPdfsInternalServerError) Code() int {
return 500
}
func (o *ListPdfsInternalServerError) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /pdfs][%d] listPdfsInternalServerError %s", 500, payload)
}
func (o *ListPdfsInternalServerError) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /pdfs][%d] listPdfsInternalServerError %s", 500, payload)
}
func (o *ListPdfsInternalServerError) GetPayload() *stash_models.Error {
return o.Payload
}
func (o *ListPdfsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(stash_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
return nil
}

View File

@ -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 stash_pdf
import (
"context"
"net/http"
"time"
"code.tnxs.net/vernonkeenan/lib/api/stash/stash_models"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewPostPdfsParams creates a new PostPdfsParams 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 NewPostPdfsParams() *PostPdfsParams {
return NewPostPdfsParamsWithTimeout(cr.DefaultTimeout)
}
// NewPostPdfsParamsWithTimeout creates a new PostPdfsParams object
// with the ability to set a timeout on a request.
func NewPostPdfsParamsWithTimeout(timeout time.Duration) *PostPdfsParams {
return &PostPdfsParams{
inner: innerParams{
timeout: timeout,
},
}
}
// NewPostPdfsParamsWithContext creates a new PostPdfsParams object
// with the ability to set a context for a request.
//
// Deprecated: use the operation call with context to pass the context instead of [PostPdfsParams].
func NewPostPdfsParamsWithContext(ctx context.Context) *PostPdfsParams {
return &PostPdfsParams{
inner: innerParams{
ctx: ctx,
},
}
}
// NewPostPdfsParamsWithHTTPClient creates a new PostPdfsParams object
// with the ability to set a custom HTTPClient for a request.
func NewPostPdfsParamsWithHTTPClient(client *http.Client) *PostPdfsParams {
return &PostPdfsParams{
HTTPClient: client,
}
}
/*
PostPdfsParams contains all the parameters to send to the API endpoint
for the post pdfs operation.
Typically these are written to a http.Request.
*/
type PostPdfsParams struct {
// PDFRequest.
//
// An array of new PDF records
PDFRequest *stash_models.PDFRequest
HTTPClient *http.Client
inner innerParams
}
// WithDefaults hydrates default values in the post pdfs params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *PostPdfsParams) WithDefaults() *PostPdfsParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the post pdfs params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *PostPdfsParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the post pdfs params.
func (o *PostPdfsParams) WithTimeout(timeout time.Duration) *PostPdfsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the post pdfs params.
func (o *PostPdfsParams) SetTimeout(timeout time.Duration) {
o.inner.timeout = timeout
}
// WithContext adds the context to the post pdfs params.
//
// Deprecated: use the operation call with context to pass the context instead of [PostPdfsParams].
func (o *PostPdfsParams) WithContext(ctx context.Context) *PostPdfsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the post pdfs params.
//
// Deprecated: use the operation call with context to pass the context instead of [PostPdfsParams].
func (o *PostPdfsParams) SetContext(ctx context.Context) {
o.inner.ctx = ctx
}
// WithHTTPClient adds the HTTPClient to the post pdfs params.
func (o *PostPdfsParams) WithHTTPClient(client *http.Client) *PostPdfsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the post pdfs params.
func (o *PostPdfsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithPDFRequest adds the pDFRequest to the post pdfs params.
func (o *PostPdfsParams) WithPDFRequest(pDFRequest *stash_models.PDFRequest) *PostPdfsParams {
o.SetPDFRequest(pDFRequest)
return o
}
// SetPDFRequest adds the pDFRequest to the post pdfs params.
func (o *PostPdfsParams) SetPDFRequest(pDFRequest *stash_models.PDFRequest) {
o.PDFRequest = pDFRequest
}
// WriteToRequest writes these params to a [runtime.ClientRequest].
func (o *PostPdfsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.inner.timeout); err != nil {
return err
}
var res []error
if o.PDFRequest != nil {
if err := r.SetBodyParam(o.PDFRequest); err != nil {
return err
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -1,475 +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 stash_pdf
import (
"encoding/json"
stderrors "errors"
"fmt"
"io"
"code.tnxs.net/vernonkeenan/lib/api/stash/stash_models"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
)
// PostPdfsReader is a Reader for the PostPdfs structure.
type PostPdfsReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *PostPdfsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
switch response.Code() {
case 200:
result := NewPostPdfsOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 401:
result := NewPostPdfsUnauthorized()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 403:
result := NewPostPdfsForbidden()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewPostPdfsNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 422:
result := NewPostPdfsUnprocessableEntity()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewPostPdfsInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("[POST /pdfs] postPdfs", response, response.Code())
}
}
// NewPostPdfsOK creates a PostPdfsOK with default headers values
func NewPostPdfsOK() *PostPdfsOK {
return &PostPdfsOK{}
}
// PostPdfsOK describes a response with status code 200, with default header values.
//
// Rendered documents response
type PostPdfsOK struct {
Payload *stash_models.DocumentResponse
}
// IsSuccess returns true when this post pdfs o k response has a 2xx status code
func (o *PostPdfsOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this post pdfs o k response has a 3xx status code
func (o *PostPdfsOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this post pdfs o k response has a 4xx status code
func (o *PostPdfsOK) IsClientError() bool {
return false
}
// IsServerError returns true when this post pdfs o k response has a 5xx status code
func (o *PostPdfsOK) IsServerError() bool {
return false
}
// IsCode returns true when this post pdfs o k response a status code equal to that given
func (o *PostPdfsOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the post pdfs o k response
func (o *PostPdfsOK) Code() int {
return 200
}
func (o *PostPdfsOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /pdfs][%d] postPdfsOK %s", 200, payload)
}
func (o *PostPdfsOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /pdfs][%d] postPdfsOK %s", 200, payload)
}
func (o *PostPdfsOK) GetPayload() *stash_models.DocumentResponse {
return o.Payload
}
func (o *PostPdfsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(stash_models.DocumentResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
return nil
}
// NewPostPdfsUnauthorized creates a PostPdfsUnauthorized with default headers values
func NewPostPdfsUnauthorized() *PostPdfsUnauthorized {
return &PostPdfsUnauthorized{}
}
// PostPdfsUnauthorized describes a response with status code 401, with default header values.
//
// Access Unauthorized, invalid API-KEY was used
type PostPdfsUnauthorized struct {
Payload *stash_models.Error
}
// IsSuccess returns true when this post pdfs unauthorized response has a 2xx status code
func (o *PostPdfsUnauthorized) IsSuccess() bool {
return false
}
// IsRedirect returns true when this post pdfs unauthorized response has a 3xx status code
func (o *PostPdfsUnauthorized) IsRedirect() bool {
return false
}
// IsClientError returns true when this post pdfs unauthorized response has a 4xx status code
func (o *PostPdfsUnauthorized) IsClientError() bool {
return true
}
// IsServerError returns true when this post pdfs unauthorized response has a 5xx status code
func (o *PostPdfsUnauthorized) IsServerError() bool {
return false
}
// IsCode returns true when this post pdfs unauthorized response a status code equal to that given
func (o *PostPdfsUnauthorized) IsCode(code int) bool {
return code == 401
}
// Code gets the status code for the post pdfs unauthorized response
func (o *PostPdfsUnauthorized) Code() int {
return 401
}
func (o *PostPdfsUnauthorized) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /pdfs][%d] postPdfsUnauthorized %s", 401, payload)
}
func (o *PostPdfsUnauthorized) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /pdfs][%d] postPdfsUnauthorized %s", 401, payload)
}
func (o *PostPdfsUnauthorized) GetPayload() *stash_models.Error {
return o.Payload
}
func (o *PostPdfsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(stash_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
return nil
}
// NewPostPdfsForbidden creates a PostPdfsForbidden with default headers values
func NewPostPdfsForbidden() *PostPdfsForbidden {
return &PostPdfsForbidden{}
}
// PostPdfsForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
type PostPdfsForbidden struct {
Payload *stash_models.Error
}
// IsSuccess returns true when this post pdfs forbidden response has a 2xx status code
func (o *PostPdfsForbidden) IsSuccess() bool {
return false
}
// IsRedirect returns true when this post pdfs forbidden response has a 3xx status code
func (o *PostPdfsForbidden) IsRedirect() bool {
return false
}
// IsClientError returns true when this post pdfs forbidden response has a 4xx status code
func (o *PostPdfsForbidden) IsClientError() bool {
return true
}
// IsServerError returns true when this post pdfs forbidden response has a 5xx status code
func (o *PostPdfsForbidden) IsServerError() bool {
return false
}
// IsCode returns true when this post pdfs forbidden response a status code equal to that given
func (o *PostPdfsForbidden) IsCode(code int) bool {
return code == 403
}
// Code gets the status code for the post pdfs forbidden response
func (o *PostPdfsForbidden) Code() int {
return 403
}
func (o *PostPdfsForbidden) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /pdfs][%d] postPdfsForbidden %s", 403, payload)
}
func (o *PostPdfsForbidden) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /pdfs][%d] postPdfsForbidden %s", 403, payload)
}
func (o *PostPdfsForbidden) GetPayload() *stash_models.Error {
return o.Payload
}
func (o *PostPdfsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(stash_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
return nil
}
// NewPostPdfsNotFound creates a PostPdfsNotFound with default headers values
func NewPostPdfsNotFound() *PostPdfsNotFound {
return &PostPdfsNotFound{}
}
// PostPdfsNotFound describes a response with status code 404, with default header values.
//
// Resource was not found
type PostPdfsNotFound struct {
Payload *stash_models.Error
}
// IsSuccess returns true when this post pdfs not found response has a 2xx status code
func (o *PostPdfsNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this post pdfs not found response has a 3xx status code
func (o *PostPdfsNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this post pdfs not found response has a 4xx status code
func (o *PostPdfsNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this post pdfs not found response has a 5xx status code
func (o *PostPdfsNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this post pdfs not found response a status code equal to that given
func (o *PostPdfsNotFound) IsCode(code int) bool {
return code == 404
}
// Code gets the status code for the post pdfs not found response
func (o *PostPdfsNotFound) Code() int {
return 404
}
func (o *PostPdfsNotFound) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /pdfs][%d] postPdfsNotFound %s", 404, payload)
}
func (o *PostPdfsNotFound) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /pdfs][%d] postPdfsNotFound %s", 404, payload)
}
func (o *PostPdfsNotFound) GetPayload() *stash_models.Error {
return o.Payload
}
func (o *PostPdfsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(stash_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
return nil
}
// NewPostPdfsUnprocessableEntity creates a PostPdfsUnprocessableEntity with default headers values
func NewPostPdfsUnprocessableEntity() *PostPdfsUnprocessableEntity {
return &PostPdfsUnprocessableEntity{}
}
// PostPdfsUnprocessableEntity describes a response with status code 422, with default header values.
//
// Unprocessable Entity, likely a bad parameter
type PostPdfsUnprocessableEntity struct {
Payload *stash_models.Error
}
// IsSuccess returns true when this post pdfs unprocessable entity response has a 2xx status code
func (o *PostPdfsUnprocessableEntity) IsSuccess() bool {
return false
}
// IsRedirect returns true when this post pdfs unprocessable entity response has a 3xx status code
func (o *PostPdfsUnprocessableEntity) IsRedirect() bool {
return false
}
// IsClientError returns true when this post pdfs unprocessable entity response has a 4xx status code
func (o *PostPdfsUnprocessableEntity) IsClientError() bool {
return true
}
// IsServerError returns true when this post pdfs unprocessable entity response has a 5xx status code
func (o *PostPdfsUnprocessableEntity) IsServerError() bool {
return false
}
// IsCode returns true when this post pdfs unprocessable entity response a status code equal to that given
func (o *PostPdfsUnprocessableEntity) IsCode(code int) bool {
return code == 422
}
// Code gets the status code for the post pdfs unprocessable entity response
func (o *PostPdfsUnprocessableEntity) Code() int {
return 422
}
func (o *PostPdfsUnprocessableEntity) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /pdfs][%d] postPdfsUnprocessableEntity %s", 422, payload)
}
func (o *PostPdfsUnprocessableEntity) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /pdfs][%d] postPdfsUnprocessableEntity %s", 422, payload)
}
func (o *PostPdfsUnprocessableEntity) GetPayload() *stash_models.Error {
return o.Payload
}
func (o *PostPdfsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(stash_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
return nil
}
// NewPostPdfsInternalServerError creates a PostPdfsInternalServerError with default headers values
func NewPostPdfsInternalServerError() *PostPdfsInternalServerError {
return &PostPdfsInternalServerError{}
}
// PostPdfsInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
type PostPdfsInternalServerError struct {
Payload *stash_models.Error
}
// IsSuccess returns true when this post pdfs internal server error response has a 2xx status code
func (o *PostPdfsInternalServerError) IsSuccess() bool {
return false
}
// IsRedirect returns true when this post pdfs internal server error response has a 3xx status code
func (o *PostPdfsInternalServerError) IsRedirect() bool {
return false
}
// IsClientError returns true when this post pdfs internal server error response has a 4xx status code
func (o *PostPdfsInternalServerError) IsClientError() bool {
return false
}
// IsServerError returns true when this post pdfs internal server error response has a 5xx status code
func (o *PostPdfsInternalServerError) IsServerError() bool {
return true
}
// IsCode returns true when this post pdfs internal server error response a status code equal to that given
func (o *PostPdfsInternalServerError) IsCode(code int) bool {
return code == 500
}
// Code gets the status code for the post pdfs internal server error response
func (o *PostPdfsInternalServerError) Code() int {
return 500
}
func (o *PostPdfsInternalServerError) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /pdfs][%d] postPdfsInternalServerError %s", 500, payload)
}
func (o *PostPdfsInternalServerError) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /pdfs][%d] postPdfsInternalServerError %s", 500, payload)
}
func (o *PostPdfsInternalServerError) GetPayload() *stash_models.Error {
return o.Payload
}
func (o *PostPdfsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(stash_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
return nil
}

View File

@ -60,24 +60,30 @@ type ClientOption func(*runtime.ClientOperation)
// ClientService is the interface for Client methods.
type ClientService interface {
// PostPdfs create new p d fs.
PostPdfs(params *PostPdfsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostPdfsOK, error)
// GetPdfs get a single p d f record by ID.
GetPdfs(params *GetPdfsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetPdfsOK, error)
// PostPdfsContext create new p d fs.
PostPdfsContext(ctx context.Context, params *PostPdfsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostPdfsOK, error)
// GetPdfsContext get a single p d f record by ID.
GetPdfsContext(ctx context.Context, params *GetPdfsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetPdfsOK, error)
// ListPdfs list verified tenant p d f metadata.
ListPdfs(params *ListPdfsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListPdfsOK, error)
// ListPdfsContext list verified tenant p d f metadata.
ListPdfsContext(ctx context.Context, params *ListPdfsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListPdfsOK, error)
SetTransport(transport runtime.ContextualTransport)
}
// PostPdfs creates new p d fs.
// GetPdfs gets a single p d f record by ID.
//
// Store new PDFs.
// Return metadata for one verified PDF in the configured Keenan Vision tenant. Requires a native service principal with exact stash:pdf:read and an active Keenan Vision or Contributor session..
//
// This method does not support injected context.
// However, timeout and opentracing contexts are honored whenever enabled.
//
// If you need to pass a specific context, use [Client.PostPdfsContext] instead.
func (a *Client) PostPdfs(params *PostPdfsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostPdfsOK, error) {
// If you need to pass a specific context, use [Client.GetPdfsContext] instead.
func (a *Client) GetPdfs(params *GetPdfsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetPdfsOK, error) {
var ctx context.Context
if params.inner.ctx != nil {
ctx = params.inner.ctx
@ -85,29 +91,29 @@ func (a *Client) PostPdfs(params *PostPdfsParams, authInfo runtime.ClientAuthInf
ctx = context.Background()
}
return a.PostPdfsContext(ctx, params, authInfo, opts...)
return a.GetPdfsContext(ctx, params, authInfo, opts...)
}
// PostPdfsContext creates new p d fs.
// GetPdfsContext gets a single p d f record by ID.
//
// Store new PDFs.
// Return metadata for one verified PDF in the configured Keenan Vision tenant. Requires a native service principal with exact stash:pdf:read and an active Keenan Vision or Contributor session..
//
// Do not use the deprecated [PostPdfsParams.Context] with this method: it would be ignored.
func (a *Client) PostPdfsContext(ctx context.Context, params *PostPdfsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostPdfsOK, error) {
// Do not use the deprecated [GetPdfsParams.Context] with this method: it would be ignored.
func (a *Client) GetPdfsContext(ctx context.Context, params *GetPdfsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetPdfsOK, error) {
// NOTE: parameters are not validated before sending
if params == nil {
params = NewPostPdfsParams()
params = NewGetPdfsParams()
}
op := &runtime.ClientOperation{
ID: "postPdfs",
Method: "POST",
PathPattern: "/pdfs",
ID: "getPdfs",
Method: "GET",
PathPattern: "/pdfs/{pdfId}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PostPdfsReader{formats: a.formats},
Reader: &GetPdfsReader{formats: a.formats},
AuthInfo: authInfo,
Client: params.HTTPClient,
}
@ -122,7 +128,7 @@ func (a *Client) PostPdfsContext(ctx context.Context, params *PostPdfsParams, au
}
// only one success response has to be checked
success, ok := result.(*PostPdfsOK)
success, ok := result.(*GetPdfsOK)
if ok {
return success, nil
}
@ -132,7 +138,74 @@ func (a *Client) PostPdfsContext(ctx context.Context, params *PostPdfsParams, au
// 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 postPdfs: API contract not enforced by server. Client expected to get an error, but got: %T", result)
msg := fmt.Sprintf("unexpected success response for getPdfs: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// ListPdfs lists verified tenant p d f metadata.
//
// Return bounded metadata for verified PDFs in the configured Keenan Vision tenant. Requires a native service principal with exact stash:pdf:read and an active Keenan Vision or Contributor session..
//
// This method does not support injected context.
// However, timeout and opentracing contexts are honored whenever enabled.
//
// If you need to pass a specific context, use [Client.ListPdfsContext] instead.
func (a *Client) ListPdfs(params *ListPdfsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListPdfsOK, error) {
var ctx context.Context
if params.inner.ctx != nil {
ctx = params.inner.ctx
} else {
ctx = context.Background()
}
return a.ListPdfsContext(ctx, params, authInfo, opts...)
}
// ListPdfsContext lists verified tenant p d f metadata.
//
// Return bounded metadata for verified PDFs in the configured Keenan Vision tenant. Requires a native service principal with exact stash:pdf:read and an active Keenan Vision or Contributor session..
//
// Do not use the deprecated [ListPdfsParams.Context] with this method: it would be ignored.
func (a *Client) ListPdfsContext(ctx context.Context, params *ListPdfsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListPdfsOK, error) {
// NOTE: parameters are not validated before sending
if params == nil {
params = NewListPdfsParams()
}
op := &runtime.ClientOperation{
ID: "listPdfs",
Method: "GET",
PathPattern: "/pdfs",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &ListPdfsReader{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.(*ListPdfsOK)
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 listPdfs: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}

View File

@ -13,7 +13,7 @@ import (
"github.com/go-openapi/swag/jsonutils"
)
// Document document
// Document Sanitized PDF metadata; document bytes and legacy ownership fields are excluded.
//
// swagger:model Document
type Document struct {
@ -24,12 +24,6 @@ type Document struct {
// ID
ID string `json:"ID,omitempty"`
// parent ID
ParentID string `json:"ParentID,omitempty"`
// saga type
SagaType string `json:"SagaType,omitempty"`
// title
Title string `json:"Title,omitempty"`

View File

@ -17,7 +17,7 @@ import (
"github.com/go-openapi/swag/typeutils"
)
// DocumentResponse An array of rendered documents
// DocumentResponse An array of sanitized PDF metadata
//
// swagger:model DocumentResponse
type DocumentResponse struct {

View File

@ -1,75 +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 stash_models
import (
"context"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/jsonutils"
)
// NewPDF new p d f
//
// swagger:model NewPDF
type NewPDF struct {
// Description
Description string `json:"Description,omitempty"`
// Filename only
Filename string `json:"Filename,omitempty"`
// The HTML data in text format
HTML string `json:"HTML,omitempty"`
// Last Accessed By
LastAccessedByID string `json:"LastAccessedByID,omitempty"`
// This document's financial object origination
ObjectType string `json:"ObjectType,omitempty"`
// User who created the PDF
OwnerID string `json:"OwnerID,omitempty"`
// ID of the record that owns this PDF
ParentID string `json:"ParentID,omitempty"`
// External reference if any
Ref string `json:"Ref,omitempty"`
// Document descriptive title
Title string `json:"Title,omitempty"`
}
// Validate validates this new p d f
func (m *NewPDF) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this new p d f based on context it is used
func (m *NewPDF) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *NewPDF) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *NewPDF) UnmarshalBinary(b []byte) error {
var res NewPDF
if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@ -1,191 +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 stash_models
import (
"context"
stderrors "errors"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag/typeutils"
)
// PDFRequest p d f request
//
// swagger:model PDFRequest
type PDFRequest struct {
// data
Data []*NewPDF `json:"Data"`
// meta
Meta *RequestMeta `json:"Meta,omitempty"`
}
// Validate validates this p d f request
func (m *PDFRequest) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateData(formats); err != nil {
res = append(res, err)
}
if err := m.validateMeta(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *PDFRequest) validateData(formats strfmt.Registry) error {
if typeutils.IsZero(m.Data) { // not required
return nil
}
for i := 0; i < len(m.Data); i++ {
if typeutils.IsZero(m.Data[i]) { // not required
continue
}
if m.Data[i] != nil {
if err := m.Data[i].Validate(formats); err != nil {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *PDFRequest) validateMeta(formats strfmt.Registry) error {
if typeutils.IsZero(m.Meta) { // not required
return nil
}
if m.Meta != nil {
if err := m.Meta.Validate(formats); err != nil {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Meta")
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Meta")
}
return err
}
}
return nil
}
// ContextValidate validate this p d f request based on the context it is used
func (m *PDFRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateData(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateMeta(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *PDFRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.Data); i++ {
if m.Data[i] != nil {
if typeutils.IsZero(m.Data[i]) { // not required
return nil
}
if err := m.Data[i].ContextValidate(ctx, formats); err != nil {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *PDFRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error {
if m.Meta != nil {
if typeutils.IsZero(m.Meta) { // not required
return nil
}
if err := m.Meta.ContextValidate(ctx, formats); err != nil {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Meta")
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Meta")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (m *PDFRequest) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *PDFRequest) UnmarshalBinary(b []byte) error {
var res PDFRequest
if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@ -1,72 +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 stash_models
import (
"context"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/validate"
)
// RequestMeta request meta
//
// swagger:model RequestMeta
type RequestMeta struct {
// Account Number of the Reseller or OEM
// Required: true
ExternalAccount *string `json:"ExternalAccount"`
}
// Validate validates this request meta
func (m *RequestMeta) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateExternalAccount(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *RequestMeta) validateExternalAccount(formats strfmt.Registry) error {
if err := validate.Required("ExternalAccount", "body", m.ExternalAccount); err != nil {
return err
}
return nil
}
// ContextValidate validates this request meta based on context it is used
func (m *RequestMeta) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *RequestMeta) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *RequestMeta) UnmarshalBinary(b []byte) error {
var res RequestMeta
if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@ -0,0 +1,43 @@
# Stash PDF metadata client
This slice generates a read-only Stash client for the response contract in
`vernonkeenan/stash` draft PR #16 at provider commit
`b2f5b4a6ae5ff507dfdc86bb7b9ee5a9bb924131`.
The generated surface contains only:
- `GET /v1/pdfs`, with bounded `limit` and `offset`;
- `GET /v1/pdfs/{pdfId}`; and
- response metadata fields `ID`, `Filename`, `Title`, and `URI`.
The provider spec retains a deprecated `POST /v1/pdfs` compatibility route
that always fails closed. Lib deliberately does not generate that operation.
It also narrows the provider's legacy `Document` definition to the four fields
the PR #16 handlers populate, so document bytes, render inputs, tenant IDs, and
legacy ownership fields cannot enter the consumer contract.
Both reads require one caller-supplied `runtime.ClientAuthInfoWriter` that
writes the native service credential to `X-API-Key` and forwards only the
`kvSession` cookie. The generated operations retain that single compound
writer. Callers must not forward the browser's complete cookie header.
`swagger/client/stash-pdf-metadata.yaml` is the reproducible consumer
projection. `scripts/release.sh regen` uses it only for Stash while continuing
to copy the complete provider spec into the normal internal and external
documentation locations.
## Dependency and release gate
This Lib PR may be reviewed while Stash PR #16 is open, but it must not be
released for production consumption before the provider PR is merged and its
deployment gates are satisfied. In particular, Stash deployment remains
blocked on:
1. the governed PDF tenancy migration from `go/db` commit
`5e3c03d5d52c8328708897032fcc213f548bc667`;
2. the exact `stash:pdf:read` scope grant;
3. canonical Keenan Vision tenant configuration; and
4. the provider's production no-write smoke test.
This client slice applies no database change, grants no scope, changes no
credential, creates no release, and performs no deployment.

View File

@ -172,15 +172,34 @@ cmd_regen() {
IFS=':' read -r dir spec_base name target pkg model <<<"$svc"
log "generating ${name} client -> ${target}"
mkdir -p "$target"
local generation_spec="./swagger/${spec_base}.yaml"
local -a generation_filter=()
if [[ "$dir" == "stash" ]]; then
# Stash's provider spec retains a deprecated, fail-closed POST so old
# callers receive a governed 403. Lib must not turn that compatibility
# route back into a mutation client. Generate only the two metadata
# reads from the narrower consumer projection, which also excludes
# document bytes and legacy ownership fields from the response model.
generation_spec="./swagger/client/stash-pdf-metadata.yaml"
generation_filter=(
--operation=listPdfs
--operation=getPdfs
--model=Document
--model=DocumentResponse
--model=Error
--model=ResponseMeta
)
fi
"$bin" generate client \
--log-output="./swagger/logs/generate-${name}-client.log" \
--copyright-file=./build/COPYRIGHT \
--name="${name}" \
--spec="./swagger/${spec_base}.yaml" \
--spec="${generation_spec}" \
--target="${target}" \
--client-package="${pkg}" \
--model-package="${model}" \
--principal=app.User
--principal=app.User \
"${generation_filter[@]}"
local host path ext="./swagger/external/${spec_base}.yaml"
host="$(external_host_for "$dir")"

View File

@ -0,0 +1,197 @@
swagger: "2.0"
info:
version: 0.3.0
title: "stash"
description: "Read-only client projection of the Stash PDF metadata contract"
termsOfService: "https://keenanvision.net/terms/"
contact:
email: "info@keenanvision.net"
license:
name: "Proprietary - Copyright (c) 2018-2024 by Vernon Keenan"
x-provider-pr: "vernonkeenan/stash#16"
x-provider-head: "b2f5b4a6ae5ff507dfdc86bb7b9ee5a9bb924131"
securityDefinitions:
ApiKeyAuth:
type: "apiKey"
in: "header"
name: "X-API-Key"
kvSessionCookie:
type: "apiKey"
in: "header"
name: "Cookie"
description: "Members session cookie. Credential values are never accepted in request bodies, responses, or logs."
schemes:
- "http"
basePath: "/v1"
host: "stash.vernonkeenan.com:8080"
produces:
- "application/json"
parameters:
limitQuery:
description: Maximum metadata records to return
in: query
name: limit
required: false
type: integer
format: int64
minimum: 1
maximum: 100
default: 25
offsetQuery:
description: Metadata records to skip
in: query
name: offset
required: false
type: integer
format: int64
minimum: 0
maximum: 10000
default: 0
responses:
AccessForbidden:
description: "Access forbidden, account lacks access"
schema:
$ref: "#/definitions/Error"
NotFound:
description: Resource was not found
schema:
$ref: "#/definitions/Error"
ServerError:
description: Server Internal Error
schema:
$ref: "#/definitions/Error"
Unauthorized:
description: "Access Unauthorized, invalid API-KEY was used"
schema:
$ref: "#/definitions/Error"
UnprocessableEntity:
description: "Unprocessable Entity, likely a bad parameter"
schema:
$ref: "#/definitions/Error"
DocumentResponse:
description: Sanitized PDF metadata response
schema:
$ref: "#/definitions/DocumentResponse"
paths:
/pdfs:
get:
description: "Return bounded metadata for verified PDFs in the configured Keenan Vision tenant. Requires a native service principal with exact stash:pdf:read and an active Keenan Vision or Contributor session."
operationId: listPdfs
parameters:
- $ref: "#/parameters/limitQuery"
- $ref: "#/parameters/offsetQuery"
responses:
"200":
$ref: "#/responses/DocumentResponse"
"401":
$ref: "#/responses/Unauthorized"
"403":
$ref: "#/responses/AccessForbidden"
"422":
$ref: "#/responses/UnprocessableEntity"
"500":
$ref: "#/responses/ServerError"
security:
- ApiKeyAuth: []
kvSessionCookie: []
summary: List verified tenant PDF metadata
tags:
- StashPdf
/pdfs/{pdfId}:
get:
description: "Return metadata for one verified PDF in the configured Keenan Vision tenant. Requires a native service principal with exact stash:pdf:read and an active Keenan Vision or Contributor session."
operationId: getPdfs
parameters:
- name: pdfId
in: path
description: PDF record ID
required: true
type: string
responses:
"200":
$ref: "#/responses/DocumentResponse"
"401":
$ref: "#/responses/Unauthorized"
"403":
$ref: "#/responses/AccessForbidden"
"404":
$ref: "#/responses/NotFound"
"422":
$ref: "#/responses/UnprocessableEntity"
"500":
$ref: "#/responses/ServerError"
security:
- ApiKeyAuth: []
kvSessionCookie: []
summary: Get a single PDF record by ID
tags:
- StashPdf
definitions:
Document:
description: Sanitized PDF metadata; document bytes and legacy ownership fields are excluded.
properties:
Filename:
type: string
ID:
type: string
Title:
type: string
URI:
type: string
type: object
DocumentResponse:
description: An array of sanitized PDF metadata
properties:
Data:
items:
$ref: "#/definitions/Document"
type: array
Meta:
$ref: "#/definitions/ResponseMeta"
type: object
Error:
properties:
Code:
format: int64
type: number
Fields:
type: string
Message:
type: string
type: object
ResponseMeta:
properties:
Contact:
description: Microservice Contact Info
type: string
Copyright:
description: Copyright Info
type: string
License:
description: License Information and Restrictions
type: string
OperationID:
description: Operation ID
type: string
RequestIP:
description: Request IP Address
type: string
RequestType:
description: Request Type
type: string
RequestURL:
description: Request URL
type: string
ServerInfo:
description: Data Server Info
type: string
ServerResponseTime:
description: Data Server Response Time (ms)
type: string
ServerTimestamp:
description: Backend Server Timestamp
type: string
ExternalAccount:
description: Account Number used for recording transactions
type: string
type: object

View File

@ -3,9 +3,9 @@ info:
version: 0.3.0
title: "stash"
description: "PDF Storage Microservice"
termsOfService: "https://salesforcedevops.net/terms/"
termsOfService: "https://keenanvision.net/terms/"
contact:
email: "vern@vernonkeenan.com"
email: "info@keenanvision.net"
license:
name: "Proprietary - Copyright (c) 2018-2024 by Vernon Keenan"
securityDefinitions:
@ -13,6 +13,11 @@ securityDefinitions:
type: "apiKey"
in: "header"
name: "X-API-Key"
kvSessionCookie:
type: "apiKey"
in: "header"
name: "Cookie"
description: "Members session cookie. Credential values are never accepted in request bodies, responses, or logs."
security:
- ApiKeyAuth: []
schemes:
@ -24,24 +29,26 @@ consumes:
produces:
- "application/json"
parameters:
X-API-Key:
name: X-API-Key
in: "header"
required: true
type: string
PDFRequest:
description: An array of new PDF records
in: body
name: PDFRequest
required: true
schema:
$ref: "#/definitions/PDFRequest"
pdfIdQueryRequired:
description: PDF record ID
limitQuery:
description: Maximum metadata records to return
in: query
name: pdfId
required: true
type: string
name: limit
required: false
type: integer
format: int64
minimum: 1
maximum: 100
default: 25
offsetQuery:
description: Metadata records to skip
in: query
name: offset
required: false
type: integer
format: int64
minimum: 0
maximum: 10000
default: 0
responses:
AccessForbidden:
description: "Access forbidden, account lacks access"
@ -51,10 +58,6 @@ responses:
description: Resource was not found
schema:
$ref: "#/definitions/Error"
PdfResponse:
description: Response with an array of pdfs
schema:
$ref: "#/definitions/DocumentResponse"
ServerError:
description: Server Internal Error
schema:
@ -73,11 +76,49 @@ responses:
$ref: "#/definitions/DocumentResponse"
paths:
/pdfs:
post:
description: Store new PDFs
operationId: postPdfs
get:
description: "Return bounded metadata for verified PDFs in the configured Keenan Vision tenant. Requires a native service principal with exact stash:pdf:read and an active Keenan Vision or Contributor session."
operationId: listPdfs
parameters:
- $ref: "#/parameters/PDFRequest"
- $ref: "#/parameters/limitQuery"
- $ref: "#/parameters/offsetQuery"
responses:
"200":
$ref: "#/responses/DocumentResponse"
"401":
$ref: "#/responses/Unauthorized"
"403":
$ref: "#/responses/AccessForbidden"
"422":
$ref: "#/responses/UnprocessableEntity"
"500":
$ref: "#/responses/ServerError"
security:
- ApiKeyAuth: []
kvSessionCookie: []
summary: List verified tenant PDF metadata
tags:
- StashPdf
post:
deprecated: true
description: "Disabled. Stash is metadata-read-only; create and rendering fail closed before body validation or provider access."
operationId: postPdfs
responses:
"403":
$ref: "#/responses/AccessForbidden"
summary: PDF creation is disabled
tags:
- StashPdf
/pdfs/{pdfId}:
get:
description: "Return metadata for one verified PDF in the configured Keenan Vision tenant. Requires a native service principal with exact stash:pdf:read and an active Keenan Vision or Contributor session."
operationId: getPdfs
parameters:
- name: pdfId
in: path
description: PDF record ID
required: true
type: string
responses:
"200":
$ref: "#/responses/DocumentResponse"
@ -91,7 +132,10 @@ paths:
$ref: "#/responses/UnprocessableEntity"
"500":
$ref: "#/responses/ServerError"
summary: Create new PDFs
security:
- ApiKeyAuth: []
kvSessionCookie: []
summary: Get a single PDF record by ID
tags:
- StashPdf
definitions:

View File

@ -3,9 +3,9 @@ info:
version: 0.3.0
title: "stash"
description: "PDF Storage Microservice"
termsOfService: "https://salesforcedevops.net/terms/"
termsOfService: "https://keenanvision.net/terms/"
contact:
email: "vern@vernonkeenan.com"
email: "info@keenanvision.net"
license:
name: "Proprietary - Copyright (c) 2018-2024 by Vernon Keenan"
securityDefinitions:
@ -13,6 +13,11 @@ securityDefinitions:
type: "apiKey"
in: "header"
name: "X-API-Key"
kvSessionCookie:
type: "apiKey"
in: "header"
name: "Cookie"
description: "Members session cookie. Credential values are never accepted in request bodies, responses, or logs."
security:
- ApiKeyAuth: []
schemes:
@ -24,24 +29,26 @@ consumes:
produces:
- "application/json"
parameters:
X-API-Key:
name: X-API-Key
in: "header"
required: true
type: string
PDFRequest:
description: An array of new PDF records
in: body
name: PDFRequest
required: true
schema:
$ref: "#/definitions/PDFRequest"
pdfIdQueryRequired:
description: PDF record ID
limitQuery:
description: Maximum metadata records to return
in: query
name: pdfId
required: true
type: string
name: limit
required: false
type: integer
format: int64
minimum: 1
maximum: 100
default: 25
offsetQuery:
description: Metadata records to skip
in: query
name: offset
required: false
type: integer
format: int64
minimum: 0
maximum: 10000
default: 0
responses:
AccessForbidden:
description: "Access forbidden, account lacks access"
@ -51,10 +58,6 @@ responses:
description: Resource was not found
schema:
$ref: "#/definitions/Error"
PdfResponse:
description: Response with an array of pdfs
schema:
$ref: "#/definitions/DocumentResponse"
ServerError:
description: Server Internal Error
schema:
@ -73,11 +76,49 @@ responses:
$ref: "#/definitions/DocumentResponse"
paths:
/pdfs:
post:
description: Store new PDFs
operationId: postPdfs
get:
description: "Return bounded metadata for verified PDFs in the configured Keenan Vision tenant. Requires a native service principal with exact stash:pdf:read and an active Keenan Vision or Contributor session."
operationId: listPdfs
parameters:
- $ref: "#/parameters/PDFRequest"
- $ref: "#/parameters/limitQuery"
- $ref: "#/parameters/offsetQuery"
responses:
"200":
$ref: "#/responses/DocumentResponse"
"401":
$ref: "#/responses/Unauthorized"
"403":
$ref: "#/responses/AccessForbidden"
"422":
$ref: "#/responses/UnprocessableEntity"
"500":
$ref: "#/responses/ServerError"
security:
- ApiKeyAuth: []
kvSessionCookie: []
summary: List verified tenant PDF metadata
tags:
- StashPdf
post:
deprecated: true
description: "Disabled. Stash is metadata-read-only; create and rendering fail closed before body validation or provider access."
operationId: postPdfs
responses:
"403":
$ref: "#/responses/AccessForbidden"
summary: PDF creation is disabled
tags:
- StashPdf
/pdfs/{pdfId}:
get:
description: "Return metadata for one verified PDF in the configured Keenan Vision tenant. Requires a native service principal with exact stash:pdf:read and an active Keenan Vision or Contributor session."
operationId: getPdfs
parameters:
- name: pdfId
in: path
description: PDF record ID
required: true
type: string
responses:
"200":
$ref: "#/responses/DocumentResponse"
@ -91,7 +132,10 @@ paths:
$ref: "#/responses/UnprocessableEntity"
"500":
$ref: "#/responses/ServerError"
summary: Create new PDFs
security:
- ApiKeyAuth: []
kvSessionCookie: []
summary: Get a single PDF record by ID
tags:
- StashPdf
definitions: