Compare commits

..

No commits in common. "v0.7.12" and "v0.5.15" have entirely different histories.

1132 changed files with 35979 additions and 103461 deletions

View File

@ -1,62 +0,0 @@
name: CI (lib)
# First-ever CI for go/lib (ADR-KV-014). lib is publicly mirrored on
# code.tnxs.net, so every push and PR gets a build/vet/test job plus a
# gitleaks secret-scan job. lib is a Go library — no Dockerfile, no deploy.
#
# push trigger is scoped to main + release tags (not every branch): with
# `branches: ['**']` *and* `pull_request` both set, every PR ran CI twice —
# once for the pull_request event, once for the push to the PR's source
# branch. main+tags replaced branch-per-version (ADR-KV-014, DT-KV-004), so
# there's no longer a fleet of long-lived version branches that need their
# own push-triggered runs independent of a PR.
on:
push:
branches: [main]
tags: ['v*']
pull_request:
defaults:
run:
shell: bash
# Serialize per ref. PR runs cancel superseded validations; branch pushes never cancel.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
test:
runs-on: [self-hosted, Linux]
permissions: { contents: read }
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
with:
go-version: stable
# DT-KV-018: remote actions-cache round-trip (~287MB) vs the
# persistent runner-local GOMODCACHE — disable, don't fetch it.
cache: false
- name: go build ./...
run: go build ./...
- name: go vet ./...
run: go vet ./...
- name: go test ./...
run: go test ./...
gitleaks:
runs-on: [self-hosted, Linux]
permissions: { contents: read }
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
fetch-depth: 0
- name: gitleaks detect (git history)
run: |
docker run --rm -v "$PWD:/repo" -w /repo zricethezav/gitleaks:latest \
detect --source /repo --redact -v

View File

@ -1,20 +0,0 @@
title = "gitleaks config for code.tnxs.net/vernonkeenan/lib"
[extend]
useDefault = true
# ADR-KV-014: first-ever CI gitleaks scan surfaced 6 findings, all in
# swagger-codegen-generated Kazoo API client models and the vendored
# Kazoo swagger spec. Each is an illustrative `// Example:` / `example:`
# JWT hardcoded by the generator to document the shape of an auth_token
# field — a placeholder from the vendor's public API docs, not a
# credential issued to or used by this project. Scoped narrowly to the
# four generated files that triggered, not repo-wide.
[allowlist]
description = "Generated Kazoo API client/swagger example JWTs (not real secrets)"
paths = [
'''api/kazoo/kazoo_models/get_account_descendent_response\.go''',
'''api/kazoo/kazoo_models/get_account_callflow_response\.go''',
'''api/kazoo/kazoo_models/get_account_response\.go''',
'''swagger/kazoo-telnexus\.yaml''',
]

View File

@ -1,153 +0,0 @@
# Changelog
All notable changes to `go/lib` (`code.tnxs.net/vernonkeenan/lib`) are
documented here. The format is based on
[Keep a Changelog](https://keepachangelog.com/en/1.0.0/). Releases are
`v*` git tags cut from `main` via `make release VERSION=vX.Y.Z`
(main + PR flow, ADR-KV-014, which also governs KV-C6 lib
distribution — see also ADR-KV-004/006 for the mesh-wide branching/release
model). **Branch-per-version is retired** as of 2026-07-12: `main` was
created from the `v0.7.4` tip and is now the only long-lived branch; the
~70 legacy `vX.Y.Z` branches still present in the repo are historical
artifacts of the old convention, not active release refs. Every section
below corresponds to a real git tag in this repo's history (only `v0.7.5`,
cut by the new `make release` script, is an annotated tag — the 71 tags
before it are lightweight, a holdover from the old ritual); no tag, date,
or PR number is invented.
## [Unreleased]
### Removed
- Removed `app.InitForce`, `app.TheForce`, and the `go-force` module from the
shared package after Auth reached native-only. `sf-gate` remains pinned to
its prior Lib pending retirement; deprecated Cache must not consume this
breaking release.
### Added
- 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-
entitlement operations and models (ADR-KV-017).
- Added the compound-auth Members client surface for Estate Administrator,
Owner, and Manager tenant-membership administration, including manageable-
tenant discovery, optimistic updates, and soft revocation (ADR-KV-021).
- Regenerated the Research Go client and synchronized Research Swagger copies
for governed Industry read/create/update plus tenant-attributed
IndustryCompany, IndustryProduct, and IndustryService read/create operations.
Contract tests pin the generated HTTP methods and paths and prevent an
unsupported `IndustryService.HTML` field from entering the shared model.
## [v0.7.5] — 2026-07-12
First release cut with the new `make release` scripted ritual (ADR-KV-014),
and the first release with CI behind it.
### Added
- First-ever CI for `lib`: `go build/vet/test ./...` job plus a gitleaks
secret-scan job on every push/PR, closing out the last un-covered repo in
the 12-repo Go-mesh test-harness program (ci/first-ci-gitleaks, PR #1)
- Table-driven unit tests for `app/service-helpers.go`'s pure helpers
(test/app-service-helpers, PR #2)
### Changed
- Replaced the manual three-web-UI-plus-CLI release ritual with
`scripts/release.sh` / `make release` + `make release-dry-run`
(feat/scripted-release, ADR-KV-014, PR #3)
- Regenerated all sibling clients under `api/` with go-swagger v0.35.0
(feat/regen-clients-processor-token, PR #5)
### Fixed
- `PaymentMethod` swagger def updated for the `card_*``processor_token`
migration (PR #4)
## [v0.7.4] — 2025-05-27
### Added
- Generated session-management API client and models
## [v0.7.3] — 2025-05-01
### Changed
- Refactored swagger defs (`Address`, `CompanyProduct`, `CompanyService`,
`Factor`, `FinancialStatement`, `Industry`, `IndustryCompany`,
`IndustryProduct`, `IndustryService`, `Observation`, `Topic`) to use
external `$ref` component defs instead of inline definitions
## [v0.7.2] — 2025-04-30
### Changed
- Replaced `AccountID` with `CompanyID` in `GetIndustryCompaniesParams` and
the related swagger definitions
## [v0.7.1] — 2025-04-29
No code changes — retag of the same commit as `v0.7.0`/`v0.6.7`.
## [v0.7.0] — 2025-04-29
No code changes — retag of the same commit as `v0.6.7`.
## [v0.6.7] — 2025-04-29
### Added
- Enrichment fields on `Account`, `CompanyProduct`, and `CompanyService`
models
## [v0.6.6] — 2025-04-29
### Changed
- General code-structure refactor for readability/maintainability
## [v0.6.5] — 2024-06-30
### Added
- `Channels` field on `Account` and `Contact` models
## [v0.6.4] — 2024-06-29
### Added
- `AppExchange` URL field on `CompanyProduct` model
## [v0.6.3] — 2024-06-28
### Added
- `AppExchange` URL field on `CompanyProduct` model
## [v0.6.2] — 2024-06-28
### Added
- `AppExchange` URL field on `Account` and `Company` models
## [v0.6.1] — 2024-06-27
### Added
- `FullDescription` field on `Account` model
## [v0.6.0] — 2024-01-22
### Added
- `FullDescription` field on `Industry` model
## Pre-v0.6.0 history (v0.0.1 v0.5.15, 2021-07-30 2023-08-25)
58 tags predate `v0.6.0`, from `lib`'s original scaffolding through the
last patch release before the year-and-a-half gap to `v0.6.0`. Coarse
summary by theme (no PR numbers — this history predates the PR-merge
convention):
- **2021 (v0.0.1v0.1.9):** Initial `app` package scaffolding — config,
logger, MySQL, and Salesforce (`go-force`) init helpers; first
go-swagger client generation against the estate's early services
(including a since-retired Telnexus/Kazoo-era client, still visible as
vendored specs under `swagger/`); early devops endpoint moves and
`/etc` config-path changes.
- **2022 (v0.1.2v0.4.9):** Buildout of `sf-gate` and `members` swagger
clients; schema cleanups; `research` and `plex` microservices added to
the platform; user/session/batch-endpoint additions across `sf-gate` and
`members`.
- **2023 H1 (v0.5.0v0.5.8):** `members` feature buildout — prompts and
prompt answers, favorites, documents, event categories, external
accounts — plus a research-domain refactor.
- **2023 H2 (v0.5.9v0.5.15):** Steady patch releases stabilizing the
prompts/members surface; `v0.5.15` (2023-08-25) is the last tag before
the gap to `v0.6.0`.

188
Makefile
View File

@ -1,35 +1,157 @@
# Pinned go-swagger version for `make install-swagger` / `make regen`.
# Bump deliberately, verify `swagger version` matches, and record the change
# here and in README.md's Release Procedure. Chosen 2026-07-12: latest
# stable go-swagger release at the time (ADR-KV-014).
SWAGGER_VERSION := v0.35.0
export SWAGGER_VERSION
.PHONY: swagger
.PHONY: install-swagger regen release release-dry-run swagger
# Install the pinned go-swagger CLI and verify its version.
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`.
regen: install-swagger
./scripts/release.sh regen
# Cut a release: tag HEAD of main, push the tag, publish the GitHub release,
# and trigger the Gitea mirror-sync. Requires a clean main checkout that
# matches origin/main. Usage: make release VERSION=v0.7.5
release:
./scripts/release.sh release "$(VERSION)"
# Same as `release` but stops before tag/push/release/mirror-sync — prints
# what would happen. Usage: make release-dry-run VERSION=v0.7.5
release-dry-run:
./scripts/release.sh release "$(VERSION)" --dry-run
# Deprecated alias for `regen`, kept because old muscle memory (and the
# README ritual) called this `make swagger`.
swagger: regen
swagger:
cp ../auth/swagger/auth-vernonkeenan.yaml ./swagger
cp ../auth/swagger/auth-vernonkeenan.yaml ./swagger/external
cp ../crm/swagger/crm-vernonkeenan.yaml ./swagger
cp ../crm/swagger/crm-vernonkeenan.yaml ./swagger/external
cp ../stash/swagger/stash-vernonkeenan.yaml ./swagger
cp ../stash/swagger/stash-vernonkeenan.yaml ./swagger/external
cp ../sf-gate/swagger/sf-gate-vernonkeenan.yaml ./swagger
cp ../sf-gate/swagger/sf-gate-vernonkeenan.yaml ./swagger/external
cp ../research/swagger/research-vernonkeenan.yaml ./swagger
cp ../research/swagger/research-vernonkeenan.yaml ./swagger/external
cp ../members/swagger/members-vernonkeenan.yaml ./swagger
cp ../members/swagger/members-vernonkeenan.yaml ./swagger/external
cp ../plex/swagger/plex-vernonkeenan.yaml ./swagger
cp ../plex/swagger/plex-vernonkeenan.yaml ./swagger/external
#
rm -rf api
#
# generate auth client
#
mkdir -p api/auth
swagger generate client \
--log-output=./swagger/logs/generate-auth-client.log \
--copyright-file=./build/COPYRIGHT \
--name=auth \
--spec=./swagger/auth-vernonkeenan.yaml \
--target=./api/auth \
--client-package=auth-client \
--model-package=auth-models \
--principal=app.User
#
# update external auth client
#
sed -i 's|"http"|"https"|g' ./swagger/external/auth-vernonkeenan.yaml
sed -i 's|auth.vernonkeenan.com:8080|gw.tnxs.net|g' ./swagger/external/auth-vernonkeenan.yaml
sed -i 's|"/v1"|"/vk/auth/v1"|g' ./swagger/external/auth-vernonkeenan.yaml
#
# generate crm client
#
mkdir api/crm
swagger generate client \
--log-output=./swagger/logs/generate-crm-client.log \
--copyright-file=./build/COPYRIGHT \
--name=crm \
--spec=./swagger/crm-vernonkeenan.yaml \
--target=./api/crm \
--client-package=crm-client \
--model-package=crm-models \
--principal=app.User
#
# update external crm client
#
sed -i 's|"http"|"https"|g' ./swagger/external/crm-vernonkeenan.yaml
sed -i 's|crm.vernonkeenan.com:8080|gw.tnxs.net|g' ./swagger/external/crm-vernonkeenan.yaml
sed -i 's|"/v1"|"/vk/crm/v1"|g' ./swagger/external/crm-vernonkeenan.yaml
#
# generate stash client
#
mkdir api/stash
swagger generate client \
--log-output=./swagger/logs/generate-stash-client.log \
--copyright-file=./build/COPYRIGHT \
--name=stash \
--spec=./swagger/stash-vernonkeenan.yaml \
--target=./api/stash \
--client-package=stash-client \
--model-package=stash-models \
--principal=app.User
#
# update external stash client
#
sed -i 's|"http"|"https"|g' ./swagger/external/stash-vernonkeenan.yaml
sed -i 's|stash.vernonkeenan.com:8080|gw.tnxs.net|g' ./swagger/external/stash-vernonkeenan.yaml
sed -i 's|"/v1"|"/vk/stash/v1"|g' ./swagger/external/stash-vernonkeenan.yaml
#
# generate sfgate client
#
mkdir api/sfgate
swagger generate client \
--log-output=./swagger/logs/generate-sfgate-client.log \
--copyright-file=./build/COPYRIGHT \
--name=sfgate \
--spec=./swagger/sf-gate-vernonkeenan.yaml \
--target=./api/sfgate \
--client-package=sfgate-client \
--model-package=sfgate-models \
--principal=app.User
#
# update external crm client
#
sed -i 's|"http"|"https"|g' ./swagger/external/sf-gate-vernonkeenan.yaml
sed -i 's|sf-gate.vernonkeenan.com:8080|gw.tnxs.net|g' ./swagger/external/sf-gate-vernonkeenan.yaml
sed -i 's|"/v1"|"/vk/sf-gate/v1"|g' ./swagger/external/sf-gate-vernonkeenan.yaml
#
# generate research client
#
mkdir api/research
swagger generate client \
--log-output=./swagger/logs/generate-research-client.log \
--copyright-file=./build/COPYRIGHT \
--name=research \
--spec=./swagger/research-vernonkeenan.yaml \
--target=./api/research \
--client-package=research-client \
--model-package=research-models \
--principal=app.User
#
# update external research client
#
sed -i 's|"http"|"https"|g' ./swagger/external/research-vernonkeenan.yaml
sed -i 's|research.vernonkeenan.com:8080|gw.tnxs.net|g' ./swagger/external/research-vernonkeenan.yaml
sed -i 's|"/v1"|"/vk/research/v1"|g' ./swagger/external/research-vernonkeenan.yaml
#
# generate members client
#
mkdir api/members
swagger generate client \
--log-output=./swagger/logs/generate-members-client.log \
--copyright-file=./build/COPYRIGHT \
--name=members \
--spec=./swagger/members-vernonkeenan.yaml \
--target=./api/members \
--client-package=members-client \
--model-package=members-models \
--principal=app.User
#
# update external members client
#
sed -i 's|"http"|"https"|g' ./swagger/external/members-vernonkeenan.yaml
sed -i 's|members.vernonkeenan.com:8080|gw.tnxs.net|g' ./swagger/external/members-vernonkeenan.yaml
sed -i 's|"/v1"|"/vk/members/v1"|g' ./swagger/external/members-vernonkeenan.yaml
#
# generate plex client
#
mkdir api/plex
swagger generate client \
--log-output=./swagger/logs/generate-plex-client.log \
--copyright-file=./build/COPYRIGHT \
--name=plex \
--spec=./swagger/plex-vernonkeenan.yaml \
--target=./api/plex \
--client-package=plex-client \
--model-package=plex-models \
--principal=app.User
#
# update external plex client
#
sed -i 's|"http"|"https"|g' ./swagger/external/plex-vernonkeenan.yaml
sed -i 's|plex.vernonkeenan.com:8080|gw.tnxs.net|g' ./swagger/external/plex-vernonkeenan.yaml
sed -i 's|"/v1"|"/vk/plex/v1"|g' ./swagger/external/plex-vernonkeenan.yaml
#
# copy external swagger files
#
scp ./swagger/external/*.yaml root@whm.noc.tnxs.net:/home/taxassets/www/swagger/external

170
README.md
View File

@ -1,163 +1,27 @@
# go/lib — Shared Go library for the Keenan Vision service mesh
# lib
`go/lib` (module `code.tnxs.net/vernonkeenan/lib`) is the shared toolchain
every Go microservice in the Keenan Vision mesh pins in its `go.mod`. It is
not a service — it ships no server, no Dockerfile, no compose entry — it is
a library `app` package (`InitConfig`/`InitDB`, config
accessors, zap logging, Prometheus/CORS middleware, generic marshal
helpers) plus a set of go-swaggergenerated typed HTTP clients (`api/`)
against the sibling services' own swagger specs. Because every mesh service
pins the same module, a `lib` bump is a constellation-wide rebuild (KV-C6a).
vernonkeenan Shared Libraries (go)
## Constellation context
## Dependent Systems
- Toolchain member of the Keenan Vision Go mesh governed by `../../kv-meta/`
(see `../../kv-meta/CONSTELLATION.md` §1.3, contract KV-C6). Not a
deployed service: no swagger server, no port, no entry in the
`docker/kvweb` compose on pluto.
- KV-C6a: every mesh service (`auth`, `cache`, `crm`, `members`, `pdf`,
`plex`, `render`, `research`, `sf-gate`, `stash`) pins an explicit
`code.tnxs.net/vernonkeenan/lib` tag in its own `go.mod`; consumption is a
per-consumer `go.mod` bump, never automatic.
- Distribution is via the world-readable Gitea pull-mirror at
`code.tnxs.net/vernonkeenan/lib`, enabling
credential-free `go get code.tnxs.net/vernonkeenan/lib@vX.Y.Z` from
Docker/CI/dev boxes even though the GitHub repo itself is private
(ADR-KV-014). Everything committed here is treated as **published,
permanently** — a gitleaks CI gate makes leaking a secret a build
failure, not a review nit.
- CI (self-hosted runner, `go build/vet/test ./...` + gitleaks on every
push/PR) landed 2026-07-12 as `lib`'s first-ever pipeline (ADR-KV-014) —
`lib` was the only one of the 12 Go-roster repos with no CI at all going
into the 2026-07-12 test-harness audit, so this closes out that gap. The
`test` job is `lib`'s instance of the mesh-wide unit-test-gate program
(ADR-KV-009, amended by ADR-KV-013, which scopes `lib` as one of its 12
governed repos); the `gitleaks` job is ADR-KV-014's public-mirror
secret-scan gate, specific to `lib` because it's the one repo mirrored
world-readable.
- `api/` also acts as `lib`'s own internal client of the mesh: `app/auth.go`'s
`CheckAPIUser` calls `auth`'s generated client to validate an API key, so
`lib` is simultaneously a library *and* a consumer of one sibling service.
The Gitea server <https://code.tnxs.net> must be up and running with admin access.
## Package surface
## Update Procedure
| Path | What it is |
|---|---|
| `app/root.go` | `InitConfig(systemName, level)` — loads `/etc/vernonkeenan/<systemName>.yaml` via viper, one-time init guard |
| `app/config.go` | `Configuration` struct + `Get*`/`Is*` accessors (DBMS, DSN, authentication mode, log level, metrics, service accounts, workers, email, chunk/cache sizing) |
| `app/mysql.go` | `InitDB()` — opens `MyDB *sql.DB` against the configured MySQL DSN |
| `app/auth.go` | `CheckAPIUser(token)` — validates a credential against `auth`; errors never log the raw value |
| `app/prometheus.go` | `SetupPrometheusHandler` — CORS + request-count/duration middleware |
| `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 |
| `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 |
Prerequisite: All the other repos are cloned locally in adjacent directories.
## Build, run, test
* Increment branch number in local repo
* Generate all OpenAPI libraries and then cleanup modules
```bash
go build ./...
go vet ./...
go test ./... # table-driven unit tests today: app/service-helpers.go pure helpers
make install-swagger # install the pinned go-swagger CLI (SWAGGER_VERSION in Makefile)
make regen # aka `make swagger` — regenerate api/ from sibling specs
make release VERSION=vX.Y.Z
make release-dry-run VERSION=vX.Y.Z
make swagger
go get -u -f ./...
go mod tidy
```
`go test ./...` is CI-gating on every push and PR (ADR-KV-009/013), same as
the rest of the mesh; `lib` is a library so there is nothing to "run."
`make regen` requires the sibling repos `auth`, `crm`, `stash`, `sf-gate`,
`research`, `members`, `plex` cloned adjacently — it reads each one's
`swagger/<service>-vernonkeenan.yaml`, copies it into `./swagger` and
`./swagger/external`, and regenerates every client under `api/`, rewriting
the external specs' scheme/host/path the same way the old `make swagger`
ritual did. It fails fast, before touching anything, if any sibling spec is
missing. Review `git status`/`git diff`, commit, open a PR, and merge it to
`main` like any other change — client regen is never bundled into the
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.
**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
`<name>_client/<name>_client.go` doesn't respect `--client-package`
reproduced across go-swagger v0.33.2 through v0.35.0 while building this
tooling. The one instance found, `sf-gate-vernonkeenan.yaml`'s `PUT
/researchprojectservices` (no `tags:`), was fixed at the source (sf-gate
#3 added the missing `tags:` entry) and regenerated clean in the v0.7.5
`feat/regen-clients-processor-token` PR — `api/sfgate` has no fallback
`operations` package today. If a future sibling spec change reintroduces an
untagged operation, `make regen`'s non-fatal `go build ./...` step will
fail with this same signature; fix it at the source (add a `tags:` entry in
that service's spec) rather than hand-patching generated code, since the
next regen would just reintroduce it.
## Configuration
`lib` reads no config file of its own. `app.InitConfig(systemName, level)`
loads config **on behalf of the calling service**: viper reads
`/etc/vernonkeenan/<systemName>.yaml` (YAML), with environment-variable
overrides via prefix `VERNONKEENAN_` (`.` replaced by `_` in key names),
unmarshalled into `app.Configuration``AppName`, `BackendID`,
`DBMS`/`DBMSHost`/`DBMSName`/`DBMSUsername`/`DBMSPassword`, `DSN`,
`Environment`, `LogLevel`, `GelfURI`, `Metrics` (address/enabled),
`ServiceAccounts` (a map of external-system credentials, e.g. the `auth`
service account `CheckAPIUser` reads its own API key from), `Workers`,
`Email`, `CacheSizes`/`Chunks`. The concrete `/etc/vernonkeenan/<name>.yaml`
file lives on each deploy host, not in this repo — see the calling
service's own README for its file name and required keys.
## Versioning & pinning contract (KV-C6a)
- **Module:** `code.tnxs.net/vernonkeenan/lib`, fetched via the Gitea
anonymous mirror (not GitHub directly — the GitHub repo is private).
- **Pin, don't float:** every consumer pins an explicit `vX.Y.Z` tag in its
`go.mod`. Bumping the pin is a normal PR in the consumer repo; there is no
auto-bump mechanism.
- **Release is one command:** `make release VERSION=vX.Y.Z`
(`scripts/release.sh`) from a clean `main` checkout that matches
`origin/main`:
1. Validates `VERSION` is `vMAJOR.MINOR.PATCH` and strictly greater than
the latest existing tag.
2. Requires you're on `main`, the tree is clean, and local `main` matches
`origin/main` (no local-only commits).
3. Runs `go build ./...` and `go vet ./...` as a last sanity check.
4. Creates an annotated tag at HEAD, pushes it, and runs `gh release
create` with generated notes.
5. POSTs an explicit zero-length body to the Gitea mirror-sync API for
`vernonkeenan/lib` (skipped with a warning if `GITEA_TOKEN` is unset).
`make release-dry-run VERSION=vX.Y.Z` runs steps 1-3 and prints what
steps 4-5 would do, without tagging, pushing, publishing, or syncing
anything.
- **A `lib` bump is constellation-wide:** any breaking change to
`app.Configuration`, `InitConfig`/`InitDB`, or a generated
client's shape ripples to every pinned service on its next `go.mod` bump.
v0.7.10 deliberately removes the retired `InitForce` API and `go-force`
dependency. `sf-gate` stays pinned to its prior Lib while awaiting
retirement; deprecated Cache must not be rebuilt or upgraded.
- **Branch-per-version is retired** (ADR-KV-014, 2026-07-12): `lib` moved
to main + `v*` tags, replacing the old three-web-UI-plus-CLI manual
release ritual. ~70 legacy `vX.Y.Z` branches (one per pre-migration
release; `git branch --list 'v*'`) remain in the repo as historical
artifacts of the old convention, not the active release mechanism.
- **Prerequisites for a release:** the sibling repos (for `make regen`)
cloned adjacently; [`gh`](https://cli.github.com/) authenticated with
push access to `vernonkeenan/lib`; `GITEA_TOKEN` exported for the
mirror-sync step (optional — see above).
## Release & deploy
`main` + PR flow: land changes on `main` via PR (CI runs build/vet/test +
gitleaks on the PR and on push to `main`), then cut a release with `make
release VERSION=vX.Y.Z`, which tags `main`, publishes a GitHub release, and
triggers the Gitea mirror-sync. Unlike the deployed mesh services, `lib` has
**no Dockerfile, no container image, and no deploy step** — it is never
built into `hub.tnxs.net` and never rolled out via the `docker/kvweb`
compose on pluto. "Release" means "a new tag other repos can pin," full
stop; downstream rollout happens when each consumer bumps its own `go.mod`
line for `code.tnxs.net/vernonkeenan/lib` to the new tag and goes through
its own release/deploy path.
* Commit and push new branch to GitHub
* On GitHub goto <https://github.com/vernonkeenan/lib/settings/branches> set the new branch to default.
* On GitHub goto <https://github.com/vernonkeenan/lib/releases> and publish a new release for the new branch. Make the new tag the branch name.
* On Gitea goto <https://code.tnxs.net/vernonkeenan/lib/settings> and click Synchronize Now.
* Update the ``go.mod`` line with ``code.tnxs.net/vernonkeenan/lib`` in each project to match the latest version.

View File

@ -6,26 +6,30 @@
package auth_client
import (
"maps"
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
"code.tnxs.net/vernonkeenan/lib/api/auth/auth_client/user"
import (
"github.com/go-openapi/runtime"
httptransport "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/auth/auth_client/user"
)
// Default auth HTTP client.
var Default = NewHTTPClient(nil)
const (
// DefaultHost is the default Host found in Meta (info) section of spec file.
// DefaultHost is the default Host
// found in Meta (info) section of spec file
DefaultHost string = "auth.vernonkeenan.com:8080"
// DefaultBasePath is the default BasePath found in Meta (info) section of spec file.
// DefaultBasePath is the default BasePath
// found in Meta (info) section of spec file
DefaultBasePath string = "/v1"
)
// DefaultSchemes are the default schemes found in Meta (info) section of spec file.
// DefaultSchemes are the default schemes found in Meta (info) section of spec file
var DefaultSchemes = []string{"http"}
// NewHTTPClient creates a new auth HTTP client.
@ -41,16 +45,13 @@ func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *Aut
cfg = DefaultTransportConfig()
}
// create transport and client.
// create transport and client
transport := httptransport.New(cfg.Host, cfg.BasePath, cfg.Schemes)
maps.Copy(transport.Producers, cfg.Producers)
maps.Copy(transport.Consumers, cfg.Consumers)
return New(transport, formats)
}
// New creates a new auth client.
func New(transport runtime.ContextualTransport, formats strfmt.Registry) *Auth {
// New creates a new auth client
func New(transport runtime.ClientTransport, formats strfmt.Registry) *Auth {
// ensure nullable parameters have default
if formats == nil {
formats = strfmt.Default
@ -59,7 +60,6 @@ func New(transport runtime.ContextualTransport, formats strfmt.Registry) *Auth {
cli := new(Auth)
cli.Transport = transport
cli.User = user.New(transport, formats)
return cli
}
@ -79,8 +79,6 @@ type TransportConfig struct {
Host string
BasePath string
Schemes []string
Producers map[string]runtime.Producer
Consumers map[string]runtime.Consumer
}
// WithHost overrides the default host,
@ -104,27 +102,15 @@ func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig {
return cfg
}
// WithProducers overrides the default producers registered by [httptransport.Runtime].
func (cfg *TransportConfig) WithProducers(producers map[string]runtime.Producer) *TransportConfig {
cfg.Producers = producers
return cfg
}
// WithConsumers overrides the default consumers registered by [httptransport.Runtime].
func (cfg *TransportConfig) WithConsumers(consumers map[string]runtime.Consumer) *TransportConfig {
cfg.Consumers = consumers
return cfg
}
// Auth is a client for auth.
// Auth is a client for auth
type Auth struct {
User user.ClientService
Transport runtime.ContextualTransport
Transport runtime.ClientTransport
}
// SetTransport changes the transport on the client and all its subresources.
func (c *Auth) SetTransport(transport runtime.ContextualTransport) {
// SetTransport changes the transport on the client and all its subresources
func (c *Auth) SetTransport(transport runtime.ClientTransport) {
c.Transport = transport
c.User.SetTransport(transport)
}

View File

@ -6,6 +6,9 @@
package user
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
@ -24,28 +27,24 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewGetUsersParams() *GetUsersParams {
return NewGetUsersParamsWithTimeout(cr.DefaultTimeout)
return &GetUsersParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetUsersParamsWithTimeout creates a new GetUsersParams object
// with the ability to set a timeout on a request.
func NewGetUsersParamsWithTimeout(timeout time.Duration) *GetUsersParams {
return &GetUsersParams{
inner: innerParams{
timeout: timeout,
},
}
}
// NewGetUsersParamsWithContext creates a new GetUsersParams object
// with the ability to set a context for a request.
//
// Deprecated: use the operation call with context to pass the context instead of [GetUsersParams].
func NewGetUsersParamsWithContext(ctx context.Context) *GetUsersParams {
return &GetUsersParams{
inner: innerParams{
ctx: ctx,
},
Context: ctx,
}
}
@ -66,14 +65,15 @@ GetUsersParams contains all the parameters to send to the API endpoint
*/
type GetUsersParams struct {
// Apikey.
//
// Service account or developer API key
/* Apikey.
Service account or developer API key
*/
Apikey *string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
inner innerParams
}
// WithDefaults hydrates default values in the get users params (not the query body).
@ -91,57 +91,54 @@ func (o *GetUsersParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the get users params.
// WithTimeout adds the timeout to the get users params
func (o *GetUsersParams) WithTimeout(timeout time.Duration) *GetUsersParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get users params.
// SetTimeout adds the timeout to the get users params
func (o *GetUsersParams) SetTimeout(timeout time.Duration) {
o.inner.timeout = timeout
o.timeout = timeout
}
// WithContext adds the context to the get users params.
//
// Deprecated: use the operation call with context to pass the context instead of [GetUsersParams].
// WithContext adds the context to the get users params
func (o *GetUsersParams) WithContext(ctx context.Context) *GetUsersParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get users params.
//
// Deprecated: use the operation call with context to pass the context instead of [GetUsersParams].
// SetContext adds the context to the get users params
func (o *GetUsersParams) SetContext(ctx context.Context) {
o.inner.ctx = ctx
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get users params.
// WithHTTPClient adds the HTTPClient to the get users params
func (o *GetUsersParams) WithHTTPClient(client *http.Client) *GetUsersParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get users params.
// SetHTTPClient adds the HTTPClient to the get users params
func (o *GetUsersParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithApikey adds the apikey to the get users params.
// WithApikey adds the apikey to the get users params
func (o *GetUsersParams) WithApikey(apikey *string) *GetUsersParams {
o.SetApikey(apikey)
return o
}
// SetApikey adds the apikey to the get users params.
// SetApikey adds the apikey to the get users params
func (o *GetUsersParams) SetApikey(apikey *string) {
o.Apikey = apikey
}
// WriteToRequest writes these params to a [runtime.ClientRequest].
// WriteToRequest writes these params to a swagger request
func (o *GetUsersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.inner.timeout); err != nil {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error

View File

@ -6,15 +6,17 @@
package user
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
stderrors "errors"
"fmt"
"io"
"code.tnxs.net/vernonkeenan/lib/api/auth/auth_models"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/auth/auth_models"
)
// GetUsersReader is a Reader for the GetUsers structure.
@ -23,7 +25,7 @@ type GetUsersReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *GetUsersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
func (o *GetUsersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetUsersOK()
@ -62,7 +64,7 @@ func (o *GetUsersReader) ReadResponse(response runtime.ClientResponse, consumer
}
return nil, result
default:
return nil, runtime.NewAPIError("[GET /users] getUsers", response, response.Code())
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
@ -71,9 +73,11 @@ func NewGetUsersOK() *GetUsersOK {
return &GetUsersOK{}
}
// GetUsersOK describes a response with status code 200, with default header values.
//
// Response with User objects
/*
GetUsersOK describes a response with status code 200, with default header values.
Response with User objects
*/
type GetUsersOK struct {
Payload *auth_models.UserResponse
}
@ -109,13 +113,11 @@ func (o *GetUsersOK) Code() int {
}
func (o *GetUsersOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /users][%d] getUsersOK %s", 200, payload)
return fmt.Sprintf("[GET /users][%d] getUsersOK %+v", 200, o.Payload)
}
func (o *GetUsersOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /users][%d] getUsersOK %s", 200, payload)
return fmt.Sprintf("[GET /users][%d] getUsersOK %+v", 200, o.Payload)
}
func (o *GetUsersOK) GetPayload() *auth_models.UserResponse {
@ -127,7 +129,7 @@ func (o *GetUsersOK) readResponse(response runtime.ClientResponse, consumer runt
o.Payload = new(auth_models.UserResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -139,9 +141,11 @@ func NewGetUsersUnauthorized() *GetUsersUnauthorized {
return &GetUsersUnauthorized{}
}
// GetUsersUnauthorized describes a response with status code 401, with default header values.
//
// Access Unauthorized, invalid API-KEY was used
/*
GetUsersUnauthorized describes a response with status code 401, with default header values.
Access Unauthorized, invalid API-KEY was used
*/
type GetUsersUnauthorized struct {
Payload *auth_models.Error
}
@ -177,13 +181,11 @@ func (o *GetUsersUnauthorized) Code() int {
}
func (o *GetUsersUnauthorized) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /users][%d] getUsersUnauthorized %s", 401, payload)
return fmt.Sprintf("[GET /users][%d] getUsersUnauthorized %+v", 401, o.Payload)
}
func (o *GetUsersUnauthorized) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /users][%d] getUsersUnauthorized %s", 401, payload)
return fmt.Sprintf("[GET /users][%d] getUsersUnauthorized %+v", 401, o.Payload)
}
func (o *GetUsersUnauthorized) GetPayload() *auth_models.Error {
@ -195,7 +197,7 @@ func (o *GetUsersUnauthorized) readResponse(response runtime.ClientResponse, con
o.Payload = new(auth_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -207,9 +209,11 @@ func NewGetUsersForbidden() *GetUsersForbidden {
return &GetUsersForbidden{}
}
// GetUsersForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
/*
GetUsersForbidden describes a response with status code 403, with default header values.
Access forbidden, account lacks access
*/
type GetUsersForbidden struct {
Payload *auth_models.Error
}
@ -245,13 +249,11 @@ func (o *GetUsersForbidden) Code() int {
}
func (o *GetUsersForbidden) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /users][%d] getUsersForbidden %s", 403, payload)
return fmt.Sprintf("[GET /users][%d] getUsersForbidden %+v", 403, o.Payload)
}
func (o *GetUsersForbidden) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /users][%d] getUsersForbidden %s", 403, payload)
return fmt.Sprintf("[GET /users][%d] getUsersForbidden %+v", 403, o.Payload)
}
func (o *GetUsersForbidden) GetPayload() *auth_models.Error {
@ -263,7 +265,7 @@ func (o *GetUsersForbidden) readResponse(response runtime.ClientResponse, consum
o.Payload = new(auth_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -275,9 +277,11 @@ func NewGetUsersNotFound() *GetUsersNotFound {
return &GetUsersNotFound{}
}
// GetUsersNotFound describes a response with status code 404, with default header values.
//
// Resource was not found
/*
GetUsersNotFound describes a response with status code 404, with default header values.
Resource was not found
*/
type GetUsersNotFound struct {
Payload *auth_models.Error
}
@ -313,13 +317,11 @@ func (o *GetUsersNotFound) Code() int {
}
func (o *GetUsersNotFound) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /users][%d] getUsersNotFound %s", 404, payload)
return fmt.Sprintf("[GET /users][%d] getUsersNotFound %+v", 404, o.Payload)
}
func (o *GetUsersNotFound) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /users][%d] getUsersNotFound %s", 404, payload)
return fmt.Sprintf("[GET /users][%d] getUsersNotFound %+v", 404, o.Payload)
}
func (o *GetUsersNotFound) GetPayload() *auth_models.Error {
@ -331,7 +333,7 @@ func (o *GetUsersNotFound) readResponse(response runtime.ClientResponse, consume
o.Payload = new(auth_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -343,9 +345,11 @@ func NewGetUsersUnprocessableEntity() *GetUsersUnprocessableEntity {
return &GetUsersUnprocessableEntity{}
}
// GetUsersUnprocessableEntity describes a response with status code 422, with default header values.
//
// Unprocessable Entity, likely a bad parameter
/*
GetUsersUnprocessableEntity describes a response with status code 422, with default header values.
Unprocessable Entity, likely a bad parameter
*/
type GetUsersUnprocessableEntity struct {
Payload *auth_models.Error
}
@ -381,13 +385,11 @@ func (o *GetUsersUnprocessableEntity) Code() int {
}
func (o *GetUsersUnprocessableEntity) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /users][%d] getUsersUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[GET /users][%d] getUsersUnprocessableEntity %+v", 422, o.Payload)
}
func (o *GetUsersUnprocessableEntity) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /users][%d] getUsersUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[GET /users][%d] getUsersUnprocessableEntity %+v", 422, o.Payload)
}
func (o *GetUsersUnprocessableEntity) GetPayload() *auth_models.Error {
@ -399,7 +401,7 @@ func (o *GetUsersUnprocessableEntity) readResponse(response runtime.ClientRespon
o.Payload = new(auth_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -411,9 +413,11 @@ func NewGetUsersInternalServerError() *GetUsersInternalServerError {
return &GetUsersInternalServerError{}
}
// GetUsersInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
/*
GetUsersInternalServerError describes a response with status code 500, with default header values.
Server Internal Error
*/
type GetUsersInternalServerError struct {
Payload *auth_models.Error
}
@ -449,13 +453,11 @@ func (o *GetUsersInternalServerError) Code() int {
}
func (o *GetUsersInternalServerError) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /users][%d] getUsersInternalServerError %s", 500, payload)
return fmt.Sprintf("[GET /users][%d] getUsersInternalServerError %+v", 500, o.Payload)
}
func (o *GetUsersInternalServerError) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /users][%d] getUsersInternalServerError %s", 500, payload)
return fmt.Sprintf("[GET /users][%d] getUsersInternalServerError %+v", 500, o.Payload)
}
func (o *GetUsersInternalServerError) GetPayload() *auth_models.Error {
@ -467,7 +469,7 @@ func (o *GetUsersInternalServerError) readResponse(response runtime.ClientRespon
o.Payload = new(auth_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}

View File

@ -6,99 +6,49 @@
package user
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"fmt"
"time"
"github.com/go-openapi/runtime"
httptransport "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// New creates a new user API client.
func New(transport runtime.ContextualTransport, formats strfmt.Registry) ClientService {
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
// New creates a new user API client with basic auth credentials.
//
// It takes the following parameters:
// - host: http host (github.com).
// - basePath: any base path for the API client ("/v1", "/v3").
// - scheme: http scheme ("http", "https").
// - user: user for basic authentication header.
// - password: password for basic authentication header.
func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService {
transport := httptransport.New(host, basePath, []string{scheme})
transport.DefaultAuthentication = httptransport.BasicAuth(user, password)
return &Client{transport: transport, formats: strfmt.Default}
}
// New creates a new user API client with a bearer token for authentication.
//
// It takes the following parameters:
// - host: http host (github.com).
// - basePath: any base path for the API client ("/v1", "/v3").
// - scheme: http scheme ("http", "https").
// - bearerToken: bearer token for Bearer authentication header.
func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService {
transport := httptransport.New(host, basePath, []string{scheme})
transport.DefaultAuthentication = httptransport.BearerToken(bearerToken)
return &Client{transport: transport, formats: strfmt.Default}
}
// Client for user API.
/*
Client for user API
*/
type Client struct {
transport runtime.ContextualTransport
transport runtime.ClientTransport
formats strfmt.Registry
}
// ClientOption may be used to customize the behavior of Client methods.
// ClientOption is the option for Client methods
type ClientOption func(*runtime.ClientOperation)
// ClientService is the interface for Client methods.
// ClientService is the interface for Client methods
type ClientService interface {
// GetUsers check API key.
GetUsers(params *GetUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetUsersOK, error)
// GetUsersContext check API key.
GetUsersContext(ctx context.Context, params *GetUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetUsersOK, error)
SetTransport(transport runtime.ContextualTransport)
SetTransport(transport runtime.ClientTransport)
}
// GetUsers checks API key.
//
// Checks for a valid API key, and returns full user record.
//
// This method does not support injected context.
// However, timeout and opentracing contexts are honored whenever enabled.
//
// If you need to pass a specific context, use [Client.GetUsersContext] instead.
/*
GetUsers checks API key
Checks for a valid API key, and returns full user record
*/
func (a *Client) GetUsers(params *GetUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetUsersOK, error) {
var ctx context.Context
if params.inner.ctx != nil {
ctx = params.inner.ctx
} else {
ctx = context.Background()
}
return a.GetUsersContext(ctx, params, authInfo, opts...)
}
// GetUsersContext checks API key.
//
// Checks for a valid API key, and returns full user record.
//
// Do not use the deprecated [GetUsersParams.Context] with this method: it would be ignored.
func (a *Client) GetUsersContext(ctx context.Context, params *GetUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetUsersOK, error) {
// NOTE: parameters are not validated before sending
// TODO: Validate the params before sending
if params == nil {
params = NewGetUsersParams()
}
op := &runtime.ClientOperation{
ID: "getUsers",
Method: "GET",
@ -109,42 +59,28 @@ func (a *Client) GetUsersContext(ctx context.Context, params *GetUsersParams, au
Params: params,
Reader: &GetUsersReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.SubmitContext(ctx, op)
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*GetUsersOK)
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
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for getUsers: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ContextualTransport) {
func (a *Client) SetTransport(transport runtime.ClientTransport) {
a.transport = transport
}
// innerParams captures internal fields so they don't conflict with user-supplied parameters.
type innerParams struct {
timeout time.Duration
// Deprecated: use the operation call with context to pass the context instead of [UserParams].
ctx context.Context
}

View File

@ -6,11 +6,14 @@
package auth_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag"
)
// Address address
@ -55,13 +58,13 @@ func (m *Address) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return jsonutils.WriteJSON(m)
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Address) UnmarshalBinary(b []byte) error {
var res Address
if err := jsonutils.ReadJSON(b, &res); err != nil {
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,11 +6,14 @@
package auth_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag"
)
// Error error
@ -43,13 +46,13 @@ func (m *Error) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return jsonutils.WriteJSON(m)
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Error) UnmarshalBinary(b []byte) error {
var res Error
if err := jsonutils.ReadJSON(b, &res); err != nil {
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,11 +6,14 @@
package auth_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag"
)
// ResponseMeta response meta
@ -67,13 +70,13 @@ func (m *ResponseMeta) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return jsonutils.WriteJSON(m)
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *ResponseMeta) UnmarshalBinary(b []byte) error {
var res ResponseMeta
if err := jsonutils.ReadJSON(b, &res); err != nil {
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,11 +6,14 @@
package auth_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag"
)
// TenantUser Relationship object that connects users to a tenant
@ -82,13 +85,13 @@ func (m *TenantUser) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return jsonutils.WriteJSON(m)
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *TenantUser) UnmarshalBinary(b []byte) error {
var res TenantUser
if err := jsonutils.ReadJSON(b, &res); err != nil {
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,15 +6,16 @@
package auth_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
stderrors "errors"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag/typeutils"
"github.com/go-openapi/swag"
)
// User user
@ -148,12 +149,6 @@ type User struct {
// Portal Role Level
PortalRole string `json:"PortalRole,omitempty"`
// Stable machine principal key; empty for legacy human principals
PrincipalKey string `json:"PrincipalKey,omitempty"`
// Principal type, currently service or legacy_user
PrincipalType string `json:"PrincipalType,omitempty"`
// Profile
ProfileID string `json:"ProfileID,omitempty"`
@ -163,9 +158,6 @@ type User struct {
// Admin Info Emails
ReceivesAdminInfoEmails bool `json:"ReceivesAdminInfoEmails,omitempty"`
// Explicit mesh authorization scopes; never contains credentials
Scopes []string `json:"Scopes"`
// Email Sender Address
SenderEmail string `json:"SenderEmail,omitempty"`
@ -229,21 +221,17 @@ func (m *User) Validate(formats strfmt.Registry) error {
}
func (m *User) validateAddress(formats strfmt.Registry) error {
if typeutils.IsZero(m.Address) { // not required
if swag.IsZero(m.Address) { // not required
return nil
}
if m.Address != nil {
if err := m.Address.Validate(formats); err != nil {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Address")
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Address")
}
return err
}
}
@ -252,26 +240,22 @@ func (m *User) validateAddress(formats strfmt.Registry) error {
}
func (m *User) validateTenantUsers(formats strfmt.Registry) error {
if typeutils.IsZero(m.TenantUsers) { // not required
if swag.IsZero(m.TenantUsers) { // not required
return nil
}
for i := 0; i < len(m.TenantUsers); i++ {
if typeutils.IsZero(m.TenantUsers[i]) { // not required
if swag.IsZero(m.TenantUsers[i]) { // not required
continue
}
if m.TenantUsers[i] != nil {
if err := m.TenantUsers[i].Validate(formats); err != nil {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("TenantUsers" + "." + strconv.Itoa(i))
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("TenantUsers" + "." + strconv.Itoa(i))
}
return err
}
}
@ -282,26 +266,22 @@ func (m *User) validateTenantUsers(formats strfmt.Registry) error {
}
func (m *User) validateUserRoles(formats strfmt.Registry) error {
if typeutils.IsZero(m.UserRoles) { // not required
if swag.IsZero(m.UserRoles) { // not required
return nil
}
for i := 0; i < len(m.UserRoles); i++ {
if typeutils.IsZero(m.UserRoles[i]) { // not required
if swag.IsZero(m.UserRoles[i]) { // not required
continue
}
if m.UserRoles[i] != nil {
if err := m.UserRoles[i].Validate(formats); err != nil {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("UserRoles" + "." + strconv.Itoa(i))
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("UserRoles" + "." + strconv.Itoa(i))
}
return err
}
}
@ -336,21 +316,12 @@ func (m *User) ContextValidate(ctx context.Context, formats strfmt.Registry) err
func (m *User) contextValidateAddress(ctx context.Context, formats strfmt.Registry) error {
if m.Address != nil {
if typeutils.IsZero(m.Address) { // not required
return nil
}
if err := m.Address.ContextValidate(ctx, formats); err != nil {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Address")
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Address")
}
return err
}
}
@ -363,21 +334,12 @@ func (m *User) contextValidateTenantUsers(ctx context.Context, formats strfmt.Re
for i := 0; i < len(m.TenantUsers); i++ {
if m.TenantUsers[i] != nil {
if typeutils.IsZero(m.TenantUsers[i]) { // not required
return nil
}
if err := m.TenantUsers[i].ContextValidate(ctx, formats); err != nil {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("TenantUsers" + "." + strconv.Itoa(i))
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("TenantUsers" + "." + strconv.Itoa(i))
}
return err
}
}
@ -392,21 +354,12 @@ func (m *User) contextValidateUserRoles(ctx context.Context, formats strfmt.Regi
for i := 0; i < len(m.UserRoles); i++ {
if m.UserRoles[i] != nil {
if typeutils.IsZero(m.UserRoles[i]) { // not required
return nil
}
if err := m.UserRoles[i].ContextValidate(ctx, formats); err != nil {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("UserRoles" + "." + strconv.Itoa(i))
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("UserRoles" + "." + strconv.Itoa(i))
}
return err
}
}
@ -421,13 +374,13 @@ func (m *User) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return jsonutils.WriteJSON(m)
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *User) UnmarshalBinary(b []byte) error {
var res User
if err := jsonutils.ReadJSON(b, &res); err != nil {
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,15 +6,16 @@
package auth_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
stderrors "errors"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag/typeutils"
"github.com/go-openapi/swag"
)
// UserResponse An array Taxnexus user objects
@ -48,26 +49,22 @@ func (m *UserResponse) Validate(formats strfmt.Registry) error {
}
func (m *UserResponse) validateData(formats strfmt.Registry) error {
if typeutils.IsZero(m.Data) { // not required
if swag.IsZero(m.Data) { // not required
return nil
}
for i := 0; i < len(m.Data); i++ {
if typeutils.IsZero(m.Data[i]) { // not required
if swag.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) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -78,21 +75,17 @@ func (m *UserResponse) validateData(formats strfmt.Registry) error {
}
func (m *UserResponse) validateMeta(formats strfmt.Registry) error {
if typeutils.IsZero(m.Meta) { // not required
if swag.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) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Meta")
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Meta")
}
return err
}
}
@ -123,21 +116,12 @@ func (m *UserResponse) contextValidateData(ctx context.Context, formats strfmt.R
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) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -150,21 +134,12 @@ func (m *UserResponse) contextValidateData(ctx context.Context, formats strfmt.R
func (m *UserResponse) 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) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Meta")
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Meta")
}
return err
}
}
@ -177,13 +152,13 @@ func (m *UserResponse) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return jsonutils.WriteJSON(m)
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *UserResponse) UnmarshalBinary(b []byte) error {
var res UserResponse
if err := jsonutils.ReadJSON(b, &res); err != nil {
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,11 +6,14 @@
package auth_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag"
)
// UserRole Relationship object that connects user to a role
@ -73,13 +76,13 @@ func (m *UserRole) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return jsonutils.WriteJSON(m)
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *UserRole) UnmarshalBinary(b []byte) error {
var res UserRole
if err := jsonutils.ReadJSON(b, &res); err != nil {
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,117 +6,55 @@
package accounts
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"fmt"
"time"
"github.com/go-openapi/runtime"
httptransport "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// New creates a new accounts API client.
func New(transport runtime.ContextualTransport, formats strfmt.Registry) ClientService {
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
// New creates a new accounts API client with basic auth credentials.
//
// It takes the following parameters:
// - host: http host (github.com).
// - basePath: any base path for the API client ("/v1", "/v3").
// - scheme: http scheme ("http", "https").
// - user: user for basic authentication header.
// - password: password for basic authentication header.
func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService {
transport := httptransport.New(host, basePath, []string{scheme})
transport.DefaultAuthentication = httptransport.BasicAuth(user, password)
return &Client{transport: transport, formats: strfmt.Default}
}
// New creates a new accounts API client with a bearer token for authentication.
//
// It takes the following parameters:
// - host: http host (github.com).
// - basePath: any base path for the API client ("/v1", "/v3").
// - scheme: http scheme ("http", "https").
// - bearerToken: bearer token for Bearer authentication header.
func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService {
transport := httptransport.New(host, basePath, []string{scheme})
transport.DefaultAuthentication = httptransport.BearerToken(bearerToken)
return &Client{transport: transport, formats: strfmt.Default}
}
// Client for accounts API.
/*
Client for accounts API
*/
type Client struct {
transport runtime.ContextualTransport
transport runtime.ClientTransport
formats strfmt.Registry
}
// ClientOption may be used to customize the behavior of Client methods.
// ClientOption is the option for Client methods
type ClientOption func(*runtime.ClientOperation)
// ClientService is the interface for Client methods.
// ClientService is the interface for Client methods
type ClientService interface {
// DeleteAccount delete an account.
DeleteAccount(params *DeleteAccountParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAccountOK, error)
// DeleteAccountContext delete an account.
DeleteAccountContext(ctx context.Context, params *DeleteAccountParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAccountOK, error)
// GetAccounts get a list of accounts.
GetAccounts(params *GetAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAccountsOK, error)
// GetAccountsContext get a list of accounts.
GetAccountsContext(ctx context.Context, params *GetAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAccountsOK, error)
// PostAccounts add a new account to salesforce devops net.
PostAccounts(params *PostAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAccountsOK, error)
// PostAccountsContext add a new account to salesforce devops net.
PostAccountsContext(ctx context.Context, params *PostAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAccountsOK, error)
// PutAccounts update a single account.
PutAccounts(params *PutAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutAccountsOK, error)
// PutAccountsContext update a single account.
PutAccountsContext(ctx context.Context, params *PutAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutAccountsOK, error)
SetTransport(transport runtime.ContextualTransport)
SetTransport(transport runtime.ClientTransport)
}
// DeleteAccount deletes an account.
//
// Delete SalesforceDevops.net Account record.
//
// This method does not support injected context.
// However, timeout and opentracing contexts are honored whenever enabled.
//
// If you need to pass a specific context, use [Client.DeleteAccountContext] instead.
/*
DeleteAccount deletes an account
Delete SalesforceDevops.net Account record
*/
func (a *Client) DeleteAccount(params *DeleteAccountParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAccountOK, error) {
var ctx context.Context
if params.inner.ctx != nil {
ctx = params.inner.ctx
} else {
ctx = context.Background()
}
return a.DeleteAccountContext(ctx, params, authInfo, opts...)
}
// DeleteAccountContext deletes an account.
//
// Delete SalesforceDevops.net Account record.
//
// Do not use the deprecated [DeleteAccountParams.Context] with this method: it would be ignored.
func (a *Client) DeleteAccountContext(ctx context.Context, params *DeleteAccountParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAccountOK, error) {
// NOTE: parameters are not validated before sending
// TODO: Validate the params before sending
if params == nil {
params = NewDeleteAccountParams()
}
op := &runtime.ClientOperation{
ID: "deleteAccount",
Method: "DELETE",
@ -127,63 +65,37 @@ func (a *Client) DeleteAccountContext(ctx context.Context, params *DeleteAccount
Params: params,
Reader: &DeleteAccountReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.SubmitContext(ctx, op)
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*DeleteAccountOK)
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
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for deleteAccount: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// GetAccounts gets a list of accounts.
//
// Return a list of all available Accounts.
//
// 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.GetAccountsContext] instead.
/*
GetAccounts gets a list of accounts
Return a list of all available Accounts
*/
func (a *Client) GetAccounts(params *GetAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAccountsOK, error) {
var ctx context.Context
if params.inner.ctx != nil {
ctx = params.inner.ctx
} else {
ctx = context.Background()
}
return a.GetAccountsContext(ctx, params, authInfo, opts...)
}
// GetAccountsContext gets a list of accounts.
//
// Return a list of all available Accounts.
//
// Do not use the deprecated [GetAccountsParams.Context] with this method: it would be ignored.
func (a *Client) GetAccountsContext(ctx context.Context, params *GetAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAccountsOK, error) {
// NOTE: parameters are not validated before sending
// TODO: Validate the params before sending
if params == nil {
params = NewGetAccountsParams()
}
op := &runtime.ClientOperation{
ID: "getAccounts",
Method: "GET",
@ -194,63 +106,37 @@ func (a *Client) GetAccountsContext(ctx context.Context, params *GetAccountsPara
Params: params,
Reader: &GetAccountsReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.SubmitContext(ctx, op)
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*GetAccountsOK)
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
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for getAccounts: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// PostAccounts adds a new account to salesforce devops net.
//
// Account record to be added.
//
// This method does not support injected context.
// However, timeout and opentracing contexts are honored whenever enabled.
//
// If you need to pass a specific context, use [Client.PostAccountsContext] instead.
/*
PostAccounts adds a new account to salesforce devops net
Account record to be added
*/
func (a *Client) PostAccounts(params *PostAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAccountsOK, error) {
var ctx context.Context
if params.inner.ctx != nil {
ctx = params.inner.ctx
} else {
ctx = context.Background()
}
return a.PostAccountsContext(ctx, params, authInfo, opts...)
}
// PostAccountsContext adds a new account to salesforce devops net.
//
// Account record to be added.
//
// Do not use the deprecated [PostAccountsParams.Context] with this method: it would be ignored.
func (a *Client) PostAccountsContext(ctx context.Context, params *PostAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAccountsOK, error) {
// NOTE: parameters are not validated before sending
// TODO: Validate the params before sending
if params == nil {
params = NewPostAccountsParams()
}
op := &runtime.ClientOperation{
ID: "postAccounts",
Method: "POST",
@ -261,63 +147,37 @@ func (a *Client) PostAccountsContext(ctx context.Context, params *PostAccountsPa
Params: params,
Reader: &PostAccountsReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.SubmitContext(ctx, op)
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*PostAccountsOK)
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
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for postAccounts: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// PutAccounts updates a single account.
//
// Update one or more accounts.
//
// 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.PutAccountsContext] instead.
/*
PutAccounts updates a single account
Update one or more accounts
*/
func (a *Client) PutAccounts(params *PutAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutAccountsOK, error) {
var ctx context.Context
if params.inner.ctx != nil {
ctx = params.inner.ctx
} else {
ctx = context.Background()
}
return a.PutAccountsContext(ctx, params, authInfo, opts...)
}
// PutAccountsContext updates a single account.
//
// Update one or more accounts.
//
// Do not use the deprecated [PutAccountsParams.Context] with this method: it would be ignored.
func (a *Client) PutAccountsContext(ctx context.Context, params *PutAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutAccountsOK, error) {
// NOTE: parameters are not validated before sending
// TODO: Validate the params before sending
if params == nil {
params = NewPutAccountsParams()
}
op := &runtime.ClientOperation{
ID: "putAccounts",
Method: "PUT",
@ -328,42 +188,28 @@ func (a *Client) PutAccountsContext(ctx context.Context, params *PutAccountsPara
Params: params,
Reader: &PutAccountsReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.SubmitContext(ctx, op)
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*PutAccountsOK)
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
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for putAccounts: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ContextualTransport) {
func (a *Client) SetTransport(transport runtime.ClientTransport) {
a.transport = transport
}
// innerParams captures internal fields so they don't conflict with user-supplied parameters.
type innerParams struct {
timeout time.Duration
// Deprecated: use the operation call with context to pass the context instead of [AccountsParams].
ctx context.Context
}

View File

@ -6,6 +6,9 @@
package accounts
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
@ -24,28 +27,24 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewDeleteAccountParams() *DeleteAccountParams {
return NewDeleteAccountParamsWithTimeout(cr.DefaultTimeout)
return &DeleteAccountParams{
timeout: cr.DefaultTimeout,
}
}
// NewDeleteAccountParamsWithTimeout creates a new DeleteAccountParams object
// with the ability to set a timeout on a request.
func NewDeleteAccountParamsWithTimeout(timeout time.Duration) *DeleteAccountParams {
return &DeleteAccountParams{
inner: innerParams{
timeout: timeout,
},
}
}
// NewDeleteAccountParamsWithContext creates a new DeleteAccountParams object
// with the ability to set a context for a request.
//
// Deprecated: use the operation call with context to pass the context instead of [DeleteAccountParams].
func NewDeleteAccountParamsWithContext(ctx context.Context) *DeleteAccountParams {
return &DeleteAccountParams{
inner: innerParams{
ctx: ctx,
},
Context: ctx,
}
}
@ -66,14 +65,15 @@ DeleteAccountParams contains all the parameters to send to the API endpoint
*/
type DeleteAccountParams struct {
// AccountID.
//
// Record Id of an Account
/* AccountID.
Record Id of an Account
*/
AccountID *string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
inner innerParams
}
// WithDefaults hydrates default values in the delete account params (not the query body).
@ -91,57 +91,54 @@ func (o *DeleteAccountParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the delete account params.
// WithTimeout adds the timeout to the delete account params
func (o *DeleteAccountParams) WithTimeout(timeout time.Duration) *DeleteAccountParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the delete account params.
// SetTimeout adds the timeout to the delete account params
func (o *DeleteAccountParams) SetTimeout(timeout time.Duration) {
o.inner.timeout = timeout
o.timeout = timeout
}
// WithContext adds the context to the delete account params.
//
// Deprecated: use the operation call with context to pass the context instead of [DeleteAccountParams].
// WithContext adds the context to the delete account params
func (o *DeleteAccountParams) WithContext(ctx context.Context) *DeleteAccountParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the delete account params.
//
// Deprecated: use the operation call with context to pass the context instead of [DeleteAccountParams].
// SetContext adds the context to the delete account params
func (o *DeleteAccountParams) SetContext(ctx context.Context) {
o.inner.ctx = ctx
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the delete account params.
// WithHTTPClient adds the HTTPClient to the delete account params
func (o *DeleteAccountParams) WithHTTPClient(client *http.Client) *DeleteAccountParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the delete account params.
// SetHTTPClient adds the HTTPClient to the delete account params
func (o *DeleteAccountParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithAccountID adds the accountID to the delete account params.
// WithAccountID adds the accountID to the delete account params
func (o *DeleteAccountParams) WithAccountID(accountID *string) *DeleteAccountParams {
o.SetAccountID(accountID)
return o
}
// SetAccountID adds the accountId to the delete account params.
// SetAccountID adds the accountId to the delete account params
func (o *DeleteAccountParams) SetAccountID(accountID *string) {
o.AccountID = accountID
}
// WriteToRequest writes these params to a [runtime.ClientRequest].
// WriteToRequest writes these params to a swagger request
func (o *DeleteAccountParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.inner.timeout); err != nil {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error

View File

@ -6,15 +6,17 @@
package accounts
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
stderrors "errors"
"fmt"
"io"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
)
// DeleteAccountReader is a Reader for the DeleteAccount structure.
@ -23,7 +25,7 @@ type DeleteAccountReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *DeleteAccountReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
func (o *DeleteAccountReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewDeleteAccountOK()
@ -62,7 +64,7 @@ func (o *DeleteAccountReader) ReadResponse(response runtime.ClientResponse, cons
}
return nil, result
default:
return nil, runtime.NewAPIError("[DELETE /accounts] deleteAccount", response, response.Code())
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
@ -71,9 +73,11 @@ func NewDeleteAccountOK() *DeleteAccountOK {
return &DeleteAccountOK{}
}
// DeleteAccountOK describes a response with status code 200, with default header values.
//
// Response with Message Objects with Delete Status
/*
DeleteAccountOK describes a response with status code 200, with default header values.
Response with Message Objects with Delete Status
*/
type DeleteAccountOK struct {
AccessControlAllowOrigin string
@ -111,13 +115,11 @@ func (o *DeleteAccountOK) Code() int {
}
func (o *DeleteAccountOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountOK %s", 200, payload)
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountOK %+v", 200, o.Payload)
}
func (o *DeleteAccountOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountOK %s", 200, payload)
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountOK %+v", 200, o.Payload)
}
func (o *DeleteAccountOK) GetPayload() *crm_models.DeleteResponse {
@ -136,7 +138,7 @@ func (o *DeleteAccountOK) readResponse(response runtime.ClientResponse, consumer
o.Payload = new(crm_models.DeleteResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -148,9 +150,11 @@ func NewDeleteAccountUnauthorized() *DeleteAccountUnauthorized {
return &DeleteAccountUnauthorized{}
}
// DeleteAccountUnauthorized describes a response with status code 401, with default header values.
//
// Access unauthorized, invalid API-KEY was used
/*
DeleteAccountUnauthorized describes a response with status code 401, with default header values.
Access unauthorized, invalid API-KEY was used
*/
type DeleteAccountUnauthorized struct {
AccessControlAllowOrigin string
@ -188,13 +192,11 @@ func (o *DeleteAccountUnauthorized) Code() int {
}
func (o *DeleteAccountUnauthorized) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountUnauthorized %s", 401, payload)
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountUnauthorized %+v", 401, o.Payload)
}
func (o *DeleteAccountUnauthorized) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountUnauthorized %s", 401, payload)
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountUnauthorized %+v", 401, o.Payload)
}
func (o *DeleteAccountUnauthorized) GetPayload() *crm_models.Error {
@ -213,7 +215,7 @@ func (o *DeleteAccountUnauthorized) readResponse(response runtime.ClientResponse
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -225,9 +227,11 @@ func NewDeleteAccountForbidden() *DeleteAccountForbidden {
return &DeleteAccountForbidden{}
}
// DeleteAccountForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
/*
DeleteAccountForbidden describes a response with status code 403, with default header values.
Access forbidden, account lacks access
*/
type DeleteAccountForbidden struct {
AccessControlAllowOrigin string
@ -265,13 +269,11 @@ func (o *DeleteAccountForbidden) Code() int {
}
func (o *DeleteAccountForbidden) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountForbidden %s", 403, payload)
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountForbidden %+v", 403, o.Payload)
}
func (o *DeleteAccountForbidden) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountForbidden %s", 403, payload)
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountForbidden %+v", 403, o.Payload)
}
func (o *DeleteAccountForbidden) GetPayload() *crm_models.Error {
@ -290,7 +292,7 @@ func (o *DeleteAccountForbidden) readResponse(response runtime.ClientResponse, c
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -302,9 +304,11 @@ func NewDeleteAccountNotFound() *DeleteAccountNotFound {
return &DeleteAccountNotFound{}
}
// DeleteAccountNotFound describes a response with status code 404, with default header values.
//
// Resource was not found
/*
DeleteAccountNotFound describes a response with status code 404, with default header values.
Resource was not found
*/
type DeleteAccountNotFound struct {
AccessControlAllowOrigin string
@ -342,13 +346,11 @@ func (o *DeleteAccountNotFound) Code() int {
}
func (o *DeleteAccountNotFound) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountNotFound %s", 404, payload)
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountNotFound %+v", 404, o.Payload)
}
func (o *DeleteAccountNotFound) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountNotFound %s", 404, payload)
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountNotFound %+v", 404, o.Payload)
}
func (o *DeleteAccountNotFound) GetPayload() *crm_models.Error {
@ -367,7 +369,7 @@ func (o *DeleteAccountNotFound) readResponse(response runtime.ClientResponse, co
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -379,9 +381,11 @@ func NewDeleteAccountUnprocessableEntity() *DeleteAccountUnprocessableEntity {
return &DeleteAccountUnprocessableEntity{}
}
// DeleteAccountUnprocessableEntity describes a response with status code 422, with default header values.
//
// Unprocessable Entity, likely a bad parameter
/*
DeleteAccountUnprocessableEntity describes a response with status code 422, with default header values.
Unprocessable Entity, likely a bad parameter
*/
type DeleteAccountUnprocessableEntity struct {
AccessControlAllowOrigin string
@ -419,13 +423,11 @@ func (o *DeleteAccountUnprocessableEntity) Code() int {
}
func (o *DeleteAccountUnprocessableEntity) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountUnprocessableEntity %+v", 422, o.Payload)
}
func (o *DeleteAccountUnprocessableEntity) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountUnprocessableEntity %+v", 422, o.Payload)
}
func (o *DeleteAccountUnprocessableEntity) GetPayload() *crm_models.Error {
@ -444,7 +446,7 @@ func (o *DeleteAccountUnprocessableEntity) readResponse(response runtime.ClientR
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -456,9 +458,11 @@ func NewDeleteAccountInternalServerError() *DeleteAccountInternalServerError {
return &DeleteAccountInternalServerError{}
}
// DeleteAccountInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
/*
DeleteAccountInternalServerError describes a response with status code 500, with default header values.
Server Internal Error
*/
type DeleteAccountInternalServerError struct {
AccessControlAllowOrigin string
@ -496,13 +500,11 @@ func (o *DeleteAccountInternalServerError) Code() int {
}
func (o *DeleteAccountInternalServerError) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountInternalServerError %s", 500, payload)
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountInternalServerError %+v", 500, o.Payload)
}
func (o *DeleteAccountInternalServerError) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountInternalServerError %s", 500, payload)
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountInternalServerError %+v", 500, o.Payload)
}
func (o *DeleteAccountInternalServerError) GetPayload() *crm_models.Error {
@ -521,7 +523,7 @@ func (o *DeleteAccountInternalServerError) readResponse(response runtime.ClientR
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}

View File

@ -6,6 +6,9 @@
package accounts
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
@ -15,7 +18,7 @@ import (
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/conv"
"github.com/go-openapi/swag"
)
// NewGetAccountsParams creates a new GetAccountsParams object,
@ -25,28 +28,24 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewGetAccountsParams() *GetAccountsParams {
return NewGetAccountsParamsWithTimeout(cr.DefaultTimeout)
return &GetAccountsParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetAccountsParamsWithTimeout creates a new GetAccountsParams object
// with the ability to set a timeout on a request.
func NewGetAccountsParamsWithTimeout(timeout time.Duration) *GetAccountsParams {
return &GetAccountsParams{
inner: innerParams{
timeout: timeout,
},
}
}
// NewGetAccountsParamsWithContext creates a new GetAccountsParams object
// with the ability to set a context for a request.
//
// Deprecated: use the operation call with context to pass the context instead of [GetAccountsParams].
func NewGetAccountsParamsWithContext(ctx context.Context) *GetAccountsParams {
return &GetAccountsParams{
inner: innerParams{
ctx: ctx,
},
Context: ctx,
}
}
@ -67,43 +66,49 @@ GetAccountsParams contains all the parameters to send to the API endpoint
*/
type GetAccountsParams struct {
// AccountID.
//
// Record Id of an Account
/* AccountID.
Record Id of an Account
*/
AccountID *string
// Active.
//
// Only retrieve active records?
/* Active.
Only retrieve active records?
*/
Active *bool
// Limit.
//
// How many objects to return at one time
//
// Format: int64
/* Limit.
How many objects to return at one time
Format: int64
*/
Limit *int64
// Name.
//
// The Name of this Object
/* Name.
The Name of this Object
*/
Name *string
// Offset.
//
// How many objects to skip?
//
// Format: int64
/* Offset.
How many objects to skip?
Format: int64
*/
Offset *int64
// Slug.
//
// The Slug of this Object
/* Slug.
The Slug of this Object
*/
Slug *string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
inner innerParams
}
// WithDefaults hydrates default values in the get accounts params (not the query body).
@ -121,112 +126,109 @@ func (o *GetAccountsParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the get accounts params.
// WithTimeout adds the timeout to the get accounts params
func (o *GetAccountsParams) WithTimeout(timeout time.Duration) *GetAccountsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get accounts params.
// SetTimeout adds the timeout to the get accounts params
func (o *GetAccountsParams) SetTimeout(timeout time.Duration) {
o.inner.timeout = timeout
o.timeout = timeout
}
// WithContext adds the context to the get accounts params.
//
// Deprecated: use the operation call with context to pass the context instead of [GetAccountsParams].
// WithContext adds the context to the get accounts params
func (o *GetAccountsParams) WithContext(ctx context.Context) *GetAccountsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get accounts params.
//
// Deprecated: use the operation call with context to pass the context instead of [GetAccountsParams].
// SetContext adds the context to the get accounts params
func (o *GetAccountsParams) SetContext(ctx context.Context) {
o.inner.ctx = ctx
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get accounts params.
// WithHTTPClient adds the HTTPClient to the get accounts params
func (o *GetAccountsParams) WithHTTPClient(client *http.Client) *GetAccountsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get accounts params.
// SetHTTPClient adds the HTTPClient to the get accounts params
func (o *GetAccountsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithAccountID adds the accountID to the get accounts params.
// WithAccountID adds the accountID to the get accounts params
func (o *GetAccountsParams) WithAccountID(accountID *string) *GetAccountsParams {
o.SetAccountID(accountID)
return o
}
// SetAccountID adds the accountId to the get accounts params.
// SetAccountID adds the accountId to the get accounts params
func (o *GetAccountsParams) SetAccountID(accountID *string) {
o.AccountID = accountID
}
// WithActive adds the active to the get accounts params.
// WithActive adds the active to the get accounts params
func (o *GetAccountsParams) WithActive(active *bool) *GetAccountsParams {
o.SetActive(active)
return o
}
// SetActive adds the active to the get accounts params.
// SetActive adds the active to the get accounts params
func (o *GetAccountsParams) SetActive(active *bool) {
o.Active = active
}
// WithLimit adds the limit to the get accounts params.
// WithLimit adds the limit to the get accounts params
func (o *GetAccountsParams) WithLimit(limit *int64) *GetAccountsParams {
o.SetLimit(limit)
return o
}
// SetLimit adds the limit to the get accounts params.
// SetLimit adds the limit to the get accounts params
func (o *GetAccountsParams) SetLimit(limit *int64) {
o.Limit = limit
}
// WithName adds the name to the get accounts params.
// WithName adds the name to the get accounts params
func (o *GetAccountsParams) WithName(name *string) *GetAccountsParams {
o.SetName(name)
return o
}
// SetName adds the name to the get accounts params.
// SetName adds the name to the get accounts params
func (o *GetAccountsParams) SetName(name *string) {
o.Name = name
}
// WithOffset adds the offset to the get accounts params.
// WithOffset adds the offset to the get accounts params
func (o *GetAccountsParams) WithOffset(offset *int64) *GetAccountsParams {
o.SetOffset(offset)
return o
}
// SetOffset adds the offset to the get accounts params.
// SetOffset adds the offset to the get accounts params
func (o *GetAccountsParams) SetOffset(offset *int64) {
o.Offset = offset
}
// WithSlug adds the slug to the get accounts params.
// WithSlug adds the slug to the get accounts params
func (o *GetAccountsParams) WithSlug(slug *string) *GetAccountsParams {
o.SetSlug(slug)
return o
}
// SetSlug adds the slug to the get accounts params.
// SetSlug adds the slug to the get accounts params
func (o *GetAccountsParams) SetSlug(slug *string) {
o.Slug = slug
}
// WriteToRequest writes these params to a [runtime.ClientRequest].
// WriteToRequest writes these params to a swagger request
func (o *GetAccountsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.inner.timeout); err != nil {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
@ -256,7 +258,7 @@ func (o *GetAccountsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R
if o.Active != nil {
qrActive = *o.Active
}
qActive := conv.FormatBool(qrActive)
qActive := swag.FormatBool(qrActive)
if qActive != "" {
if err := r.SetQueryParam("active", qActive); err != nil {
@ -273,7 +275,7 @@ func (o *GetAccountsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R
if o.Limit != nil {
qrLimit = *o.Limit
}
qLimit := conv.FormatInteger(qrLimit)
qLimit := swag.FormatInt64(qrLimit)
if qLimit != "" {
if err := r.SetQueryParam("limit", qLimit); err != nil {
@ -307,7 +309,7 @@ func (o *GetAccountsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R
if o.Offset != nil {
qrOffset = *o.Offset
}
qOffset := conv.FormatInteger(qrOffset)
qOffset := swag.FormatInt64(qrOffset)
if qOffset != "" {
if err := r.SetQueryParam("offset", qOffset); err != nil {

View File

@ -6,15 +6,17 @@
package accounts
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
stderrors "errors"
"fmt"
"io"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
)
// GetAccountsReader is a Reader for the GetAccounts structure.
@ -23,7 +25,7 @@ type GetAccountsReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *GetAccountsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
func (o *GetAccountsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetAccountsOK()
@ -62,7 +64,7 @@ func (o *GetAccountsReader) ReadResponse(response runtime.ClientResponse, consum
}
return nil, result
default:
return nil, runtime.NewAPIError("[GET /accounts] getAccounts", response, response.Code())
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
@ -71,9 +73,11 @@ func NewGetAccountsOK() *GetAccountsOK {
return &GetAccountsOK{}
}
// GetAccountsOK describes a response with status code 200, with default header values.
//
// Response with Account objects with Contacts
/*
GetAccountsOK describes a response with status code 200, with default header values.
Response with Account objects with Contacts
*/
type GetAccountsOK struct {
AccessControlAllowOrigin string
CacheControl string
@ -112,13 +116,11 @@ func (o *GetAccountsOK) Code() int {
}
func (o *GetAccountsOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /accounts][%d] getAccountsOK %s", 200, payload)
return fmt.Sprintf("[GET /accounts][%d] getAccountsOK %+v", 200, o.Payload)
}
func (o *GetAccountsOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /accounts][%d] getAccountsOK %s", 200, payload)
return fmt.Sprintf("[GET /accounts][%d] getAccountsOK %+v", 200, o.Payload)
}
func (o *GetAccountsOK) GetPayload() *crm_models.AccountResponse {
@ -144,7 +146,7 @@ func (o *GetAccountsOK) readResponse(response runtime.ClientResponse, consumer r
o.Payload = new(crm_models.AccountResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -156,9 +158,11 @@ func NewGetAccountsUnauthorized() *GetAccountsUnauthorized {
return &GetAccountsUnauthorized{}
}
// GetAccountsUnauthorized describes a response with status code 401, with default header values.
//
// Access unauthorized, invalid API-KEY was used
/*
GetAccountsUnauthorized describes a response with status code 401, with default header values.
Access unauthorized, invalid API-KEY was used
*/
type GetAccountsUnauthorized struct {
AccessControlAllowOrigin string
@ -196,13 +200,11 @@ func (o *GetAccountsUnauthorized) Code() int {
}
func (o *GetAccountsUnauthorized) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /accounts][%d] getAccountsUnauthorized %s", 401, payload)
return fmt.Sprintf("[GET /accounts][%d] getAccountsUnauthorized %+v", 401, o.Payload)
}
func (o *GetAccountsUnauthorized) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /accounts][%d] getAccountsUnauthorized %s", 401, payload)
return fmt.Sprintf("[GET /accounts][%d] getAccountsUnauthorized %+v", 401, o.Payload)
}
func (o *GetAccountsUnauthorized) GetPayload() *crm_models.Error {
@ -221,7 +223,7 @@ func (o *GetAccountsUnauthorized) readResponse(response runtime.ClientResponse,
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -233,9 +235,11 @@ func NewGetAccountsForbidden() *GetAccountsForbidden {
return &GetAccountsForbidden{}
}
// GetAccountsForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
/*
GetAccountsForbidden describes a response with status code 403, with default header values.
Access forbidden, account lacks access
*/
type GetAccountsForbidden struct {
AccessControlAllowOrigin string
@ -273,13 +277,11 @@ func (o *GetAccountsForbidden) Code() int {
}
func (o *GetAccountsForbidden) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /accounts][%d] getAccountsForbidden %s", 403, payload)
return fmt.Sprintf("[GET /accounts][%d] getAccountsForbidden %+v", 403, o.Payload)
}
func (o *GetAccountsForbidden) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /accounts][%d] getAccountsForbidden %s", 403, payload)
return fmt.Sprintf("[GET /accounts][%d] getAccountsForbidden %+v", 403, o.Payload)
}
func (o *GetAccountsForbidden) GetPayload() *crm_models.Error {
@ -298,7 +300,7 @@ func (o *GetAccountsForbidden) readResponse(response runtime.ClientResponse, con
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -310,9 +312,11 @@ func NewGetAccountsNotFound() *GetAccountsNotFound {
return &GetAccountsNotFound{}
}
// GetAccountsNotFound describes a response with status code 404, with default header values.
//
// Resource was not found
/*
GetAccountsNotFound describes a response with status code 404, with default header values.
Resource was not found
*/
type GetAccountsNotFound struct {
AccessControlAllowOrigin string
@ -350,13 +354,11 @@ func (o *GetAccountsNotFound) Code() int {
}
func (o *GetAccountsNotFound) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /accounts][%d] getAccountsNotFound %s", 404, payload)
return fmt.Sprintf("[GET /accounts][%d] getAccountsNotFound %+v", 404, o.Payload)
}
func (o *GetAccountsNotFound) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /accounts][%d] getAccountsNotFound %s", 404, payload)
return fmt.Sprintf("[GET /accounts][%d] getAccountsNotFound %+v", 404, o.Payload)
}
func (o *GetAccountsNotFound) GetPayload() *crm_models.Error {
@ -375,7 +377,7 @@ func (o *GetAccountsNotFound) readResponse(response runtime.ClientResponse, cons
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -387,9 +389,11 @@ func NewGetAccountsUnprocessableEntity() *GetAccountsUnprocessableEntity {
return &GetAccountsUnprocessableEntity{}
}
// GetAccountsUnprocessableEntity describes a response with status code 422, with default header values.
//
// Unprocessable Entity, likely a bad parameter
/*
GetAccountsUnprocessableEntity describes a response with status code 422, with default header values.
Unprocessable Entity, likely a bad parameter
*/
type GetAccountsUnprocessableEntity struct {
AccessControlAllowOrigin string
@ -427,13 +431,11 @@ func (o *GetAccountsUnprocessableEntity) Code() int {
}
func (o *GetAccountsUnprocessableEntity) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /accounts][%d] getAccountsUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[GET /accounts][%d] getAccountsUnprocessableEntity %+v", 422, o.Payload)
}
func (o *GetAccountsUnprocessableEntity) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /accounts][%d] getAccountsUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[GET /accounts][%d] getAccountsUnprocessableEntity %+v", 422, o.Payload)
}
func (o *GetAccountsUnprocessableEntity) GetPayload() *crm_models.Error {
@ -452,7 +454,7 @@ func (o *GetAccountsUnprocessableEntity) readResponse(response runtime.ClientRes
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -464,9 +466,11 @@ func NewGetAccountsInternalServerError() *GetAccountsInternalServerError {
return &GetAccountsInternalServerError{}
}
// GetAccountsInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
/*
GetAccountsInternalServerError describes a response with status code 500, with default header values.
Server Internal Error
*/
type GetAccountsInternalServerError struct {
AccessControlAllowOrigin string
@ -504,13 +508,11 @@ func (o *GetAccountsInternalServerError) Code() int {
}
func (o *GetAccountsInternalServerError) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /accounts][%d] getAccountsInternalServerError %s", 500, payload)
return fmt.Sprintf("[GET /accounts][%d] getAccountsInternalServerError %+v", 500, o.Payload)
}
func (o *GetAccountsInternalServerError) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /accounts][%d] getAccountsInternalServerError %s", 500, payload)
return fmt.Sprintf("[GET /accounts][%d] getAccountsInternalServerError %+v", 500, o.Payload)
}
func (o *GetAccountsInternalServerError) GetPayload() *crm_models.Error {
@ -529,7 +531,7 @@ func (o *GetAccountsInternalServerError) readResponse(response runtime.ClientRes
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}

View File

@ -6,16 +6,20 @@
package accounts
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
)
// NewPostAccountsParams creates a new PostAccountsParams object,
@ -25,28 +29,24 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewPostAccountsParams() *PostAccountsParams {
return NewPostAccountsParamsWithTimeout(cr.DefaultTimeout)
return &PostAccountsParams{
timeout: cr.DefaultTimeout,
}
}
// NewPostAccountsParamsWithTimeout creates a new PostAccountsParams object
// with the ability to set a timeout on a request.
func NewPostAccountsParamsWithTimeout(timeout time.Duration) *PostAccountsParams {
return &PostAccountsParams{
inner: innerParams{
timeout: timeout,
},
}
}
// NewPostAccountsParamsWithContext creates a new PostAccountsParams object
// with the ability to set a context for a request.
//
// Deprecated: use the operation call with context to pass the context instead of [PostAccountsParams].
func NewPostAccountsParamsWithContext(ctx context.Context) *PostAccountsParams {
return &PostAccountsParams{
inner: innerParams{
ctx: ctx,
},
Context: ctx,
}
}
@ -67,14 +67,15 @@ PostAccountsParams contains all the parameters to send to the API endpoint
*/
type PostAccountsParams struct {
// AccountRequest.
//
// An array of new Account records
/* AccountRequest.
An array of new Account records
*/
AccountRequest *crm_models.AccountRequest
timeout time.Duration
Context context.Context
HTTPClient *http.Client
inner innerParams
}
// WithDefaults hydrates default values in the post accounts params (not the query body).
@ -92,57 +93,54 @@ func (o *PostAccountsParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the post accounts params.
// WithTimeout adds the timeout to the post accounts params
func (o *PostAccountsParams) WithTimeout(timeout time.Duration) *PostAccountsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the post accounts params.
// SetTimeout adds the timeout to the post accounts params
func (o *PostAccountsParams) SetTimeout(timeout time.Duration) {
o.inner.timeout = timeout
o.timeout = timeout
}
// WithContext adds the context to the post accounts params.
//
// Deprecated: use the operation call with context to pass the context instead of [PostAccountsParams].
// WithContext adds the context to the post accounts params
func (o *PostAccountsParams) WithContext(ctx context.Context) *PostAccountsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the post accounts params.
//
// Deprecated: use the operation call with context to pass the context instead of [PostAccountsParams].
// SetContext adds the context to the post accounts params
func (o *PostAccountsParams) SetContext(ctx context.Context) {
o.inner.ctx = ctx
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the post accounts params.
// WithHTTPClient adds the HTTPClient to the post accounts params
func (o *PostAccountsParams) WithHTTPClient(client *http.Client) *PostAccountsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the post accounts params.
// SetHTTPClient adds the HTTPClient to the post accounts params
func (o *PostAccountsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithAccountRequest adds the accountRequest to the post accounts params.
// WithAccountRequest adds the accountRequest to the post accounts params
func (o *PostAccountsParams) WithAccountRequest(accountRequest *crm_models.AccountRequest) *PostAccountsParams {
o.SetAccountRequest(accountRequest)
return o
}
// SetAccountRequest adds the accountRequest to the post accounts params.
// SetAccountRequest adds the accountRequest to the post accounts params
func (o *PostAccountsParams) SetAccountRequest(accountRequest *crm_models.AccountRequest) {
o.AccountRequest = accountRequest
}
// WriteToRequest writes these params to a [runtime.ClientRequest].
// WriteToRequest writes these params to a swagger request
func (o *PostAccountsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.inner.timeout); err != nil {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error

View File

@ -6,15 +6,17 @@
package accounts
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
stderrors "errors"
"fmt"
"io"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
)
// PostAccountsReader is a Reader for the PostAccounts structure.
@ -23,7 +25,7 @@ type PostAccountsReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *PostAccountsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
func (o *PostAccountsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewPostAccountsOK()
@ -62,7 +64,7 @@ func (o *PostAccountsReader) ReadResponse(response runtime.ClientResponse, consu
}
return nil, result
default:
return nil, runtime.NewAPIError("[POST /accounts] postAccounts", response, response.Code())
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
@ -71,9 +73,11 @@ func NewPostAccountsOK() *PostAccountsOK {
return &PostAccountsOK{}
}
// PostAccountsOK describes a response with status code 200, with default header values.
//
// Response with Account objects with Contacts
/*
PostAccountsOK describes a response with status code 200, with default header values.
Response with Account objects with Contacts
*/
type PostAccountsOK struct {
AccessControlAllowOrigin string
CacheControl string
@ -112,13 +116,11 @@ func (o *PostAccountsOK) Code() int {
}
func (o *PostAccountsOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /accounts][%d] postAccountsOK %s", 200, payload)
return fmt.Sprintf("[POST /accounts][%d] postAccountsOK %+v", 200, o.Payload)
}
func (o *PostAccountsOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /accounts][%d] postAccountsOK %s", 200, payload)
return fmt.Sprintf("[POST /accounts][%d] postAccountsOK %+v", 200, o.Payload)
}
func (o *PostAccountsOK) GetPayload() *crm_models.AccountResponse {
@ -144,7 +146,7 @@ func (o *PostAccountsOK) readResponse(response runtime.ClientResponse, consumer
o.Payload = new(crm_models.AccountResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -156,9 +158,11 @@ func NewPostAccountsUnauthorized() *PostAccountsUnauthorized {
return &PostAccountsUnauthorized{}
}
// PostAccountsUnauthorized describes a response with status code 401, with default header values.
//
// Access unauthorized, invalid API-KEY was used
/*
PostAccountsUnauthorized describes a response with status code 401, with default header values.
Access unauthorized, invalid API-KEY was used
*/
type PostAccountsUnauthorized struct {
AccessControlAllowOrigin string
@ -196,13 +200,11 @@ func (o *PostAccountsUnauthorized) Code() int {
}
func (o *PostAccountsUnauthorized) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /accounts][%d] postAccountsUnauthorized %s", 401, payload)
return fmt.Sprintf("[POST /accounts][%d] postAccountsUnauthorized %+v", 401, o.Payload)
}
func (o *PostAccountsUnauthorized) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /accounts][%d] postAccountsUnauthorized %s", 401, payload)
return fmt.Sprintf("[POST /accounts][%d] postAccountsUnauthorized %+v", 401, o.Payload)
}
func (o *PostAccountsUnauthorized) GetPayload() *crm_models.Error {
@ -221,7 +223,7 @@ func (o *PostAccountsUnauthorized) readResponse(response runtime.ClientResponse,
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -233,9 +235,11 @@ func NewPostAccountsForbidden() *PostAccountsForbidden {
return &PostAccountsForbidden{}
}
// PostAccountsForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
/*
PostAccountsForbidden describes a response with status code 403, with default header values.
Access forbidden, account lacks access
*/
type PostAccountsForbidden struct {
AccessControlAllowOrigin string
@ -273,13 +277,11 @@ func (o *PostAccountsForbidden) Code() int {
}
func (o *PostAccountsForbidden) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /accounts][%d] postAccountsForbidden %s", 403, payload)
return fmt.Sprintf("[POST /accounts][%d] postAccountsForbidden %+v", 403, o.Payload)
}
func (o *PostAccountsForbidden) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /accounts][%d] postAccountsForbidden %s", 403, payload)
return fmt.Sprintf("[POST /accounts][%d] postAccountsForbidden %+v", 403, o.Payload)
}
func (o *PostAccountsForbidden) GetPayload() *crm_models.Error {
@ -298,7 +300,7 @@ func (o *PostAccountsForbidden) readResponse(response runtime.ClientResponse, co
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -310,9 +312,11 @@ func NewPostAccountsNotFound() *PostAccountsNotFound {
return &PostAccountsNotFound{}
}
// PostAccountsNotFound describes a response with status code 404, with default header values.
//
// Resource was not found
/*
PostAccountsNotFound describes a response with status code 404, with default header values.
Resource was not found
*/
type PostAccountsNotFound struct {
AccessControlAllowOrigin string
@ -350,13 +354,11 @@ func (o *PostAccountsNotFound) Code() int {
}
func (o *PostAccountsNotFound) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /accounts][%d] postAccountsNotFound %s", 404, payload)
return fmt.Sprintf("[POST /accounts][%d] postAccountsNotFound %+v", 404, o.Payload)
}
func (o *PostAccountsNotFound) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /accounts][%d] postAccountsNotFound %s", 404, payload)
return fmt.Sprintf("[POST /accounts][%d] postAccountsNotFound %+v", 404, o.Payload)
}
func (o *PostAccountsNotFound) GetPayload() *crm_models.Error {
@ -375,7 +377,7 @@ func (o *PostAccountsNotFound) readResponse(response runtime.ClientResponse, con
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -387,9 +389,11 @@ func NewPostAccountsUnprocessableEntity() *PostAccountsUnprocessableEntity {
return &PostAccountsUnprocessableEntity{}
}
// PostAccountsUnprocessableEntity describes a response with status code 422, with default header values.
//
// Unprocessable Entity, likely a bad parameter
/*
PostAccountsUnprocessableEntity describes a response with status code 422, with default header values.
Unprocessable Entity, likely a bad parameter
*/
type PostAccountsUnprocessableEntity struct {
AccessControlAllowOrigin string
@ -427,13 +431,11 @@ func (o *PostAccountsUnprocessableEntity) Code() int {
}
func (o *PostAccountsUnprocessableEntity) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /accounts][%d] postAccountsUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[POST /accounts][%d] postAccountsUnprocessableEntity %+v", 422, o.Payload)
}
func (o *PostAccountsUnprocessableEntity) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /accounts][%d] postAccountsUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[POST /accounts][%d] postAccountsUnprocessableEntity %+v", 422, o.Payload)
}
func (o *PostAccountsUnprocessableEntity) GetPayload() *crm_models.Error {
@ -452,7 +454,7 @@ func (o *PostAccountsUnprocessableEntity) readResponse(response runtime.ClientRe
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -464,9 +466,11 @@ func NewPostAccountsInternalServerError() *PostAccountsInternalServerError {
return &PostAccountsInternalServerError{}
}
// PostAccountsInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
/*
PostAccountsInternalServerError describes a response with status code 500, with default header values.
Server Internal Error
*/
type PostAccountsInternalServerError struct {
AccessControlAllowOrigin string
@ -504,13 +508,11 @@ func (o *PostAccountsInternalServerError) Code() int {
}
func (o *PostAccountsInternalServerError) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /accounts][%d] postAccountsInternalServerError %s", 500, payload)
return fmt.Sprintf("[POST /accounts][%d] postAccountsInternalServerError %+v", 500, o.Payload)
}
func (o *PostAccountsInternalServerError) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /accounts][%d] postAccountsInternalServerError %s", 500, payload)
return fmt.Sprintf("[POST /accounts][%d] postAccountsInternalServerError %+v", 500, o.Payload)
}
func (o *PostAccountsInternalServerError) GetPayload() *crm_models.Error {
@ -529,7 +531,7 @@ func (o *PostAccountsInternalServerError) readResponse(response runtime.ClientRe
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}

View File

@ -6,16 +6,20 @@
package accounts
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
)
// NewPutAccountsParams creates a new PutAccountsParams object,
@ -25,28 +29,24 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewPutAccountsParams() *PutAccountsParams {
return NewPutAccountsParamsWithTimeout(cr.DefaultTimeout)
return &PutAccountsParams{
timeout: cr.DefaultTimeout,
}
}
// NewPutAccountsParamsWithTimeout creates a new PutAccountsParams object
// with the ability to set a timeout on a request.
func NewPutAccountsParamsWithTimeout(timeout time.Duration) *PutAccountsParams {
return &PutAccountsParams{
inner: innerParams{
timeout: timeout,
},
}
}
// NewPutAccountsParamsWithContext creates a new PutAccountsParams object
// with the ability to set a context for a request.
//
// Deprecated: use the operation call with context to pass the context instead of [PutAccountsParams].
func NewPutAccountsParamsWithContext(ctx context.Context) *PutAccountsParams {
return &PutAccountsParams{
inner: innerParams{
ctx: ctx,
},
Context: ctx,
}
}
@ -67,14 +67,15 @@ PutAccountsParams contains all the parameters to send to the API endpoint
*/
type PutAccountsParams struct {
// AccountRequest.
//
// An array of new Account records
/* AccountRequest.
An array of new Account records
*/
AccountRequest *crm_models.AccountRequest
timeout time.Duration
Context context.Context
HTTPClient *http.Client
inner innerParams
}
// WithDefaults hydrates default values in the put accounts params (not the query body).
@ -92,57 +93,54 @@ func (o *PutAccountsParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the put accounts params.
// WithTimeout adds the timeout to the put accounts params
func (o *PutAccountsParams) WithTimeout(timeout time.Duration) *PutAccountsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the put accounts params.
// SetTimeout adds the timeout to the put accounts params
func (o *PutAccountsParams) SetTimeout(timeout time.Duration) {
o.inner.timeout = timeout
o.timeout = timeout
}
// WithContext adds the context to the put accounts params.
//
// Deprecated: use the operation call with context to pass the context instead of [PutAccountsParams].
// WithContext adds the context to the put accounts params
func (o *PutAccountsParams) WithContext(ctx context.Context) *PutAccountsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the put accounts params.
//
// Deprecated: use the operation call with context to pass the context instead of [PutAccountsParams].
// SetContext adds the context to the put accounts params
func (o *PutAccountsParams) SetContext(ctx context.Context) {
o.inner.ctx = ctx
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the put accounts params.
// WithHTTPClient adds the HTTPClient to the put accounts params
func (o *PutAccountsParams) WithHTTPClient(client *http.Client) *PutAccountsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the put accounts params.
// SetHTTPClient adds the HTTPClient to the put accounts params
func (o *PutAccountsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithAccountRequest adds the accountRequest to the put accounts params.
// WithAccountRequest adds the accountRequest to the put accounts params
func (o *PutAccountsParams) WithAccountRequest(accountRequest *crm_models.AccountRequest) *PutAccountsParams {
o.SetAccountRequest(accountRequest)
return o
}
// SetAccountRequest adds the accountRequest to the put accounts params.
// SetAccountRequest adds the accountRequest to the put accounts params
func (o *PutAccountsParams) SetAccountRequest(accountRequest *crm_models.AccountRequest) {
o.AccountRequest = accountRequest
}
// WriteToRequest writes these params to a [runtime.ClientRequest].
// WriteToRequest writes these params to a swagger request
func (o *PutAccountsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.inner.timeout); err != nil {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error

View File

@ -6,15 +6,17 @@
package accounts
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
stderrors "errors"
"fmt"
"io"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
)
// PutAccountsReader is a Reader for the PutAccounts structure.
@ -23,7 +25,7 @@ type PutAccountsReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *PutAccountsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
func (o *PutAccountsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewPutAccountsOK()
@ -62,7 +64,7 @@ func (o *PutAccountsReader) ReadResponse(response runtime.ClientResponse, consum
}
return nil, result
default:
return nil, runtime.NewAPIError("[PUT /accounts] putAccounts", response, response.Code())
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
@ -71,9 +73,11 @@ func NewPutAccountsOK() *PutAccountsOK {
return &PutAccountsOK{}
}
// PutAccountsOK describes a response with status code 200, with default header values.
//
// Response with Account objects with Contacts
/*
PutAccountsOK describes a response with status code 200, with default header values.
Response with Account objects with Contacts
*/
type PutAccountsOK struct {
AccessControlAllowOrigin string
CacheControl string
@ -112,13 +116,11 @@ func (o *PutAccountsOK) Code() int {
}
func (o *PutAccountsOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /accounts][%d] putAccountsOK %s", 200, payload)
return fmt.Sprintf("[PUT /accounts][%d] putAccountsOK %+v", 200, o.Payload)
}
func (o *PutAccountsOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /accounts][%d] putAccountsOK %s", 200, payload)
return fmt.Sprintf("[PUT /accounts][%d] putAccountsOK %+v", 200, o.Payload)
}
func (o *PutAccountsOK) GetPayload() *crm_models.AccountResponse {
@ -144,7 +146,7 @@ func (o *PutAccountsOK) readResponse(response runtime.ClientResponse, consumer r
o.Payload = new(crm_models.AccountResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -156,9 +158,11 @@ func NewPutAccountsUnauthorized() *PutAccountsUnauthorized {
return &PutAccountsUnauthorized{}
}
// PutAccountsUnauthorized describes a response with status code 401, with default header values.
//
// Access unauthorized, invalid API-KEY was used
/*
PutAccountsUnauthorized describes a response with status code 401, with default header values.
Access unauthorized, invalid API-KEY was used
*/
type PutAccountsUnauthorized struct {
AccessControlAllowOrigin string
@ -196,13 +200,11 @@ func (o *PutAccountsUnauthorized) Code() int {
}
func (o *PutAccountsUnauthorized) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /accounts][%d] putAccountsUnauthorized %s", 401, payload)
return fmt.Sprintf("[PUT /accounts][%d] putAccountsUnauthorized %+v", 401, o.Payload)
}
func (o *PutAccountsUnauthorized) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /accounts][%d] putAccountsUnauthorized %s", 401, payload)
return fmt.Sprintf("[PUT /accounts][%d] putAccountsUnauthorized %+v", 401, o.Payload)
}
func (o *PutAccountsUnauthorized) GetPayload() *crm_models.Error {
@ -221,7 +223,7 @@ func (o *PutAccountsUnauthorized) readResponse(response runtime.ClientResponse,
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -233,9 +235,11 @@ func NewPutAccountsForbidden() *PutAccountsForbidden {
return &PutAccountsForbidden{}
}
// PutAccountsForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
/*
PutAccountsForbidden describes a response with status code 403, with default header values.
Access forbidden, account lacks access
*/
type PutAccountsForbidden struct {
AccessControlAllowOrigin string
@ -273,13 +277,11 @@ func (o *PutAccountsForbidden) Code() int {
}
func (o *PutAccountsForbidden) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /accounts][%d] putAccountsForbidden %s", 403, payload)
return fmt.Sprintf("[PUT /accounts][%d] putAccountsForbidden %+v", 403, o.Payload)
}
func (o *PutAccountsForbidden) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /accounts][%d] putAccountsForbidden %s", 403, payload)
return fmt.Sprintf("[PUT /accounts][%d] putAccountsForbidden %+v", 403, o.Payload)
}
func (o *PutAccountsForbidden) GetPayload() *crm_models.Error {
@ -298,7 +300,7 @@ func (o *PutAccountsForbidden) readResponse(response runtime.ClientResponse, con
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -310,9 +312,11 @@ func NewPutAccountsNotFound() *PutAccountsNotFound {
return &PutAccountsNotFound{}
}
// PutAccountsNotFound describes a response with status code 404, with default header values.
//
// Resource was not found
/*
PutAccountsNotFound describes a response with status code 404, with default header values.
Resource was not found
*/
type PutAccountsNotFound struct {
AccessControlAllowOrigin string
@ -350,13 +354,11 @@ func (o *PutAccountsNotFound) Code() int {
}
func (o *PutAccountsNotFound) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /accounts][%d] putAccountsNotFound %s", 404, payload)
return fmt.Sprintf("[PUT /accounts][%d] putAccountsNotFound %+v", 404, o.Payload)
}
func (o *PutAccountsNotFound) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /accounts][%d] putAccountsNotFound %s", 404, payload)
return fmt.Sprintf("[PUT /accounts][%d] putAccountsNotFound %+v", 404, o.Payload)
}
func (o *PutAccountsNotFound) GetPayload() *crm_models.Error {
@ -375,7 +377,7 @@ func (o *PutAccountsNotFound) readResponse(response runtime.ClientResponse, cons
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -387,9 +389,11 @@ func NewPutAccountsUnprocessableEntity() *PutAccountsUnprocessableEntity {
return &PutAccountsUnprocessableEntity{}
}
// PutAccountsUnprocessableEntity describes a response with status code 422, with default header values.
//
// Unprocessable Entity, likely a bad parameter
/*
PutAccountsUnprocessableEntity describes a response with status code 422, with default header values.
Unprocessable Entity, likely a bad parameter
*/
type PutAccountsUnprocessableEntity struct {
AccessControlAllowOrigin string
@ -427,13 +431,11 @@ func (o *PutAccountsUnprocessableEntity) Code() int {
}
func (o *PutAccountsUnprocessableEntity) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /accounts][%d] putAccountsUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[PUT /accounts][%d] putAccountsUnprocessableEntity %+v", 422, o.Payload)
}
func (o *PutAccountsUnprocessableEntity) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /accounts][%d] putAccountsUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[PUT /accounts][%d] putAccountsUnprocessableEntity %+v", 422, o.Payload)
}
func (o *PutAccountsUnprocessableEntity) GetPayload() *crm_models.Error {
@ -452,7 +454,7 @@ func (o *PutAccountsUnprocessableEntity) readResponse(response runtime.ClientRes
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -464,9 +466,11 @@ func NewPutAccountsInternalServerError() *PutAccountsInternalServerError {
return &PutAccountsInternalServerError{}
}
// PutAccountsInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
/*
PutAccountsInternalServerError describes a response with status code 500, with default header values.
Server Internal Error
*/
type PutAccountsInternalServerError struct {
AccessControlAllowOrigin string
@ -504,13 +508,11 @@ func (o *PutAccountsInternalServerError) Code() int {
}
func (o *PutAccountsInternalServerError) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /accounts][%d] putAccountsInternalServerError %s", 500, payload)
return fmt.Sprintf("[PUT /accounts][%d] putAccountsInternalServerError %+v", 500, o.Payload)
}
func (o *PutAccountsInternalServerError) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /accounts][%d] putAccountsInternalServerError %s", 500, payload)
return fmt.Sprintf("[PUT /accounts][%d] putAccountsInternalServerError %+v", 500, o.Payload)
}
func (o *PutAccountsInternalServerError) GetPayload() *crm_models.Error {
@ -529,7 +531,7 @@ func (o *PutAccountsInternalServerError) readResponse(response runtime.ClientRes
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}

View File

@ -6,117 +6,55 @@
package assets
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"fmt"
"time"
"github.com/go-openapi/runtime"
httptransport "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// New creates a new assets API client.
func New(transport runtime.ContextualTransport, formats strfmt.Registry) ClientService {
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
// New creates a new assets API client with basic auth credentials.
//
// It takes the following parameters:
// - host: http host (github.com).
// - basePath: any base path for the API client ("/v1", "/v3").
// - scheme: http scheme ("http", "https").
// - user: user for basic authentication header.
// - password: password for basic authentication header.
func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService {
transport := httptransport.New(host, basePath, []string{scheme})
transport.DefaultAuthentication = httptransport.BasicAuth(user, password)
return &Client{transport: transport, formats: strfmt.Default}
}
// New creates a new assets API client with a bearer token for authentication.
//
// It takes the following parameters:
// - host: http host (github.com).
// - basePath: any base path for the API client ("/v1", "/v3").
// - scheme: http scheme ("http", "https").
// - bearerToken: bearer token for Bearer authentication header.
func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService {
transport := httptransport.New(host, basePath, []string{scheme})
transport.DefaultAuthentication = httptransport.BearerToken(bearerToken)
return &Client{transport: transport, formats: strfmt.Default}
}
// Client for assets API.
/*
Client for assets API
*/
type Client struct {
transport runtime.ContextualTransport
transport runtime.ClientTransport
formats strfmt.Registry
}
// ClientOption may be used to customize the behavior of Client methods.
// ClientOption is the option for Client methods
type ClientOption func(*runtime.ClientOperation)
// ClientService is the interface for Client methods.
// ClientService is the interface for Client methods
type ClientService interface {
// DeleteAsset delete an asset.
DeleteAsset(params *DeleteAssetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAssetOK, error)
// DeleteAssetContext delete an asset.
DeleteAssetContext(ctx context.Context, params *DeleteAssetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAssetOK, error)
// GetAssets get a list of assets.
GetAssets(params *GetAssetsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAssetsOK, error)
// GetAssetsContext get a list of assets.
GetAssetsContext(ctx context.Context, params *GetAssetsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAssetsOK, error)
// PostAssets add a new asset.
PostAssets(params *PostAssetsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAssetsOK, error)
// PostAssetsContext add a new asset.
PostAssetsContext(ctx context.Context, params *PostAssetsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAssetsOK, error)
// PutAsset update a single asset.
PutAsset(params *PutAssetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutAssetOK, error)
// PutAssetContext update a single asset.
PutAssetContext(ctx context.Context, params *PutAssetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutAssetOK, error)
SetTransport(transport runtime.ContextualTransport)
SetTransport(transport runtime.ClientTransport)
}
// DeleteAsset deletes an asset.
//
// Delete SalesforceDevops.net Asset record.
//
// This method does not support injected context.
// However, timeout and opentracing contexts are honored whenever enabled.
//
// If you need to pass a specific context, use [Client.DeleteAssetContext] instead.
/*
DeleteAsset deletes an asset
Delete SalesforceDevops.net Asset record
*/
func (a *Client) DeleteAsset(params *DeleteAssetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAssetOK, error) {
var ctx context.Context
if params.inner.ctx != nil {
ctx = params.inner.ctx
} else {
ctx = context.Background()
}
return a.DeleteAssetContext(ctx, params, authInfo, opts...)
}
// DeleteAssetContext deletes an asset.
//
// Delete SalesforceDevops.net Asset record.
//
// Do not use the deprecated [DeleteAssetParams.Context] with this method: it would be ignored.
func (a *Client) DeleteAssetContext(ctx context.Context, params *DeleteAssetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAssetOK, error) {
// NOTE: parameters are not validated before sending
// TODO: Validate the params before sending
if params == nil {
params = NewDeleteAssetParams()
}
op := &runtime.ClientOperation{
ID: "deleteAsset",
Method: "DELETE",
@ -127,63 +65,37 @@ func (a *Client) DeleteAssetContext(ctx context.Context, params *DeleteAssetPara
Params: params,
Reader: &DeleteAssetReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.SubmitContext(ctx, op)
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*DeleteAssetOK)
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
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for deleteAsset: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// GetAssets gets a list of assets.
//
// Return tenant-bound Asset records. Requires the exact crm:asset:read scope..
//
// 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.GetAssetsContext] instead.
/*
GetAssets gets a list of assets
Return a list of all available Assets
*/
func (a *Client) GetAssets(params *GetAssetsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAssetsOK, error) {
var ctx context.Context
if params.inner.ctx != nil {
ctx = params.inner.ctx
} else {
ctx = context.Background()
}
return a.GetAssetsContext(ctx, params, authInfo, opts...)
}
// GetAssetsContext gets a list of assets.
//
// Return tenant-bound Asset records. Requires the exact crm:asset:read scope..
//
// Do not use the deprecated [GetAssetsParams.Context] with this method: it would be ignored.
func (a *Client) GetAssetsContext(ctx context.Context, params *GetAssetsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAssetsOK, error) {
// NOTE: parameters are not validated before sending
// TODO: Validate the params before sending
if params == nil {
params = NewGetAssetsParams()
}
op := &runtime.ClientOperation{
ID: "getAssets",
Method: "GET",
@ -194,63 +106,37 @@ func (a *Client) GetAssetsContext(ctx context.Context, params *GetAssetsParams,
Params: params,
Reader: &GetAssetsReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.SubmitContext(ctx, op)
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*GetAssetsOK)
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
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for getAssets: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// PostAssets adds a new asset.
//
// Create one tenant-bound Asset with server-owned identity and audit fields..
//
// This method does not support injected context.
// However, timeout and opentracing contexts are honored whenever enabled.
//
// If you need to pass a specific context, use [Client.PostAssetsContext] instead.
/*
PostAssets adds a new asset to salesforce devops net
Asset record to be added
*/
func (a *Client) PostAssets(params *PostAssetsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAssetsOK, error) {
var ctx context.Context
if params.inner.ctx != nil {
ctx = params.inner.ctx
} else {
ctx = context.Background()
}
return a.PostAssetsContext(ctx, params, authInfo, opts...)
}
// PostAssetsContext adds a new asset.
//
// Create one tenant-bound Asset with server-owned identity and audit fields..
//
// Do not use the deprecated [PostAssetsParams.Context] with this method: it would be ignored.
func (a *Client) PostAssetsContext(ctx context.Context, params *PostAssetsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAssetsOK, error) {
// NOTE: parameters are not validated before sending
// TODO: Validate the params before sending
if params == nil {
params = NewPostAssetsParams()
}
op := &runtime.ClientOperation{
ID: "postAssets",
Method: "POST",
@ -261,63 +147,37 @@ func (a *Client) PostAssetsContext(ctx context.Context, params *PostAssetsParams
Params: params,
Reader: &PostAssetsReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.SubmitContext(ctx, op)
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*PostAssetsOK)
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
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for postAssets: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// PutAsset updates a single asset.
//
// Optimistically update one tenant-bound Asset's authoritative business fields..
//
// This method does not support injected context.
// However, timeout and opentracing contexts are honored whenever enabled.
//
// If you need to pass a specific context, use [Client.PutAssetContext] instead.
/*
PutAsset updates a single asset
Update a single asset specified by assetId
*/
func (a *Client) PutAsset(params *PutAssetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutAssetOK, error) {
var ctx context.Context
if params.inner.ctx != nil {
ctx = params.inner.ctx
} else {
ctx = context.Background()
}
return a.PutAssetContext(ctx, params, authInfo, opts...)
}
// PutAssetContext updates a single asset.
//
// Optimistically update one tenant-bound Asset's authoritative business fields..
//
// Do not use the deprecated [PutAssetParams.Context] with this method: it would be ignored.
func (a *Client) PutAssetContext(ctx context.Context, params *PutAssetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutAssetOK, error) {
// NOTE: parameters are not validated before sending
// TODO: Validate the params before sending
if params == nil {
params = NewPutAssetParams()
}
op := &runtime.ClientOperation{
ID: "putAsset",
Method: "PUT",
@ -328,42 +188,28 @@ func (a *Client) PutAssetContext(ctx context.Context, params *PutAssetParams, au
Params: params,
Reader: &PutAssetReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.SubmitContext(ctx, op)
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*PutAssetOK)
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
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for putAsset: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ContextualTransport) {
func (a *Client) SetTransport(transport runtime.ClientTransport) {
a.transport = transport
}
// innerParams captures internal fields so they don't conflict with user-supplied parameters.
type innerParams struct {
timeout time.Duration
// Deprecated: use the operation call with context to pass the context instead of [AssetsParams].
ctx context.Context
}

View File

@ -6,6 +6,9 @@
package assets
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
@ -24,28 +27,24 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewDeleteAssetParams() *DeleteAssetParams {
return NewDeleteAssetParamsWithTimeout(cr.DefaultTimeout)
return &DeleteAssetParams{
timeout: cr.DefaultTimeout,
}
}
// NewDeleteAssetParamsWithTimeout creates a new DeleteAssetParams object
// with the ability to set a timeout on a request.
func NewDeleteAssetParamsWithTimeout(timeout time.Duration) *DeleteAssetParams {
return &DeleteAssetParams{
inner: innerParams{
timeout: timeout,
},
}
}
// NewDeleteAssetParamsWithContext creates a new DeleteAssetParams object
// with the ability to set a context for a request.
//
// Deprecated: use the operation call with context to pass the context instead of [DeleteAssetParams].
func NewDeleteAssetParamsWithContext(ctx context.Context) *DeleteAssetParams {
return &DeleteAssetParams{
inner: innerParams{
ctx: ctx,
},
Context: ctx,
}
}
@ -66,14 +65,15 @@ DeleteAssetParams contains all the parameters to send to the API endpoint
*/
type DeleteAssetParams struct {
// AssetID.
//
// Record Id of an Asset
/* AssetID.
Record Id of an Asset
*/
AssetID *string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
inner innerParams
}
// WithDefaults hydrates default values in the delete asset params (not the query body).
@ -91,57 +91,54 @@ func (o *DeleteAssetParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the delete asset params.
// WithTimeout adds the timeout to the delete asset params
func (o *DeleteAssetParams) WithTimeout(timeout time.Duration) *DeleteAssetParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the delete asset params.
// SetTimeout adds the timeout to the delete asset params
func (o *DeleteAssetParams) SetTimeout(timeout time.Duration) {
o.inner.timeout = timeout
o.timeout = timeout
}
// WithContext adds the context to the delete asset params.
//
// Deprecated: use the operation call with context to pass the context instead of [DeleteAssetParams].
// WithContext adds the context to the delete asset params
func (o *DeleteAssetParams) WithContext(ctx context.Context) *DeleteAssetParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the delete asset params.
//
// Deprecated: use the operation call with context to pass the context instead of [DeleteAssetParams].
// SetContext adds the context to the delete asset params
func (o *DeleteAssetParams) SetContext(ctx context.Context) {
o.inner.ctx = ctx
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the delete asset params.
// WithHTTPClient adds the HTTPClient to the delete asset params
func (o *DeleteAssetParams) WithHTTPClient(client *http.Client) *DeleteAssetParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the delete asset params.
// SetHTTPClient adds the HTTPClient to the delete asset params
func (o *DeleteAssetParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithAssetID adds the assetID to the delete asset params.
// WithAssetID adds the assetID to the delete asset params
func (o *DeleteAssetParams) WithAssetID(assetID *string) *DeleteAssetParams {
o.SetAssetID(assetID)
return o
}
// SetAssetID adds the assetId to the delete asset params.
// SetAssetID adds the assetId to the delete asset params
func (o *DeleteAssetParams) SetAssetID(assetID *string) {
o.AssetID = assetID
}
// WriteToRequest writes these params to a [runtime.ClientRequest].
// WriteToRequest writes these params to a swagger request
func (o *DeleteAssetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.inner.timeout); err != nil {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error

View File

@ -6,15 +6,17 @@
package assets
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
stderrors "errors"
"fmt"
"io"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
)
// DeleteAssetReader is a Reader for the DeleteAsset structure.
@ -23,7 +25,7 @@ type DeleteAssetReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *DeleteAssetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
func (o *DeleteAssetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewDeleteAssetOK()
@ -62,7 +64,7 @@ func (o *DeleteAssetReader) ReadResponse(response runtime.ClientResponse, consum
}
return nil, result
default:
return nil, runtime.NewAPIError("[DELETE /assets] deleteAsset", response, response.Code())
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
@ -71,9 +73,11 @@ func NewDeleteAssetOK() *DeleteAssetOK {
return &DeleteAssetOK{}
}
// DeleteAssetOK describes a response with status code 200, with default header values.
//
// Response with Message Objects with Delete Status
/*
DeleteAssetOK describes a response with status code 200, with default header values.
Response with Message Objects with Delete Status
*/
type DeleteAssetOK struct {
AccessControlAllowOrigin string
@ -111,13 +115,11 @@ func (o *DeleteAssetOK) Code() int {
}
func (o *DeleteAssetOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetOK %s", 200, payload)
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetOK %+v", 200, o.Payload)
}
func (o *DeleteAssetOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetOK %s", 200, payload)
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetOK %+v", 200, o.Payload)
}
func (o *DeleteAssetOK) GetPayload() *crm_models.DeleteResponse {
@ -136,7 +138,7 @@ func (o *DeleteAssetOK) readResponse(response runtime.ClientResponse, consumer r
o.Payload = new(crm_models.DeleteResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -148,9 +150,11 @@ func NewDeleteAssetUnauthorized() *DeleteAssetUnauthorized {
return &DeleteAssetUnauthorized{}
}
// DeleteAssetUnauthorized describes a response with status code 401, with default header values.
//
// Access unauthorized, invalid API-KEY was used
/*
DeleteAssetUnauthorized describes a response with status code 401, with default header values.
Access unauthorized, invalid API-KEY was used
*/
type DeleteAssetUnauthorized struct {
AccessControlAllowOrigin string
@ -188,13 +192,11 @@ func (o *DeleteAssetUnauthorized) Code() int {
}
func (o *DeleteAssetUnauthorized) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetUnauthorized %s", 401, payload)
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetUnauthorized %+v", 401, o.Payload)
}
func (o *DeleteAssetUnauthorized) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetUnauthorized %s", 401, payload)
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetUnauthorized %+v", 401, o.Payload)
}
func (o *DeleteAssetUnauthorized) GetPayload() *crm_models.Error {
@ -213,7 +215,7 @@ func (o *DeleteAssetUnauthorized) readResponse(response runtime.ClientResponse,
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -225,9 +227,11 @@ func NewDeleteAssetForbidden() *DeleteAssetForbidden {
return &DeleteAssetForbidden{}
}
// DeleteAssetForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
/*
DeleteAssetForbidden describes a response with status code 403, with default header values.
Access forbidden, account lacks access
*/
type DeleteAssetForbidden struct {
AccessControlAllowOrigin string
@ -265,13 +269,11 @@ func (o *DeleteAssetForbidden) Code() int {
}
func (o *DeleteAssetForbidden) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetForbidden %s", 403, payload)
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetForbidden %+v", 403, o.Payload)
}
func (o *DeleteAssetForbidden) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetForbidden %s", 403, payload)
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetForbidden %+v", 403, o.Payload)
}
func (o *DeleteAssetForbidden) GetPayload() *crm_models.Error {
@ -290,7 +292,7 @@ func (o *DeleteAssetForbidden) readResponse(response runtime.ClientResponse, con
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -302,9 +304,11 @@ func NewDeleteAssetNotFound() *DeleteAssetNotFound {
return &DeleteAssetNotFound{}
}
// DeleteAssetNotFound describes a response with status code 404, with default header values.
//
// Resource was not found
/*
DeleteAssetNotFound describes a response with status code 404, with default header values.
Resource was not found
*/
type DeleteAssetNotFound struct {
AccessControlAllowOrigin string
@ -342,13 +346,11 @@ func (o *DeleteAssetNotFound) Code() int {
}
func (o *DeleteAssetNotFound) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetNotFound %s", 404, payload)
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetNotFound %+v", 404, o.Payload)
}
func (o *DeleteAssetNotFound) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetNotFound %s", 404, payload)
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetNotFound %+v", 404, o.Payload)
}
func (o *DeleteAssetNotFound) GetPayload() *crm_models.Error {
@ -367,7 +369,7 @@ func (o *DeleteAssetNotFound) readResponse(response runtime.ClientResponse, cons
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -379,9 +381,11 @@ func NewDeleteAssetUnprocessableEntity() *DeleteAssetUnprocessableEntity {
return &DeleteAssetUnprocessableEntity{}
}
// DeleteAssetUnprocessableEntity describes a response with status code 422, with default header values.
//
// Unprocessable Entity, likely a bad parameter
/*
DeleteAssetUnprocessableEntity describes a response with status code 422, with default header values.
Unprocessable Entity, likely a bad parameter
*/
type DeleteAssetUnprocessableEntity struct {
AccessControlAllowOrigin string
@ -419,13 +423,11 @@ func (o *DeleteAssetUnprocessableEntity) Code() int {
}
func (o *DeleteAssetUnprocessableEntity) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetUnprocessableEntity %+v", 422, o.Payload)
}
func (o *DeleteAssetUnprocessableEntity) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetUnprocessableEntity %+v", 422, o.Payload)
}
func (o *DeleteAssetUnprocessableEntity) GetPayload() *crm_models.Error {
@ -444,7 +446,7 @@ func (o *DeleteAssetUnprocessableEntity) readResponse(response runtime.ClientRes
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -456,9 +458,11 @@ func NewDeleteAssetInternalServerError() *DeleteAssetInternalServerError {
return &DeleteAssetInternalServerError{}
}
// DeleteAssetInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
/*
DeleteAssetInternalServerError describes a response with status code 500, with default header values.
Server Internal Error
*/
type DeleteAssetInternalServerError struct {
AccessControlAllowOrigin string
@ -496,13 +500,11 @@ func (o *DeleteAssetInternalServerError) Code() int {
}
func (o *DeleteAssetInternalServerError) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetInternalServerError %s", 500, payload)
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetInternalServerError %+v", 500, o.Payload)
}
func (o *DeleteAssetInternalServerError) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetInternalServerError %s", 500, payload)
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetInternalServerError %+v", 500, o.Payload)
}
func (o *DeleteAssetInternalServerError) GetPayload() *crm_models.Error {
@ -521,7 +523,7 @@ func (o *DeleteAssetInternalServerError) readResponse(response runtime.ClientRes
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}

View File

@ -6,6 +6,9 @@
package assets
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
@ -15,7 +18,7 @@ import (
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/conv"
"github.com/go-openapi/swag"
)
// NewGetAssetsParams creates a new GetAssetsParams object,
@ -25,28 +28,24 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewGetAssetsParams() *GetAssetsParams {
return NewGetAssetsParamsWithTimeout(cr.DefaultTimeout)
return &GetAssetsParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetAssetsParamsWithTimeout creates a new GetAssetsParams object
// with the ability to set a timeout on a request.
func NewGetAssetsParamsWithTimeout(timeout time.Duration) *GetAssetsParams {
return &GetAssetsParams{
inner: innerParams{
timeout: timeout,
},
}
}
// NewGetAssetsParamsWithContext creates a new GetAssetsParams object
// with the ability to set a context for a request.
//
// Deprecated: use the operation call with context to pass the context instead of [GetAssetsParams].
func NewGetAssetsParamsWithContext(ctx context.Context) *GetAssetsParams {
return &GetAssetsParams{
inner: innerParams{
ctx: ctx,
},
Context: ctx,
}
}
@ -67,33 +66,37 @@ GetAssetsParams contains all the parameters to send to the API endpoint
*/
type GetAssetsParams struct {
// AccountID.
//
// Record Id of an Account
/* AccountID.
Record Id of an Account
*/
AccountID *string
// AssetID.
//
// Record Id of an Asset
/* AssetID.
Record Id of an Asset
*/
AssetID *string
// Limit.
//
// How many objects to return at one time
//
// Format: int64
/* Limit.
How many objects to return at one time
Format: int64
*/
Limit *int64
// Offset.
//
// How many objects to skip?
//
// Format: int64
/* Offset.
How many objects to skip?
Format: int64
*/
Offset *int64
timeout time.Duration
Context context.Context
HTTPClient *http.Client
inner innerParams
}
// WithDefaults hydrates default values in the get assets params (not the query body).
@ -111,90 +114,87 @@ func (o *GetAssetsParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the get assets params.
// WithTimeout adds the timeout to the get assets params
func (o *GetAssetsParams) WithTimeout(timeout time.Duration) *GetAssetsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get assets params.
// SetTimeout adds the timeout to the get assets params
func (o *GetAssetsParams) SetTimeout(timeout time.Duration) {
o.inner.timeout = timeout
o.timeout = timeout
}
// WithContext adds the context to the get assets params.
//
// Deprecated: use the operation call with context to pass the context instead of [GetAssetsParams].
// WithContext adds the context to the get assets params
func (o *GetAssetsParams) WithContext(ctx context.Context) *GetAssetsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get assets params.
//
// Deprecated: use the operation call with context to pass the context instead of [GetAssetsParams].
// SetContext adds the context to the get assets params
func (o *GetAssetsParams) SetContext(ctx context.Context) {
o.inner.ctx = ctx
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get assets params.
// WithHTTPClient adds the HTTPClient to the get assets params
func (o *GetAssetsParams) WithHTTPClient(client *http.Client) *GetAssetsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get assets params.
// SetHTTPClient adds the HTTPClient to the get assets params
func (o *GetAssetsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithAccountID adds the accountID to the get assets params.
// WithAccountID adds the accountID to the get assets params
func (o *GetAssetsParams) WithAccountID(accountID *string) *GetAssetsParams {
o.SetAccountID(accountID)
return o
}
// SetAccountID adds the accountId to the get assets params.
// SetAccountID adds the accountId to the get assets params
func (o *GetAssetsParams) SetAccountID(accountID *string) {
o.AccountID = accountID
}
// WithAssetID adds the assetID to the get assets params.
// WithAssetID adds the assetID to the get assets params
func (o *GetAssetsParams) WithAssetID(assetID *string) *GetAssetsParams {
o.SetAssetID(assetID)
return o
}
// SetAssetID adds the assetId to the get assets params.
// SetAssetID adds the assetId to the get assets params
func (o *GetAssetsParams) SetAssetID(assetID *string) {
o.AssetID = assetID
}
// WithLimit adds the limit to the get assets params.
// WithLimit adds the limit to the get assets params
func (o *GetAssetsParams) WithLimit(limit *int64) *GetAssetsParams {
o.SetLimit(limit)
return o
}
// SetLimit adds the limit to the get assets params.
// SetLimit adds the limit to the get assets params
func (o *GetAssetsParams) SetLimit(limit *int64) {
o.Limit = limit
}
// WithOffset adds the offset to the get assets params.
// WithOffset adds the offset to the get assets params
func (o *GetAssetsParams) WithOffset(offset *int64) *GetAssetsParams {
o.SetOffset(offset)
return o
}
// SetOffset adds the offset to the get assets params.
// SetOffset adds the offset to the get assets params
func (o *GetAssetsParams) SetOffset(offset *int64) {
o.Offset = offset
}
// WriteToRequest writes these params to a [runtime.ClientRequest].
// WriteToRequest writes these params to a swagger request
func (o *GetAssetsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.inner.timeout); err != nil {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
@ -241,7 +241,7 @@ func (o *GetAssetsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Reg
if o.Limit != nil {
qrLimit = *o.Limit
}
qLimit := conv.FormatInteger(qrLimit)
qLimit := swag.FormatInt64(qrLimit)
if qLimit != "" {
if err := r.SetQueryParam("limit", qLimit); err != nil {
@ -258,7 +258,7 @@ func (o *GetAssetsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Reg
if o.Offset != nil {
qrOffset = *o.Offset
}
qOffset := conv.FormatInteger(qrOffset)
qOffset := swag.FormatInt64(qrOffset)
if qOffset != "" {
if err := r.SetQueryParam("offset", qOffset); err != nil {

View File

@ -6,15 +6,17 @@
package assets
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
stderrors "errors"
"fmt"
"io"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
)
// GetAssetsReader is a Reader for the GetAssets structure.
@ -23,7 +25,7 @@ type GetAssetsReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *GetAssetsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
func (o *GetAssetsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetAssetsOK()
@ -62,7 +64,7 @@ func (o *GetAssetsReader) ReadResponse(response runtime.ClientResponse, consumer
}
return nil, result
default:
return nil, runtime.NewAPIError("[GET /assets] getAssets", response, response.Code())
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
@ -71,9 +73,11 @@ func NewGetAssetsOK() *GetAssetsOK {
return &GetAssetsOK{}
}
// GetAssetsOK describes a response with status code 200, with default header values.
//
// Response with Asset objects with Contacts
/*
GetAssetsOK describes a response with status code 200, with default header values.
Response with Asset objects with Contacts
*/
type GetAssetsOK struct {
AccessControlAllowOrigin string
CacheControl string
@ -112,13 +116,11 @@ func (o *GetAssetsOK) Code() int {
}
func (o *GetAssetsOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /assets][%d] getAssetsOK %s", 200, payload)
return fmt.Sprintf("[GET /assets][%d] getAssetsOK %+v", 200, o.Payload)
}
func (o *GetAssetsOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /assets][%d] getAssetsOK %s", 200, payload)
return fmt.Sprintf("[GET /assets][%d] getAssetsOK %+v", 200, o.Payload)
}
func (o *GetAssetsOK) GetPayload() *crm_models.AssetResponse {
@ -144,7 +146,7 @@ func (o *GetAssetsOK) readResponse(response runtime.ClientResponse, consumer run
o.Payload = new(crm_models.AssetResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -156,9 +158,11 @@ func NewGetAssetsUnauthorized() *GetAssetsUnauthorized {
return &GetAssetsUnauthorized{}
}
// GetAssetsUnauthorized describes a response with status code 401, with default header values.
//
// Access unauthorized, invalid API-KEY was used
/*
GetAssetsUnauthorized describes a response with status code 401, with default header values.
Access unauthorized, invalid API-KEY was used
*/
type GetAssetsUnauthorized struct {
AccessControlAllowOrigin string
@ -196,13 +200,11 @@ func (o *GetAssetsUnauthorized) Code() int {
}
func (o *GetAssetsUnauthorized) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /assets][%d] getAssetsUnauthorized %s", 401, payload)
return fmt.Sprintf("[GET /assets][%d] getAssetsUnauthorized %+v", 401, o.Payload)
}
func (o *GetAssetsUnauthorized) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /assets][%d] getAssetsUnauthorized %s", 401, payload)
return fmt.Sprintf("[GET /assets][%d] getAssetsUnauthorized %+v", 401, o.Payload)
}
func (o *GetAssetsUnauthorized) GetPayload() *crm_models.Error {
@ -221,7 +223,7 @@ func (o *GetAssetsUnauthorized) readResponse(response runtime.ClientResponse, co
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -233,9 +235,11 @@ func NewGetAssetsForbidden() *GetAssetsForbidden {
return &GetAssetsForbidden{}
}
// GetAssetsForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
/*
GetAssetsForbidden describes a response with status code 403, with default header values.
Access forbidden, account lacks access
*/
type GetAssetsForbidden struct {
AccessControlAllowOrigin string
@ -273,13 +277,11 @@ func (o *GetAssetsForbidden) Code() int {
}
func (o *GetAssetsForbidden) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /assets][%d] getAssetsForbidden %s", 403, payload)
return fmt.Sprintf("[GET /assets][%d] getAssetsForbidden %+v", 403, o.Payload)
}
func (o *GetAssetsForbidden) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /assets][%d] getAssetsForbidden %s", 403, payload)
return fmt.Sprintf("[GET /assets][%d] getAssetsForbidden %+v", 403, o.Payload)
}
func (o *GetAssetsForbidden) GetPayload() *crm_models.Error {
@ -298,7 +300,7 @@ func (o *GetAssetsForbidden) readResponse(response runtime.ClientResponse, consu
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -310,9 +312,11 @@ func NewGetAssetsNotFound() *GetAssetsNotFound {
return &GetAssetsNotFound{}
}
// GetAssetsNotFound describes a response with status code 404, with default header values.
//
// Resource was not found
/*
GetAssetsNotFound describes a response with status code 404, with default header values.
Resource was not found
*/
type GetAssetsNotFound struct {
AccessControlAllowOrigin string
@ -350,13 +354,11 @@ func (o *GetAssetsNotFound) Code() int {
}
func (o *GetAssetsNotFound) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /assets][%d] getAssetsNotFound %s", 404, payload)
return fmt.Sprintf("[GET /assets][%d] getAssetsNotFound %+v", 404, o.Payload)
}
func (o *GetAssetsNotFound) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /assets][%d] getAssetsNotFound %s", 404, payload)
return fmt.Sprintf("[GET /assets][%d] getAssetsNotFound %+v", 404, o.Payload)
}
func (o *GetAssetsNotFound) GetPayload() *crm_models.Error {
@ -375,7 +377,7 @@ func (o *GetAssetsNotFound) readResponse(response runtime.ClientResponse, consum
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -387,9 +389,11 @@ func NewGetAssetsUnprocessableEntity() *GetAssetsUnprocessableEntity {
return &GetAssetsUnprocessableEntity{}
}
// GetAssetsUnprocessableEntity describes a response with status code 422, with default header values.
//
// Unprocessable Entity, likely a bad parameter
/*
GetAssetsUnprocessableEntity describes a response with status code 422, with default header values.
Unprocessable Entity, likely a bad parameter
*/
type GetAssetsUnprocessableEntity struct {
AccessControlAllowOrigin string
@ -427,13 +431,11 @@ func (o *GetAssetsUnprocessableEntity) Code() int {
}
func (o *GetAssetsUnprocessableEntity) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /assets][%d] getAssetsUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[GET /assets][%d] getAssetsUnprocessableEntity %+v", 422, o.Payload)
}
func (o *GetAssetsUnprocessableEntity) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /assets][%d] getAssetsUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[GET /assets][%d] getAssetsUnprocessableEntity %+v", 422, o.Payload)
}
func (o *GetAssetsUnprocessableEntity) GetPayload() *crm_models.Error {
@ -452,7 +454,7 @@ func (o *GetAssetsUnprocessableEntity) readResponse(response runtime.ClientRespo
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -464,9 +466,11 @@ func NewGetAssetsInternalServerError() *GetAssetsInternalServerError {
return &GetAssetsInternalServerError{}
}
// GetAssetsInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
/*
GetAssetsInternalServerError describes a response with status code 500, with default header values.
Server Internal Error
*/
type GetAssetsInternalServerError struct {
AccessControlAllowOrigin string
@ -504,13 +508,11 @@ func (o *GetAssetsInternalServerError) Code() int {
}
func (o *GetAssetsInternalServerError) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /assets][%d] getAssetsInternalServerError %s", 500, payload)
return fmt.Sprintf("[GET /assets][%d] getAssetsInternalServerError %+v", 500, o.Payload)
}
func (o *GetAssetsInternalServerError) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /assets][%d] getAssetsInternalServerError %s", 500, payload)
return fmt.Sprintf("[GET /assets][%d] getAssetsInternalServerError %+v", 500, o.Payload)
}
func (o *GetAssetsInternalServerError) GetPayload() *crm_models.Error {
@ -529,7 +531,7 @@ func (o *GetAssetsInternalServerError) readResponse(response runtime.ClientRespo
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}

View File

@ -6,16 +6,20 @@
package assets
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
)
// NewPostAssetsParams creates a new PostAssetsParams object,
@ -25,28 +29,24 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewPostAssetsParams() *PostAssetsParams {
return NewPostAssetsParamsWithTimeout(cr.DefaultTimeout)
return &PostAssetsParams{
timeout: cr.DefaultTimeout,
}
}
// NewPostAssetsParamsWithTimeout creates a new PostAssetsParams object
// with the ability to set a timeout on a request.
func NewPostAssetsParamsWithTimeout(timeout time.Duration) *PostAssetsParams {
return &PostAssetsParams{
inner: innerParams{
timeout: timeout,
},
}
}
// NewPostAssetsParamsWithContext creates a new PostAssetsParams object
// with the ability to set a context for a request.
//
// Deprecated: use the operation call with context to pass the context instead of [PostAssetsParams].
func NewPostAssetsParamsWithContext(ctx context.Context) *PostAssetsParams {
return &PostAssetsParams{
inner: innerParams{
ctx: ctx,
},
Context: ctx,
}
}
@ -67,14 +67,15 @@ PostAssetsParams contains all the parameters to send to the API endpoint
*/
type PostAssetsParams struct {
// AssetRequest.
//
// An array of new Asset records
/* AssetRequest.
An array of new Asset records
*/
AssetRequest *crm_models.AssetRequest
timeout time.Duration
Context context.Context
HTTPClient *http.Client
inner innerParams
}
// WithDefaults hydrates default values in the post assets params (not the query body).
@ -92,57 +93,54 @@ func (o *PostAssetsParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the post assets params.
// WithTimeout adds the timeout to the post assets params
func (o *PostAssetsParams) WithTimeout(timeout time.Duration) *PostAssetsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the post assets params.
// SetTimeout adds the timeout to the post assets params
func (o *PostAssetsParams) SetTimeout(timeout time.Duration) {
o.inner.timeout = timeout
o.timeout = timeout
}
// WithContext adds the context to the post assets params.
//
// Deprecated: use the operation call with context to pass the context instead of [PostAssetsParams].
// WithContext adds the context to the post assets params
func (o *PostAssetsParams) WithContext(ctx context.Context) *PostAssetsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the post assets params.
//
// Deprecated: use the operation call with context to pass the context instead of [PostAssetsParams].
// SetContext adds the context to the post assets params
func (o *PostAssetsParams) SetContext(ctx context.Context) {
o.inner.ctx = ctx
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the post assets params.
// WithHTTPClient adds the HTTPClient to the post assets params
func (o *PostAssetsParams) WithHTTPClient(client *http.Client) *PostAssetsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the post assets params.
// SetHTTPClient adds the HTTPClient to the post assets params
func (o *PostAssetsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithAssetRequest adds the assetRequest to the post assets params.
// WithAssetRequest adds the assetRequest to the post assets params
func (o *PostAssetsParams) WithAssetRequest(assetRequest *crm_models.AssetRequest) *PostAssetsParams {
o.SetAssetRequest(assetRequest)
return o
}
// SetAssetRequest adds the assetRequest to the post assets params.
// SetAssetRequest adds the assetRequest to the post assets params
func (o *PostAssetsParams) SetAssetRequest(assetRequest *crm_models.AssetRequest) {
o.AssetRequest = assetRequest
}
// WriteToRequest writes these params to a [runtime.ClientRequest].
// WriteToRequest writes these params to a swagger request
func (o *PostAssetsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.inner.timeout); err != nil {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error

View File

@ -6,15 +6,17 @@
package assets
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
stderrors "errors"
"fmt"
"io"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
)
// PostAssetsReader is a Reader for the PostAssets structure.
@ -23,7 +25,7 @@ type PostAssetsReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *PostAssetsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
func (o *PostAssetsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewPostAssetsOK()
@ -62,7 +64,7 @@ func (o *PostAssetsReader) ReadResponse(response runtime.ClientResponse, consume
}
return nil, result
default:
return nil, runtime.NewAPIError("[POST /assets] postAssets", response, response.Code())
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
@ -71,9 +73,11 @@ func NewPostAssetsOK() *PostAssetsOK {
return &PostAssetsOK{}
}
// PostAssetsOK describes a response with status code 200, with default header values.
//
// Response with Asset objects with Contacts
/*
PostAssetsOK describes a response with status code 200, with default header values.
Response with Asset objects with Contacts
*/
type PostAssetsOK struct {
AccessControlAllowOrigin string
CacheControl string
@ -112,13 +116,11 @@ func (o *PostAssetsOK) Code() int {
}
func (o *PostAssetsOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /assets][%d] postAssetsOK %s", 200, payload)
return fmt.Sprintf("[POST /assets][%d] postAssetsOK %+v", 200, o.Payload)
}
func (o *PostAssetsOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /assets][%d] postAssetsOK %s", 200, payload)
return fmt.Sprintf("[POST /assets][%d] postAssetsOK %+v", 200, o.Payload)
}
func (o *PostAssetsOK) GetPayload() *crm_models.AssetResponse {
@ -144,7 +146,7 @@ func (o *PostAssetsOK) readResponse(response runtime.ClientResponse, consumer ru
o.Payload = new(crm_models.AssetResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -156,9 +158,11 @@ func NewPostAssetsUnauthorized() *PostAssetsUnauthorized {
return &PostAssetsUnauthorized{}
}
// PostAssetsUnauthorized describes a response with status code 401, with default header values.
//
// Access unauthorized, invalid API-KEY was used
/*
PostAssetsUnauthorized describes a response with status code 401, with default header values.
Access unauthorized, invalid API-KEY was used
*/
type PostAssetsUnauthorized struct {
AccessControlAllowOrigin string
@ -196,13 +200,11 @@ func (o *PostAssetsUnauthorized) Code() int {
}
func (o *PostAssetsUnauthorized) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /assets][%d] postAssetsUnauthorized %s", 401, payload)
return fmt.Sprintf("[POST /assets][%d] postAssetsUnauthorized %+v", 401, o.Payload)
}
func (o *PostAssetsUnauthorized) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /assets][%d] postAssetsUnauthorized %s", 401, payload)
return fmt.Sprintf("[POST /assets][%d] postAssetsUnauthorized %+v", 401, o.Payload)
}
func (o *PostAssetsUnauthorized) GetPayload() *crm_models.Error {
@ -221,7 +223,7 @@ func (o *PostAssetsUnauthorized) readResponse(response runtime.ClientResponse, c
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -233,9 +235,11 @@ func NewPostAssetsForbidden() *PostAssetsForbidden {
return &PostAssetsForbidden{}
}
// PostAssetsForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
/*
PostAssetsForbidden describes a response with status code 403, with default header values.
Access forbidden, account lacks access
*/
type PostAssetsForbidden struct {
AccessControlAllowOrigin string
@ -273,13 +277,11 @@ func (o *PostAssetsForbidden) Code() int {
}
func (o *PostAssetsForbidden) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /assets][%d] postAssetsForbidden %s", 403, payload)
return fmt.Sprintf("[POST /assets][%d] postAssetsForbidden %+v", 403, o.Payload)
}
func (o *PostAssetsForbidden) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /assets][%d] postAssetsForbidden %s", 403, payload)
return fmt.Sprintf("[POST /assets][%d] postAssetsForbidden %+v", 403, o.Payload)
}
func (o *PostAssetsForbidden) GetPayload() *crm_models.Error {
@ -298,7 +300,7 @@ func (o *PostAssetsForbidden) readResponse(response runtime.ClientResponse, cons
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -310,9 +312,11 @@ func NewPostAssetsNotFound() *PostAssetsNotFound {
return &PostAssetsNotFound{}
}
// PostAssetsNotFound describes a response with status code 404, with default header values.
//
// Resource was not found
/*
PostAssetsNotFound describes a response with status code 404, with default header values.
Resource was not found
*/
type PostAssetsNotFound struct {
AccessControlAllowOrigin string
@ -350,13 +354,11 @@ func (o *PostAssetsNotFound) Code() int {
}
func (o *PostAssetsNotFound) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /assets][%d] postAssetsNotFound %s", 404, payload)
return fmt.Sprintf("[POST /assets][%d] postAssetsNotFound %+v", 404, o.Payload)
}
func (o *PostAssetsNotFound) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /assets][%d] postAssetsNotFound %s", 404, payload)
return fmt.Sprintf("[POST /assets][%d] postAssetsNotFound %+v", 404, o.Payload)
}
func (o *PostAssetsNotFound) GetPayload() *crm_models.Error {
@ -375,7 +377,7 @@ func (o *PostAssetsNotFound) readResponse(response runtime.ClientResponse, consu
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -387,9 +389,11 @@ func NewPostAssetsUnprocessableEntity() *PostAssetsUnprocessableEntity {
return &PostAssetsUnprocessableEntity{}
}
// PostAssetsUnprocessableEntity describes a response with status code 422, with default header values.
//
// Unprocessable Entity, likely a bad parameter
/*
PostAssetsUnprocessableEntity describes a response with status code 422, with default header values.
Unprocessable Entity, likely a bad parameter
*/
type PostAssetsUnprocessableEntity struct {
AccessControlAllowOrigin string
@ -427,13 +431,11 @@ func (o *PostAssetsUnprocessableEntity) Code() int {
}
func (o *PostAssetsUnprocessableEntity) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /assets][%d] postAssetsUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[POST /assets][%d] postAssetsUnprocessableEntity %+v", 422, o.Payload)
}
func (o *PostAssetsUnprocessableEntity) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /assets][%d] postAssetsUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[POST /assets][%d] postAssetsUnprocessableEntity %+v", 422, o.Payload)
}
func (o *PostAssetsUnprocessableEntity) GetPayload() *crm_models.Error {
@ -452,7 +454,7 @@ func (o *PostAssetsUnprocessableEntity) readResponse(response runtime.ClientResp
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -464,9 +466,11 @@ func NewPostAssetsInternalServerError() *PostAssetsInternalServerError {
return &PostAssetsInternalServerError{}
}
// PostAssetsInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
/*
PostAssetsInternalServerError describes a response with status code 500, with default header values.
Server Internal Error
*/
type PostAssetsInternalServerError struct {
AccessControlAllowOrigin string
@ -504,13 +508,11 @@ func (o *PostAssetsInternalServerError) Code() int {
}
func (o *PostAssetsInternalServerError) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /assets][%d] postAssetsInternalServerError %s", 500, payload)
return fmt.Sprintf("[POST /assets][%d] postAssetsInternalServerError %+v", 500, o.Payload)
}
func (o *PostAssetsInternalServerError) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /assets][%d] postAssetsInternalServerError %s", 500, payload)
return fmt.Sprintf("[POST /assets][%d] postAssetsInternalServerError %+v", 500, o.Payload)
}
func (o *PostAssetsInternalServerError) GetPayload() *crm_models.Error {
@ -529,7 +531,7 @@ func (o *PostAssetsInternalServerError) readResponse(response runtime.ClientResp
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}

View File

@ -6,16 +6,20 @@
package assets
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
)
// NewPutAssetParams creates a new PutAssetParams object,
@ -25,28 +29,24 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewPutAssetParams() *PutAssetParams {
return NewPutAssetParamsWithTimeout(cr.DefaultTimeout)
return &PutAssetParams{
timeout: cr.DefaultTimeout,
}
}
// NewPutAssetParamsWithTimeout creates a new PutAssetParams object
// with the ability to set a timeout on a request.
func NewPutAssetParamsWithTimeout(timeout time.Duration) *PutAssetParams {
return &PutAssetParams{
inner: innerParams{
timeout: timeout,
},
}
}
// NewPutAssetParamsWithContext creates a new PutAssetParams object
// with the ability to set a context for a request.
//
// Deprecated: use the operation call with context to pass the context instead of [PutAssetParams].
func NewPutAssetParamsWithContext(ctx context.Context) *PutAssetParams {
return &PutAssetParams{
inner: innerParams{
ctx: ctx,
},
Context: ctx,
}
}
@ -67,14 +67,15 @@ PutAssetParams contains all the parameters to send to the API endpoint
*/
type PutAssetParams struct {
// AssetRequest.
//
// An array of new Asset records
/* AssetRequest.
An array of new Asset records
*/
AssetRequest *crm_models.AssetRequest
timeout time.Duration
Context context.Context
HTTPClient *http.Client
inner innerParams
}
// WithDefaults hydrates default values in the put asset params (not the query body).
@ -92,57 +93,54 @@ func (o *PutAssetParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the put asset params.
// WithTimeout adds the timeout to the put asset params
func (o *PutAssetParams) WithTimeout(timeout time.Duration) *PutAssetParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the put asset params.
// SetTimeout adds the timeout to the put asset params
func (o *PutAssetParams) SetTimeout(timeout time.Duration) {
o.inner.timeout = timeout
o.timeout = timeout
}
// WithContext adds the context to the put asset params.
//
// Deprecated: use the operation call with context to pass the context instead of [PutAssetParams].
// WithContext adds the context to the put asset params
func (o *PutAssetParams) WithContext(ctx context.Context) *PutAssetParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the put asset params.
//
// Deprecated: use the operation call with context to pass the context instead of [PutAssetParams].
// SetContext adds the context to the put asset params
func (o *PutAssetParams) SetContext(ctx context.Context) {
o.inner.ctx = ctx
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the put asset params.
// WithHTTPClient adds the HTTPClient to the put asset params
func (o *PutAssetParams) WithHTTPClient(client *http.Client) *PutAssetParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the put asset params.
// SetHTTPClient adds the HTTPClient to the put asset params
func (o *PutAssetParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithAssetRequest adds the assetRequest to the put asset params.
// WithAssetRequest adds the assetRequest to the put asset params
func (o *PutAssetParams) WithAssetRequest(assetRequest *crm_models.AssetRequest) *PutAssetParams {
o.SetAssetRequest(assetRequest)
return o
}
// SetAssetRequest adds the assetRequest to the put asset params.
// SetAssetRequest adds the assetRequest to the put asset params
func (o *PutAssetParams) SetAssetRequest(assetRequest *crm_models.AssetRequest) {
o.AssetRequest = assetRequest
}
// WriteToRequest writes these params to a [runtime.ClientRequest].
// WriteToRequest writes these params to a swagger request
func (o *PutAssetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.inner.timeout); err != nil {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error

View File

@ -6,15 +6,17 @@
package assets
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
stderrors "errors"
"fmt"
"io"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
)
// PutAssetReader is a Reader for the PutAsset structure.
@ -23,7 +25,7 @@ type PutAssetReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *PutAssetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
func (o *PutAssetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewPutAssetOK()
@ -49,12 +51,6 @@ func (o *PutAssetReader) ReadResponse(response runtime.ClientResponse, consumer
return nil, err
}
return nil, result
case 409:
result := NewPutAssetConflict()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 422:
result := NewPutAssetUnprocessableEntity()
if err := result.readResponse(response, consumer, o.formats); err != nil {
@ -68,7 +64,7 @@ func (o *PutAssetReader) ReadResponse(response runtime.ClientResponse, consumer
}
return nil, result
default:
return nil, runtime.NewAPIError("[PUT /assets] putAsset", response, response.Code())
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
@ -77,9 +73,11 @@ func NewPutAssetOK() *PutAssetOK {
return &PutAssetOK{}
}
// PutAssetOK describes a response with status code 200, with default header values.
//
// Response with Asset objects with Contacts
/*
PutAssetOK describes a response with status code 200, with default header values.
Response with Asset objects with Contacts
*/
type PutAssetOK struct {
AccessControlAllowOrigin string
CacheControl string
@ -118,13 +116,11 @@ func (o *PutAssetOK) Code() int {
}
func (o *PutAssetOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /assets][%d] putAssetOK %s", 200, payload)
return fmt.Sprintf("[PUT /assets][%d] putAssetOK %+v", 200, o.Payload)
}
func (o *PutAssetOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /assets][%d] putAssetOK %s", 200, payload)
return fmt.Sprintf("[PUT /assets][%d] putAssetOK %+v", 200, o.Payload)
}
func (o *PutAssetOK) GetPayload() *crm_models.AssetResponse {
@ -150,7 +146,7 @@ func (o *PutAssetOK) readResponse(response runtime.ClientResponse, consumer runt
o.Payload = new(crm_models.AssetResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -162,9 +158,11 @@ func NewPutAssetUnauthorized() *PutAssetUnauthorized {
return &PutAssetUnauthorized{}
}
// PutAssetUnauthorized describes a response with status code 401, with default header values.
//
// Access unauthorized, invalid API-KEY was used
/*
PutAssetUnauthorized describes a response with status code 401, with default header values.
Access unauthorized, invalid API-KEY was used
*/
type PutAssetUnauthorized struct {
AccessControlAllowOrigin string
@ -202,13 +200,11 @@ func (o *PutAssetUnauthorized) Code() int {
}
func (o *PutAssetUnauthorized) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /assets][%d] putAssetUnauthorized %s", 401, payload)
return fmt.Sprintf("[PUT /assets][%d] putAssetUnauthorized %+v", 401, o.Payload)
}
func (o *PutAssetUnauthorized) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /assets][%d] putAssetUnauthorized %s", 401, payload)
return fmt.Sprintf("[PUT /assets][%d] putAssetUnauthorized %+v", 401, o.Payload)
}
func (o *PutAssetUnauthorized) GetPayload() *crm_models.Error {
@ -227,7 +223,7 @@ func (o *PutAssetUnauthorized) readResponse(response runtime.ClientResponse, con
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -239,9 +235,11 @@ func NewPutAssetForbidden() *PutAssetForbidden {
return &PutAssetForbidden{}
}
// PutAssetForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
/*
PutAssetForbidden describes a response with status code 403, with default header values.
Access forbidden, account lacks access
*/
type PutAssetForbidden struct {
AccessControlAllowOrigin string
@ -279,13 +277,11 @@ func (o *PutAssetForbidden) Code() int {
}
func (o *PutAssetForbidden) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /assets][%d] putAssetForbidden %s", 403, payload)
return fmt.Sprintf("[PUT /assets][%d] putAssetForbidden %+v", 403, o.Payload)
}
func (o *PutAssetForbidden) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /assets][%d] putAssetForbidden %s", 403, payload)
return fmt.Sprintf("[PUT /assets][%d] putAssetForbidden %+v", 403, o.Payload)
}
func (o *PutAssetForbidden) GetPayload() *crm_models.Error {
@ -304,7 +300,7 @@ func (o *PutAssetForbidden) readResponse(response runtime.ClientResponse, consum
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -316,9 +312,11 @@ func NewPutAssetNotFound() *PutAssetNotFound {
return &PutAssetNotFound{}
}
// PutAssetNotFound describes a response with status code 404, with default header values.
//
// Resource was not found
/*
PutAssetNotFound describes a response with status code 404, with default header values.
Resource was not found
*/
type PutAssetNotFound struct {
AccessControlAllowOrigin string
@ -356,13 +354,11 @@ func (o *PutAssetNotFound) Code() int {
}
func (o *PutAssetNotFound) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /assets][%d] putAssetNotFound %s", 404, payload)
return fmt.Sprintf("[PUT /assets][%d] putAssetNotFound %+v", 404, o.Payload)
}
func (o *PutAssetNotFound) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /assets][%d] putAssetNotFound %s", 404, payload)
return fmt.Sprintf("[PUT /assets][%d] putAssetNotFound %+v", 404, o.Payload)
}
func (o *PutAssetNotFound) GetPayload() *crm_models.Error {
@ -381,84 +377,7 @@ func (o *PutAssetNotFound) readResponse(response runtime.ClientResponse, consume
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
return nil
}
// NewPutAssetConflict creates a PutAssetConflict with default headers values
func NewPutAssetConflict() *PutAssetConflict {
return &PutAssetConflict{}
}
// PutAssetConflict describes a response with status code 409, with default header values.
//
// Conflict
type PutAssetConflict struct {
AccessControlAllowOrigin string
Payload *crm_models.Error
}
// IsSuccess returns true when this put asset conflict response has a 2xx status code
func (o *PutAssetConflict) IsSuccess() bool {
return false
}
// IsRedirect returns true when this put asset conflict response has a 3xx status code
func (o *PutAssetConflict) IsRedirect() bool {
return false
}
// IsClientError returns true when this put asset conflict response has a 4xx status code
func (o *PutAssetConflict) IsClientError() bool {
return true
}
// IsServerError returns true when this put asset conflict response has a 5xx status code
func (o *PutAssetConflict) IsServerError() bool {
return false
}
// IsCode returns true when this put asset conflict response a status code equal to that given
func (o *PutAssetConflict) IsCode(code int) bool {
return code == 409
}
// Code gets the status code for the put asset conflict response
func (o *PutAssetConflict) Code() int {
return 409
}
func (o *PutAssetConflict) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /assets][%d] putAssetConflict %s", 409, payload)
}
func (o *PutAssetConflict) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /assets][%d] putAssetConflict %s", 409, payload)
}
func (o *PutAssetConflict) GetPayload() *crm_models.Error {
return o.Payload
}
func (o *PutAssetConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// hydrates response header Access-Control-Allow-Origin
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
if hdrAccessControlAllowOrigin != "" {
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
}
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -470,9 +389,11 @@ func NewPutAssetUnprocessableEntity() *PutAssetUnprocessableEntity {
return &PutAssetUnprocessableEntity{}
}
// PutAssetUnprocessableEntity describes a response with status code 422, with default header values.
//
// Unprocessable Entity, likely a bad parameter
/*
PutAssetUnprocessableEntity describes a response with status code 422, with default header values.
Unprocessable Entity, likely a bad parameter
*/
type PutAssetUnprocessableEntity struct {
AccessControlAllowOrigin string
@ -510,13 +431,11 @@ func (o *PutAssetUnprocessableEntity) Code() int {
}
func (o *PutAssetUnprocessableEntity) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /assets][%d] putAssetUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[PUT /assets][%d] putAssetUnprocessableEntity %+v", 422, o.Payload)
}
func (o *PutAssetUnprocessableEntity) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /assets][%d] putAssetUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[PUT /assets][%d] putAssetUnprocessableEntity %+v", 422, o.Payload)
}
func (o *PutAssetUnprocessableEntity) GetPayload() *crm_models.Error {
@ -535,7 +454,7 @@ func (o *PutAssetUnprocessableEntity) readResponse(response runtime.ClientRespon
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -547,9 +466,11 @@ func NewPutAssetInternalServerError() *PutAssetInternalServerError {
return &PutAssetInternalServerError{}
}
// PutAssetInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
/*
PutAssetInternalServerError describes a response with status code 500, with default header values.
Server Internal Error
*/
type PutAssetInternalServerError struct {
AccessControlAllowOrigin string
@ -587,13 +508,11 @@ func (o *PutAssetInternalServerError) Code() int {
}
func (o *PutAssetInternalServerError) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /assets][%d] putAssetInternalServerError %s", 500, payload)
return fmt.Sprintf("[PUT /assets][%d] putAssetInternalServerError %+v", 500, o.Payload)
}
func (o *PutAssetInternalServerError) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /assets][%d] putAssetInternalServerError %s", 500, payload)
return fmt.Sprintf("[PUT /assets][%d] putAssetInternalServerError %+v", 500, o.Payload)
}
func (o *PutAssetInternalServerError) GetPayload() *crm_models.Error {
@ -612,7 +531,7 @@ func (o *PutAssetInternalServerError) readResponse(response runtime.ClientRespon
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}

View File

@ -6,117 +6,55 @@
package contacts
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"fmt"
"time"
"github.com/go-openapi/runtime"
httptransport "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// New creates a new contacts API client.
func New(transport runtime.ContextualTransport, formats strfmt.Registry) ClientService {
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
// New creates a new contacts API client with basic auth credentials.
//
// It takes the following parameters:
// - host: http host (github.com).
// - basePath: any base path for the API client ("/v1", "/v3").
// - scheme: http scheme ("http", "https").
// - user: user for basic authentication header.
// - password: password for basic authentication header.
func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService {
transport := httptransport.New(host, basePath, []string{scheme})
transport.DefaultAuthentication = httptransport.BasicAuth(user, password)
return &Client{transport: transport, formats: strfmt.Default}
}
// New creates a new contacts API client with a bearer token for authentication.
//
// It takes the following parameters:
// - host: http host (github.com).
// - basePath: any base path for the API client ("/v1", "/v3").
// - scheme: http scheme ("http", "https").
// - bearerToken: bearer token for Bearer authentication header.
func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService {
transport := httptransport.New(host, basePath, []string{scheme})
transport.DefaultAuthentication = httptransport.BearerToken(bearerToken)
return &Client{transport: transport, formats: strfmt.Default}
}
// Client for contacts API.
/*
Client for contacts API
*/
type Client struct {
transport runtime.ContextualTransport
transport runtime.ClientTransport
formats strfmt.Registry
}
// ClientOption may be used to customize the behavior of Client methods.
// ClientOption is the option for Client methods
type ClientOption func(*runtime.ClientOperation)
// ClientService is the interface for Client methods.
// ClientService is the interface for Client methods
type ClientService interface {
// DeleteContact delete a contact.
DeleteContact(params *DeleteContactParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteContactOK, error)
// DeleteContactContext delete a contact.
DeleteContactContext(ctx context.Context, params *DeleteContactParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteContactOK, error)
// GetContacts get a list of contacts.
GetContacts(params *GetContactsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetContactsOK, error)
// GetContactsContext get a list of contacts.
GetContactsContext(ctx context.Context, params *GetContactsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetContactsOK, error)
// PostContacts add new contacts.
PostContacts(params *PostContactsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostContactsOK, error)
// PostContactsContext add new contacts.
PostContactsContext(ctx context.Context, params *PostContactsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostContactsOK, error)
// PutContacts update contact.
PutContacts(params *PutContactsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutContactsOK, error)
// PutContactsContext update contact.
PutContactsContext(ctx context.Context, params *PutContactsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutContactsOK, error)
SetTransport(transport runtime.ContextualTransport)
SetTransport(transport runtime.ClientTransport)
}
// DeleteContact deletes a contact.
//
// Delete SalesforceDevops.net Contact record.
//
// This method does not support injected context.
// However, timeout and opentracing contexts are honored whenever enabled.
//
// If you need to pass a specific context, use [Client.DeleteContactContext] instead.
/*
DeleteContact deletes a contact
Delete SalesforceDevops.net Contact record
*/
func (a *Client) DeleteContact(params *DeleteContactParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteContactOK, error) {
var ctx context.Context
if params.inner.ctx != nil {
ctx = params.inner.ctx
} else {
ctx = context.Background()
}
return a.DeleteContactContext(ctx, params, authInfo, opts...)
}
// DeleteContactContext deletes a contact.
//
// Delete SalesforceDevops.net Contact record.
//
// Do not use the deprecated [DeleteContactParams.Context] with this method: it would be ignored.
func (a *Client) DeleteContactContext(ctx context.Context, params *DeleteContactParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteContactOK, error) {
// NOTE: parameters are not validated before sending
// TODO: Validate the params before sending
if params == nil {
params = NewDeleteContactParams()
}
op := &runtime.ClientOperation{
ID: "deleteContact",
Method: "DELETE",
@ -127,63 +65,37 @@ func (a *Client) DeleteContactContext(ctx context.Context, params *DeleteContact
Params: params,
Reader: &DeleteContactReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.SubmitContext(ctx, op)
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*DeleteContactOK)
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
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for deleteContact: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// GetContacts gets a list of contacts.
//
// Return a list of all available Contacts.
//
// 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.GetContactsContext] instead.
/*
GetContacts gets a list of contacts
Return a list of all available Contacts
*/
func (a *Client) GetContacts(params *GetContactsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetContactsOK, error) {
var ctx context.Context
if params.inner.ctx != nil {
ctx = params.inner.ctx
} else {
ctx = context.Background()
}
return a.GetContactsContext(ctx, params, authInfo, opts...)
}
// GetContactsContext gets a list of contacts.
//
// Return a list of all available Contacts.
//
// Do not use the deprecated [GetContactsParams.Context] with this method: it would be ignored.
func (a *Client) GetContactsContext(ctx context.Context, params *GetContactsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetContactsOK, error) {
// NOTE: parameters are not validated before sending
// TODO: Validate the params before sending
if params == nil {
params = NewGetContactsParams()
}
op := &runtime.ClientOperation{
ID: "getContacts",
Method: "GET",
@ -194,63 +106,37 @@ func (a *Client) GetContactsContext(ctx context.Context, params *GetContactsPara
Params: params,
Reader: &GetContactsReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.SubmitContext(ctx, op)
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*GetContactsOK)
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
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for getContacts: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// PostContacts adds new contacts.
//
// Contact record to be added.
//
// This method does not support injected context.
// However, timeout and opentracing contexts are honored whenever enabled.
//
// If you need to pass a specific context, use [Client.PostContactsContext] instead.
/*
PostContacts adds new contacts
Contact record to be added
*/
func (a *Client) PostContacts(params *PostContactsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostContactsOK, error) {
var ctx context.Context
if params.inner.ctx != nil {
ctx = params.inner.ctx
} else {
ctx = context.Background()
}
return a.PostContactsContext(ctx, params, authInfo, opts...)
}
// PostContactsContext adds new contacts.
//
// Contact record to be added.
//
// Do not use the deprecated [PostContactsParams.Context] with this method: it would be ignored.
func (a *Client) PostContactsContext(ctx context.Context, params *PostContactsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostContactsOK, error) {
// NOTE: parameters are not validated before sending
// TODO: Validate the params before sending
if params == nil {
params = NewPostContactsParams()
}
op := &runtime.ClientOperation{
ID: "postContacts",
Method: "POST",
@ -261,63 +147,37 @@ func (a *Client) PostContactsContext(ctx context.Context, params *PostContactsPa
Params: params,
Reader: &PostContactsReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.SubmitContext(ctx, op)
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*PostContactsOK)
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
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for postContacts: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// PutContacts updates contact.
//
// Update Contact records.
//
// This method does not support injected context.
// However, timeout and opentracing contexts are honored whenever enabled.
//
// If you need to pass a specific context, use [Client.PutContactsContext] instead.
/*
PutContacts updates contact
Update Contact records
*/
func (a *Client) PutContacts(params *PutContactsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutContactsOK, error) {
var ctx context.Context
if params.inner.ctx != nil {
ctx = params.inner.ctx
} else {
ctx = context.Background()
}
return a.PutContactsContext(ctx, params, authInfo, opts...)
}
// PutContactsContext updates contact.
//
// Update Contact records.
//
// Do not use the deprecated [PutContactsParams.Context] with this method: it would be ignored.
func (a *Client) PutContactsContext(ctx context.Context, params *PutContactsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutContactsOK, error) {
// NOTE: parameters are not validated before sending
// TODO: Validate the params before sending
if params == nil {
params = NewPutContactsParams()
}
op := &runtime.ClientOperation{
ID: "putContacts",
Method: "PUT",
@ -328,42 +188,28 @@ func (a *Client) PutContactsContext(ctx context.Context, params *PutContactsPara
Params: params,
Reader: &PutContactsReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.SubmitContext(ctx, op)
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*PutContactsOK)
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
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for putContacts: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ContextualTransport) {
func (a *Client) SetTransport(transport runtime.ClientTransport) {
a.transport = transport
}
// innerParams captures internal fields so they don't conflict with user-supplied parameters.
type innerParams struct {
timeout time.Duration
// Deprecated: use the operation call with context to pass the context instead of [ContactsParams].
ctx context.Context
}

View File

@ -6,6 +6,9 @@
package contacts
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
@ -24,28 +27,24 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewDeleteContactParams() *DeleteContactParams {
return NewDeleteContactParamsWithTimeout(cr.DefaultTimeout)
return &DeleteContactParams{
timeout: cr.DefaultTimeout,
}
}
// NewDeleteContactParamsWithTimeout creates a new DeleteContactParams object
// with the ability to set a timeout on a request.
func NewDeleteContactParamsWithTimeout(timeout time.Duration) *DeleteContactParams {
return &DeleteContactParams{
inner: innerParams{
timeout: timeout,
},
}
}
// NewDeleteContactParamsWithContext creates a new DeleteContactParams object
// with the ability to set a context for a request.
//
// Deprecated: use the operation call with context to pass the context instead of [DeleteContactParams].
func NewDeleteContactParamsWithContext(ctx context.Context) *DeleteContactParams {
return &DeleteContactParams{
inner: innerParams{
ctx: ctx,
},
Context: ctx,
}
}
@ -66,14 +65,15 @@ DeleteContactParams contains all the parameters to send to the API endpoint
*/
type DeleteContactParams struct {
// ContactID.
//
// Contact record ID
/* ContactID.
Contact record ID
*/
ContactID *string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
inner innerParams
}
// WithDefaults hydrates default values in the delete contact params (not the query body).
@ -91,57 +91,54 @@ func (o *DeleteContactParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the delete contact params.
// WithTimeout adds the timeout to the delete contact params
func (o *DeleteContactParams) WithTimeout(timeout time.Duration) *DeleteContactParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the delete contact params.
// SetTimeout adds the timeout to the delete contact params
func (o *DeleteContactParams) SetTimeout(timeout time.Duration) {
o.inner.timeout = timeout
o.timeout = timeout
}
// WithContext adds the context to the delete contact params.
//
// Deprecated: use the operation call with context to pass the context instead of [DeleteContactParams].
// WithContext adds the context to the delete contact params
func (o *DeleteContactParams) WithContext(ctx context.Context) *DeleteContactParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the delete contact params.
//
// Deprecated: use the operation call with context to pass the context instead of [DeleteContactParams].
// SetContext adds the context to the delete contact params
func (o *DeleteContactParams) SetContext(ctx context.Context) {
o.inner.ctx = ctx
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the delete contact params.
// WithHTTPClient adds the HTTPClient to the delete contact params
func (o *DeleteContactParams) WithHTTPClient(client *http.Client) *DeleteContactParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the delete contact params.
// SetHTTPClient adds the HTTPClient to the delete contact params
func (o *DeleteContactParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithContactID adds the contactID to the delete contact params.
// WithContactID adds the contactID to the delete contact params
func (o *DeleteContactParams) WithContactID(contactID *string) *DeleteContactParams {
o.SetContactID(contactID)
return o
}
// SetContactID adds the contactId to the delete contact params.
// SetContactID adds the contactId to the delete contact params
func (o *DeleteContactParams) SetContactID(contactID *string) {
o.ContactID = contactID
}
// WriteToRequest writes these params to a [runtime.ClientRequest].
// WriteToRequest writes these params to a swagger request
func (o *DeleteContactParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.inner.timeout); err != nil {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error

View File

@ -6,15 +6,17 @@
package contacts
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
stderrors "errors"
"fmt"
"io"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
)
// DeleteContactReader is a Reader for the DeleteContact structure.
@ -23,7 +25,7 @@ type DeleteContactReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *DeleteContactReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
func (o *DeleteContactReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewDeleteContactOK()
@ -62,7 +64,7 @@ func (o *DeleteContactReader) ReadResponse(response runtime.ClientResponse, cons
}
return nil, result
default:
return nil, runtime.NewAPIError("[DELETE /contacts] deleteContact", response, response.Code())
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
@ -71,9 +73,11 @@ func NewDeleteContactOK() *DeleteContactOK {
return &DeleteContactOK{}
}
// DeleteContactOK describes a response with status code 200, with default header values.
//
// Response with Message Objects with Delete Status
/*
DeleteContactOK describes a response with status code 200, with default header values.
Response with Message Objects with Delete Status
*/
type DeleteContactOK struct {
AccessControlAllowOrigin string
@ -111,13 +115,11 @@ func (o *DeleteContactOK) Code() int {
}
func (o *DeleteContactOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactOK %s", 200, payload)
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactOK %+v", 200, o.Payload)
}
func (o *DeleteContactOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactOK %s", 200, payload)
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactOK %+v", 200, o.Payload)
}
func (o *DeleteContactOK) GetPayload() *crm_models.DeleteResponse {
@ -136,7 +138,7 @@ func (o *DeleteContactOK) readResponse(response runtime.ClientResponse, consumer
o.Payload = new(crm_models.DeleteResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -148,9 +150,11 @@ func NewDeleteContactUnauthorized() *DeleteContactUnauthorized {
return &DeleteContactUnauthorized{}
}
// DeleteContactUnauthorized describes a response with status code 401, with default header values.
//
// Access unauthorized, invalid API-KEY was used
/*
DeleteContactUnauthorized describes a response with status code 401, with default header values.
Access unauthorized, invalid API-KEY was used
*/
type DeleteContactUnauthorized struct {
AccessControlAllowOrigin string
@ -188,13 +192,11 @@ func (o *DeleteContactUnauthorized) Code() int {
}
func (o *DeleteContactUnauthorized) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactUnauthorized %s", 401, payload)
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactUnauthorized %+v", 401, o.Payload)
}
func (o *DeleteContactUnauthorized) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactUnauthorized %s", 401, payload)
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactUnauthorized %+v", 401, o.Payload)
}
func (o *DeleteContactUnauthorized) GetPayload() *crm_models.Error {
@ -213,7 +215,7 @@ func (o *DeleteContactUnauthorized) readResponse(response runtime.ClientResponse
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -225,9 +227,11 @@ func NewDeleteContactForbidden() *DeleteContactForbidden {
return &DeleteContactForbidden{}
}
// DeleteContactForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
/*
DeleteContactForbidden describes a response with status code 403, with default header values.
Access forbidden, account lacks access
*/
type DeleteContactForbidden struct {
AccessControlAllowOrigin string
@ -265,13 +269,11 @@ func (o *DeleteContactForbidden) Code() int {
}
func (o *DeleteContactForbidden) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactForbidden %s", 403, payload)
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactForbidden %+v", 403, o.Payload)
}
func (o *DeleteContactForbidden) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactForbidden %s", 403, payload)
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactForbidden %+v", 403, o.Payload)
}
func (o *DeleteContactForbidden) GetPayload() *crm_models.Error {
@ -290,7 +292,7 @@ func (o *DeleteContactForbidden) readResponse(response runtime.ClientResponse, c
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -302,9 +304,11 @@ func NewDeleteContactNotFound() *DeleteContactNotFound {
return &DeleteContactNotFound{}
}
// DeleteContactNotFound describes a response with status code 404, with default header values.
//
// Resource was not found
/*
DeleteContactNotFound describes a response with status code 404, with default header values.
Resource was not found
*/
type DeleteContactNotFound struct {
AccessControlAllowOrigin string
@ -342,13 +346,11 @@ func (o *DeleteContactNotFound) Code() int {
}
func (o *DeleteContactNotFound) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactNotFound %s", 404, payload)
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactNotFound %+v", 404, o.Payload)
}
func (o *DeleteContactNotFound) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactNotFound %s", 404, payload)
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactNotFound %+v", 404, o.Payload)
}
func (o *DeleteContactNotFound) GetPayload() *crm_models.Error {
@ -367,7 +369,7 @@ func (o *DeleteContactNotFound) readResponse(response runtime.ClientResponse, co
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -379,9 +381,11 @@ func NewDeleteContactUnprocessableEntity() *DeleteContactUnprocessableEntity {
return &DeleteContactUnprocessableEntity{}
}
// DeleteContactUnprocessableEntity describes a response with status code 422, with default header values.
//
// Unprocessable Entity, likely a bad parameter
/*
DeleteContactUnprocessableEntity describes a response with status code 422, with default header values.
Unprocessable Entity, likely a bad parameter
*/
type DeleteContactUnprocessableEntity struct {
AccessControlAllowOrigin string
@ -419,13 +423,11 @@ func (o *DeleteContactUnprocessableEntity) Code() int {
}
func (o *DeleteContactUnprocessableEntity) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactUnprocessableEntity %+v", 422, o.Payload)
}
func (o *DeleteContactUnprocessableEntity) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactUnprocessableEntity %+v", 422, o.Payload)
}
func (o *DeleteContactUnprocessableEntity) GetPayload() *crm_models.Error {
@ -444,7 +446,7 @@ func (o *DeleteContactUnprocessableEntity) readResponse(response runtime.ClientR
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -456,9 +458,11 @@ func NewDeleteContactInternalServerError() *DeleteContactInternalServerError {
return &DeleteContactInternalServerError{}
}
// DeleteContactInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
/*
DeleteContactInternalServerError describes a response with status code 500, with default header values.
Server Internal Error
*/
type DeleteContactInternalServerError struct {
AccessControlAllowOrigin string
@ -496,13 +500,11 @@ func (o *DeleteContactInternalServerError) Code() int {
}
func (o *DeleteContactInternalServerError) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactInternalServerError %s", 500, payload)
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactInternalServerError %+v", 500, o.Payload)
}
func (o *DeleteContactInternalServerError) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactInternalServerError %s", 500, payload)
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactInternalServerError %+v", 500, o.Payload)
}
func (o *DeleteContactInternalServerError) GetPayload() *crm_models.Error {
@ -521,7 +523,7 @@ func (o *DeleteContactInternalServerError) readResponse(response runtime.ClientR
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}

View File

@ -6,6 +6,9 @@
package contacts
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
@ -15,7 +18,7 @@ import (
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/conv"
"github.com/go-openapi/swag"
)
// NewGetContactsParams creates a new GetContactsParams object,
@ -25,28 +28,24 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewGetContactsParams() *GetContactsParams {
return NewGetContactsParamsWithTimeout(cr.DefaultTimeout)
return &GetContactsParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetContactsParamsWithTimeout creates a new GetContactsParams object
// with the ability to set a timeout on a request.
func NewGetContactsParamsWithTimeout(timeout time.Duration) *GetContactsParams {
return &GetContactsParams{
inner: innerParams{
timeout: timeout,
},
}
}
// NewGetContactsParamsWithContext creates a new GetContactsParams object
// with the ability to set a context for a request.
//
// Deprecated: use the operation call with context to pass the context instead of [GetContactsParams].
func NewGetContactsParamsWithContext(ctx context.Context) *GetContactsParams {
return &GetContactsParams{
inner: innerParams{
ctx: ctx,
},
Context: ctx,
}
}
@ -67,43 +66,49 @@ GetContactsParams contains all the parameters to send to the API endpoint
*/
type GetContactsParams struct {
// Active.
//
// Only retrieve active records?
/* Active.
Only retrieve active records?
*/
Active *bool
// ContactID.
//
// Contact record ID
/* ContactID.
Contact record ID
*/
ContactID *string
// Email.
//
// Email address used for identity lookup
/* Email.
Email address used for identity lookup
*/
Email *string
// Limit.
//
// How many objects to return at one time
//
// Format: int64
/* Limit.
How many objects to return at one time
Format: int64
*/
Limit *int64
// Offset.
//
// How many objects to skip?
//
// Format: int64
/* Offset.
How many objects to skip?
Format: int64
*/
Offset *int64
// Slug.
//
// The Slug of this Object
/* Slug.
The Slug of this Object
*/
Slug *string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
inner innerParams
}
// WithDefaults hydrates default values in the get contacts params (not the query body).
@ -121,112 +126,109 @@ func (o *GetContactsParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the get contacts params.
// WithTimeout adds the timeout to the get contacts params
func (o *GetContactsParams) WithTimeout(timeout time.Duration) *GetContactsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get contacts params.
// SetTimeout adds the timeout to the get contacts params
func (o *GetContactsParams) SetTimeout(timeout time.Duration) {
o.inner.timeout = timeout
o.timeout = timeout
}
// WithContext adds the context to the get contacts params.
//
// Deprecated: use the operation call with context to pass the context instead of [GetContactsParams].
// WithContext adds the context to the get contacts params
func (o *GetContactsParams) WithContext(ctx context.Context) *GetContactsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get contacts params.
//
// Deprecated: use the operation call with context to pass the context instead of [GetContactsParams].
// SetContext adds the context to the get contacts params
func (o *GetContactsParams) SetContext(ctx context.Context) {
o.inner.ctx = ctx
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get contacts params.
// WithHTTPClient adds the HTTPClient to the get contacts params
func (o *GetContactsParams) WithHTTPClient(client *http.Client) *GetContactsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get contacts params.
// SetHTTPClient adds the HTTPClient to the get contacts params
func (o *GetContactsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithActive adds the active to the get contacts params.
// WithActive adds the active to the get contacts params
func (o *GetContactsParams) WithActive(active *bool) *GetContactsParams {
o.SetActive(active)
return o
}
// SetActive adds the active to the get contacts params.
// SetActive adds the active to the get contacts params
func (o *GetContactsParams) SetActive(active *bool) {
o.Active = active
}
// WithContactID adds the contactID to the get contacts params.
// WithContactID adds the contactID to the get contacts params
func (o *GetContactsParams) WithContactID(contactID *string) *GetContactsParams {
o.SetContactID(contactID)
return o
}
// SetContactID adds the contactId to the get contacts params.
// SetContactID adds the contactId to the get contacts params
func (o *GetContactsParams) SetContactID(contactID *string) {
o.ContactID = contactID
}
// WithEmail adds the email to the get contacts params.
// WithEmail adds the email to the get contacts params
func (o *GetContactsParams) WithEmail(email *string) *GetContactsParams {
o.SetEmail(email)
return o
}
// SetEmail adds the email to the get contacts params.
// SetEmail adds the email to the get contacts params
func (o *GetContactsParams) SetEmail(email *string) {
o.Email = email
}
// WithLimit adds the limit to the get contacts params.
// WithLimit adds the limit to the get contacts params
func (o *GetContactsParams) WithLimit(limit *int64) *GetContactsParams {
o.SetLimit(limit)
return o
}
// SetLimit adds the limit to the get contacts params.
// SetLimit adds the limit to the get contacts params
func (o *GetContactsParams) SetLimit(limit *int64) {
o.Limit = limit
}
// WithOffset adds the offset to the get contacts params.
// WithOffset adds the offset to the get contacts params
func (o *GetContactsParams) WithOffset(offset *int64) *GetContactsParams {
o.SetOffset(offset)
return o
}
// SetOffset adds the offset to the get contacts params.
// SetOffset adds the offset to the get contacts params
func (o *GetContactsParams) SetOffset(offset *int64) {
o.Offset = offset
}
// WithSlug adds the slug to the get contacts params.
// WithSlug adds the slug to the get contacts params
func (o *GetContactsParams) WithSlug(slug *string) *GetContactsParams {
o.SetSlug(slug)
return o
}
// SetSlug adds the slug to the get contacts params.
// SetSlug adds the slug to the get contacts params
func (o *GetContactsParams) SetSlug(slug *string) {
o.Slug = slug
}
// WriteToRequest writes these params to a [runtime.ClientRequest].
// WriteToRequest writes these params to a swagger request
func (o *GetContactsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.inner.timeout); err != nil {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
@ -239,7 +241,7 @@ func (o *GetContactsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R
if o.Active != nil {
qrActive = *o.Active
}
qActive := conv.FormatBool(qrActive)
qActive := swag.FormatBool(qrActive)
if qActive != "" {
if err := r.SetQueryParam("active", qActive); err != nil {
@ -290,7 +292,7 @@ func (o *GetContactsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R
if o.Limit != nil {
qrLimit = *o.Limit
}
qLimit := conv.FormatInteger(qrLimit)
qLimit := swag.FormatInt64(qrLimit)
if qLimit != "" {
if err := r.SetQueryParam("limit", qLimit); err != nil {
@ -307,7 +309,7 @@ func (o *GetContactsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R
if o.Offset != nil {
qrOffset = *o.Offset
}
qOffset := conv.FormatInteger(qrOffset)
qOffset := swag.FormatInt64(qrOffset)
if qOffset != "" {
if err := r.SetQueryParam("offset", qOffset); err != nil {

View File

@ -6,15 +6,17 @@
package contacts
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
stderrors "errors"
"fmt"
"io"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
)
// GetContactsReader is a Reader for the GetContacts structure.
@ -23,7 +25,7 @@ type GetContactsReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *GetContactsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
func (o *GetContactsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetContactsOK()
@ -62,7 +64,7 @@ func (o *GetContactsReader) ReadResponse(response runtime.ClientResponse, consum
}
return nil, result
default:
return nil, runtime.NewAPIError("[GET /contacts] getContacts", response, response.Code())
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
@ -71,9 +73,11 @@ func NewGetContactsOK() *GetContactsOK {
return &GetContactsOK{}
}
// GetContactsOK describes a response with status code 200, with default header values.
//
// Response with an array of Contact objects
/*
GetContactsOK describes a response with status code 200, with default header values.
Response with an array of Contact objects
*/
type GetContactsOK struct {
AccessControlAllowOrigin string
CacheControl string
@ -112,13 +116,11 @@ func (o *GetContactsOK) Code() int {
}
func (o *GetContactsOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contacts][%d] getContactsOK %s", 200, payload)
return fmt.Sprintf("[GET /contacts][%d] getContactsOK %+v", 200, o.Payload)
}
func (o *GetContactsOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contacts][%d] getContactsOK %s", 200, payload)
return fmt.Sprintf("[GET /contacts][%d] getContactsOK %+v", 200, o.Payload)
}
func (o *GetContactsOK) GetPayload() *crm_models.ContactResponse {
@ -144,7 +146,7 @@ func (o *GetContactsOK) readResponse(response runtime.ClientResponse, consumer r
o.Payload = new(crm_models.ContactResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -156,9 +158,11 @@ func NewGetContactsUnauthorized() *GetContactsUnauthorized {
return &GetContactsUnauthorized{}
}
// GetContactsUnauthorized describes a response with status code 401, with default header values.
//
// Access unauthorized, invalid API-KEY was used
/*
GetContactsUnauthorized describes a response with status code 401, with default header values.
Access unauthorized, invalid API-KEY was used
*/
type GetContactsUnauthorized struct {
AccessControlAllowOrigin string
@ -196,13 +200,11 @@ func (o *GetContactsUnauthorized) Code() int {
}
func (o *GetContactsUnauthorized) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contacts][%d] getContactsUnauthorized %s", 401, payload)
return fmt.Sprintf("[GET /contacts][%d] getContactsUnauthorized %+v", 401, o.Payload)
}
func (o *GetContactsUnauthorized) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contacts][%d] getContactsUnauthorized %s", 401, payload)
return fmt.Sprintf("[GET /contacts][%d] getContactsUnauthorized %+v", 401, o.Payload)
}
func (o *GetContactsUnauthorized) GetPayload() *crm_models.Error {
@ -221,7 +223,7 @@ func (o *GetContactsUnauthorized) readResponse(response runtime.ClientResponse,
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -233,9 +235,11 @@ func NewGetContactsForbidden() *GetContactsForbidden {
return &GetContactsForbidden{}
}
// GetContactsForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
/*
GetContactsForbidden describes a response with status code 403, with default header values.
Access forbidden, account lacks access
*/
type GetContactsForbidden struct {
AccessControlAllowOrigin string
@ -273,13 +277,11 @@ func (o *GetContactsForbidden) Code() int {
}
func (o *GetContactsForbidden) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contacts][%d] getContactsForbidden %s", 403, payload)
return fmt.Sprintf("[GET /contacts][%d] getContactsForbidden %+v", 403, o.Payload)
}
func (o *GetContactsForbidden) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contacts][%d] getContactsForbidden %s", 403, payload)
return fmt.Sprintf("[GET /contacts][%d] getContactsForbidden %+v", 403, o.Payload)
}
func (o *GetContactsForbidden) GetPayload() *crm_models.Error {
@ -298,7 +300,7 @@ func (o *GetContactsForbidden) readResponse(response runtime.ClientResponse, con
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -310,9 +312,11 @@ func NewGetContactsNotFound() *GetContactsNotFound {
return &GetContactsNotFound{}
}
// GetContactsNotFound describes a response with status code 404, with default header values.
//
// Resource was not found
/*
GetContactsNotFound describes a response with status code 404, with default header values.
Resource was not found
*/
type GetContactsNotFound struct {
AccessControlAllowOrigin string
@ -350,13 +354,11 @@ func (o *GetContactsNotFound) Code() int {
}
func (o *GetContactsNotFound) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contacts][%d] getContactsNotFound %s", 404, payload)
return fmt.Sprintf("[GET /contacts][%d] getContactsNotFound %+v", 404, o.Payload)
}
func (o *GetContactsNotFound) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contacts][%d] getContactsNotFound %s", 404, payload)
return fmt.Sprintf("[GET /contacts][%d] getContactsNotFound %+v", 404, o.Payload)
}
func (o *GetContactsNotFound) GetPayload() *crm_models.Error {
@ -375,7 +377,7 @@ func (o *GetContactsNotFound) readResponse(response runtime.ClientResponse, cons
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -387,9 +389,11 @@ func NewGetContactsUnprocessableEntity() *GetContactsUnprocessableEntity {
return &GetContactsUnprocessableEntity{}
}
// GetContactsUnprocessableEntity describes a response with status code 422, with default header values.
//
// Unprocessable Entity, likely a bad parameter
/*
GetContactsUnprocessableEntity describes a response with status code 422, with default header values.
Unprocessable Entity, likely a bad parameter
*/
type GetContactsUnprocessableEntity struct {
AccessControlAllowOrigin string
@ -427,13 +431,11 @@ func (o *GetContactsUnprocessableEntity) Code() int {
}
func (o *GetContactsUnprocessableEntity) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contacts][%d] getContactsUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[GET /contacts][%d] getContactsUnprocessableEntity %+v", 422, o.Payload)
}
func (o *GetContactsUnprocessableEntity) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contacts][%d] getContactsUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[GET /contacts][%d] getContactsUnprocessableEntity %+v", 422, o.Payload)
}
func (o *GetContactsUnprocessableEntity) GetPayload() *crm_models.Error {
@ -452,7 +454,7 @@ func (o *GetContactsUnprocessableEntity) readResponse(response runtime.ClientRes
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -464,9 +466,11 @@ func NewGetContactsInternalServerError() *GetContactsInternalServerError {
return &GetContactsInternalServerError{}
}
// GetContactsInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
/*
GetContactsInternalServerError describes a response with status code 500, with default header values.
Server Internal Error
*/
type GetContactsInternalServerError struct {
AccessControlAllowOrigin string
@ -504,13 +508,11 @@ func (o *GetContactsInternalServerError) Code() int {
}
func (o *GetContactsInternalServerError) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contacts][%d] getContactsInternalServerError %s", 500, payload)
return fmt.Sprintf("[GET /contacts][%d] getContactsInternalServerError %+v", 500, o.Payload)
}
func (o *GetContactsInternalServerError) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contacts][%d] getContactsInternalServerError %s", 500, payload)
return fmt.Sprintf("[GET /contacts][%d] getContactsInternalServerError %+v", 500, o.Payload)
}
func (o *GetContactsInternalServerError) GetPayload() *crm_models.Error {
@ -529,7 +531,7 @@ func (o *GetContactsInternalServerError) readResponse(response runtime.ClientRes
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}

View File

@ -6,16 +6,20 @@
package contacts
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
)
// NewPostContactsParams creates a new PostContactsParams object,
@ -25,28 +29,24 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewPostContactsParams() *PostContactsParams {
return NewPostContactsParamsWithTimeout(cr.DefaultTimeout)
return &PostContactsParams{
timeout: cr.DefaultTimeout,
}
}
// NewPostContactsParamsWithTimeout creates a new PostContactsParams object
// with the ability to set a timeout on a request.
func NewPostContactsParamsWithTimeout(timeout time.Duration) *PostContactsParams {
return &PostContactsParams{
inner: innerParams{
timeout: timeout,
},
}
}
// NewPostContactsParamsWithContext creates a new PostContactsParams object
// with the ability to set a context for a request.
//
// Deprecated: use the operation call with context to pass the context instead of [PostContactsParams].
func NewPostContactsParamsWithContext(ctx context.Context) *PostContactsParams {
return &PostContactsParams{
inner: innerParams{
ctx: ctx,
},
Context: ctx,
}
}
@ -67,14 +67,15 @@ PostContactsParams contains all the parameters to send to the API endpoint
*/
type PostContactsParams struct {
// ContactsRequest.
//
// An array of new Contact records
/* ContactsRequest.
An array of new Contact records
*/
ContactsRequest *crm_models.ContactRequest
timeout time.Duration
Context context.Context
HTTPClient *http.Client
inner innerParams
}
// WithDefaults hydrates default values in the post contacts params (not the query body).
@ -92,57 +93,54 @@ func (o *PostContactsParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the post contacts params.
// WithTimeout adds the timeout to the post contacts params
func (o *PostContactsParams) WithTimeout(timeout time.Duration) *PostContactsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the post contacts params.
// SetTimeout adds the timeout to the post contacts params
func (o *PostContactsParams) SetTimeout(timeout time.Duration) {
o.inner.timeout = timeout
o.timeout = timeout
}
// WithContext adds the context to the post contacts params.
//
// Deprecated: use the operation call with context to pass the context instead of [PostContactsParams].
// WithContext adds the context to the post contacts params
func (o *PostContactsParams) WithContext(ctx context.Context) *PostContactsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the post contacts params.
//
// Deprecated: use the operation call with context to pass the context instead of [PostContactsParams].
// SetContext adds the context to the post contacts params
func (o *PostContactsParams) SetContext(ctx context.Context) {
o.inner.ctx = ctx
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the post contacts params.
// WithHTTPClient adds the HTTPClient to the post contacts params
func (o *PostContactsParams) WithHTTPClient(client *http.Client) *PostContactsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the post contacts params.
// SetHTTPClient adds the HTTPClient to the post contacts params
func (o *PostContactsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithContactsRequest adds the contactsRequest to the post contacts params.
// WithContactsRequest adds the contactsRequest to the post contacts params
func (o *PostContactsParams) WithContactsRequest(contactsRequest *crm_models.ContactRequest) *PostContactsParams {
o.SetContactsRequest(contactsRequest)
return o
}
// SetContactsRequest adds the contactsRequest to the post contacts params.
// SetContactsRequest adds the contactsRequest to the post contacts params
func (o *PostContactsParams) SetContactsRequest(contactsRequest *crm_models.ContactRequest) {
o.ContactsRequest = contactsRequest
}
// WriteToRequest writes these params to a [runtime.ClientRequest].
// WriteToRequest writes these params to a swagger request
func (o *PostContactsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.inner.timeout); err != nil {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error

View File

@ -6,15 +6,17 @@
package contacts
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
stderrors "errors"
"fmt"
"io"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
)
// PostContactsReader is a Reader for the PostContacts structure.
@ -23,7 +25,7 @@ type PostContactsReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *PostContactsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
func (o *PostContactsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewPostContactsOK()
@ -62,7 +64,7 @@ func (o *PostContactsReader) ReadResponse(response runtime.ClientResponse, consu
}
return nil, result
default:
return nil, runtime.NewAPIError("[POST /contacts] postContacts", response, response.Code())
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
@ -71,9 +73,11 @@ func NewPostContactsOK() *PostContactsOK {
return &PostContactsOK{}
}
// PostContactsOK describes a response with status code 200, with default header values.
//
// Response with an array of Contact objects
/*
PostContactsOK describes a response with status code 200, with default header values.
Response with an array of Contact objects
*/
type PostContactsOK struct {
AccessControlAllowOrigin string
CacheControl string
@ -112,13 +116,11 @@ func (o *PostContactsOK) Code() int {
}
func (o *PostContactsOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contacts][%d] postContactsOK %s", 200, payload)
return fmt.Sprintf("[POST /contacts][%d] postContactsOK %+v", 200, o.Payload)
}
func (o *PostContactsOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contacts][%d] postContactsOK %s", 200, payload)
return fmt.Sprintf("[POST /contacts][%d] postContactsOK %+v", 200, o.Payload)
}
func (o *PostContactsOK) GetPayload() *crm_models.ContactResponse {
@ -144,7 +146,7 @@ func (o *PostContactsOK) readResponse(response runtime.ClientResponse, consumer
o.Payload = new(crm_models.ContactResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -156,9 +158,11 @@ func NewPostContactsUnauthorized() *PostContactsUnauthorized {
return &PostContactsUnauthorized{}
}
// PostContactsUnauthorized describes a response with status code 401, with default header values.
//
// Access unauthorized, invalid API-KEY was used
/*
PostContactsUnauthorized describes a response with status code 401, with default header values.
Access unauthorized, invalid API-KEY was used
*/
type PostContactsUnauthorized struct {
AccessControlAllowOrigin string
@ -196,13 +200,11 @@ func (o *PostContactsUnauthorized) Code() int {
}
func (o *PostContactsUnauthorized) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contacts][%d] postContactsUnauthorized %s", 401, payload)
return fmt.Sprintf("[POST /contacts][%d] postContactsUnauthorized %+v", 401, o.Payload)
}
func (o *PostContactsUnauthorized) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contacts][%d] postContactsUnauthorized %s", 401, payload)
return fmt.Sprintf("[POST /contacts][%d] postContactsUnauthorized %+v", 401, o.Payload)
}
func (o *PostContactsUnauthorized) GetPayload() *crm_models.Error {
@ -221,7 +223,7 @@ func (o *PostContactsUnauthorized) readResponse(response runtime.ClientResponse,
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -233,9 +235,11 @@ func NewPostContactsForbidden() *PostContactsForbidden {
return &PostContactsForbidden{}
}
// PostContactsForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
/*
PostContactsForbidden describes a response with status code 403, with default header values.
Access forbidden, account lacks access
*/
type PostContactsForbidden struct {
AccessControlAllowOrigin string
@ -273,13 +277,11 @@ func (o *PostContactsForbidden) Code() int {
}
func (o *PostContactsForbidden) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contacts][%d] postContactsForbidden %s", 403, payload)
return fmt.Sprintf("[POST /contacts][%d] postContactsForbidden %+v", 403, o.Payload)
}
func (o *PostContactsForbidden) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contacts][%d] postContactsForbidden %s", 403, payload)
return fmt.Sprintf("[POST /contacts][%d] postContactsForbidden %+v", 403, o.Payload)
}
func (o *PostContactsForbidden) GetPayload() *crm_models.Error {
@ -298,7 +300,7 @@ func (o *PostContactsForbidden) readResponse(response runtime.ClientResponse, co
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -310,9 +312,11 @@ func NewPostContactsNotFound() *PostContactsNotFound {
return &PostContactsNotFound{}
}
// PostContactsNotFound describes a response with status code 404, with default header values.
//
// Resource was not found
/*
PostContactsNotFound describes a response with status code 404, with default header values.
Resource was not found
*/
type PostContactsNotFound struct {
AccessControlAllowOrigin string
@ -350,13 +354,11 @@ func (o *PostContactsNotFound) Code() int {
}
func (o *PostContactsNotFound) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contacts][%d] postContactsNotFound %s", 404, payload)
return fmt.Sprintf("[POST /contacts][%d] postContactsNotFound %+v", 404, o.Payload)
}
func (o *PostContactsNotFound) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contacts][%d] postContactsNotFound %s", 404, payload)
return fmt.Sprintf("[POST /contacts][%d] postContactsNotFound %+v", 404, o.Payload)
}
func (o *PostContactsNotFound) GetPayload() *crm_models.Error {
@ -375,7 +377,7 @@ func (o *PostContactsNotFound) readResponse(response runtime.ClientResponse, con
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -387,9 +389,11 @@ func NewPostContactsUnprocessableEntity() *PostContactsUnprocessableEntity {
return &PostContactsUnprocessableEntity{}
}
// PostContactsUnprocessableEntity describes a response with status code 422, with default header values.
//
// Unprocessable Entity, likely a bad parameter
/*
PostContactsUnprocessableEntity describes a response with status code 422, with default header values.
Unprocessable Entity, likely a bad parameter
*/
type PostContactsUnprocessableEntity struct {
AccessControlAllowOrigin string
@ -427,13 +431,11 @@ func (o *PostContactsUnprocessableEntity) Code() int {
}
func (o *PostContactsUnprocessableEntity) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contacts][%d] postContactsUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[POST /contacts][%d] postContactsUnprocessableEntity %+v", 422, o.Payload)
}
func (o *PostContactsUnprocessableEntity) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contacts][%d] postContactsUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[POST /contacts][%d] postContactsUnprocessableEntity %+v", 422, o.Payload)
}
func (o *PostContactsUnprocessableEntity) GetPayload() *crm_models.Error {
@ -452,7 +454,7 @@ func (o *PostContactsUnprocessableEntity) readResponse(response runtime.ClientRe
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -464,9 +466,11 @@ func NewPostContactsInternalServerError() *PostContactsInternalServerError {
return &PostContactsInternalServerError{}
}
// PostContactsInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
/*
PostContactsInternalServerError describes a response with status code 500, with default header values.
Server Internal Error
*/
type PostContactsInternalServerError struct {
AccessControlAllowOrigin string
@ -504,13 +508,11 @@ func (o *PostContactsInternalServerError) Code() int {
}
func (o *PostContactsInternalServerError) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contacts][%d] postContactsInternalServerError %s", 500, payload)
return fmt.Sprintf("[POST /contacts][%d] postContactsInternalServerError %+v", 500, o.Payload)
}
func (o *PostContactsInternalServerError) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contacts][%d] postContactsInternalServerError %s", 500, payload)
return fmt.Sprintf("[POST /contacts][%d] postContactsInternalServerError %+v", 500, o.Payload)
}
func (o *PostContactsInternalServerError) GetPayload() *crm_models.Error {
@ -529,7 +531,7 @@ func (o *PostContactsInternalServerError) readResponse(response runtime.ClientRe
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}

View File

@ -6,16 +6,20 @@
package contacts
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
)
// NewPutContactsParams creates a new PutContactsParams object,
@ -25,28 +29,24 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewPutContactsParams() *PutContactsParams {
return NewPutContactsParamsWithTimeout(cr.DefaultTimeout)
return &PutContactsParams{
timeout: cr.DefaultTimeout,
}
}
// NewPutContactsParamsWithTimeout creates a new PutContactsParams object
// with the ability to set a timeout on a request.
func NewPutContactsParamsWithTimeout(timeout time.Duration) *PutContactsParams {
return &PutContactsParams{
inner: innerParams{
timeout: timeout,
},
}
}
// NewPutContactsParamsWithContext creates a new PutContactsParams object
// with the ability to set a context for a request.
//
// Deprecated: use the operation call with context to pass the context instead of [PutContactsParams].
func NewPutContactsParamsWithContext(ctx context.Context) *PutContactsParams {
return &PutContactsParams{
inner: innerParams{
ctx: ctx,
},
Context: ctx,
}
}
@ -67,14 +67,15 @@ PutContactsParams contains all the parameters to send to the API endpoint
*/
type PutContactsParams struct {
// ContactsRequest.
//
// An array of new Contact records
/* ContactsRequest.
An array of new Contact records
*/
ContactsRequest *crm_models.ContactRequest
timeout time.Duration
Context context.Context
HTTPClient *http.Client
inner innerParams
}
// WithDefaults hydrates default values in the put contacts params (not the query body).
@ -92,57 +93,54 @@ func (o *PutContactsParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the put contacts params.
// WithTimeout adds the timeout to the put contacts params
func (o *PutContactsParams) WithTimeout(timeout time.Duration) *PutContactsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the put contacts params.
// SetTimeout adds the timeout to the put contacts params
func (o *PutContactsParams) SetTimeout(timeout time.Duration) {
o.inner.timeout = timeout
o.timeout = timeout
}
// WithContext adds the context to the put contacts params.
//
// Deprecated: use the operation call with context to pass the context instead of [PutContactsParams].
// WithContext adds the context to the put contacts params
func (o *PutContactsParams) WithContext(ctx context.Context) *PutContactsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the put contacts params.
//
// Deprecated: use the operation call with context to pass the context instead of [PutContactsParams].
// SetContext adds the context to the put contacts params
func (o *PutContactsParams) SetContext(ctx context.Context) {
o.inner.ctx = ctx
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the put contacts params.
// WithHTTPClient adds the HTTPClient to the put contacts params
func (o *PutContactsParams) WithHTTPClient(client *http.Client) *PutContactsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the put contacts params.
// SetHTTPClient adds the HTTPClient to the put contacts params
func (o *PutContactsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithContactsRequest adds the contactsRequest to the put contacts params.
// WithContactsRequest adds the contactsRequest to the put contacts params
func (o *PutContactsParams) WithContactsRequest(contactsRequest *crm_models.ContactRequest) *PutContactsParams {
o.SetContactsRequest(contactsRequest)
return o
}
// SetContactsRequest adds the contactsRequest to the put contacts params.
// SetContactsRequest adds the contactsRequest to the put contacts params
func (o *PutContactsParams) SetContactsRequest(contactsRequest *crm_models.ContactRequest) {
o.ContactsRequest = contactsRequest
}
// WriteToRequest writes these params to a [runtime.ClientRequest].
// WriteToRequest writes these params to a swagger request
func (o *PutContactsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.inner.timeout); err != nil {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error

View File

@ -6,15 +6,17 @@
package contacts
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
stderrors "errors"
"fmt"
"io"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
)
// PutContactsReader is a Reader for the PutContacts structure.
@ -23,7 +25,7 @@ type PutContactsReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *PutContactsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
func (o *PutContactsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewPutContactsOK()
@ -62,7 +64,7 @@ func (o *PutContactsReader) ReadResponse(response runtime.ClientResponse, consum
}
return nil, result
default:
return nil, runtime.NewAPIError("[PUT /contacts] putContacts", response, response.Code())
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
@ -71,9 +73,11 @@ func NewPutContactsOK() *PutContactsOK {
return &PutContactsOK{}
}
// PutContactsOK describes a response with status code 200, with default header values.
//
// Response with an array of Contact objects
/*
PutContactsOK describes a response with status code 200, with default header values.
Response with an array of Contact objects
*/
type PutContactsOK struct {
AccessControlAllowOrigin string
CacheControl string
@ -112,13 +116,11 @@ func (o *PutContactsOK) Code() int {
}
func (o *PutContactsOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contacts][%d] putContactsOK %s", 200, payload)
return fmt.Sprintf("[PUT /contacts][%d] putContactsOK %+v", 200, o.Payload)
}
func (o *PutContactsOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contacts][%d] putContactsOK %s", 200, payload)
return fmt.Sprintf("[PUT /contacts][%d] putContactsOK %+v", 200, o.Payload)
}
func (o *PutContactsOK) GetPayload() *crm_models.ContactResponse {
@ -144,7 +146,7 @@ func (o *PutContactsOK) readResponse(response runtime.ClientResponse, consumer r
o.Payload = new(crm_models.ContactResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -156,9 +158,11 @@ func NewPutContactsUnauthorized() *PutContactsUnauthorized {
return &PutContactsUnauthorized{}
}
// PutContactsUnauthorized describes a response with status code 401, with default header values.
//
// Access unauthorized, invalid API-KEY was used
/*
PutContactsUnauthorized describes a response with status code 401, with default header values.
Access unauthorized, invalid API-KEY was used
*/
type PutContactsUnauthorized struct {
AccessControlAllowOrigin string
@ -196,13 +200,11 @@ func (o *PutContactsUnauthorized) Code() int {
}
func (o *PutContactsUnauthorized) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contacts][%d] putContactsUnauthorized %s", 401, payload)
return fmt.Sprintf("[PUT /contacts][%d] putContactsUnauthorized %+v", 401, o.Payload)
}
func (o *PutContactsUnauthorized) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contacts][%d] putContactsUnauthorized %s", 401, payload)
return fmt.Sprintf("[PUT /contacts][%d] putContactsUnauthorized %+v", 401, o.Payload)
}
func (o *PutContactsUnauthorized) GetPayload() *crm_models.Error {
@ -221,7 +223,7 @@ func (o *PutContactsUnauthorized) readResponse(response runtime.ClientResponse,
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -233,9 +235,11 @@ func NewPutContactsForbidden() *PutContactsForbidden {
return &PutContactsForbidden{}
}
// PutContactsForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
/*
PutContactsForbidden describes a response with status code 403, with default header values.
Access forbidden, account lacks access
*/
type PutContactsForbidden struct {
AccessControlAllowOrigin string
@ -273,13 +277,11 @@ func (o *PutContactsForbidden) Code() int {
}
func (o *PutContactsForbidden) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contacts][%d] putContactsForbidden %s", 403, payload)
return fmt.Sprintf("[PUT /contacts][%d] putContactsForbidden %+v", 403, o.Payload)
}
func (o *PutContactsForbidden) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contacts][%d] putContactsForbidden %s", 403, payload)
return fmt.Sprintf("[PUT /contacts][%d] putContactsForbidden %+v", 403, o.Payload)
}
func (o *PutContactsForbidden) GetPayload() *crm_models.Error {
@ -298,7 +300,7 @@ func (o *PutContactsForbidden) readResponse(response runtime.ClientResponse, con
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -310,9 +312,11 @@ func NewPutContactsNotFound() *PutContactsNotFound {
return &PutContactsNotFound{}
}
// PutContactsNotFound describes a response with status code 404, with default header values.
//
// Resource was not found
/*
PutContactsNotFound describes a response with status code 404, with default header values.
Resource was not found
*/
type PutContactsNotFound struct {
AccessControlAllowOrigin string
@ -350,13 +354,11 @@ func (o *PutContactsNotFound) Code() int {
}
func (o *PutContactsNotFound) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contacts][%d] putContactsNotFound %s", 404, payload)
return fmt.Sprintf("[PUT /contacts][%d] putContactsNotFound %+v", 404, o.Payload)
}
func (o *PutContactsNotFound) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contacts][%d] putContactsNotFound %s", 404, payload)
return fmt.Sprintf("[PUT /contacts][%d] putContactsNotFound %+v", 404, o.Payload)
}
func (o *PutContactsNotFound) GetPayload() *crm_models.Error {
@ -375,7 +377,7 @@ func (o *PutContactsNotFound) readResponse(response runtime.ClientResponse, cons
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -387,9 +389,11 @@ func NewPutContactsUnprocessableEntity() *PutContactsUnprocessableEntity {
return &PutContactsUnprocessableEntity{}
}
// PutContactsUnprocessableEntity describes a response with status code 422, with default header values.
//
// Unprocessable Entity, likely a bad parameter
/*
PutContactsUnprocessableEntity describes a response with status code 422, with default header values.
Unprocessable Entity, likely a bad parameter
*/
type PutContactsUnprocessableEntity struct {
AccessControlAllowOrigin string
@ -427,13 +431,11 @@ func (o *PutContactsUnprocessableEntity) Code() int {
}
func (o *PutContactsUnprocessableEntity) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contacts][%d] putContactsUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[PUT /contacts][%d] putContactsUnprocessableEntity %+v", 422, o.Payload)
}
func (o *PutContactsUnprocessableEntity) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contacts][%d] putContactsUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[PUT /contacts][%d] putContactsUnprocessableEntity %+v", 422, o.Payload)
}
func (o *PutContactsUnprocessableEntity) GetPayload() *crm_models.Error {
@ -452,7 +454,7 @@ func (o *PutContactsUnprocessableEntity) readResponse(response runtime.ClientRes
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -464,9 +466,11 @@ func NewPutContactsInternalServerError() *PutContactsInternalServerError {
return &PutContactsInternalServerError{}
}
// PutContactsInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
/*
PutContactsInternalServerError describes a response with status code 500, with default header values.
Server Internal Error
*/
type PutContactsInternalServerError struct {
AccessControlAllowOrigin string
@ -504,13 +508,11 @@ func (o *PutContactsInternalServerError) Code() int {
}
func (o *PutContactsInternalServerError) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contacts][%d] putContactsInternalServerError %s", 500, payload)
return fmt.Sprintf("[PUT /contacts][%d] putContactsInternalServerError %+v", 500, o.Payload)
}
func (o *PutContactsInternalServerError) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contacts][%d] putContactsInternalServerError %s", 500, payload)
return fmt.Sprintf("[PUT /contacts][%d] putContactsInternalServerError %+v", 500, o.Payload)
}
func (o *PutContactsInternalServerError) GetPayload() *crm_models.Error {
@ -529,7 +531,7 @@ func (o *PutContactsInternalServerError) readResponse(response runtime.ClientRes
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}

View File

@ -6,117 +6,55 @@
package contracts
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"fmt"
"time"
"github.com/go-openapi/runtime"
httptransport "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// New creates a new contracts API client.
func New(transport runtime.ContextualTransport, formats strfmt.Registry) ClientService {
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
// New creates a new contracts API client with basic auth credentials.
//
// It takes the following parameters:
// - host: http host (github.com).
// - basePath: any base path for the API client ("/v1", "/v3").
// - scheme: http scheme ("http", "https").
// - user: user for basic authentication header.
// - password: password for basic authentication header.
func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService {
transport := httptransport.New(host, basePath, []string{scheme})
transport.DefaultAuthentication = httptransport.BasicAuth(user, password)
return &Client{transport: transport, formats: strfmt.Default}
}
// New creates a new contracts API client with a bearer token for authentication.
//
// It takes the following parameters:
// - host: http host (github.com).
// - basePath: any base path for the API client ("/v1", "/v3").
// - scheme: http scheme ("http", "https").
// - bearerToken: bearer token for Bearer authentication header.
func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService {
transport := httptransport.New(host, basePath, []string{scheme})
transport.DefaultAuthentication = httptransport.BearerToken(bearerToken)
return &Client{transport: transport, formats: strfmt.Default}
}
// Client for contracts API.
/*
Client for contracts API
*/
type Client struct {
transport runtime.ContextualTransport
transport runtime.ClientTransport
formats strfmt.Registry
}
// ClientOption may be used to customize the behavior of Client methods.
// ClientOption is the option for Client methods
type ClientOption func(*runtime.ClientOperation)
// ClientService is the interface for Client methods.
// ClientService is the interface for Client methods
type ClientService interface {
// DeleteContract delete an contract.
DeleteContract(params *DeleteContractParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteContractOK, error)
// DeleteContractContext delete an contract.
DeleteContractContext(ctx context.Context, params *DeleteContractParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteContractOK, error)
// GetContracts get a list of contracts.
GetContracts(params *GetContractsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetContractsOK, error)
// GetContractsContext get a list of contracts.
GetContractsContext(ctx context.Context, params *GetContractsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetContractsOK, error)
// PostContracts add a new contract to salesforce devops net.
PostContracts(params *PostContractsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostContractsOK, error)
// PostContractsContext add a new contract to salesforce devops net.
PostContractsContext(ctx context.Context, params *PostContractsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostContractsOK, error)
// PutContract update a single contract.
PutContract(params *PutContractParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutContractOK, error)
// PutContractContext update a single contract.
PutContractContext(ctx context.Context, params *PutContractParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutContractOK, error)
SetTransport(transport runtime.ContextualTransport)
SetTransport(transport runtime.ClientTransport)
}
// DeleteContract deletes an contract.
//
// Delete SalesforceDevops.net Contract record.
//
// This method does not support injected context.
// However, timeout and opentracing contexts are honored whenever enabled.
//
// If you need to pass a specific context, use [Client.DeleteContractContext] instead.
/*
DeleteContract deletes an contract
Delete SalesforceDevops.net Contract record
*/
func (a *Client) DeleteContract(params *DeleteContractParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteContractOK, error) {
var ctx context.Context
if params.inner.ctx != nil {
ctx = params.inner.ctx
} else {
ctx = context.Background()
}
return a.DeleteContractContext(ctx, params, authInfo, opts...)
}
// DeleteContractContext deletes an contract.
//
// Delete SalesforceDevops.net Contract record.
//
// Do not use the deprecated [DeleteContractParams.Context] with this method: it would be ignored.
func (a *Client) DeleteContractContext(ctx context.Context, params *DeleteContractParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteContractOK, error) {
// NOTE: parameters are not validated before sending
// TODO: Validate the params before sending
if params == nil {
params = NewDeleteContractParams()
}
op := &runtime.ClientOperation{
ID: "deleteContract",
Method: "DELETE",
@ -127,63 +65,37 @@ func (a *Client) DeleteContractContext(ctx context.Context, params *DeleteContra
Params: params,
Reader: &DeleteContractReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.SubmitContext(ctx, op)
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*DeleteContractOK)
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
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for deleteContract: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// GetContracts gets a list of contracts.
//
// Return a list of all available Contracts.
//
// 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.GetContractsContext] instead.
/*
GetContracts gets a list of contracts
Return a list of all available Contracts
*/
func (a *Client) GetContracts(params *GetContractsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetContractsOK, error) {
var ctx context.Context
if params.inner.ctx != nil {
ctx = params.inner.ctx
} else {
ctx = context.Background()
}
return a.GetContractsContext(ctx, params, authInfo, opts...)
}
// GetContractsContext gets a list of contracts.
//
// Return a list of all available Contracts.
//
// Do not use the deprecated [GetContractsParams.Context] with this method: it would be ignored.
func (a *Client) GetContractsContext(ctx context.Context, params *GetContractsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetContractsOK, error) {
// NOTE: parameters are not validated before sending
// TODO: Validate the params before sending
if params == nil {
params = NewGetContractsParams()
}
op := &runtime.ClientOperation{
ID: "getContracts",
Method: "GET",
@ -194,63 +106,37 @@ func (a *Client) GetContractsContext(ctx context.Context, params *GetContractsPa
Params: params,
Reader: &GetContractsReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.SubmitContext(ctx, op)
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*GetContractsOK)
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
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for getContracts: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// PostContracts adds a new contract to salesforce devops net.
//
// Contract record to be added.
//
// This method does not support injected context.
// However, timeout and opentracing contexts are honored whenever enabled.
//
// If you need to pass a specific context, use [Client.PostContractsContext] instead.
/*
PostContracts adds a new contract to salesforce devops net
Contract record to be added
*/
func (a *Client) PostContracts(params *PostContractsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostContractsOK, error) {
var ctx context.Context
if params.inner.ctx != nil {
ctx = params.inner.ctx
} else {
ctx = context.Background()
}
return a.PostContractsContext(ctx, params, authInfo, opts...)
}
// PostContractsContext adds a new contract to salesforce devops net.
//
// Contract record to be added.
//
// Do not use the deprecated [PostContractsParams.Context] with this method: it would be ignored.
func (a *Client) PostContractsContext(ctx context.Context, params *PostContractsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostContractsOK, error) {
// NOTE: parameters are not validated before sending
// TODO: Validate the params before sending
if params == nil {
params = NewPostContractsParams()
}
op := &runtime.ClientOperation{
ID: "postContracts",
Method: "POST",
@ -261,63 +147,37 @@ func (a *Client) PostContractsContext(ctx context.Context, params *PostContracts
Params: params,
Reader: &PostContractsReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.SubmitContext(ctx, op)
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*PostContractsOK)
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
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for postContracts: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// PutContract updates a single contract.
//
// Update a single contract specified by contractId.
//
// 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.PutContractContext] instead.
/*
PutContract updates a single contract
Update a single contract specified by contractId
*/
func (a *Client) PutContract(params *PutContractParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutContractOK, error) {
var ctx context.Context
if params.inner.ctx != nil {
ctx = params.inner.ctx
} else {
ctx = context.Background()
}
return a.PutContractContext(ctx, params, authInfo, opts...)
}
// PutContractContext updates a single contract.
//
// Update a single contract specified by contractId.
//
// Do not use the deprecated [PutContractParams.Context] with this method: it would be ignored.
func (a *Client) PutContractContext(ctx context.Context, params *PutContractParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutContractOK, error) {
// NOTE: parameters are not validated before sending
// TODO: Validate the params before sending
if params == nil {
params = NewPutContractParams()
}
op := &runtime.ClientOperation{
ID: "putContract",
Method: "PUT",
@ -328,42 +188,28 @@ func (a *Client) PutContractContext(ctx context.Context, params *PutContractPara
Params: params,
Reader: &PutContractReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.SubmitContext(ctx, op)
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*PutContractOK)
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
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for putContract: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ContextualTransport) {
func (a *Client) SetTransport(transport runtime.ClientTransport) {
a.transport = transport
}
// innerParams captures internal fields so they don't conflict with user-supplied parameters.
type innerParams struct {
timeout time.Duration
// Deprecated: use the operation call with context to pass the context instead of [ContractsParams].
ctx context.Context
}

View File

@ -6,6 +6,9 @@
package contracts
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
@ -24,28 +27,24 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewDeleteContractParams() *DeleteContractParams {
return NewDeleteContractParamsWithTimeout(cr.DefaultTimeout)
return &DeleteContractParams{
timeout: cr.DefaultTimeout,
}
}
// NewDeleteContractParamsWithTimeout creates a new DeleteContractParams object
// with the ability to set a timeout on a request.
func NewDeleteContractParamsWithTimeout(timeout time.Duration) *DeleteContractParams {
return &DeleteContractParams{
inner: innerParams{
timeout: timeout,
},
}
}
// NewDeleteContractParamsWithContext creates a new DeleteContractParams object
// with the ability to set a context for a request.
//
// Deprecated: use the operation call with context to pass the context instead of [DeleteContractParams].
func NewDeleteContractParamsWithContext(ctx context.Context) *DeleteContractParams {
return &DeleteContractParams{
inner: innerParams{
ctx: ctx,
},
Context: ctx,
}
}
@ -66,14 +65,15 @@ DeleteContractParams contains all the parameters to send to the API endpoint
*/
type DeleteContractParams struct {
// ContractID.
//
// Contact record ID
/* ContractID.
Contact record ID
*/
ContractID *string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
inner innerParams
}
// WithDefaults hydrates default values in the delete contract params (not the query body).
@ -91,57 +91,54 @@ func (o *DeleteContractParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the delete contract params.
// WithTimeout adds the timeout to the delete contract params
func (o *DeleteContractParams) WithTimeout(timeout time.Duration) *DeleteContractParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the delete contract params.
// SetTimeout adds the timeout to the delete contract params
func (o *DeleteContractParams) SetTimeout(timeout time.Duration) {
o.inner.timeout = timeout
o.timeout = timeout
}
// WithContext adds the context to the delete contract params.
//
// Deprecated: use the operation call with context to pass the context instead of [DeleteContractParams].
// WithContext adds the context to the delete contract params
func (o *DeleteContractParams) WithContext(ctx context.Context) *DeleteContractParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the delete contract params.
//
// Deprecated: use the operation call with context to pass the context instead of [DeleteContractParams].
// SetContext adds the context to the delete contract params
func (o *DeleteContractParams) SetContext(ctx context.Context) {
o.inner.ctx = ctx
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the delete contract params.
// WithHTTPClient adds the HTTPClient to the delete contract params
func (o *DeleteContractParams) WithHTTPClient(client *http.Client) *DeleteContractParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the delete contract params.
// SetHTTPClient adds the HTTPClient to the delete contract params
func (o *DeleteContractParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithContractID adds the contractID to the delete contract params.
// WithContractID adds the contractID to the delete contract params
func (o *DeleteContractParams) WithContractID(contractID *string) *DeleteContractParams {
o.SetContractID(contractID)
return o
}
// SetContractID adds the contractId to the delete contract params.
// SetContractID adds the contractId to the delete contract params
func (o *DeleteContractParams) SetContractID(contractID *string) {
o.ContractID = contractID
}
// WriteToRequest writes these params to a [runtime.ClientRequest].
// WriteToRequest writes these params to a swagger request
func (o *DeleteContractParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.inner.timeout); err != nil {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error

View File

@ -6,15 +6,17 @@
package contracts
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
stderrors "errors"
"fmt"
"io"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
)
// DeleteContractReader is a Reader for the DeleteContract structure.
@ -23,7 +25,7 @@ type DeleteContractReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *DeleteContractReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
func (o *DeleteContractReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewDeleteContractOK()
@ -62,7 +64,7 @@ func (o *DeleteContractReader) ReadResponse(response runtime.ClientResponse, con
}
return nil, result
default:
return nil, runtime.NewAPIError("[DELETE /contracts] deleteContract", response, response.Code())
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
@ -71,9 +73,11 @@ func NewDeleteContractOK() *DeleteContractOK {
return &DeleteContractOK{}
}
// DeleteContractOK describes a response with status code 200, with default header values.
//
// Response with Message Objects with Delete Status
/*
DeleteContractOK describes a response with status code 200, with default header values.
Response with Message Objects with Delete Status
*/
type DeleteContractOK struct {
AccessControlAllowOrigin string
@ -111,13 +115,11 @@ func (o *DeleteContractOK) Code() int {
}
func (o *DeleteContractOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractOK %s", 200, payload)
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractOK %+v", 200, o.Payload)
}
func (o *DeleteContractOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractOK %s", 200, payload)
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractOK %+v", 200, o.Payload)
}
func (o *DeleteContractOK) GetPayload() *crm_models.DeleteResponse {
@ -136,7 +138,7 @@ func (o *DeleteContractOK) readResponse(response runtime.ClientResponse, consume
o.Payload = new(crm_models.DeleteResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -148,9 +150,11 @@ func NewDeleteContractUnauthorized() *DeleteContractUnauthorized {
return &DeleteContractUnauthorized{}
}
// DeleteContractUnauthorized describes a response with status code 401, with default header values.
//
// Access unauthorized, invalid API-KEY was used
/*
DeleteContractUnauthorized describes a response with status code 401, with default header values.
Access unauthorized, invalid API-KEY was used
*/
type DeleteContractUnauthorized struct {
AccessControlAllowOrigin string
@ -188,13 +192,11 @@ func (o *DeleteContractUnauthorized) Code() int {
}
func (o *DeleteContractUnauthorized) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractUnauthorized %s", 401, payload)
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractUnauthorized %+v", 401, o.Payload)
}
func (o *DeleteContractUnauthorized) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractUnauthorized %s", 401, payload)
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractUnauthorized %+v", 401, o.Payload)
}
func (o *DeleteContractUnauthorized) GetPayload() *crm_models.Error {
@ -213,7 +215,7 @@ func (o *DeleteContractUnauthorized) readResponse(response runtime.ClientRespons
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -225,9 +227,11 @@ func NewDeleteContractForbidden() *DeleteContractForbidden {
return &DeleteContractForbidden{}
}
// DeleteContractForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
/*
DeleteContractForbidden describes a response with status code 403, with default header values.
Access forbidden, account lacks access
*/
type DeleteContractForbidden struct {
AccessControlAllowOrigin string
@ -265,13 +269,11 @@ func (o *DeleteContractForbidden) Code() int {
}
func (o *DeleteContractForbidden) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractForbidden %s", 403, payload)
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractForbidden %+v", 403, o.Payload)
}
func (o *DeleteContractForbidden) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractForbidden %s", 403, payload)
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractForbidden %+v", 403, o.Payload)
}
func (o *DeleteContractForbidden) GetPayload() *crm_models.Error {
@ -290,7 +292,7 @@ func (o *DeleteContractForbidden) readResponse(response runtime.ClientResponse,
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -302,9 +304,11 @@ func NewDeleteContractNotFound() *DeleteContractNotFound {
return &DeleteContractNotFound{}
}
// DeleteContractNotFound describes a response with status code 404, with default header values.
//
// Resource was not found
/*
DeleteContractNotFound describes a response with status code 404, with default header values.
Resource was not found
*/
type DeleteContractNotFound struct {
AccessControlAllowOrigin string
@ -342,13 +346,11 @@ func (o *DeleteContractNotFound) Code() int {
}
func (o *DeleteContractNotFound) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractNotFound %s", 404, payload)
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractNotFound %+v", 404, o.Payload)
}
func (o *DeleteContractNotFound) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractNotFound %s", 404, payload)
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractNotFound %+v", 404, o.Payload)
}
func (o *DeleteContractNotFound) GetPayload() *crm_models.Error {
@ -367,7 +369,7 @@ func (o *DeleteContractNotFound) readResponse(response runtime.ClientResponse, c
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -379,9 +381,11 @@ func NewDeleteContractUnprocessableEntity() *DeleteContractUnprocessableEntity {
return &DeleteContractUnprocessableEntity{}
}
// DeleteContractUnprocessableEntity describes a response with status code 422, with default header values.
//
// Unprocessable Entity, likely a bad parameter
/*
DeleteContractUnprocessableEntity describes a response with status code 422, with default header values.
Unprocessable Entity, likely a bad parameter
*/
type DeleteContractUnprocessableEntity struct {
AccessControlAllowOrigin string
@ -419,13 +423,11 @@ func (o *DeleteContractUnprocessableEntity) Code() int {
}
func (o *DeleteContractUnprocessableEntity) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractUnprocessableEntity %+v", 422, o.Payload)
}
func (o *DeleteContractUnprocessableEntity) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractUnprocessableEntity %+v", 422, o.Payload)
}
func (o *DeleteContractUnprocessableEntity) GetPayload() *crm_models.Error {
@ -444,7 +446,7 @@ func (o *DeleteContractUnprocessableEntity) readResponse(response runtime.Client
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -456,9 +458,11 @@ func NewDeleteContractInternalServerError() *DeleteContractInternalServerError {
return &DeleteContractInternalServerError{}
}
// DeleteContractInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
/*
DeleteContractInternalServerError describes a response with status code 500, with default header values.
Server Internal Error
*/
type DeleteContractInternalServerError struct {
AccessControlAllowOrigin string
@ -496,13 +500,11 @@ func (o *DeleteContractInternalServerError) Code() int {
}
func (o *DeleteContractInternalServerError) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractInternalServerError %s", 500, payload)
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractInternalServerError %+v", 500, o.Payload)
}
func (o *DeleteContractInternalServerError) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractInternalServerError %s", 500, payload)
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractInternalServerError %+v", 500, o.Payload)
}
func (o *DeleteContractInternalServerError) GetPayload() *crm_models.Error {
@ -521,7 +523,7 @@ func (o *DeleteContractInternalServerError) readResponse(response runtime.Client
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}

View File

@ -6,6 +6,9 @@
package contracts
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
@ -15,7 +18,7 @@ import (
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/conv"
"github.com/go-openapi/swag"
)
// NewGetContractsParams creates a new GetContractsParams object,
@ -25,28 +28,24 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewGetContractsParams() *GetContractsParams {
return NewGetContractsParamsWithTimeout(cr.DefaultTimeout)
return &GetContractsParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetContractsParamsWithTimeout creates a new GetContractsParams object
// with the ability to set a timeout on a request.
func NewGetContractsParamsWithTimeout(timeout time.Duration) *GetContractsParams {
return &GetContractsParams{
inner: innerParams{
timeout: timeout,
},
}
}
// NewGetContractsParamsWithContext creates a new GetContractsParams object
// with the ability to set a context for a request.
//
// Deprecated: use the operation call with context to pass the context instead of [GetContractsParams].
func NewGetContractsParamsWithContext(ctx context.Context) *GetContractsParams {
return &GetContractsParams{
inner: innerParams{
ctx: ctx,
},
Context: ctx,
}
}
@ -67,33 +66,37 @@ GetContractsParams contains all the parameters to send to the API endpoint
*/
type GetContractsParams struct {
// Active.
//
// Only retrieve active records?
/* Active.
Only retrieve active records?
*/
Active *bool
// ContractID.
//
// Contact record ID
/* ContractID.
Contact record ID
*/
ContractID *string
// Limit.
//
// How many objects to return at one time
//
// Format: int64
/* Limit.
How many objects to return at one time
Format: int64
*/
Limit *int64
// Offset.
//
// How many objects to skip?
//
// Format: int64
/* Offset.
How many objects to skip?
Format: int64
*/
Offset *int64
timeout time.Duration
Context context.Context
HTTPClient *http.Client
inner innerParams
}
// WithDefaults hydrates default values in the get contracts params (not the query body).
@ -111,90 +114,87 @@ func (o *GetContractsParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the get contracts params.
// WithTimeout adds the timeout to the get contracts params
func (o *GetContractsParams) WithTimeout(timeout time.Duration) *GetContractsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get contracts params.
// SetTimeout adds the timeout to the get contracts params
func (o *GetContractsParams) SetTimeout(timeout time.Duration) {
o.inner.timeout = timeout
o.timeout = timeout
}
// WithContext adds the context to the get contracts params.
//
// Deprecated: use the operation call with context to pass the context instead of [GetContractsParams].
// WithContext adds the context to the get contracts params
func (o *GetContractsParams) WithContext(ctx context.Context) *GetContractsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get contracts params.
//
// Deprecated: use the operation call with context to pass the context instead of [GetContractsParams].
// SetContext adds the context to the get contracts params
func (o *GetContractsParams) SetContext(ctx context.Context) {
o.inner.ctx = ctx
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get contracts params.
// WithHTTPClient adds the HTTPClient to the get contracts params
func (o *GetContractsParams) WithHTTPClient(client *http.Client) *GetContractsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get contracts params.
// SetHTTPClient adds the HTTPClient to the get contracts params
func (o *GetContractsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithActive adds the active to the get contracts params.
// WithActive adds the active to the get contracts params
func (o *GetContractsParams) WithActive(active *bool) *GetContractsParams {
o.SetActive(active)
return o
}
// SetActive adds the active to the get contracts params.
// SetActive adds the active to the get contracts params
func (o *GetContractsParams) SetActive(active *bool) {
o.Active = active
}
// WithContractID adds the contractID to the get contracts params.
// WithContractID adds the contractID to the get contracts params
func (o *GetContractsParams) WithContractID(contractID *string) *GetContractsParams {
o.SetContractID(contractID)
return o
}
// SetContractID adds the contractId to the get contracts params.
// SetContractID adds the contractId to the get contracts params
func (o *GetContractsParams) SetContractID(contractID *string) {
o.ContractID = contractID
}
// WithLimit adds the limit to the get contracts params.
// WithLimit adds the limit to the get contracts params
func (o *GetContractsParams) WithLimit(limit *int64) *GetContractsParams {
o.SetLimit(limit)
return o
}
// SetLimit adds the limit to the get contracts params.
// SetLimit adds the limit to the get contracts params
func (o *GetContractsParams) SetLimit(limit *int64) {
o.Limit = limit
}
// WithOffset adds the offset to the get contracts params.
// WithOffset adds the offset to the get contracts params
func (o *GetContractsParams) WithOffset(offset *int64) *GetContractsParams {
o.SetOffset(offset)
return o
}
// SetOffset adds the offset to the get contracts params.
// SetOffset adds the offset to the get contracts params
func (o *GetContractsParams) SetOffset(offset *int64) {
o.Offset = offset
}
// WriteToRequest writes these params to a [runtime.ClientRequest].
// WriteToRequest writes these params to a swagger request
func (o *GetContractsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.inner.timeout); err != nil {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
@ -207,7 +207,7 @@ func (o *GetContractsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.
if o.Active != nil {
qrActive = *o.Active
}
qActive := conv.FormatBool(qrActive)
qActive := swag.FormatBool(qrActive)
if qActive != "" {
if err := r.SetQueryParam("active", qActive); err != nil {
@ -241,7 +241,7 @@ func (o *GetContractsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.
if o.Limit != nil {
qrLimit = *o.Limit
}
qLimit := conv.FormatInteger(qrLimit)
qLimit := swag.FormatInt64(qrLimit)
if qLimit != "" {
if err := r.SetQueryParam("limit", qLimit); err != nil {
@ -258,7 +258,7 @@ func (o *GetContractsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.
if o.Offset != nil {
qrOffset = *o.Offset
}
qOffset := conv.FormatInteger(qrOffset)
qOffset := swag.FormatInt64(qrOffset)
if qOffset != "" {
if err := r.SetQueryParam("offset", qOffset); err != nil {

View File

@ -6,15 +6,17 @@
package contracts
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
stderrors "errors"
"fmt"
"io"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
)
// GetContractsReader is a Reader for the GetContracts structure.
@ -23,7 +25,7 @@ type GetContractsReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *GetContractsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
func (o *GetContractsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetContractsOK()
@ -62,7 +64,7 @@ func (o *GetContractsReader) ReadResponse(response runtime.ClientResponse, consu
}
return nil, result
default:
return nil, runtime.NewAPIError("[GET /contracts] getContracts", response, response.Code())
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
@ -71,9 +73,11 @@ func NewGetContractsOK() *GetContractsOK {
return &GetContractsOK{}
}
// GetContractsOK describes a response with status code 200, with default header values.
//
// Response with an array of Contract objects
/*
GetContractsOK describes a response with status code 200, with default header values.
Response with an array of Contract objects
*/
type GetContractsOK struct {
AccessControlAllowOrigin string
CacheControl string
@ -112,13 +116,11 @@ func (o *GetContractsOK) Code() int {
}
func (o *GetContractsOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsOK %s", 200, payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsOK %+v", 200, o.Payload)
}
func (o *GetContractsOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsOK %s", 200, payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsOK %+v", 200, o.Payload)
}
func (o *GetContractsOK) GetPayload() *crm_models.ContractResponse {
@ -144,7 +146,7 @@ func (o *GetContractsOK) readResponse(response runtime.ClientResponse, consumer
o.Payload = new(crm_models.ContractResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -156,9 +158,11 @@ func NewGetContractsUnauthorized() *GetContractsUnauthorized {
return &GetContractsUnauthorized{}
}
// GetContractsUnauthorized describes a response with status code 401, with default header values.
//
// Access unauthorized, invalid API-KEY was used
/*
GetContractsUnauthorized describes a response with status code 401, with default header values.
Access unauthorized, invalid API-KEY was used
*/
type GetContractsUnauthorized struct {
AccessControlAllowOrigin string
@ -196,13 +200,11 @@ func (o *GetContractsUnauthorized) Code() int {
}
func (o *GetContractsUnauthorized) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsUnauthorized %s", 401, payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsUnauthorized %+v", 401, o.Payload)
}
func (o *GetContractsUnauthorized) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsUnauthorized %s", 401, payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsUnauthorized %+v", 401, o.Payload)
}
func (o *GetContractsUnauthorized) GetPayload() *crm_models.Error {
@ -221,7 +223,7 @@ func (o *GetContractsUnauthorized) readResponse(response runtime.ClientResponse,
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -233,9 +235,11 @@ func NewGetContractsForbidden() *GetContractsForbidden {
return &GetContractsForbidden{}
}
// GetContractsForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
/*
GetContractsForbidden describes a response with status code 403, with default header values.
Access forbidden, account lacks access
*/
type GetContractsForbidden struct {
AccessControlAllowOrigin string
@ -273,13 +277,11 @@ func (o *GetContractsForbidden) Code() int {
}
func (o *GetContractsForbidden) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsForbidden %s", 403, payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsForbidden %+v", 403, o.Payload)
}
func (o *GetContractsForbidden) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsForbidden %s", 403, payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsForbidden %+v", 403, o.Payload)
}
func (o *GetContractsForbidden) GetPayload() *crm_models.Error {
@ -298,7 +300,7 @@ func (o *GetContractsForbidden) readResponse(response runtime.ClientResponse, co
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -310,9 +312,11 @@ func NewGetContractsNotFound() *GetContractsNotFound {
return &GetContractsNotFound{}
}
// GetContractsNotFound describes a response with status code 404, with default header values.
//
// Resource was not found
/*
GetContractsNotFound describes a response with status code 404, with default header values.
Resource was not found
*/
type GetContractsNotFound struct {
AccessControlAllowOrigin string
@ -350,13 +354,11 @@ func (o *GetContractsNotFound) Code() int {
}
func (o *GetContractsNotFound) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsNotFound %s", 404, payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsNotFound %+v", 404, o.Payload)
}
func (o *GetContractsNotFound) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsNotFound %s", 404, payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsNotFound %+v", 404, o.Payload)
}
func (o *GetContractsNotFound) GetPayload() *crm_models.Error {
@ -375,7 +377,7 @@ func (o *GetContractsNotFound) readResponse(response runtime.ClientResponse, con
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -387,9 +389,11 @@ func NewGetContractsUnprocessableEntity() *GetContractsUnprocessableEntity {
return &GetContractsUnprocessableEntity{}
}
// GetContractsUnprocessableEntity describes a response with status code 422, with default header values.
//
// Unprocessable Entity, likely a bad parameter
/*
GetContractsUnprocessableEntity describes a response with status code 422, with default header values.
Unprocessable Entity, likely a bad parameter
*/
type GetContractsUnprocessableEntity struct {
AccessControlAllowOrigin string
@ -427,13 +431,11 @@ func (o *GetContractsUnprocessableEntity) Code() int {
}
func (o *GetContractsUnprocessableEntity) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsUnprocessableEntity %+v", 422, o.Payload)
}
func (o *GetContractsUnprocessableEntity) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsUnprocessableEntity %+v", 422, o.Payload)
}
func (o *GetContractsUnprocessableEntity) GetPayload() *crm_models.Error {
@ -452,7 +454,7 @@ func (o *GetContractsUnprocessableEntity) readResponse(response runtime.ClientRe
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -464,9 +466,11 @@ func NewGetContractsInternalServerError() *GetContractsInternalServerError {
return &GetContractsInternalServerError{}
}
// GetContractsInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
/*
GetContractsInternalServerError describes a response with status code 500, with default header values.
Server Internal Error
*/
type GetContractsInternalServerError struct {
AccessControlAllowOrigin string
@ -504,13 +508,11 @@ func (o *GetContractsInternalServerError) Code() int {
}
func (o *GetContractsInternalServerError) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsInternalServerError %s", 500, payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsInternalServerError %+v", 500, o.Payload)
}
func (o *GetContractsInternalServerError) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsInternalServerError %s", 500, payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsInternalServerError %+v", 500, o.Payload)
}
func (o *GetContractsInternalServerError) GetPayload() *crm_models.Error {
@ -529,7 +531,7 @@ func (o *GetContractsInternalServerError) readResponse(response runtime.ClientRe
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}

View File

@ -6,16 +6,20 @@
package contracts
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
)
// NewPostContractsParams creates a new PostContractsParams object,
@ -25,28 +29,24 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewPostContractsParams() *PostContractsParams {
return NewPostContractsParamsWithTimeout(cr.DefaultTimeout)
return &PostContractsParams{
timeout: cr.DefaultTimeout,
}
}
// NewPostContractsParamsWithTimeout creates a new PostContractsParams object
// with the ability to set a timeout on a request.
func NewPostContractsParamsWithTimeout(timeout time.Duration) *PostContractsParams {
return &PostContractsParams{
inner: innerParams{
timeout: timeout,
},
}
}
// NewPostContractsParamsWithContext creates a new PostContractsParams object
// with the ability to set a context for a request.
//
// Deprecated: use the operation call with context to pass the context instead of [PostContractsParams].
func NewPostContractsParamsWithContext(ctx context.Context) *PostContractsParams {
return &PostContractsParams{
inner: innerParams{
ctx: ctx,
},
Context: ctx,
}
}
@ -67,14 +67,15 @@ PostContractsParams contains all the parameters to send to the API endpoint
*/
type PostContractsParams struct {
// ContractsRequest.
//
// An array of new Contract records
/* ContractsRequest.
An array of new Contract records
*/
ContractsRequest *crm_models.ContractRequest
timeout time.Duration
Context context.Context
HTTPClient *http.Client
inner innerParams
}
// WithDefaults hydrates default values in the post contracts params (not the query body).
@ -92,57 +93,54 @@ func (o *PostContractsParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the post contracts params.
// WithTimeout adds the timeout to the post contracts params
func (o *PostContractsParams) WithTimeout(timeout time.Duration) *PostContractsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the post contracts params.
// SetTimeout adds the timeout to the post contracts params
func (o *PostContractsParams) SetTimeout(timeout time.Duration) {
o.inner.timeout = timeout
o.timeout = timeout
}
// WithContext adds the context to the post contracts params.
//
// Deprecated: use the operation call with context to pass the context instead of [PostContractsParams].
// WithContext adds the context to the post contracts params
func (o *PostContractsParams) WithContext(ctx context.Context) *PostContractsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the post contracts params.
//
// Deprecated: use the operation call with context to pass the context instead of [PostContractsParams].
// SetContext adds the context to the post contracts params
func (o *PostContractsParams) SetContext(ctx context.Context) {
o.inner.ctx = ctx
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the post contracts params.
// WithHTTPClient adds the HTTPClient to the post contracts params
func (o *PostContractsParams) WithHTTPClient(client *http.Client) *PostContractsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the post contracts params.
// SetHTTPClient adds the HTTPClient to the post contracts params
func (o *PostContractsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithContractsRequest adds the contractsRequest to the post contracts params.
// WithContractsRequest adds the contractsRequest to the post contracts params
func (o *PostContractsParams) WithContractsRequest(contractsRequest *crm_models.ContractRequest) *PostContractsParams {
o.SetContractsRequest(contractsRequest)
return o
}
// SetContractsRequest adds the contractsRequest to the post contracts params.
// SetContractsRequest adds the contractsRequest to the post contracts params
func (o *PostContractsParams) SetContractsRequest(contractsRequest *crm_models.ContractRequest) {
o.ContractsRequest = contractsRequest
}
// WriteToRequest writes these params to a [runtime.ClientRequest].
// WriteToRequest writes these params to a swagger request
func (o *PostContractsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.inner.timeout); err != nil {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error

View File

@ -6,15 +6,17 @@
package contracts
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
stderrors "errors"
"fmt"
"io"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
)
// PostContractsReader is a Reader for the PostContracts structure.
@ -23,7 +25,7 @@ type PostContractsReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *PostContractsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
func (o *PostContractsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewPostContractsOK()
@ -62,7 +64,7 @@ func (o *PostContractsReader) ReadResponse(response runtime.ClientResponse, cons
}
return nil, result
default:
return nil, runtime.NewAPIError("[POST /contracts] postContracts", response, response.Code())
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
@ -71,9 +73,11 @@ func NewPostContractsOK() *PostContractsOK {
return &PostContractsOK{}
}
// PostContractsOK describes a response with status code 200, with default header values.
//
// Response with an array of Contract objects
/*
PostContractsOK describes a response with status code 200, with default header values.
Response with an array of Contract objects
*/
type PostContractsOK struct {
AccessControlAllowOrigin string
CacheControl string
@ -112,13 +116,11 @@ func (o *PostContractsOK) Code() int {
}
func (o *PostContractsOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contracts][%d] postContractsOK %s", 200, payload)
return fmt.Sprintf("[POST /contracts][%d] postContractsOK %+v", 200, o.Payload)
}
func (o *PostContractsOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contracts][%d] postContractsOK %s", 200, payload)
return fmt.Sprintf("[POST /contracts][%d] postContractsOK %+v", 200, o.Payload)
}
func (o *PostContractsOK) GetPayload() *crm_models.ContractResponse {
@ -144,7 +146,7 @@ func (o *PostContractsOK) readResponse(response runtime.ClientResponse, consumer
o.Payload = new(crm_models.ContractResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -156,9 +158,11 @@ func NewPostContractsUnauthorized() *PostContractsUnauthorized {
return &PostContractsUnauthorized{}
}
// PostContractsUnauthorized describes a response with status code 401, with default header values.
//
// Access unauthorized, invalid API-KEY was used
/*
PostContractsUnauthorized describes a response with status code 401, with default header values.
Access unauthorized, invalid API-KEY was used
*/
type PostContractsUnauthorized struct {
AccessControlAllowOrigin string
@ -196,13 +200,11 @@ func (o *PostContractsUnauthorized) Code() int {
}
func (o *PostContractsUnauthorized) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contracts][%d] postContractsUnauthorized %s", 401, payload)
return fmt.Sprintf("[POST /contracts][%d] postContractsUnauthorized %+v", 401, o.Payload)
}
func (o *PostContractsUnauthorized) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contracts][%d] postContractsUnauthorized %s", 401, payload)
return fmt.Sprintf("[POST /contracts][%d] postContractsUnauthorized %+v", 401, o.Payload)
}
func (o *PostContractsUnauthorized) GetPayload() *crm_models.Error {
@ -221,7 +223,7 @@ func (o *PostContractsUnauthorized) readResponse(response runtime.ClientResponse
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -233,9 +235,11 @@ func NewPostContractsForbidden() *PostContractsForbidden {
return &PostContractsForbidden{}
}
// PostContractsForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
/*
PostContractsForbidden describes a response with status code 403, with default header values.
Access forbidden, account lacks access
*/
type PostContractsForbidden struct {
AccessControlAllowOrigin string
@ -273,13 +277,11 @@ func (o *PostContractsForbidden) Code() int {
}
func (o *PostContractsForbidden) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contracts][%d] postContractsForbidden %s", 403, payload)
return fmt.Sprintf("[POST /contracts][%d] postContractsForbidden %+v", 403, o.Payload)
}
func (o *PostContractsForbidden) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contracts][%d] postContractsForbidden %s", 403, payload)
return fmt.Sprintf("[POST /contracts][%d] postContractsForbidden %+v", 403, o.Payload)
}
func (o *PostContractsForbidden) GetPayload() *crm_models.Error {
@ -298,7 +300,7 @@ func (o *PostContractsForbidden) readResponse(response runtime.ClientResponse, c
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -310,9 +312,11 @@ func NewPostContractsNotFound() *PostContractsNotFound {
return &PostContractsNotFound{}
}
// PostContractsNotFound describes a response with status code 404, with default header values.
//
// Resource was not found
/*
PostContractsNotFound describes a response with status code 404, with default header values.
Resource was not found
*/
type PostContractsNotFound struct {
AccessControlAllowOrigin string
@ -350,13 +354,11 @@ func (o *PostContractsNotFound) Code() int {
}
func (o *PostContractsNotFound) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contracts][%d] postContractsNotFound %s", 404, payload)
return fmt.Sprintf("[POST /contracts][%d] postContractsNotFound %+v", 404, o.Payload)
}
func (o *PostContractsNotFound) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contracts][%d] postContractsNotFound %s", 404, payload)
return fmt.Sprintf("[POST /contracts][%d] postContractsNotFound %+v", 404, o.Payload)
}
func (o *PostContractsNotFound) GetPayload() *crm_models.Error {
@ -375,7 +377,7 @@ func (o *PostContractsNotFound) readResponse(response runtime.ClientResponse, co
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -387,9 +389,11 @@ func NewPostContractsUnprocessableEntity() *PostContractsUnprocessableEntity {
return &PostContractsUnprocessableEntity{}
}
// PostContractsUnprocessableEntity describes a response with status code 422, with default header values.
//
// Unprocessable Entity, likely a bad parameter
/*
PostContractsUnprocessableEntity describes a response with status code 422, with default header values.
Unprocessable Entity, likely a bad parameter
*/
type PostContractsUnprocessableEntity struct {
AccessControlAllowOrigin string
@ -427,13 +431,11 @@ func (o *PostContractsUnprocessableEntity) Code() int {
}
func (o *PostContractsUnprocessableEntity) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contracts][%d] postContractsUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[POST /contracts][%d] postContractsUnprocessableEntity %+v", 422, o.Payload)
}
func (o *PostContractsUnprocessableEntity) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contracts][%d] postContractsUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[POST /contracts][%d] postContractsUnprocessableEntity %+v", 422, o.Payload)
}
func (o *PostContractsUnprocessableEntity) GetPayload() *crm_models.Error {
@ -452,7 +454,7 @@ func (o *PostContractsUnprocessableEntity) readResponse(response runtime.ClientR
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -464,9 +466,11 @@ func NewPostContractsInternalServerError() *PostContractsInternalServerError {
return &PostContractsInternalServerError{}
}
// PostContractsInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
/*
PostContractsInternalServerError describes a response with status code 500, with default header values.
Server Internal Error
*/
type PostContractsInternalServerError struct {
AccessControlAllowOrigin string
@ -504,13 +508,11 @@ func (o *PostContractsInternalServerError) Code() int {
}
func (o *PostContractsInternalServerError) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contracts][%d] postContractsInternalServerError %s", 500, payload)
return fmt.Sprintf("[POST /contracts][%d] postContractsInternalServerError %+v", 500, o.Payload)
}
func (o *PostContractsInternalServerError) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contracts][%d] postContractsInternalServerError %s", 500, payload)
return fmt.Sprintf("[POST /contracts][%d] postContractsInternalServerError %+v", 500, o.Payload)
}
func (o *PostContractsInternalServerError) GetPayload() *crm_models.Error {
@ -529,7 +531,7 @@ func (o *PostContractsInternalServerError) readResponse(response runtime.ClientR
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}

View File

@ -6,16 +6,20 @@
package contracts
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
)
// NewPutContractParams creates a new PutContractParams object,
@ -25,28 +29,24 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewPutContractParams() *PutContractParams {
return NewPutContractParamsWithTimeout(cr.DefaultTimeout)
return &PutContractParams{
timeout: cr.DefaultTimeout,
}
}
// NewPutContractParamsWithTimeout creates a new PutContractParams object
// with the ability to set a timeout on a request.
func NewPutContractParamsWithTimeout(timeout time.Duration) *PutContractParams {
return &PutContractParams{
inner: innerParams{
timeout: timeout,
},
}
}
// NewPutContractParamsWithContext creates a new PutContractParams object
// with the ability to set a context for a request.
//
// Deprecated: use the operation call with context to pass the context instead of [PutContractParams].
func NewPutContractParamsWithContext(ctx context.Context) *PutContractParams {
return &PutContractParams{
inner: innerParams{
ctx: ctx,
},
Context: ctx,
}
}
@ -67,14 +67,15 @@ PutContractParams contains all the parameters to send to the API endpoint
*/
type PutContractParams struct {
// ContractsRequest.
//
// An array of new Contract records
/* ContractsRequest.
An array of new Contract records
*/
ContractsRequest *crm_models.ContractRequest
timeout time.Duration
Context context.Context
HTTPClient *http.Client
inner innerParams
}
// WithDefaults hydrates default values in the put contract params (not the query body).
@ -92,57 +93,54 @@ func (o *PutContractParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the put contract params.
// WithTimeout adds the timeout to the put contract params
func (o *PutContractParams) WithTimeout(timeout time.Duration) *PutContractParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the put contract params.
// SetTimeout adds the timeout to the put contract params
func (o *PutContractParams) SetTimeout(timeout time.Duration) {
o.inner.timeout = timeout
o.timeout = timeout
}
// WithContext adds the context to the put contract params.
//
// Deprecated: use the operation call with context to pass the context instead of [PutContractParams].
// WithContext adds the context to the put contract params
func (o *PutContractParams) WithContext(ctx context.Context) *PutContractParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the put contract params.
//
// Deprecated: use the operation call with context to pass the context instead of [PutContractParams].
// SetContext adds the context to the put contract params
func (o *PutContractParams) SetContext(ctx context.Context) {
o.inner.ctx = ctx
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the put contract params.
// WithHTTPClient adds the HTTPClient to the put contract params
func (o *PutContractParams) WithHTTPClient(client *http.Client) *PutContractParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the put contract params.
// SetHTTPClient adds the HTTPClient to the put contract params
func (o *PutContractParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithContractsRequest adds the contractsRequest to the put contract params.
// WithContractsRequest adds the contractsRequest to the put contract params
func (o *PutContractParams) WithContractsRequest(contractsRequest *crm_models.ContractRequest) *PutContractParams {
o.SetContractsRequest(contractsRequest)
return o
}
// SetContractsRequest adds the contractsRequest to the put contract params.
// SetContractsRequest adds the contractsRequest to the put contract params
func (o *PutContractParams) SetContractsRequest(contractsRequest *crm_models.ContractRequest) {
o.ContractsRequest = contractsRequest
}
// WriteToRequest writes these params to a [runtime.ClientRequest].
// WriteToRequest writes these params to a swagger request
func (o *PutContractParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.inner.timeout); err != nil {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error

View File

@ -6,15 +6,17 @@
package contracts
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
stderrors "errors"
"fmt"
"io"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
)
// PutContractReader is a Reader for the PutContract structure.
@ -23,7 +25,7 @@ type PutContractReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *PutContractReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
func (o *PutContractReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewPutContractOK()
@ -62,7 +64,7 @@ func (o *PutContractReader) ReadResponse(response runtime.ClientResponse, consum
}
return nil, result
default:
return nil, runtime.NewAPIError("[PUT /contracts] putContract", response, response.Code())
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
@ -71,9 +73,11 @@ func NewPutContractOK() *PutContractOK {
return &PutContractOK{}
}
// PutContractOK describes a response with status code 200, with default header values.
//
// Response with an array of Contract objects
/*
PutContractOK describes a response with status code 200, with default header values.
Response with an array of Contract objects
*/
type PutContractOK struct {
AccessControlAllowOrigin string
CacheControl string
@ -112,13 +116,11 @@ func (o *PutContractOK) Code() int {
}
func (o *PutContractOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractOK %s", 200, payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractOK %+v", 200, o.Payload)
}
func (o *PutContractOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractOK %s", 200, payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractOK %+v", 200, o.Payload)
}
func (o *PutContractOK) GetPayload() *crm_models.ContractResponse {
@ -144,7 +146,7 @@ func (o *PutContractOK) readResponse(response runtime.ClientResponse, consumer r
o.Payload = new(crm_models.ContractResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -156,9 +158,11 @@ func NewPutContractUnauthorized() *PutContractUnauthorized {
return &PutContractUnauthorized{}
}
// PutContractUnauthorized describes a response with status code 401, with default header values.
//
// Access unauthorized, invalid API-KEY was used
/*
PutContractUnauthorized describes a response with status code 401, with default header values.
Access unauthorized, invalid API-KEY was used
*/
type PutContractUnauthorized struct {
AccessControlAllowOrigin string
@ -196,13 +200,11 @@ func (o *PutContractUnauthorized) Code() int {
}
func (o *PutContractUnauthorized) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractUnauthorized %s", 401, payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractUnauthorized %+v", 401, o.Payload)
}
func (o *PutContractUnauthorized) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractUnauthorized %s", 401, payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractUnauthorized %+v", 401, o.Payload)
}
func (o *PutContractUnauthorized) GetPayload() *crm_models.Error {
@ -221,7 +223,7 @@ func (o *PutContractUnauthorized) readResponse(response runtime.ClientResponse,
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -233,9 +235,11 @@ func NewPutContractForbidden() *PutContractForbidden {
return &PutContractForbidden{}
}
// PutContractForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
/*
PutContractForbidden describes a response with status code 403, with default header values.
Access forbidden, account lacks access
*/
type PutContractForbidden struct {
AccessControlAllowOrigin string
@ -273,13 +277,11 @@ func (o *PutContractForbidden) Code() int {
}
func (o *PutContractForbidden) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractForbidden %s", 403, payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractForbidden %+v", 403, o.Payload)
}
func (o *PutContractForbidden) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractForbidden %s", 403, payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractForbidden %+v", 403, o.Payload)
}
func (o *PutContractForbidden) GetPayload() *crm_models.Error {
@ -298,7 +300,7 @@ func (o *PutContractForbidden) readResponse(response runtime.ClientResponse, con
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -310,9 +312,11 @@ func NewPutContractNotFound() *PutContractNotFound {
return &PutContractNotFound{}
}
// PutContractNotFound describes a response with status code 404, with default header values.
//
// Resource was not found
/*
PutContractNotFound describes a response with status code 404, with default header values.
Resource was not found
*/
type PutContractNotFound struct {
AccessControlAllowOrigin string
@ -350,13 +354,11 @@ func (o *PutContractNotFound) Code() int {
}
func (o *PutContractNotFound) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractNotFound %s", 404, payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractNotFound %+v", 404, o.Payload)
}
func (o *PutContractNotFound) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractNotFound %s", 404, payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractNotFound %+v", 404, o.Payload)
}
func (o *PutContractNotFound) GetPayload() *crm_models.Error {
@ -375,7 +377,7 @@ func (o *PutContractNotFound) readResponse(response runtime.ClientResponse, cons
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -387,9 +389,11 @@ func NewPutContractUnprocessableEntity() *PutContractUnprocessableEntity {
return &PutContractUnprocessableEntity{}
}
// PutContractUnprocessableEntity describes a response with status code 422, with default header values.
//
// Unprocessable Entity, likely a bad parameter
/*
PutContractUnprocessableEntity describes a response with status code 422, with default header values.
Unprocessable Entity, likely a bad parameter
*/
type PutContractUnprocessableEntity struct {
AccessControlAllowOrigin string
@ -427,13 +431,11 @@ func (o *PutContractUnprocessableEntity) Code() int {
}
func (o *PutContractUnprocessableEntity) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractUnprocessableEntity %+v", 422, o.Payload)
}
func (o *PutContractUnprocessableEntity) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractUnprocessableEntity %+v", 422, o.Payload)
}
func (o *PutContractUnprocessableEntity) GetPayload() *crm_models.Error {
@ -452,7 +454,7 @@ func (o *PutContractUnprocessableEntity) readResponse(response runtime.ClientRes
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -464,9 +466,11 @@ func NewPutContractInternalServerError() *PutContractInternalServerError {
return &PutContractInternalServerError{}
}
// PutContractInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
/*
PutContractInternalServerError describes a response with status code 500, with default header values.
Server Internal Error
*/
type PutContractInternalServerError struct {
AccessControlAllowOrigin string
@ -504,13 +508,11 @@ func (o *PutContractInternalServerError) Code() int {
}
func (o *PutContractInternalServerError) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractInternalServerError %s", 500, payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractInternalServerError %+v", 500, o.Payload)
}
func (o *PutContractInternalServerError) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractInternalServerError %s", 500, payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractInternalServerError %+v", 500, o.Payload)
}
func (o *PutContractInternalServerError) GetPayload() *crm_models.Error {
@ -529,7 +531,7 @@ func (o *PutContractInternalServerError) readResponse(response runtime.ClientRes
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}

View File

@ -6,30 +6,34 @@
package crm_client
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"maps"
"github.com/go-openapi/runtime"
httptransport "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_client/accounts"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_client/assets"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_client/contacts"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_client/contracts"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_client/leads"
"github.com/go-openapi/runtime"
httptransport "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// Default crm HTTP client.
var Default = NewHTTPClient(nil)
const (
// DefaultHost is the default Host found in Meta (info) section of spec file.
// DefaultHost is the default Host
// found in Meta (info) section of spec file
DefaultHost string = "crm.vernonkeenan.com:8080"
// DefaultBasePath is the default BasePath found in Meta (info) section of spec file.
// DefaultBasePath is the default BasePath
// found in Meta (info) section of spec file
DefaultBasePath string = "/v1"
)
// DefaultSchemes are the default schemes found in Meta (info) section of spec file.
// DefaultSchemes are the default schemes found in Meta (info) section of spec file
var DefaultSchemes = []string{"http"}
// NewHTTPClient creates a new crm HTTP client.
@ -45,16 +49,13 @@ func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *Crm
cfg = DefaultTransportConfig()
}
// create transport and client.
// create transport and client
transport := httptransport.New(cfg.Host, cfg.BasePath, cfg.Schemes)
maps.Copy(transport.Producers, cfg.Producers)
maps.Copy(transport.Consumers, cfg.Consumers)
return New(transport, formats)
}
// New creates a new crm client.
func New(transport runtime.ContextualTransport, formats strfmt.Registry) *Crm {
// New creates a new crm client
func New(transport runtime.ClientTransport, formats strfmt.Registry) *Crm {
// ensure nullable parameters have default
if formats == nil {
formats = strfmt.Default
@ -67,7 +68,6 @@ func New(transport runtime.ContextualTransport, formats strfmt.Registry) *Crm {
cli.Contacts = contacts.New(transport, formats)
cli.Contracts = contracts.New(transport, formats)
cli.Leads = leads.New(transport, formats)
return cli
}
@ -87,8 +87,6 @@ type TransportConfig struct {
Host string
BasePath string
Schemes []string
Producers map[string]runtime.Producer
Consumers map[string]runtime.Consumer
}
// WithHost overrides the default host,
@ -112,19 +110,7 @@ func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig {
return cfg
}
// WithProducers overrides the default producers registered by [httptransport.Runtime].
func (cfg *TransportConfig) WithProducers(producers map[string]runtime.Producer) *TransportConfig {
cfg.Producers = producers
return cfg
}
// WithConsumers overrides the default consumers registered by [httptransport.Runtime].
func (cfg *TransportConfig) WithConsumers(consumers map[string]runtime.Consumer) *TransportConfig {
cfg.Consumers = consumers
return cfg
}
// Crm is a client for crm.
// Crm is a client for crm
type Crm struct {
Accounts accounts.ClientService
@ -136,11 +122,11 @@ type Crm struct {
Leads leads.ClientService
Transport runtime.ContextualTransport
Transport runtime.ClientTransport
}
// SetTransport changes the transport on the client and all its subresources.
func (c *Crm) SetTransport(transport runtime.ContextualTransport) {
// SetTransport changes the transport on the client and all its subresources
func (c *Crm) SetTransport(transport runtime.ClientTransport) {
c.Transport = transport
c.Accounts.SetTransport(transport)
c.Assets.SetTransport(transport)

View File

@ -6,6 +6,9 @@
package leads
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
@ -24,28 +27,24 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewDeleteLeadParams() *DeleteLeadParams {
return NewDeleteLeadParamsWithTimeout(cr.DefaultTimeout)
return &DeleteLeadParams{
timeout: cr.DefaultTimeout,
}
}
// NewDeleteLeadParamsWithTimeout creates a new DeleteLeadParams object
// with the ability to set a timeout on a request.
func NewDeleteLeadParamsWithTimeout(timeout time.Duration) *DeleteLeadParams {
return &DeleteLeadParams{
inner: innerParams{
timeout: timeout,
},
}
}
// NewDeleteLeadParamsWithContext creates a new DeleteLeadParams object
// with the ability to set a context for a request.
//
// Deprecated: use the operation call with context to pass the context instead of [DeleteLeadParams].
func NewDeleteLeadParamsWithContext(ctx context.Context) *DeleteLeadParams {
return &DeleteLeadParams{
inner: innerParams{
ctx: ctx,
},
Context: ctx,
}
}
@ -66,14 +65,15 @@ DeleteLeadParams contains all the parameters to send to the API endpoint
*/
type DeleteLeadParams struct {
// LeadID.
//
// Lead record ID
/* LeadID.
Lead record ID
*/
LeadID *string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
inner innerParams
}
// WithDefaults hydrates default values in the delete lead params (not the query body).
@ -91,57 +91,54 @@ func (o *DeleteLeadParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the delete lead params.
// WithTimeout adds the timeout to the delete lead params
func (o *DeleteLeadParams) WithTimeout(timeout time.Duration) *DeleteLeadParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the delete lead params.
// SetTimeout adds the timeout to the delete lead params
func (o *DeleteLeadParams) SetTimeout(timeout time.Duration) {
o.inner.timeout = timeout
o.timeout = timeout
}
// WithContext adds the context to the delete lead params.
//
// Deprecated: use the operation call with context to pass the context instead of [DeleteLeadParams].
// WithContext adds the context to the delete lead params
func (o *DeleteLeadParams) WithContext(ctx context.Context) *DeleteLeadParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the delete lead params.
//
// Deprecated: use the operation call with context to pass the context instead of [DeleteLeadParams].
// SetContext adds the context to the delete lead params
func (o *DeleteLeadParams) SetContext(ctx context.Context) {
o.inner.ctx = ctx
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the delete lead params.
// WithHTTPClient adds the HTTPClient to the delete lead params
func (o *DeleteLeadParams) WithHTTPClient(client *http.Client) *DeleteLeadParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the delete lead params.
// SetHTTPClient adds the HTTPClient to the delete lead params
func (o *DeleteLeadParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithLeadID adds the leadID to the delete lead params.
// WithLeadID adds the leadID to the delete lead params
func (o *DeleteLeadParams) WithLeadID(leadID *string) *DeleteLeadParams {
o.SetLeadID(leadID)
return o
}
// SetLeadID adds the leadId to the delete lead params.
// SetLeadID adds the leadId to the delete lead params
func (o *DeleteLeadParams) SetLeadID(leadID *string) {
o.LeadID = leadID
}
// WriteToRequest writes these params to a [runtime.ClientRequest].
// WriteToRequest writes these params to a swagger request
func (o *DeleteLeadParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.inner.timeout); err != nil {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error

View File

@ -6,15 +6,17 @@
package leads
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
stderrors "errors"
"fmt"
"io"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
)
// DeleteLeadReader is a Reader for the DeleteLead structure.
@ -23,7 +25,7 @@ type DeleteLeadReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *DeleteLeadReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
func (o *DeleteLeadReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewDeleteLeadOK()
@ -62,7 +64,7 @@ func (o *DeleteLeadReader) ReadResponse(response runtime.ClientResponse, consume
}
return nil, result
default:
return nil, runtime.NewAPIError("[DELETE /leads] deleteLead", response, response.Code())
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
@ -71,9 +73,11 @@ func NewDeleteLeadOK() *DeleteLeadOK {
return &DeleteLeadOK{}
}
// DeleteLeadOK describes a response with status code 200, with default header values.
//
// Response with Message Objects with Delete Status
/*
DeleteLeadOK describes a response with status code 200, with default header values.
Response with Message Objects with Delete Status
*/
type DeleteLeadOK struct {
AccessControlAllowOrigin string
@ -111,13 +115,11 @@ func (o *DeleteLeadOK) Code() int {
}
func (o *DeleteLeadOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadOK %s", 200, payload)
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadOK %+v", 200, o.Payload)
}
func (o *DeleteLeadOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadOK %s", 200, payload)
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadOK %+v", 200, o.Payload)
}
func (o *DeleteLeadOK) GetPayload() *crm_models.DeleteResponse {
@ -136,7 +138,7 @@ func (o *DeleteLeadOK) readResponse(response runtime.ClientResponse, consumer ru
o.Payload = new(crm_models.DeleteResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -148,9 +150,11 @@ func NewDeleteLeadUnauthorized() *DeleteLeadUnauthorized {
return &DeleteLeadUnauthorized{}
}
// DeleteLeadUnauthorized describes a response with status code 401, with default header values.
//
// Access unauthorized, invalid API-KEY was used
/*
DeleteLeadUnauthorized describes a response with status code 401, with default header values.
Access unauthorized, invalid API-KEY was used
*/
type DeleteLeadUnauthorized struct {
AccessControlAllowOrigin string
@ -188,13 +192,11 @@ func (o *DeleteLeadUnauthorized) Code() int {
}
func (o *DeleteLeadUnauthorized) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadUnauthorized %s", 401, payload)
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadUnauthorized %+v", 401, o.Payload)
}
func (o *DeleteLeadUnauthorized) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadUnauthorized %s", 401, payload)
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadUnauthorized %+v", 401, o.Payload)
}
func (o *DeleteLeadUnauthorized) GetPayload() *crm_models.Error {
@ -213,7 +215,7 @@ func (o *DeleteLeadUnauthorized) readResponse(response runtime.ClientResponse, c
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -225,9 +227,11 @@ func NewDeleteLeadForbidden() *DeleteLeadForbidden {
return &DeleteLeadForbidden{}
}
// DeleteLeadForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
/*
DeleteLeadForbidden describes a response with status code 403, with default header values.
Access forbidden, account lacks access
*/
type DeleteLeadForbidden struct {
AccessControlAllowOrigin string
@ -265,13 +269,11 @@ func (o *DeleteLeadForbidden) Code() int {
}
func (o *DeleteLeadForbidden) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadForbidden %s", 403, payload)
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadForbidden %+v", 403, o.Payload)
}
func (o *DeleteLeadForbidden) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadForbidden %s", 403, payload)
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadForbidden %+v", 403, o.Payload)
}
func (o *DeleteLeadForbidden) GetPayload() *crm_models.Error {
@ -290,7 +292,7 @@ func (o *DeleteLeadForbidden) readResponse(response runtime.ClientResponse, cons
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -302,9 +304,11 @@ func NewDeleteLeadNotFound() *DeleteLeadNotFound {
return &DeleteLeadNotFound{}
}
// DeleteLeadNotFound describes a response with status code 404, with default header values.
//
// Resource was not found
/*
DeleteLeadNotFound describes a response with status code 404, with default header values.
Resource was not found
*/
type DeleteLeadNotFound struct {
AccessControlAllowOrigin string
@ -342,13 +346,11 @@ func (o *DeleteLeadNotFound) Code() int {
}
func (o *DeleteLeadNotFound) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadNotFound %s", 404, payload)
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadNotFound %+v", 404, o.Payload)
}
func (o *DeleteLeadNotFound) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadNotFound %s", 404, payload)
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadNotFound %+v", 404, o.Payload)
}
func (o *DeleteLeadNotFound) GetPayload() *crm_models.Error {
@ -367,7 +369,7 @@ func (o *DeleteLeadNotFound) readResponse(response runtime.ClientResponse, consu
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -379,9 +381,11 @@ func NewDeleteLeadUnprocessableEntity() *DeleteLeadUnprocessableEntity {
return &DeleteLeadUnprocessableEntity{}
}
// DeleteLeadUnprocessableEntity describes a response with status code 422, with default header values.
//
// Unprocessable Entity, likely a bad parameter
/*
DeleteLeadUnprocessableEntity describes a response with status code 422, with default header values.
Unprocessable Entity, likely a bad parameter
*/
type DeleteLeadUnprocessableEntity struct {
AccessControlAllowOrigin string
@ -419,13 +423,11 @@ func (o *DeleteLeadUnprocessableEntity) Code() int {
}
func (o *DeleteLeadUnprocessableEntity) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadUnprocessableEntity %+v", 422, o.Payload)
}
func (o *DeleteLeadUnprocessableEntity) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadUnprocessableEntity %+v", 422, o.Payload)
}
func (o *DeleteLeadUnprocessableEntity) GetPayload() *crm_models.Error {
@ -444,7 +446,7 @@ func (o *DeleteLeadUnprocessableEntity) readResponse(response runtime.ClientResp
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -456,9 +458,11 @@ func NewDeleteLeadInternalServerError() *DeleteLeadInternalServerError {
return &DeleteLeadInternalServerError{}
}
// DeleteLeadInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
/*
DeleteLeadInternalServerError describes a response with status code 500, with default header values.
Server Internal Error
*/
type DeleteLeadInternalServerError struct {
AccessControlAllowOrigin string
@ -496,13 +500,11 @@ func (o *DeleteLeadInternalServerError) Code() int {
}
func (o *DeleteLeadInternalServerError) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadInternalServerError %s", 500, payload)
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadInternalServerError %+v", 500, o.Payload)
}
func (o *DeleteLeadInternalServerError) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadInternalServerError %s", 500, payload)
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadInternalServerError %+v", 500, o.Payload)
}
func (o *DeleteLeadInternalServerError) GetPayload() *crm_models.Error {
@ -521,7 +523,7 @@ func (o *DeleteLeadInternalServerError) readResponse(response runtime.ClientResp
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}

View File

@ -6,6 +6,9 @@
package leads
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
@ -15,7 +18,7 @@ import (
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/conv"
"github.com/go-openapi/swag"
)
// NewGetLeadsParams creates a new GetLeadsParams object,
@ -25,28 +28,24 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewGetLeadsParams() *GetLeadsParams {
return NewGetLeadsParamsWithTimeout(cr.DefaultTimeout)
return &GetLeadsParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetLeadsParamsWithTimeout creates a new GetLeadsParams object
// with the ability to set a timeout on a request.
func NewGetLeadsParamsWithTimeout(timeout time.Duration) *GetLeadsParams {
return &GetLeadsParams{
inner: innerParams{
timeout: timeout,
},
}
}
// NewGetLeadsParamsWithContext creates a new GetLeadsParams object
// with the ability to set a context for a request.
//
// Deprecated: use the operation call with context to pass the context instead of [GetLeadsParams].
func NewGetLeadsParamsWithContext(ctx context.Context) *GetLeadsParams {
return &GetLeadsParams{
inner: innerParams{
ctx: ctx,
},
Context: ctx,
}
}
@ -67,38 +66,43 @@ GetLeadsParams contains all the parameters to send to the API endpoint
*/
type GetLeadsParams struct {
// Email.
//
// Email address used for identity lookup
/* Email.
Email address used for identity lookup
*/
Email *string
// LeadID.
//
// Lead record ID
/* LeadID.
Lead record ID
*/
LeadID *string
// Limit.
//
// How many objects to return at one time
//
// Format: int64
/* Limit.
How many objects to return at one time
Format: int64
*/
Limit *int64
// Name.
//
// The Name of this Object
/* Name.
The Name of this Object
*/
Name *string
// Offset.
//
// How many objects to skip?
//
// Format: int64
/* Offset.
How many objects to skip?
Format: int64
*/
Offset *int64
timeout time.Duration
Context context.Context
HTTPClient *http.Client
inner innerParams
}
// WithDefaults hydrates default values in the get leads params (not the query body).
@ -116,101 +120,98 @@ func (o *GetLeadsParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the get leads params.
// WithTimeout adds the timeout to the get leads params
func (o *GetLeadsParams) WithTimeout(timeout time.Duration) *GetLeadsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get leads params.
// SetTimeout adds the timeout to the get leads params
func (o *GetLeadsParams) SetTimeout(timeout time.Duration) {
o.inner.timeout = timeout
o.timeout = timeout
}
// WithContext adds the context to the get leads params.
//
// Deprecated: use the operation call with context to pass the context instead of [GetLeadsParams].
// WithContext adds the context to the get leads params
func (o *GetLeadsParams) WithContext(ctx context.Context) *GetLeadsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get leads params.
//
// Deprecated: use the operation call with context to pass the context instead of [GetLeadsParams].
// SetContext adds the context to the get leads params
func (o *GetLeadsParams) SetContext(ctx context.Context) {
o.inner.ctx = ctx
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get leads params.
// WithHTTPClient adds the HTTPClient to the get leads params
func (o *GetLeadsParams) WithHTTPClient(client *http.Client) *GetLeadsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get leads params.
// SetHTTPClient adds the HTTPClient to the get leads params
func (o *GetLeadsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithEmail adds the email to the get leads params.
// WithEmail adds the email to the get leads params
func (o *GetLeadsParams) WithEmail(email *string) *GetLeadsParams {
o.SetEmail(email)
return o
}
// SetEmail adds the email to the get leads params.
// SetEmail adds the email to the get leads params
func (o *GetLeadsParams) SetEmail(email *string) {
o.Email = email
}
// WithLeadID adds the leadID to the get leads params.
// WithLeadID adds the leadID to the get leads params
func (o *GetLeadsParams) WithLeadID(leadID *string) *GetLeadsParams {
o.SetLeadID(leadID)
return o
}
// SetLeadID adds the leadId to the get leads params.
// SetLeadID adds the leadId to the get leads params
func (o *GetLeadsParams) SetLeadID(leadID *string) {
o.LeadID = leadID
}
// WithLimit adds the limit to the get leads params.
// WithLimit adds the limit to the get leads params
func (o *GetLeadsParams) WithLimit(limit *int64) *GetLeadsParams {
o.SetLimit(limit)
return o
}
// SetLimit adds the limit to the get leads params.
// SetLimit adds the limit to the get leads params
func (o *GetLeadsParams) SetLimit(limit *int64) {
o.Limit = limit
}
// WithName adds the name to the get leads params.
// WithName adds the name to the get leads params
func (o *GetLeadsParams) WithName(name *string) *GetLeadsParams {
o.SetName(name)
return o
}
// SetName adds the name to the get leads params.
// SetName adds the name to the get leads params
func (o *GetLeadsParams) SetName(name *string) {
o.Name = name
}
// WithOffset adds the offset to the get leads params.
// WithOffset adds the offset to the get leads params
func (o *GetLeadsParams) WithOffset(offset *int64) *GetLeadsParams {
o.SetOffset(offset)
return o
}
// SetOffset adds the offset to the get leads params.
// SetOffset adds the offset to the get leads params
func (o *GetLeadsParams) SetOffset(offset *int64) {
o.Offset = offset
}
// WriteToRequest writes these params to a [runtime.ClientRequest].
// WriteToRequest writes these params to a swagger request
func (o *GetLeadsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.inner.timeout); err != nil {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
@ -257,7 +258,7 @@ func (o *GetLeadsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regi
if o.Limit != nil {
qrLimit = *o.Limit
}
qLimit := conv.FormatInteger(qrLimit)
qLimit := swag.FormatInt64(qrLimit)
if qLimit != "" {
if err := r.SetQueryParam("limit", qLimit); err != nil {
@ -291,7 +292,7 @@ func (o *GetLeadsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regi
if o.Offset != nil {
qrOffset = *o.Offset
}
qOffset := conv.FormatInteger(qrOffset)
qOffset := swag.FormatInt64(qrOffset)
if qOffset != "" {
if err := r.SetQueryParam("offset", qOffset); err != nil {

View File

@ -6,15 +6,17 @@
package leads
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
stderrors "errors"
"fmt"
"io"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
)
// GetLeadsReader is a Reader for the GetLeads structure.
@ -23,7 +25,7 @@ type GetLeadsReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *GetLeadsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
func (o *GetLeadsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetLeadsOK()
@ -62,7 +64,7 @@ func (o *GetLeadsReader) ReadResponse(response runtime.ClientResponse, consumer
}
return nil, result
default:
return nil, runtime.NewAPIError("[GET /leads] getLeads", response, response.Code())
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
@ -71,9 +73,11 @@ func NewGetLeadsOK() *GetLeadsOK {
return &GetLeadsOK{}
}
// GetLeadsOK describes a response with status code 200, with default header values.
//
// Response with an array of Lead objects
/*
GetLeadsOK describes a response with status code 200, with default header values.
Response with an array of Lead objects
*/
type GetLeadsOK struct {
AccessControlAllowOrigin string
CacheControl string
@ -112,13 +116,11 @@ func (o *GetLeadsOK) Code() int {
}
func (o *GetLeadsOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /leads][%d] getLeadsOK %s", 200, payload)
return fmt.Sprintf("[GET /leads][%d] getLeadsOK %+v", 200, o.Payload)
}
func (o *GetLeadsOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /leads][%d] getLeadsOK %s", 200, payload)
return fmt.Sprintf("[GET /leads][%d] getLeadsOK %+v", 200, o.Payload)
}
func (o *GetLeadsOK) GetPayload() *crm_models.LeadResponse {
@ -144,7 +146,7 @@ func (o *GetLeadsOK) readResponse(response runtime.ClientResponse, consumer runt
o.Payload = new(crm_models.LeadResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -156,9 +158,11 @@ func NewGetLeadsUnauthorized() *GetLeadsUnauthorized {
return &GetLeadsUnauthorized{}
}
// GetLeadsUnauthorized describes a response with status code 401, with default header values.
//
// Access unauthorized, invalid API-KEY was used
/*
GetLeadsUnauthorized describes a response with status code 401, with default header values.
Access unauthorized, invalid API-KEY was used
*/
type GetLeadsUnauthorized struct {
AccessControlAllowOrigin string
@ -196,13 +200,11 @@ func (o *GetLeadsUnauthorized) Code() int {
}
func (o *GetLeadsUnauthorized) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /leads][%d] getLeadsUnauthorized %s", 401, payload)
return fmt.Sprintf("[GET /leads][%d] getLeadsUnauthorized %+v", 401, o.Payload)
}
func (o *GetLeadsUnauthorized) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /leads][%d] getLeadsUnauthorized %s", 401, payload)
return fmt.Sprintf("[GET /leads][%d] getLeadsUnauthorized %+v", 401, o.Payload)
}
func (o *GetLeadsUnauthorized) GetPayload() *crm_models.Error {
@ -221,7 +223,7 @@ func (o *GetLeadsUnauthorized) readResponse(response runtime.ClientResponse, con
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -233,9 +235,11 @@ func NewGetLeadsForbidden() *GetLeadsForbidden {
return &GetLeadsForbidden{}
}
// GetLeadsForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
/*
GetLeadsForbidden describes a response with status code 403, with default header values.
Access forbidden, account lacks access
*/
type GetLeadsForbidden struct {
AccessControlAllowOrigin string
@ -273,13 +277,11 @@ func (o *GetLeadsForbidden) Code() int {
}
func (o *GetLeadsForbidden) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /leads][%d] getLeadsForbidden %s", 403, payload)
return fmt.Sprintf("[GET /leads][%d] getLeadsForbidden %+v", 403, o.Payload)
}
func (o *GetLeadsForbidden) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /leads][%d] getLeadsForbidden %s", 403, payload)
return fmt.Sprintf("[GET /leads][%d] getLeadsForbidden %+v", 403, o.Payload)
}
func (o *GetLeadsForbidden) GetPayload() *crm_models.Error {
@ -298,7 +300,7 @@ func (o *GetLeadsForbidden) readResponse(response runtime.ClientResponse, consum
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -310,9 +312,11 @@ func NewGetLeadsNotFound() *GetLeadsNotFound {
return &GetLeadsNotFound{}
}
// GetLeadsNotFound describes a response with status code 404, with default header values.
//
// Resource was not found
/*
GetLeadsNotFound describes a response with status code 404, with default header values.
Resource was not found
*/
type GetLeadsNotFound struct {
AccessControlAllowOrigin string
@ -350,13 +354,11 @@ func (o *GetLeadsNotFound) Code() int {
}
func (o *GetLeadsNotFound) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /leads][%d] getLeadsNotFound %s", 404, payload)
return fmt.Sprintf("[GET /leads][%d] getLeadsNotFound %+v", 404, o.Payload)
}
func (o *GetLeadsNotFound) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /leads][%d] getLeadsNotFound %s", 404, payload)
return fmt.Sprintf("[GET /leads][%d] getLeadsNotFound %+v", 404, o.Payload)
}
func (o *GetLeadsNotFound) GetPayload() *crm_models.Error {
@ -375,7 +377,7 @@ func (o *GetLeadsNotFound) readResponse(response runtime.ClientResponse, consume
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -387,9 +389,11 @@ func NewGetLeadsUnprocessableEntity() *GetLeadsUnprocessableEntity {
return &GetLeadsUnprocessableEntity{}
}
// GetLeadsUnprocessableEntity describes a response with status code 422, with default header values.
//
// Unprocessable Entity, likely a bad parameter
/*
GetLeadsUnprocessableEntity describes a response with status code 422, with default header values.
Unprocessable Entity, likely a bad parameter
*/
type GetLeadsUnprocessableEntity struct {
AccessControlAllowOrigin string
@ -427,13 +431,11 @@ func (o *GetLeadsUnprocessableEntity) Code() int {
}
func (o *GetLeadsUnprocessableEntity) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /leads][%d] getLeadsUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[GET /leads][%d] getLeadsUnprocessableEntity %+v", 422, o.Payload)
}
func (o *GetLeadsUnprocessableEntity) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /leads][%d] getLeadsUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[GET /leads][%d] getLeadsUnprocessableEntity %+v", 422, o.Payload)
}
func (o *GetLeadsUnprocessableEntity) GetPayload() *crm_models.Error {
@ -452,7 +454,7 @@ func (o *GetLeadsUnprocessableEntity) readResponse(response runtime.ClientRespon
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -464,9 +466,11 @@ func NewGetLeadsInternalServerError() *GetLeadsInternalServerError {
return &GetLeadsInternalServerError{}
}
// GetLeadsInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
/*
GetLeadsInternalServerError describes a response with status code 500, with default header values.
Server Internal Error
*/
type GetLeadsInternalServerError struct {
AccessControlAllowOrigin string
@ -504,13 +508,11 @@ func (o *GetLeadsInternalServerError) Code() int {
}
func (o *GetLeadsInternalServerError) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /leads][%d] getLeadsInternalServerError %s", 500, payload)
return fmt.Sprintf("[GET /leads][%d] getLeadsInternalServerError %+v", 500, o.Payload)
}
func (o *GetLeadsInternalServerError) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /leads][%d] getLeadsInternalServerError %s", 500, payload)
return fmt.Sprintf("[GET /leads][%d] getLeadsInternalServerError %+v", 500, o.Payload)
}
func (o *GetLeadsInternalServerError) GetPayload() *crm_models.Error {
@ -529,7 +531,7 @@ func (o *GetLeadsInternalServerError) readResponse(response runtime.ClientRespon
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}

View File

@ -6,117 +6,55 @@
package leads
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"fmt"
"time"
"github.com/go-openapi/runtime"
httptransport "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// New creates a new leads API client.
func New(transport runtime.ContextualTransport, formats strfmt.Registry) ClientService {
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
// New creates a new leads API client with basic auth credentials.
//
// It takes the following parameters:
// - host: http host (github.com).
// - basePath: any base path for the API client ("/v1", "/v3").
// - scheme: http scheme ("http", "https").
// - user: user for basic authentication header.
// - password: password for basic authentication header.
func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService {
transport := httptransport.New(host, basePath, []string{scheme})
transport.DefaultAuthentication = httptransport.BasicAuth(user, password)
return &Client{transport: transport, formats: strfmt.Default}
}
// New creates a new leads API client with a bearer token for authentication.
//
// It takes the following parameters:
// - host: http host (github.com).
// - basePath: any base path for the API client ("/v1", "/v3").
// - scheme: http scheme ("http", "https").
// - bearerToken: bearer token for Bearer authentication header.
func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService {
transport := httptransport.New(host, basePath, []string{scheme})
transport.DefaultAuthentication = httptransport.BearerToken(bearerToken)
return &Client{transport: transport, formats: strfmt.Default}
}
// Client for leads API.
/*
Client for leads API
*/
type Client struct {
transport runtime.ContextualTransport
transport runtime.ClientTransport
formats strfmt.Registry
}
// ClientOption may be used to customize the behavior of Client methods.
// ClientOption is the option for Client methods
type ClientOption func(*runtime.ClientOperation)
// ClientService is the interface for Client methods.
// ClientService is the interface for Client methods
type ClientService interface {
// DeleteLead delete a contact.
DeleteLead(params *DeleteLeadParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteLeadOK, error)
// DeleteLeadContext delete a contact.
DeleteLeadContext(ctx context.Context, params *DeleteLeadParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteLeadOK, error)
// GetLeads get a list of contacts.
GetLeads(params *GetLeadsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLeadsOK, error)
// GetLeadsContext get a list of contacts.
GetLeadsContext(ctx context.Context, params *GetLeadsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLeadsOK, error)
// PostLeads add new leads.
PostLeads(params *PostLeadsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostLeadsOK, error)
// PostLeadsContext add new leads.
PostLeadsContext(ctx context.Context, params *PostLeadsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostLeadsOK, error)
// PutLeads update leads.
PutLeads(params *PutLeadsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutLeadsOK, error)
// PutLeadsContext update leads.
PutLeadsContext(ctx context.Context, params *PutLeadsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutLeadsOK, error)
SetTransport(transport runtime.ContextualTransport)
SetTransport(transport runtime.ClientTransport)
}
// DeleteLead deletes a contact.
//
// Delete SalesforceDevops.net Lead record.
//
// This method does not support injected context.
// However, timeout and opentracing contexts are honored whenever enabled.
//
// If you need to pass a specific context, use [Client.DeleteLeadContext] instead.
/*
DeleteLead deletes a contact
Delete SalesforceDevops.net Lead record
*/
func (a *Client) DeleteLead(params *DeleteLeadParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteLeadOK, error) {
var ctx context.Context
if params.inner.ctx != nil {
ctx = params.inner.ctx
} else {
ctx = context.Background()
}
return a.DeleteLeadContext(ctx, params, authInfo, opts...)
}
// DeleteLeadContext deletes a contact.
//
// Delete SalesforceDevops.net Lead record.
//
// Do not use the deprecated [DeleteLeadParams.Context] with this method: it would be ignored.
func (a *Client) DeleteLeadContext(ctx context.Context, params *DeleteLeadParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteLeadOK, error) {
// NOTE: parameters are not validated before sending
// TODO: Validate the params before sending
if params == nil {
params = NewDeleteLeadParams()
}
op := &runtime.ClientOperation{
ID: "deleteLead",
Method: "DELETE",
@ -127,63 +65,37 @@ func (a *Client) DeleteLeadContext(ctx context.Context, params *DeleteLeadParams
Params: params,
Reader: &DeleteLeadReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.SubmitContext(ctx, op)
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*DeleteLeadOK)
if ok {
return success, nil
}
// unexpected success response.
// no default response is defined.
//
// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for deleteLead: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// GetLeads gets a list of contacts.
//
// Return a list of all available Leads.
//
// This method does not support injected context.
// However, timeout and opentracing contexts are honored whenever enabled.
//
// If you need to pass a specific context, use [Client.GetLeadsContext] instead.
/*
GetLeads gets a list of contacts
Return a list of all available Leads
*/
func (a *Client) GetLeads(params *GetLeadsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLeadsOK, error) {
var ctx context.Context
if params.inner.ctx != nil {
ctx = params.inner.ctx
} else {
ctx = context.Background()
}
return a.GetLeadsContext(ctx, params, authInfo, opts...)
}
// GetLeadsContext gets a list of contacts.
//
// Return a list of all available Leads.
//
// Do not use the deprecated [GetLeadsParams.Context] with this method: it would be ignored.
func (a *Client) GetLeadsContext(ctx context.Context, params *GetLeadsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLeadsOK, error) {
// NOTE: parameters are not validated before sending
// TODO: Validate the params before sending
if params == nil {
params = NewGetLeadsParams()
}
op := &runtime.ClientOperation{
ID: "getLeads",
Method: "GET",
@ -194,63 +106,37 @@ func (a *Client) GetLeadsContext(ctx context.Context, params *GetLeadsParams, au
Params: params,
Reader: &GetLeadsReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.SubmitContext(ctx, op)
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*GetLeadsOK)
if ok {
return success, nil
}
// unexpected success response.
// no default response is defined.
//
// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for getLeads: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// PostLeads adds new leads.
//
// Lead records to be added.
//
// This method does not support injected context.
// However, timeout and opentracing contexts are honored whenever enabled.
//
// If you need to pass a specific context, use [Client.PostLeadsContext] instead.
/*
PostLeads adds new leads
Lead records to be added
*/
func (a *Client) PostLeads(params *PostLeadsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostLeadsOK, error) {
var ctx context.Context
if params.inner.ctx != nil {
ctx = params.inner.ctx
} else {
ctx = context.Background()
}
return a.PostLeadsContext(ctx, params, authInfo, opts...)
}
// PostLeadsContext adds new leads.
//
// Lead records to be added.
//
// Do not use the deprecated [PostLeadsParams.Context] with this method: it would be ignored.
func (a *Client) PostLeadsContext(ctx context.Context, params *PostLeadsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostLeadsOK, error) {
// NOTE: parameters are not validated before sending
// TODO: Validate the params before sending
if params == nil {
params = NewPostLeadsParams()
}
op := &runtime.ClientOperation{
ID: "postLeads",
Method: "POST",
@ -261,63 +147,37 @@ func (a *Client) PostLeadsContext(ctx context.Context, params *PostLeadsParams,
Params: params,
Reader: &PostLeadsReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.SubmitContext(ctx, op)
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*PostLeadsOK)
if ok {
return success, nil
}
// unexpected success response.
// no default response is defined.
//
// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for postLeads: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// PutLeads updates leads.
//
// Update Lead records.
//
// This method does not support injected context.
// However, timeout and opentracing contexts are honored whenever enabled.
//
// If you need to pass a specific context, use [Client.PutLeadsContext] instead.
/*
PutLeads updates leads
Update Lead records
*/
func (a *Client) PutLeads(params *PutLeadsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutLeadsOK, error) {
var ctx context.Context
if params.inner.ctx != nil {
ctx = params.inner.ctx
} else {
ctx = context.Background()
}
return a.PutLeadsContext(ctx, params, authInfo, opts...)
}
// PutLeadsContext updates leads.
//
// Update Lead records.
//
// Do not use the deprecated [PutLeadsParams.Context] with this method: it would be ignored.
func (a *Client) PutLeadsContext(ctx context.Context, params *PutLeadsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutLeadsOK, error) {
// NOTE: parameters are not validated before sending
// TODO: Validate the params before sending
if params == nil {
params = NewPutLeadsParams()
}
op := &runtime.ClientOperation{
ID: "putLeads",
Method: "PUT",
@ -328,42 +188,28 @@ func (a *Client) PutLeadsContext(ctx context.Context, params *PutLeadsParams, au
Params: params,
Reader: &PutLeadsReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.SubmitContext(ctx, op)
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*PutLeadsOK)
if ok {
return success, nil
}
// unexpected success response.
// no default response is defined.
//
// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for putLeads: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ContextualTransport) {
func (a *Client) SetTransport(transport runtime.ClientTransport) {
a.transport = transport
}
// innerParams captures internal fields so they don't conflict with user-supplied parameters.
type innerParams struct {
timeout time.Duration
// Deprecated: use the operation call with context to pass the context instead of [LeadsParams].
ctx context.Context
}

View File

@ -6,16 +6,20 @@
package leads
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
)
// NewPostLeadsParams creates a new PostLeadsParams object,
@ -25,28 +29,24 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewPostLeadsParams() *PostLeadsParams {
return NewPostLeadsParamsWithTimeout(cr.DefaultTimeout)
return &PostLeadsParams{
timeout: cr.DefaultTimeout,
}
}
// NewPostLeadsParamsWithTimeout creates a new PostLeadsParams object
// with the ability to set a timeout on a request.
func NewPostLeadsParamsWithTimeout(timeout time.Duration) *PostLeadsParams {
return &PostLeadsParams{
inner: innerParams{
timeout: timeout,
},
}
}
// NewPostLeadsParamsWithContext creates a new PostLeadsParams object
// with the ability to set a context for a request.
//
// Deprecated: use the operation call with context to pass the context instead of [PostLeadsParams].
func NewPostLeadsParamsWithContext(ctx context.Context) *PostLeadsParams {
return &PostLeadsParams{
inner: innerParams{
ctx: ctx,
},
Context: ctx,
}
}
@ -67,14 +67,15 @@ PostLeadsParams contains all the parameters to send to the API endpoint
*/
type PostLeadsParams struct {
// LeadRequest.
//
// An array of new Lead records
/* LeadRequest.
An array of new Lead records
*/
LeadRequest *crm_models.LeadRequest
timeout time.Duration
Context context.Context
HTTPClient *http.Client
inner innerParams
}
// WithDefaults hydrates default values in the post leads params (not the query body).
@ -92,57 +93,54 @@ func (o *PostLeadsParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the post leads params.
// WithTimeout adds the timeout to the post leads params
func (o *PostLeadsParams) WithTimeout(timeout time.Duration) *PostLeadsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the post leads params.
// SetTimeout adds the timeout to the post leads params
func (o *PostLeadsParams) SetTimeout(timeout time.Duration) {
o.inner.timeout = timeout
o.timeout = timeout
}
// WithContext adds the context to the post leads params.
//
// Deprecated: use the operation call with context to pass the context instead of [PostLeadsParams].
// WithContext adds the context to the post leads params
func (o *PostLeadsParams) WithContext(ctx context.Context) *PostLeadsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the post leads params.
//
// Deprecated: use the operation call with context to pass the context instead of [PostLeadsParams].
// SetContext adds the context to the post leads params
func (o *PostLeadsParams) SetContext(ctx context.Context) {
o.inner.ctx = ctx
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the post leads params.
// WithHTTPClient adds the HTTPClient to the post leads params
func (o *PostLeadsParams) WithHTTPClient(client *http.Client) *PostLeadsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the post leads params.
// SetHTTPClient adds the HTTPClient to the post leads params
func (o *PostLeadsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithLeadRequest adds the leadRequest to the post leads params.
// WithLeadRequest adds the leadRequest to the post leads params
func (o *PostLeadsParams) WithLeadRequest(leadRequest *crm_models.LeadRequest) *PostLeadsParams {
o.SetLeadRequest(leadRequest)
return o
}
// SetLeadRequest adds the leadRequest to the post leads params.
// SetLeadRequest adds the leadRequest to the post leads params
func (o *PostLeadsParams) SetLeadRequest(leadRequest *crm_models.LeadRequest) {
o.LeadRequest = leadRequest
}
// WriteToRequest writes these params to a [runtime.ClientRequest].
// WriteToRequest writes these params to a swagger request
func (o *PostLeadsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.inner.timeout); err != nil {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error

View File

@ -6,15 +6,17 @@
package leads
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
stderrors "errors"
"fmt"
"io"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
)
// PostLeadsReader is a Reader for the PostLeads structure.
@ -23,7 +25,7 @@ type PostLeadsReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *PostLeadsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
func (o *PostLeadsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewPostLeadsOK()
@ -62,7 +64,7 @@ func (o *PostLeadsReader) ReadResponse(response runtime.ClientResponse, consumer
}
return nil, result
default:
return nil, runtime.NewAPIError("[POST /leads] postLeads", response, response.Code())
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
@ -71,9 +73,11 @@ func NewPostLeadsOK() *PostLeadsOK {
return &PostLeadsOK{}
}
// PostLeadsOK describes a response with status code 200, with default header values.
//
// Response with an array of Lead objects
/*
PostLeadsOK describes a response with status code 200, with default header values.
Response with an array of Lead objects
*/
type PostLeadsOK struct {
AccessControlAllowOrigin string
CacheControl string
@ -112,13 +116,11 @@ func (o *PostLeadsOK) Code() int {
}
func (o *PostLeadsOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /leads][%d] postLeadsOK %s", 200, payload)
return fmt.Sprintf("[POST /leads][%d] postLeadsOK %+v", 200, o.Payload)
}
func (o *PostLeadsOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /leads][%d] postLeadsOK %s", 200, payload)
return fmt.Sprintf("[POST /leads][%d] postLeadsOK %+v", 200, o.Payload)
}
func (o *PostLeadsOK) GetPayload() *crm_models.LeadResponse {
@ -144,7 +146,7 @@ func (o *PostLeadsOK) readResponse(response runtime.ClientResponse, consumer run
o.Payload = new(crm_models.LeadResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -156,9 +158,11 @@ func NewPostLeadsUnauthorized() *PostLeadsUnauthorized {
return &PostLeadsUnauthorized{}
}
// PostLeadsUnauthorized describes a response with status code 401, with default header values.
//
// Access unauthorized, invalid API-KEY was used
/*
PostLeadsUnauthorized describes a response with status code 401, with default header values.
Access unauthorized, invalid API-KEY was used
*/
type PostLeadsUnauthorized struct {
AccessControlAllowOrigin string
@ -196,13 +200,11 @@ func (o *PostLeadsUnauthorized) Code() int {
}
func (o *PostLeadsUnauthorized) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /leads][%d] postLeadsUnauthorized %s", 401, payload)
return fmt.Sprintf("[POST /leads][%d] postLeadsUnauthorized %+v", 401, o.Payload)
}
func (o *PostLeadsUnauthorized) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /leads][%d] postLeadsUnauthorized %s", 401, payload)
return fmt.Sprintf("[POST /leads][%d] postLeadsUnauthorized %+v", 401, o.Payload)
}
func (o *PostLeadsUnauthorized) GetPayload() *crm_models.Error {
@ -221,7 +223,7 @@ func (o *PostLeadsUnauthorized) readResponse(response runtime.ClientResponse, co
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -233,9 +235,11 @@ func NewPostLeadsForbidden() *PostLeadsForbidden {
return &PostLeadsForbidden{}
}
// PostLeadsForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
/*
PostLeadsForbidden describes a response with status code 403, with default header values.
Access forbidden, account lacks access
*/
type PostLeadsForbidden struct {
AccessControlAllowOrigin string
@ -273,13 +277,11 @@ func (o *PostLeadsForbidden) Code() int {
}
func (o *PostLeadsForbidden) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /leads][%d] postLeadsForbidden %s", 403, payload)
return fmt.Sprintf("[POST /leads][%d] postLeadsForbidden %+v", 403, o.Payload)
}
func (o *PostLeadsForbidden) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /leads][%d] postLeadsForbidden %s", 403, payload)
return fmt.Sprintf("[POST /leads][%d] postLeadsForbidden %+v", 403, o.Payload)
}
func (o *PostLeadsForbidden) GetPayload() *crm_models.Error {
@ -298,7 +300,7 @@ func (o *PostLeadsForbidden) readResponse(response runtime.ClientResponse, consu
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -310,9 +312,11 @@ func NewPostLeadsNotFound() *PostLeadsNotFound {
return &PostLeadsNotFound{}
}
// PostLeadsNotFound describes a response with status code 404, with default header values.
//
// Resource was not found
/*
PostLeadsNotFound describes a response with status code 404, with default header values.
Resource was not found
*/
type PostLeadsNotFound struct {
AccessControlAllowOrigin string
@ -350,13 +354,11 @@ func (o *PostLeadsNotFound) Code() int {
}
func (o *PostLeadsNotFound) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /leads][%d] postLeadsNotFound %s", 404, payload)
return fmt.Sprintf("[POST /leads][%d] postLeadsNotFound %+v", 404, o.Payload)
}
func (o *PostLeadsNotFound) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /leads][%d] postLeadsNotFound %s", 404, payload)
return fmt.Sprintf("[POST /leads][%d] postLeadsNotFound %+v", 404, o.Payload)
}
func (o *PostLeadsNotFound) GetPayload() *crm_models.Error {
@ -375,7 +377,7 @@ func (o *PostLeadsNotFound) readResponse(response runtime.ClientResponse, consum
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -387,9 +389,11 @@ func NewPostLeadsUnprocessableEntity() *PostLeadsUnprocessableEntity {
return &PostLeadsUnprocessableEntity{}
}
// PostLeadsUnprocessableEntity describes a response with status code 422, with default header values.
//
// Unprocessable Entity, likely a bad parameter
/*
PostLeadsUnprocessableEntity describes a response with status code 422, with default header values.
Unprocessable Entity, likely a bad parameter
*/
type PostLeadsUnprocessableEntity struct {
AccessControlAllowOrigin string
@ -427,13 +431,11 @@ func (o *PostLeadsUnprocessableEntity) Code() int {
}
func (o *PostLeadsUnprocessableEntity) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /leads][%d] postLeadsUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[POST /leads][%d] postLeadsUnprocessableEntity %+v", 422, o.Payload)
}
func (o *PostLeadsUnprocessableEntity) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /leads][%d] postLeadsUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[POST /leads][%d] postLeadsUnprocessableEntity %+v", 422, o.Payload)
}
func (o *PostLeadsUnprocessableEntity) GetPayload() *crm_models.Error {
@ -452,7 +454,7 @@ func (o *PostLeadsUnprocessableEntity) readResponse(response runtime.ClientRespo
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -464,9 +466,11 @@ func NewPostLeadsInternalServerError() *PostLeadsInternalServerError {
return &PostLeadsInternalServerError{}
}
// PostLeadsInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
/*
PostLeadsInternalServerError describes a response with status code 500, with default header values.
Server Internal Error
*/
type PostLeadsInternalServerError struct {
AccessControlAllowOrigin string
@ -504,13 +508,11 @@ func (o *PostLeadsInternalServerError) Code() int {
}
func (o *PostLeadsInternalServerError) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /leads][%d] postLeadsInternalServerError %s", 500, payload)
return fmt.Sprintf("[POST /leads][%d] postLeadsInternalServerError %+v", 500, o.Payload)
}
func (o *PostLeadsInternalServerError) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /leads][%d] postLeadsInternalServerError %s", 500, payload)
return fmt.Sprintf("[POST /leads][%d] postLeadsInternalServerError %+v", 500, o.Payload)
}
func (o *PostLeadsInternalServerError) GetPayload() *crm_models.Error {
@ -529,7 +531,7 @@ func (o *PostLeadsInternalServerError) readResponse(response runtime.ClientRespo
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}

View File

@ -6,16 +6,20 @@
package leads
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
)
// NewPutLeadsParams creates a new PutLeadsParams object,
@ -25,28 +29,24 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewPutLeadsParams() *PutLeadsParams {
return NewPutLeadsParamsWithTimeout(cr.DefaultTimeout)
return &PutLeadsParams{
timeout: cr.DefaultTimeout,
}
}
// NewPutLeadsParamsWithTimeout creates a new PutLeadsParams object
// with the ability to set a timeout on a request.
func NewPutLeadsParamsWithTimeout(timeout time.Duration) *PutLeadsParams {
return &PutLeadsParams{
inner: innerParams{
timeout: timeout,
},
}
}
// NewPutLeadsParamsWithContext creates a new PutLeadsParams object
// with the ability to set a context for a request.
//
// Deprecated: use the operation call with context to pass the context instead of [PutLeadsParams].
func NewPutLeadsParamsWithContext(ctx context.Context) *PutLeadsParams {
return &PutLeadsParams{
inner: innerParams{
ctx: ctx,
},
Context: ctx,
}
}
@ -67,14 +67,15 @@ PutLeadsParams contains all the parameters to send to the API endpoint
*/
type PutLeadsParams struct {
// LeadRequest.
//
// An array of new Lead records
/* LeadRequest.
An array of new Lead records
*/
LeadRequest *crm_models.LeadRequest
timeout time.Duration
Context context.Context
HTTPClient *http.Client
inner innerParams
}
// WithDefaults hydrates default values in the put leads params (not the query body).
@ -92,57 +93,54 @@ func (o *PutLeadsParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the put leads params.
// WithTimeout adds the timeout to the put leads params
func (o *PutLeadsParams) WithTimeout(timeout time.Duration) *PutLeadsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the put leads params.
// SetTimeout adds the timeout to the put leads params
func (o *PutLeadsParams) SetTimeout(timeout time.Duration) {
o.inner.timeout = timeout
o.timeout = timeout
}
// WithContext adds the context to the put leads params.
//
// Deprecated: use the operation call with context to pass the context instead of [PutLeadsParams].
// WithContext adds the context to the put leads params
func (o *PutLeadsParams) WithContext(ctx context.Context) *PutLeadsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the put leads params.
//
// Deprecated: use the operation call with context to pass the context instead of [PutLeadsParams].
// SetContext adds the context to the put leads params
func (o *PutLeadsParams) SetContext(ctx context.Context) {
o.inner.ctx = ctx
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the put leads params.
// WithHTTPClient adds the HTTPClient to the put leads params
func (o *PutLeadsParams) WithHTTPClient(client *http.Client) *PutLeadsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the put leads params.
// SetHTTPClient adds the HTTPClient to the put leads params
func (o *PutLeadsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithLeadRequest adds the leadRequest to the put leads params.
// WithLeadRequest adds the leadRequest to the put leads params
func (o *PutLeadsParams) WithLeadRequest(leadRequest *crm_models.LeadRequest) *PutLeadsParams {
o.SetLeadRequest(leadRequest)
return o
}
// SetLeadRequest adds the leadRequest to the put leads params.
// SetLeadRequest adds the leadRequest to the put leads params
func (o *PutLeadsParams) SetLeadRequest(leadRequest *crm_models.LeadRequest) {
o.LeadRequest = leadRequest
}
// WriteToRequest writes these params to a [runtime.ClientRequest].
// WriteToRequest writes these params to a swagger request
func (o *PutLeadsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.inner.timeout); err != nil {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error

View File

@ -6,15 +6,17 @@
package leads
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
stderrors "errors"
"fmt"
"io"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
)
// PutLeadsReader is a Reader for the PutLeads structure.
@ -23,7 +25,7 @@ type PutLeadsReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *PutLeadsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
func (o *PutLeadsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewPutLeadsOK()
@ -62,7 +64,7 @@ func (o *PutLeadsReader) ReadResponse(response runtime.ClientResponse, consumer
}
return nil, result
default:
return nil, runtime.NewAPIError("[PUT /leads] putLeads", response, response.Code())
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
@ -71,9 +73,11 @@ func NewPutLeadsOK() *PutLeadsOK {
return &PutLeadsOK{}
}
// PutLeadsOK describes a response with status code 200, with default header values.
//
// Response with an array of Lead objects
/*
PutLeadsOK describes a response with status code 200, with default header values.
Response with an array of Lead objects
*/
type PutLeadsOK struct {
AccessControlAllowOrigin string
CacheControl string
@ -112,13 +116,11 @@ func (o *PutLeadsOK) Code() int {
}
func (o *PutLeadsOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /leads][%d] putLeadsOK %s", 200, payload)
return fmt.Sprintf("[PUT /leads][%d] putLeadsOK %+v", 200, o.Payload)
}
func (o *PutLeadsOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /leads][%d] putLeadsOK %s", 200, payload)
return fmt.Sprintf("[PUT /leads][%d] putLeadsOK %+v", 200, o.Payload)
}
func (o *PutLeadsOK) GetPayload() *crm_models.LeadResponse {
@ -144,7 +146,7 @@ func (o *PutLeadsOK) readResponse(response runtime.ClientResponse, consumer runt
o.Payload = new(crm_models.LeadResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -156,9 +158,11 @@ func NewPutLeadsUnauthorized() *PutLeadsUnauthorized {
return &PutLeadsUnauthorized{}
}
// PutLeadsUnauthorized describes a response with status code 401, with default header values.
//
// Access unauthorized, invalid API-KEY was used
/*
PutLeadsUnauthorized describes a response with status code 401, with default header values.
Access unauthorized, invalid API-KEY was used
*/
type PutLeadsUnauthorized struct {
AccessControlAllowOrigin string
@ -196,13 +200,11 @@ func (o *PutLeadsUnauthorized) Code() int {
}
func (o *PutLeadsUnauthorized) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /leads][%d] putLeadsUnauthorized %s", 401, payload)
return fmt.Sprintf("[PUT /leads][%d] putLeadsUnauthorized %+v", 401, o.Payload)
}
func (o *PutLeadsUnauthorized) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /leads][%d] putLeadsUnauthorized %s", 401, payload)
return fmt.Sprintf("[PUT /leads][%d] putLeadsUnauthorized %+v", 401, o.Payload)
}
func (o *PutLeadsUnauthorized) GetPayload() *crm_models.Error {
@ -221,7 +223,7 @@ func (o *PutLeadsUnauthorized) readResponse(response runtime.ClientResponse, con
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -233,9 +235,11 @@ func NewPutLeadsForbidden() *PutLeadsForbidden {
return &PutLeadsForbidden{}
}
// PutLeadsForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
/*
PutLeadsForbidden describes a response with status code 403, with default header values.
Access forbidden, account lacks access
*/
type PutLeadsForbidden struct {
AccessControlAllowOrigin string
@ -273,13 +277,11 @@ func (o *PutLeadsForbidden) Code() int {
}
func (o *PutLeadsForbidden) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /leads][%d] putLeadsForbidden %s", 403, payload)
return fmt.Sprintf("[PUT /leads][%d] putLeadsForbidden %+v", 403, o.Payload)
}
func (o *PutLeadsForbidden) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /leads][%d] putLeadsForbidden %s", 403, payload)
return fmt.Sprintf("[PUT /leads][%d] putLeadsForbidden %+v", 403, o.Payload)
}
func (o *PutLeadsForbidden) GetPayload() *crm_models.Error {
@ -298,7 +300,7 @@ func (o *PutLeadsForbidden) readResponse(response runtime.ClientResponse, consum
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -310,9 +312,11 @@ func NewPutLeadsNotFound() *PutLeadsNotFound {
return &PutLeadsNotFound{}
}
// PutLeadsNotFound describes a response with status code 404, with default header values.
//
// Resource was not found
/*
PutLeadsNotFound describes a response with status code 404, with default header values.
Resource was not found
*/
type PutLeadsNotFound struct {
AccessControlAllowOrigin string
@ -350,13 +354,11 @@ func (o *PutLeadsNotFound) Code() int {
}
func (o *PutLeadsNotFound) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /leads][%d] putLeadsNotFound %s", 404, payload)
return fmt.Sprintf("[PUT /leads][%d] putLeadsNotFound %+v", 404, o.Payload)
}
func (o *PutLeadsNotFound) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /leads][%d] putLeadsNotFound %s", 404, payload)
return fmt.Sprintf("[PUT /leads][%d] putLeadsNotFound %+v", 404, o.Payload)
}
func (o *PutLeadsNotFound) GetPayload() *crm_models.Error {
@ -375,7 +377,7 @@ func (o *PutLeadsNotFound) readResponse(response runtime.ClientResponse, consume
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -387,9 +389,11 @@ func NewPutLeadsUnprocessableEntity() *PutLeadsUnprocessableEntity {
return &PutLeadsUnprocessableEntity{}
}
// PutLeadsUnprocessableEntity describes a response with status code 422, with default header values.
//
// Unprocessable Entity, likely a bad parameter
/*
PutLeadsUnprocessableEntity describes a response with status code 422, with default header values.
Unprocessable Entity, likely a bad parameter
*/
type PutLeadsUnprocessableEntity struct {
AccessControlAllowOrigin string
@ -427,13 +431,11 @@ func (o *PutLeadsUnprocessableEntity) Code() int {
}
func (o *PutLeadsUnprocessableEntity) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /leads][%d] putLeadsUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[PUT /leads][%d] putLeadsUnprocessableEntity %+v", 422, o.Payload)
}
func (o *PutLeadsUnprocessableEntity) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /leads][%d] putLeadsUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[PUT /leads][%d] putLeadsUnprocessableEntity %+v", 422, o.Payload)
}
func (o *PutLeadsUnprocessableEntity) GetPayload() *crm_models.Error {
@ -452,7 +454,7 @@ func (o *PutLeadsUnprocessableEntity) readResponse(response runtime.ClientRespon
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -464,9 +466,11 @@ func NewPutLeadsInternalServerError() *PutLeadsInternalServerError {
return &PutLeadsInternalServerError{}
}
// PutLeadsInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
/*
PutLeadsInternalServerError describes a response with status code 500, with default header values.
Server Internal Error
*/
type PutLeadsInternalServerError struct {
AccessControlAllowOrigin string
@ -504,13 +508,11 @@ func (o *PutLeadsInternalServerError) Code() int {
}
func (o *PutLeadsInternalServerError) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /leads][%d] putLeadsInternalServerError %s", 500, payload)
return fmt.Sprintf("[PUT /leads][%d] putLeadsInternalServerError %+v", 500, o.Payload)
}
func (o *PutLeadsInternalServerError) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /leads][%d] putLeadsInternalServerError %s", 500, payload)
return fmt.Sprintf("[PUT /leads][%d] putLeadsInternalServerError %+v", 500, o.Payload)
}
func (o *PutLeadsInternalServerError) GetPayload() *crm_models.Error {
@ -529,7 +531,7 @@ func (o *PutLeadsInternalServerError) readResponse(response runtime.ClientRespon
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}

View File

@ -6,14 +6,15 @@
package crm_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
stderrors "errors"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag/typeutils"
"github.com/go-openapi/swag"
)
// Account account
@ -42,9 +43,6 @@ type Account struct {
// Contact ID
BillingContactID *string `json:"BillingContactID,omitempty"`
// Channels
Channels *string `json:"Channels,omitempty"`
// Closed Date
ClosedDate *string `json:"ClosedDate,omitempty"`
@ -78,9 +76,6 @@ type Account struct {
// Main Account Email
Email *string `json:"Email,omitempty"`
// Enrichment Status
EnrichmentStatus *string `json:"EnrichmentStatus,omitempty"`
// The amount of equity EquityFunding
EquityFunding *float64 `json:"EquityFunding,omitempty"`
@ -93,9 +88,6 @@ type Account struct {
// Date company founded
FoundedDate *string `json:"FoundedDate,omitempty"`
// Full Description
FullDescription *string `json:"FullDescription,omitempty"`
// Account Id
ID string `json:"ID,omitempty"`
@ -114,12 +106,6 @@ type Account struct {
// Industry
Industry *string `json:"Industry,omitempty"`
// Last Enriched By User ID
LastEnrichedByID *string `json:"LastEnrichedByID,omitempty"`
// Last Enrichment Date
LastEnrichmentDate *string `json:"LastEnrichmentDate,omitempty"`
// Last Modified By User ID
LastModifiedByID *string `json:"LastModifiedByID,omitempty"`
@ -224,21 +210,17 @@ func (m *Account) Validate(formats strfmt.Registry) error {
}
func (m *Account) validateBillingAddress(formats strfmt.Registry) error {
if typeutils.IsZero(m.BillingAddress) { // not required
if swag.IsZero(m.BillingAddress) { // not required
return nil
}
if m.BillingAddress != nil {
if err := m.BillingAddress.Validate(formats); err != nil {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("BillingAddress")
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("BillingAddress")
}
return err
}
}
@ -247,21 +229,17 @@ func (m *Account) validateBillingAddress(formats strfmt.Registry) error {
}
func (m *Account) validateShippingAddress(formats strfmt.Registry) error {
if typeutils.IsZero(m.ShippingAddress) { // not required
if swag.IsZero(m.ShippingAddress) { // not required
return nil
}
if m.ShippingAddress != nil {
if err := m.ShippingAddress.Validate(formats); err != nil {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("ShippingAddress")
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("ShippingAddress")
}
return err
}
}
@ -290,21 +268,12 @@ func (m *Account) ContextValidate(ctx context.Context, formats strfmt.Registry)
func (m *Account) contextValidateBillingAddress(ctx context.Context, formats strfmt.Registry) error {
if m.BillingAddress != nil {
if typeutils.IsZero(m.BillingAddress) { // not required
return nil
}
if err := m.BillingAddress.ContextValidate(ctx, formats); err != nil {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("BillingAddress")
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("BillingAddress")
}
return err
}
}
@ -315,21 +284,12 @@ func (m *Account) contextValidateBillingAddress(ctx context.Context, formats str
func (m *Account) contextValidateShippingAddress(ctx context.Context, formats strfmt.Registry) error {
if m.ShippingAddress != nil {
if typeutils.IsZero(m.ShippingAddress) { // not required
return nil
}
if err := m.ShippingAddress.ContextValidate(ctx, formats); err != nil {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("ShippingAddress")
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("ShippingAddress")
}
return err
}
}
@ -342,13 +302,13 @@ func (m *Account) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return jsonutils.WriteJSON(m)
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Account) UnmarshalBinary(b []byte) error {
var res Account
if err := jsonutils.ReadJSON(b, &res); err != nil {
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,15 +6,16 @@
package crm_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
stderrors "errors"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag/typeutils"
"github.com/go-openapi/swag"
)
// AccountRequest An array of Account objects with Contacts
@ -41,26 +42,22 @@ func (m *AccountRequest) Validate(formats strfmt.Registry) error {
}
func (m *AccountRequest) validateData(formats strfmt.Registry) error {
if typeutils.IsZero(m.Data) { // not required
if swag.IsZero(m.Data) { // not required
return nil
}
for i := 0; i < len(m.Data); i++ {
if typeutils.IsZero(m.Data[i]) { // not required
if swag.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) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -89,21 +86,12 @@ func (m *AccountRequest) contextValidateData(ctx context.Context, formats strfmt
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) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -118,13 +106,13 @@ func (m *AccountRequest) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return jsonutils.WriteJSON(m)
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *AccountRequest) UnmarshalBinary(b []byte) error {
var res AccountRequest
if err := jsonutils.ReadJSON(b, &res); err != nil {
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,15 +6,16 @@
package crm_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
stderrors "errors"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag/typeutils"
"github.com/go-openapi/swag"
)
// AccountResponse An array of Account objects with Contacts
@ -48,26 +49,22 @@ func (m *AccountResponse) Validate(formats strfmt.Registry) error {
}
func (m *AccountResponse) validateData(formats strfmt.Registry) error {
if typeutils.IsZero(m.Data) { // not required
if swag.IsZero(m.Data) { // not required
return nil
}
for i := 0; i < len(m.Data); i++ {
if typeutils.IsZero(m.Data[i]) { // not required
if swag.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) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -78,21 +75,17 @@ func (m *AccountResponse) validateData(formats strfmt.Registry) error {
}
func (m *AccountResponse) validateMeta(formats strfmt.Registry) error {
if typeutils.IsZero(m.Meta) { // not required
if swag.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) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Meta")
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Meta")
}
return err
}
}
@ -123,21 +116,12 @@ func (m *AccountResponse) contextValidateData(ctx context.Context, formats strfm
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) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -150,21 +134,12 @@ func (m *AccountResponse) contextValidateData(ctx context.Context, formats strfm
func (m *AccountResponse) 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) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Meta")
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Meta")
}
return err
}
}
@ -177,13 +152,13 @@ func (m *AccountResponse) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return jsonutils.WriteJSON(m)
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *AccountResponse) UnmarshalBinary(b []byte) error {
var res AccountResponse
if err := jsonutils.ReadJSON(b, &res); err != nil {
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,11 +6,14 @@
package crm_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag"
)
// Address address
@ -55,13 +58,13 @@ func (m *Address) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return jsonutils.WriteJSON(m)
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Address) UnmarshalBinary(b []byte) error {
var res Address
if err := jsonutils.ReadJSON(b, &res); err != nil {
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,14 +6,15 @@
package crm_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
stderrors "errors"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag/typeutils"
"github.com/go-openapi/swag"
)
// Asset asset
@ -57,9 +58,6 @@ type Asset struct {
// Current Lifecycle End Date
CurrentLifecycleEndDate *string `json:"CurrentLifecycleEndDate,omitempty"`
// Current Lifecycle Start Date
CurrentLifecycleStartDate *string `json:"CurrentLifecycleStartDate,omitempty"`
// Current Monthly Recurring Revenue
CurrentMrr *float64 `json:"CurrentMrr,omitempty"`
@ -138,7 +136,7 @@ type Asset struct {
// Serial Number
SerialNumber *string `json:"SerialNumber,omitempty"`
// Compatibility-only legacy field. The authoritative CRM Asset table does not persist Status; native CRM mutations reject non-null values.
// Status
Status *string `json:"Status,omitempty"`
// Status Reason
@ -178,21 +176,17 @@ func (m *Asset) Validate(formats strfmt.Registry) error {
}
func (m *Asset) validateAddress(formats strfmt.Registry) error {
if typeutils.IsZero(m.Address) { // not required
if swag.IsZero(m.Address) { // not required
return nil
}
if m.Address != nil {
if err := m.Address.Validate(formats); err != nil {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Address")
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Address")
}
return err
}
}
@ -217,21 +211,12 @@ func (m *Asset) ContextValidate(ctx context.Context, formats strfmt.Registry) er
func (m *Asset) contextValidateAddress(ctx context.Context, formats strfmt.Registry) error {
if m.Address != nil {
if typeutils.IsZero(m.Address) { // not required
return nil
}
if err := m.Address.ContextValidate(ctx, formats); err != nil {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Address")
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Address")
}
return err
}
}
@ -244,13 +229,13 @@ func (m *Asset) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return jsonutils.WriteJSON(m)
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Asset) UnmarshalBinary(b []byte) error {
var res Asset
if err := jsonutils.ReadJSON(b, &res); err != nil {
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -1,18 +0,0 @@
package crm_models
import (
"encoding/json"
"testing"
)
func TestAssetLifecycleStartDateIsInGeneratedJSONContract(t *testing.T) {
start := "2026-07-24T03:00:00Z"
body, err := json.Marshal(&Asset{CurrentLifecycleStartDate: &start})
if err != nil {
t.Fatal(err)
}
const want = `{"CurrentLifecycleStartDate":"2026-07-24T03:00:00Z"}`
if string(body) != want {
t.Fatalf("got %s, want %s", body, want)
}
}

View File

@ -6,15 +6,16 @@
package crm_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
stderrors "errors"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag/typeutils"
"github.com/go-openapi/swag"
)
// AssetRequest An array of Asset objects with Contacts
@ -41,26 +42,22 @@ func (m *AssetRequest) Validate(formats strfmt.Registry) error {
}
func (m *AssetRequest) validateData(formats strfmt.Registry) error {
if typeutils.IsZero(m.Data) { // not required
if swag.IsZero(m.Data) { // not required
return nil
}
for i := 0; i < len(m.Data); i++ {
if typeutils.IsZero(m.Data[i]) { // not required
if swag.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) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -89,21 +86,12 @@ func (m *AssetRequest) contextValidateData(ctx context.Context, formats strfmt.R
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) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -118,13 +106,13 @@ func (m *AssetRequest) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return jsonutils.WriteJSON(m)
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *AssetRequest) UnmarshalBinary(b []byte) error {
var res AssetRequest
if err := jsonutils.ReadJSON(b, &res); err != nil {
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,15 +6,16 @@
package crm_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
stderrors "errors"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag/typeutils"
"github.com/go-openapi/swag"
)
// AssetResponse An array of Asset objects with Contacts
@ -48,26 +49,22 @@ func (m *AssetResponse) Validate(formats strfmt.Registry) error {
}
func (m *AssetResponse) validateData(formats strfmt.Registry) error {
if typeutils.IsZero(m.Data) { // not required
if swag.IsZero(m.Data) { // not required
return nil
}
for i := 0; i < len(m.Data); i++ {
if typeutils.IsZero(m.Data[i]) { // not required
if swag.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) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -78,21 +75,17 @@ func (m *AssetResponse) validateData(formats strfmt.Registry) error {
}
func (m *AssetResponse) validateMeta(formats strfmt.Registry) error {
if typeutils.IsZero(m.Meta) { // not required
if swag.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) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Meta")
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Meta")
}
return err
}
}
@ -123,21 +116,12 @@ func (m *AssetResponse) contextValidateData(ctx context.Context, formats strfmt.
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) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -150,21 +134,12 @@ func (m *AssetResponse) contextValidateData(ctx context.Context, formats strfmt.
func (m *AssetResponse) 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) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Meta")
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Meta")
}
return err
}
}
@ -177,13 +152,13 @@ func (m *AssetResponse) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return jsonutils.WriteJSON(m)
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *AssetResponse) UnmarshalBinary(b []byte) error {
var res AssetResponse
if err := jsonutils.ReadJSON(b, &res); err != nil {
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,14 +6,15 @@
package crm_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
stderrors "errors"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag/typeutils"
"github.com/go-openapi/swag"
)
// Contact contact
@ -33,9 +34,6 @@ type Contact struct {
// Birthdate
BirthDate *string `json:"BirthDate,omitempty"`
// Channels
Channels *string `json:"Channels,omitempty"`
// Created By User ID
CreatedByID *string `json:"CreatedByID,omitempty"`
@ -170,21 +168,17 @@ func (m *Contact) Validate(formats strfmt.Registry) error {
}
func (m *Contact) validateMailingAddress(formats strfmt.Registry) error {
if typeutils.IsZero(m.MailingAddress) { // not required
if swag.IsZero(m.MailingAddress) { // not required
return nil
}
if m.MailingAddress != nil {
if err := m.MailingAddress.Validate(formats); err != nil {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("MailingAddress")
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("MailingAddress")
}
return err
}
}
@ -193,21 +187,17 @@ func (m *Contact) validateMailingAddress(formats strfmt.Registry) error {
}
func (m *Contact) validateOtherAddress(formats strfmt.Registry) error {
if typeutils.IsZero(m.OtherAddress) { // not required
if swag.IsZero(m.OtherAddress) { // not required
return nil
}
if m.OtherAddress != nil {
if err := m.OtherAddress.Validate(formats); err != nil {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("OtherAddress")
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("OtherAddress")
}
return err
}
}
@ -236,21 +226,12 @@ func (m *Contact) ContextValidate(ctx context.Context, formats strfmt.Registry)
func (m *Contact) contextValidateMailingAddress(ctx context.Context, formats strfmt.Registry) error {
if m.MailingAddress != nil {
if typeutils.IsZero(m.MailingAddress) { // not required
return nil
}
if err := m.MailingAddress.ContextValidate(ctx, formats); err != nil {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("MailingAddress")
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("MailingAddress")
}
return err
}
}
@ -261,21 +242,12 @@ func (m *Contact) contextValidateMailingAddress(ctx context.Context, formats str
func (m *Contact) contextValidateOtherAddress(ctx context.Context, formats strfmt.Registry) error {
if m.OtherAddress != nil {
if typeutils.IsZero(m.OtherAddress) { // not required
return nil
}
if err := m.OtherAddress.ContextValidate(ctx, formats); err != nil {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("OtherAddress")
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("OtherAddress")
}
return err
}
}
@ -288,13 +260,13 @@ func (m *Contact) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return jsonutils.WriteJSON(m)
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Contact) UnmarshalBinary(b []byte) error {
var res Contact
if err := jsonutils.ReadJSON(b, &res); err != nil {
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,15 +6,16 @@
package crm_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
stderrors "errors"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag/typeutils"
"github.com/go-openapi/swag"
)
// ContactRequest contact request
@ -41,26 +42,22 @@ func (m *ContactRequest) Validate(formats strfmt.Registry) error {
}
func (m *ContactRequest) validateData(formats strfmt.Registry) error {
if typeutils.IsZero(m.Data) { // not required
if swag.IsZero(m.Data) { // not required
return nil
}
for i := 0; i < len(m.Data); i++ {
if typeutils.IsZero(m.Data[i]) { // not required
if swag.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) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -89,21 +86,12 @@ func (m *ContactRequest) contextValidateData(ctx context.Context, formats strfmt
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) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -118,13 +106,13 @@ func (m *ContactRequest) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return jsonutils.WriteJSON(m)
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *ContactRequest) UnmarshalBinary(b []byte) error {
var res ContactRequest
if err := jsonutils.ReadJSON(b, &res); err != nil {
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,15 +6,16 @@
package crm_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
stderrors "errors"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag/typeutils"
"github.com/go-openapi/swag"
)
// ContactResponse contact response
@ -48,26 +49,22 @@ func (m *ContactResponse) Validate(formats strfmt.Registry) error {
}
func (m *ContactResponse) validateData(formats strfmt.Registry) error {
if typeutils.IsZero(m.Data) { // not required
if swag.IsZero(m.Data) { // not required
return nil
}
for i := 0; i < len(m.Data); i++ {
if typeutils.IsZero(m.Data[i]) { // not required
if swag.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) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -78,21 +75,17 @@ func (m *ContactResponse) validateData(formats strfmt.Registry) error {
}
func (m *ContactResponse) validateMeta(formats strfmt.Registry) error {
if typeutils.IsZero(m.Meta) { // not required
if swag.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) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Meta")
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Meta")
}
return err
}
}
@ -123,21 +116,12 @@ func (m *ContactResponse) contextValidateData(ctx context.Context, formats strfm
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) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -150,21 +134,12 @@ func (m *ContactResponse) contextValidateData(ctx context.Context, formats strfm
func (m *ContactResponse) 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) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Meta")
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Meta")
}
return err
}
}
@ -177,13 +152,13 @@ func (m *ContactResponse) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return jsonutils.WriteJSON(m)
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *ContactResponse) UnmarshalBinary(b []byte) error {
var res ContactResponse
if err := jsonutils.ReadJSON(b, &res); err != nil {
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,14 +6,15 @@
package crm_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
stderrors "errors"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag/typeutils"
"github.com/go-openapi/swag"
)
// Contract contract
@ -134,21 +135,17 @@ func (m *Contract) Validate(formats strfmt.Registry) error {
}
func (m *Contract) validateBillingAddress(formats strfmt.Registry) error {
if typeutils.IsZero(m.BillingAddress) { // not required
if swag.IsZero(m.BillingAddress) { // not required
return nil
}
if m.BillingAddress != nil {
if err := m.BillingAddress.Validate(formats); err != nil {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("BillingAddress")
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("BillingAddress")
}
return err
}
}
@ -157,21 +154,17 @@ func (m *Contract) validateBillingAddress(formats strfmt.Registry) error {
}
func (m *Contract) validateShippingAddress(formats strfmt.Registry) error {
if typeutils.IsZero(m.ShippingAddress) { // not required
if swag.IsZero(m.ShippingAddress) { // not required
return nil
}
if m.ShippingAddress != nil {
if err := m.ShippingAddress.Validate(formats); err != nil {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("ShippingAddress")
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("ShippingAddress")
}
return err
}
}
@ -200,21 +193,12 @@ func (m *Contract) ContextValidate(ctx context.Context, formats strfmt.Registry)
func (m *Contract) contextValidateBillingAddress(ctx context.Context, formats strfmt.Registry) error {
if m.BillingAddress != nil {
if typeutils.IsZero(m.BillingAddress) { // not required
return nil
}
if err := m.BillingAddress.ContextValidate(ctx, formats); err != nil {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("BillingAddress")
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("BillingAddress")
}
return err
}
}
@ -225,21 +209,12 @@ func (m *Contract) contextValidateBillingAddress(ctx context.Context, formats st
func (m *Contract) contextValidateShippingAddress(ctx context.Context, formats strfmt.Registry) error {
if m.ShippingAddress != nil {
if typeutils.IsZero(m.ShippingAddress) { // not required
return nil
}
if err := m.ShippingAddress.ContextValidate(ctx, formats); err != nil {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("ShippingAddress")
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("ShippingAddress")
}
return err
}
}
@ -252,13 +227,13 @@ func (m *Contract) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return jsonutils.WriteJSON(m)
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Contract) UnmarshalBinary(b []byte) error {
var res Contract
if err := jsonutils.ReadJSON(b, &res); err != nil {
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,15 +6,16 @@
package crm_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
stderrors "errors"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag/typeutils"
"github.com/go-openapi/swag"
)
// ContractRequest contract request
@ -41,26 +42,22 @@ func (m *ContractRequest) Validate(formats strfmt.Registry) error {
}
func (m *ContractRequest) validateData(formats strfmt.Registry) error {
if typeutils.IsZero(m.Data) { // not required
if swag.IsZero(m.Data) { // not required
return nil
}
for i := 0; i < len(m.Data); i++ {
if typeutils.IsZero(m.Data[i]) { // not required
if swag.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) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -89,21 +86,12 @@ func (m *ContractRequest) contextValidateData(ctx context.Context, formats strfm
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) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -118,13 +106,13 @@ func (m *ContractRequest) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return jsonutils.WriteJSON(m)
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *ContractRequest) UnmarshalBinary(b []byte) error {
var res ContractRequest
if err := jsonutils.ReadJSON(b, &res); err != nil {
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,15 +6,16 @@
package crm_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
stderrors "errors"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag/typeutils"
"github.com/go-openapi/swag"
)
// ContractResponse contract response
@ -48,26 +49,22 @@ func (m *ContractResponse) Validate(formats strfmt.Registry) error {
}
func (m *ContractResponse) validateData(formats strfmt.Registry) error {
if typeutils.IsZero(m.Data) { // not required
if swag.IsZero(m.Data) { // not required
return nil
}
for i := 0; i < len(m.Data); i++ {
if typeutils.IsZero(m.Data[i]) { // not required
if swag.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) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -78,21 +75,17 @@ func (m *ContractResponse) validateData(formats strfmt.Registry) error {
}
func (m *ContractResponse) validateMeta(formats strfmt.Registry) error {
if typeutils.IsZero(m.Meta) { // not required
if swag.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) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Meta")
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Meta")
}
return err
}
}
@ -123,21 +116,12 @@ func (m *ContractResponse) contextValidateData(ctx context.Context, formats strf
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) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -150,21 +134,12 @@ func (m *ContractResponse) contextValidateData(ctx context.Context, formats strf
func (m *ContractResponse) 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) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Meta")
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Meta")
}
return err
}
}
@ -177,13 +152,13 @@ func (m *ContractResponse) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return jsonutils.WriteJSON(m)
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *ContractResponse) UnmarshalBinary(b []byte) error {
var res ContractResponse
if err := jsonutils.ReadJSON(b, &res); err != nil {
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,15 +6,16 @@
package crm_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
stderrors "errors"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag/typeutils"
"github.com/go-openapi/swag"
)
// DeleteResponse delete response
@ -48,26 +49,22 @@ func (m *DeleteResponse) Validate(formats strfmt.Registry) error {
}
func (m *DeleteResponse) validateData(formats strfmt.Registry) error {
if typeutils.IsZero(m.Data) { // not required
if swag.IsZero(m.Data) { // not required
return nil
}
for i := 0; i < len(m.Data); i++ {
if typeutils.IsZero(m.Data[i]) { // not required
if swag.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) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -78,21 +75,17 @@ func (m *DeleteResponse) validateData(formats strfmt.Registry) error {
}
func (m *DeleteResponse) validateMeta(formats strfmt.Registry) error {
if typeutils.IsZero(m.Meta) { // not required
if swag.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) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Meta")
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Meta")
}
return err
}
}
@ -123,21 +116,12 @@ func (m *DeleteResponse) contextValidateData(ctx context.Context, formats strfmt
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) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -150,21 +134,12 @@ func (m *DeleteResponse) contextValidateData(ctx context.Context, formats strfmt
func (m *DeleteResponse) 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) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Meta")
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Meta")
}
return err
}
}
@ -177,13 +152,13 @@ func (m *DeleteResponse) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return jsonutils.WriteJSON(m)
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *DeleteResponse) UnmarshalBinary(b []byte) error {
var res DeleteResponse
if err := jsonutils.ReadJSON(b, &res); err != nil {
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,11 +6,14 @@
package crm_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag"
)
// Error error
@ -43,13 +46,13 @@ func (m *Error) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return jsonutils.WriteJSON(m)
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Error) UnmarshalBinary(b []byte) error {
var res Error
if err := jsonutils.ReadJSON(b, &res); err != nil {
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,12 +6,15 @@
package crm_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag"
)
// InvalidError invalid error
@ -28,7 +31,7 @@ type InvalidError struct {
func (m *InvalidError) UnmarshalJSON(raw []byte) error {
// AO0
var aO0 Error
if err := jsonutils.ReadJSON(raw, &aO0); err != nil {
if err := swag.ReadJSON(raw, &aO0); err != nil {
return err
}
m.Error = aO0
@ -37,7 +40,7 @@ func (m *InvalidError) UnmarshalJSON(raw []byte) error {
var dataAO1 struct {
Details []string `json:"details"`
}
if err := jsonutils.ReadJSON(raw, &dataAO1); err != nil {
if err := swag.ReadJSON(raw, &dataAO1); err != nil {
return err
}
@ -50,7 +53,7 @@ func (m *InvalidError) UnmarshalJSON(raw []byte) error {
func (m InvalidError) MarshalJSON() ([]byte, error) {
_parts := make([][]byte, 0, 2)
aO0, err := jsonutils.WriteJSON(m.Error)
aO0, err := swag.WriteJSON(m.Error)
if err != nil {
return nil, err
}
@ -61,12 +64,12 @@ func (m InvalidError) MarshalJSON() ([]byte, error) {
dataAO1.Details = m.Details
jsonDataAO1, errAO1 := jsonutils.WriteJSON(dataAO1)
jsonDataAO1, errAO1 := swag.WriteJSON(dataAO1)
if errAO1 != nil {
return nil, errAO1
}
_parts = append(_parts, jsonDataAO1)
return jsonutils.ConcatJSON(_parts...), nil
return swag.ConcatJSON(_parts...), nil
}
// Validate validates this invalid error
@ -104,13 +107,13 @@ func (m *InvalidError) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return jsonutils.WriteJSON(m)
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *InvalidError) UnmarshalBinary(b []byte) error {
var res InvalidError
if err := jsonutils.ReadJSON(b, &res); err != nil {
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,14 +6,15 @@
package crm_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
stderrors "errors"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag/typeutils"
"github.com/go-openapi/swag"
)
// Lead lead
@ -121,21 +122,17 @@ func (m *Lead) Validate(formats strfmt.Registry) error {
}
func (m *Lead) validateAddress(formats strfmt.Registry) error {
if typeutils.IsZero(m.Address) { // not required
if swag.IsZero(m.Address) { // not required
return nil
}
if m.Address != nil {
if err := m.Address.Validate(formats); err != nil {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Address")
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Address")
}
return err
}
}
@ -160,21 +157,12 @@ func (m *Lead) ContextValidate(ctx context.Context, formats strfmt.Registry) err
func (m *Lead) contextValidateAddress(ctx context.Context, formats strfmt.Registry) error {
if m.Address != nil {
if typeutils.IsZero(m.Address) { // not required
return nil
}
if err := m.Address.ContextValidate(ctx, formats); err != nil {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Address")
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Address")
}
return err
}
}
@ -187,13 +175,13 @@ func (m *Lead) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return jsonutils.WriteJSON(m)
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Lead) UnmarshalBinary(b []byte) error {
var res Lead
if err := jsonutils.ReadJSON(b, &res); err != nil {
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,15 +6,16 @@
package crm_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
stderrors "errors"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag/typeutils"
"github.com/go-openapi/swag"
)
// LeadRequest lead request
@ -41,26 +42,22 @@ func (m *LeadRequest) Validate(formats strfmt.Registry) error {
}
func (m *LeadRequest) validateData(formats strfmt.Registry) error {
if typeutils.IsZero(m.Data) { // not required
if swag.IsZero(m.Data) { // not required
return nil
}
for i := 0; i < len(m.Data); i++ {
if typeutils.IsZero(m.Data[i]) { // not required
if swag.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) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -89,21 +86,12 @@ func (m *LeadRequest) contextValidateData(ctx context.Context, formats strfmt.Re
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) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -118,13 +106,13 @@ func (m *LeadRequest) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return jsonutils.WriteJSON(m)
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *LeadRequest) UnmarshalBinary(b []byte) error {
var res LeadRequest
if err := jsonutils.ReadJSON(b, &res); err != nil {
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,15 +6,16 @@
package crm_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
stderrors "errors"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag/typeutils"
"github.com/go-openapi/swag"
)
// LeadResponse lead response
@ -48,26 +49,22 @@ func (m *LeadResponse) Validate(formats strfmt.Registry) error {
}
func (m *LeadResponse) validateData(formats strfmt.Registry) error {
if typeutils.IsZero(m.Data) { // not required
if swag.IsZero(m.Data) { // not required
return nil
}
for i := 0; i < len(m.Data); i++ {
if typeutils.IsZero(m.Data[i]) { // not required
if swag.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) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -78,21 +75,17 @@ func (m *LeadResponse) validateData(formats strfmt.Registry) error {
}
func (m *LeadResponse) validateMeta(formats strfmt.Registry) error {
if typeutils.IsZero(m.Meta) { // not required
if swag.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) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Meta")
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Meta")
}
return err
}
}
@ -123,21 +116,12 @@ func (m *LeadResponse) contextValidateData(ctx context.Context, formats strfmt.R
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) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -150,21 +134,12 @@ func (m *LeadResponse) contextValidateData(ctx context.Context, formats strfmt.R
func (m *LeadResponse) 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) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Meta")
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Meta")
}
return err
}
}
@ -177,13 +152,13 @@ func (m *LeadResponse) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return jsonutils.WriteJSON(m)
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *LeadResponse) UnmarshalBinary(b []byte) error {
var res LeadResponse
if err := jsonutils.ReadJSON(b, &res); err != nil {
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,11 +6,14 @@
package crm_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag"
)
// Message message
@ -43,13 +46,13 @@ func (m *Message) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return jsonutils.WriteJSON(m)
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Message) UnmarshalBinary(b []byte) error {
var res Message
if err := jsonutils.ReadJSON(b, &res); err != nil {
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,11 +6,14 @@
package crm_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag"
)
// Pagination pagination
@ -46,13 +49,13 @@ func (m *Pagination) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return jsonutils.WriteJSON(m)
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Pagination) UnmarshalBinary(b []byte) error {
var res Pagination
if err := jsonutils.ReadJSON(b, &res); err != nil {
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,12 +6,15 @@
package crm_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
@ -58,13 +61,13 @@ func (m *RequestMeta) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return jsonutils.WriteJSON(m)
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *RequestMeta) UnmarshalBinary(b []byte) error {
var res RequestMeta
if err := jsonutils.ReadJSON(b, &res); err != nil {
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,14 +6,15 @@
package crm_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
stderrors "errors"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag/typeutils"
"github.com/go-openapi/swag"
)
// ResponseMeta response meta
@ -73,21 +74,17 @@ func (m *ResponseMeta) Validate(formats strfmt.Registry) error {
}
func (m *ResponseMeta) validatePagination(formats strfmt.Registry) error {
if typeutils.IsZero(m.Pagination) { // not required
if swag.IsZero(m.Pagination) { // not required
return nil
}
if m.Pagination != nil {
if err := m.Pagination.Validate(formats); err != nil {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Pagination")
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Pagination")
}
return err
}
}
@ -112,21 +109,12 @@ func (m *ResponseMeta) ContextValidate(ctx context.Context, formats strfmt.Regis
func (m *ResponseMeta) contextValidatePagination(ctx context.Context, formats strfmt.Registry) error {
if m.Pagination != nil {
if typeutils.IsZero(m.Pagination) { // not required
return nil
}
if err := m.Pagination.ContextValidate(ctx, formats); err != nil {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Pagination")
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Pagination")
}
return err
}
}
@ -139,13 +127,13 @@ func (m *ResponseMeta) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return jsonutils.WriteJSON(m)
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *ResponseMeta) UnmarshalBinary(b []byte) error {
var res ResponseMeta
if err := jsonutils.ReadJSON(b, &res); err != nil {
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,111 +6,53 @@
package attendees
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"fmt"
"time"
"github.com/go-openapi/runtime"
httptransport "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// New creates a new attendees API client.
func New(transport runtime.ContextualTransport, formats strfmt.Registry) ClientService {
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
// New creates a new attendees API client with basic auth credentials.
//
// It takes the following parameters:
// - host: http host (github.com).
// - basePath: any base path for the API client ("/v1", "/v3").
// - scheme: http scheme ("http", "https").
// - user: user for basic authentication header.
// - password: password for basic authentication header.
func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService {
transport := httptransport.New(host, basePath, []string{scheme})
transport.DefaultAuthentication = httptransport.BasicAuth(user, password)
return &Client{transport: transport, formats: strfmt.Default}
}
// New creates a new attendees API client with a bearer token for authentication.
//
// It takes the following parameters:
// - host: http host (github.com).
// - basePath: any base path for the API client ("/v1", "/v3").
// - scheme: http scheme ("http", "https").
// - bearerToken: bearer token for Bearer authentication header.
func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService {
transport := httptransport.New(host, basePath, []string{scheme})
transport.DefaultAuthentication = httptransport.BearerToken(bearerToken)
return &Client{transport: transport, formats: strfmt.Default}
}
// Client for attendees API.
/*
Client for attendees API
*/
type Client struct {
transport runtime.ContextualTransport
transport runtime.ClientTransport
formats strfmt.Registry
}
// ClientOption may be used to customize the behavior of Client methods.
// ClientOption is the option for Client methods
type ClientOption func(*runtime.ClientOperation)
// ClientService is the interface for Client methods.
// ClientService is the interface for Client methods
type ClientService interface {
// GetAttendees get a list attendees.
GetAttendees(params *GetAttendeesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAttendeesOK, error)
// GetAttendeesContext get a list attendees.
GetAttendeesContext(ctx context.Context, params *GetAttendeesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAttendeesOK, error)
// PostAttendees create new attendees.
PostAttendees(params *PostAttendeesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAttendeesOK, error)
// PostAttendeesContext create new attendees.
PostAttendeesContext(ctx context.Context, params *PostAttendeesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAttendeesOK, error)
// PutAttendees update attendee.
PutAttendees(params *PutAttendeesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutAttendeesOK, error)
// PutAttendeesContext update attendee.
PutAttendeesContext(ctx context.Context, params *PutAttendeesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutAttendeesOK, error)
SetTransport(transport runtime.ContextualTransport)
SetTransport(transport runtime.ClientTransport)
}
// GetAttendees gets a list attendees.
//
// Return a list of Attendee records from the datastore.
//
// 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.GetAttendeesContext] instead.
/*
GetAttendees gets a list attendees
Return a list of Attendee records from the datastore
*/
func (a *Client) GetAttendees(params *GetAttendeesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAttendeesOK, error) {
var ctx context.Context
if params.inner.ctx != nil {
ctx = params.inner.ctx
} else {
ctx = context.Background()
}
return a.GetAttendeesContext(ctx, params, authInfo, opts...)
}
// GetAttendeesContext gets a list attendees.
//
// Return a list of Attendee records from the datastore.
//
// Do not use the deprecated [GetAttendeesParams.Context] with this method: it would be ignored.
func (a *Client) GetAttendeesContext(ctx context.Context, params *GetAttendeesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAttendeesOK, error) {
// NOTE: parameters are not validated before sending
// TODO: Validate the params before sending
if params == nil {
params = NewGetAttendeesParams()
}
op := &runtime.ClientOperation{
ID: "getAttendees",
Method: "GET",
@ -121,63 +63,37 @@ func (a *Client) GetAttendeesContext(ctx context.Context, params *GetAttendeesPa
Params: params,
Reader: &GetAttendeesReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.SubmitContext(ctx, op)
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*GetAttendeesOK)
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
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for getAttendees: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// PostAttendees creates new attendees.
//
// Create Attendees.
//
// 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.PostAttendeesContext] instead.
/*
PostAttendees creates new attendees
Create Attendees
*/
func (a *Client) PostAttendees(params *PostAttendeesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAttendeesOK, error) {
var ctx context.Context
if params.inner.ctx != nil {
ctx = params.inner.ctx
} else {
ctx = context.Background()
}
return a.PostAttendeesContext(ctx, params, authInfo, opts...)
}
// PostAttendeesContext creates new attendees.
//
// Create Attendees.
//
// Do not use the deprecated [PostAttendeesParams.Context] with this method: it would be ignored.
func (a *Client) PostAttendeesContext(ctx context.Context, params *PostAttendeesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAttendeesOK, error) {
// NOTE: parameters are not validated before sending
// TODO: Validate the params before sending
if params == nil {
params = NewPostAttendeesParams()
}
op := &runtime.ClientOperation{
ID: "postAttendees",
Method: "POST",
@ -188,63 +104,37 @@ func (a *Client) PostAttendeesContext(ctx context.Context, params *PostAttendees
Params: params,
Reader: &PostAttendeesReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.SubmitContext(ctx, op)
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*PostAttendeesOK)
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
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for postAttendees: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// PutAttendees updates attendee.
//
// Update Attendee.
//
// 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.PutAttendeesContext] instead.
/*
PutAttendees updates attendee
Update Attendee
*/
func (a *Client) PutAttendees(params *PutAttendeesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutAttendeesOK, error) {
var ctx context.Context
if params.inner.ctx != nil {
ctx = params.inner.ctx
} else {
ctx = context.Background()
}
return a.PutAttendeesContext(ctx, params, authInfo, opts...)
}
// PutAttendeesContext updates attendee.
//
// Update Attendee.
//
// Do not use the deprecated [PutAttendeesParams.Context] with this method: it would be ignored.
func (a *Client) PutAttendeesContext(ctx context.Context, params *PutAttendeesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutAttendeesOK, error) {
// NOTE: parameters are not validated before sending
// TODO: Validate the params before sending
if params == nil {
params = NewPutAttendeesParams()
}
op := &runtime.ClientOperation{
ID: "putAttendees",
Method: "PUT",
@ -255,42 +145,28 @@ func (a *Client) PutAttendeesContext(ctx context.Context, params *PutAttendeesPa
Params: params,
Reader: &PutAttendeesReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.SubmitContext(ctx, op)
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*PutAttendeesOK)
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
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for putAttendees: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ContextualTransport) {
func (a *Client) SetTransport(transport runtime.ClientTransport) {
a.transport = transport
}
// innerParams captures internal fields so they don't conflict with user-supplied parameters.
type innerParams struct {
timeout time.Duration
// Deprecated: use the operation call with context to pass the context instead of [AttendeesParams].
ctx context.Context
}

View File

@ -6,6 +6,9 @@
package attendees
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
@ -15,7 +18,7 @@ import (
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/conv"
"github.com/go-openapi/swag"
)
// NewGetAttendeesParams creates a new GetAttendeesParams object,
@ -25,28 +28,24 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewGetAttendeesParams() *GetAttendeesParams {
return NewGetAttendeesParamsWithTimeout(cr.DefaultTimeout)
return &GetAttendeesParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetAttendeesParamsWithTimeout creates a new GetAttendeesParams object
// with the ability to set a timeout on a request.
func NewGetAttendeesParamsWithTimeout(timeout time.Duration) *GetAttendeesParams {
return &GetAttendeesParams{
inner: innerParams{
timeout: timeout,
},
}
}
// NewGetAttendeesParamsWithContext creates a new GetAttendeesParams object
// with the ability to set a context for a request.
//
// Deprecated: use the operation call with context to pass the context instead of [GetAttendeesParams].
func NewGetAttendeesParamsWithContext(ctx context.Context) *GetAttendeesParams {
return &GetAttendeesParams{
inner: innerParams{
ctx: ctx,
},
Context: ctx,
}
}
@ -67,28 +66,31 @@ GetAttendeesParams contains all the parameters to send to the API endpoint
*/
type GetAttendeesParams struct {
// ID.
//
// Unique Record ID
/* ID.
Unique Record ID
*/
ID *string
// Limit.
//
// How many objects to return at one time
//
// Format: int64
/* Limit.
How many objects to return at one time
Format: int64
*/
Limit *int64
// Offset.
//
// How many objects to skip?
//
// Format: int64
/* Offset.
How many objects to skip?
Format: int64
*/
Offset *int64
timeout time.Duration
Context context.Context
HTTPClient *http.Client
inner innerParams
}
// WithDefaults hydrates default values in the get attendees params (not the query body).
@ -106,79 +108,76 @@ func (o *GetAttendeesParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the get attendees params.
// WithTimeout adds the timeout to the get attendees params
func (o *GetAttendeesParams) WithTimeout(timeout time.Duration) *GetAttendeesParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get attendees params.
// SetTimeout adds the timeout to the get attendees params
func (o *GetAttendeesParams) SetTimeout(timeout time.Duration) {
o.inner.timeout = timeout
o.timeout = timeout
}
// WithContext adds the context to the get attendees params.
//
// Deprecated: use the operation call with context to pass the context instead of [GetAttendeesParams].
// WithContext adds the context to the get attendees params
func (o *GetAttendeesParams) WithContext(ctx context.Context) *GetAttendeesParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get attendees params.
//
// Deprecated: use the operation call with context to pass the context instead of [GetAttendeesParams].
// SetContext adds the context to the get attendees params
func (o *GetAttendeesParams) SetContext(ctx context.Context) {
o.inner.ctx = ctx
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get attendees params.
// WithHTTPClient adds the HTTPClient to the get attendees params
func (o *GetAttendeesParams) WithHTTPClient(client *http.Client) *GetAttendeesParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get attendees params.
// SetHTTPClient adds the HTTPClient to the get attendees params
func (o *GetAttendeesParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithID adds the id to the get attendees params.
// WithID adds the id to the get attendees params
func (o *GetAttendeesParams) WithID(id *string) *GetAttendeesParams {
o.SetID(id)
return o
}
// SetID adds the id to the get attendees params.
// SetID adds the id to the get attendees params
func (o *GetAttendeesParams) SetID(id *string) {
o.ID = id
}
// WithLimit adds the limit to the get attendees params.
// WithLimit adds the limit to the get attendees params
func (o *GetAttendeesParams) WithLimit(limit *int64) *GetAttendeesParams {
o.SetLimit(limit)
return o
}
// SetLimit adds the limit to the get attendees params.
// SetLimit adds the limit to the get attendees params
func (o *GetAttendeesParams) SetLimit(limit *int64) {
o.Limit = limit
}
// WithOffset adds the offset to the get attendees params.
// WithOffset adds the offset to the get attendees params
func (o *GetAttendeesParams) WithOffset(offset *int64) *GetAttendeesParams {
o.SetOffset(offset)
return o
}
// SetOffset adds the offset to the get attendees params.
// SetOffset adds the offset to the get attendees params
func (o *GetAttendeesParams) SetOffset(offset *int64) {
o.Offset = offset
}
// WriteToRequest writes these params to a [runtime.ClientRequest].
// WriteToRequest writes these params to a swagger request
func (o *GetAttendeesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.inner.timeout); err != nil {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
@ -208,7 +207,7 @@ func (o *GetAttendeesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.
if o.Limit != nil {
qrLimit = *o.Limit
}
qLimit := conv.FormatInteger(qrLimit)
qLimit := swag.FormatInt64(qrLimit)
if qLimit != "" {
if err := r.SetQueryParam("limit", qLimit); err != nil {
@ -225,7 +224,7 @@ func (o *GetAttendeesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.
if o.Offset != nil {
qrOffset = *o.Offset
}
qOffset := conv.FormatInteger(qrOffset)
qOffset := swag.FormatInt64(qrOffset)
if qOffset != "" {
if err := r.SetQueryParam("offset", qOffset); err != nil {

View File

@ -6,15 +6,17 @@
package attendees
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
stderrors "errors"
"fmt"
"io"
"code.tnxs.net/vernonkeenan/lib/api/members/members_models"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/members/members_models"
)
// GetAttendeesReader is a Reader for the GetAttendees structure.
@ -23,7 +25,7 @@ type GetAttendeesReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *GetAttendeesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
func (o *GetAttendeesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetAttendeesOK()
@ -62,7 +64,7 @@ func (o *GetAttendeesReader) ReadResponse(response runtime.ClientResponse, consu
}
return nil, result
default:
return nil, runtime.NewAPIError("[GET /attendees] getAttendees", response, response.Code())
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
@ -71,9 +73,11 @@ func NewGetAttendeesOK() *GetAttendeesOK {
return &GetAttendeesOK{}
}
// GetAttendeesOK describes a response with status code 200, with default header values.
//
// Attendee Response Object
/*
GetAttendeesOK describes a response with status code 200, with default header values.
Attendee Response Object
*/
type GetAttendeesOK struct {
Payload *members_models.AttendeeResponse
}
@ -109,13 +113,11 @@ func (o *GetAttendeesOK) Code() int {
}
func (o *GetAttendeesOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /attendees][%d] getAttendeesOK %s", 200, payload)
return fmt.Sprintf("[GET /attendees][%d] getAttendeesOK %+v", 200, o.Payload)
}
func (o *GetAttendeesOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /attendees][%d] getAttendeesOK %s", 200, payload)
return fmt.Sprintf("[GET /attendees][%d] getAttendeesOK %+v", 200, o.Payload)
}
func (o *GetAttendeesOK) GetPayload() *members_models.AttendeeResponse {
@ -127,7 +129,7 @@ func (o *GetAttendeesOK) readResponse(response runtime.ClientResponse, consumer
o.Payload = new(members_models.AttendeeResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -139,9 +141,11 @@ func NewGetAttendeesUnauthorized() *GetAttendeesUnauthorized {
return &GetAttendeesUnauthorized{}
}
// GetAttendeesUnauthorized describes a response with status code 401, with default header values.
//
// Access Unauthorized, invalid API-KEY was used
/*
GetAttendeesUnauthorized describes a response with status code 401, with default header values.
Access Unauthorized, invalid API-KEY was used
*/
type GetAttendeesUnauthorized struct {
Payload *members_models.Error
}
@ -177,13 +181,11 @@ func (o *GetAttendeesUnauthorized) Code() int {
}
func (o *GetAttendeesUnauthorized) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /attendees][%d] getAttendeesUnauthorized %s", 401, payload)
return fmt.Sprintf("[GET /attendees][%d] getAttendeesUnauthorized %+v", 401, o.Payload)
}
func (o *GetAttendeesUnauthorized) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /attendees][%d] getAttendeesUnauthorized %s", 401, payload)
return fmt.Sprintf("[GET /attendees][%d] getAttendeesUnauthorized %+v", 401, o.Payload)
}
func (o *GetAttendeesUnauthorized) GetPayload() *members_models.Error {
@ -195,7 +197,7 @@ func (o *GetAttendeesUnauthorized) readResponse(response runtime.ClientResponse,
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -207,9 +209,11 @@ func NewGetAttendeesForbidden() *GetAttendeesForbidden {
return &GetAttendeesForbidden{}
}
// GetAttendeesForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
/*
GetAttendeesForbidden describes a response with status code 403, with default header values.
Access forbidden, account lacks access
*/
type GetAttendeesForbidden struct {
AccessControlAllowOrigin string
@ -247,13 +251,11 @@ func (o *GetAttendeesForbidden) Code() int {
}
func (o *GetAttendeesForbidden) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /attendees][%d] getAttendeesForbidden %s", 403, payload)
return fmt.Sprintf("[GET /attendees][%d] getAttendeesForbidden %+v", 403, o.Payload)
}
func (o *GetAttendeesForbidden) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /attendees][%d] getAttendeesForbidden %s", 403, payload)
return fmt.Sprintf("[GET /attendees][%d] getAttendeesForbidden %+v", 403, o.Payload)
}
func (o *GetAttendeesForbidden) GetPayload() *members_models.Error {
@ -272,7 +274,7 @@ func (o *GetAttendeesForbidden) readResponse(response runtime.ClientResponse, co
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -284,9 +286,11 @@ func NewGetAttendeesNotFound() *GetAttendeesNotFound {
return &GetAttendeesNotFound{}
}
// GetAttendeesNotFound describes a response with status code 404, with default header values.
//
// Resource was not found
/*
GetAttendeesNotFound describes a response with status code 404, with default header values.
Resource was not found
*/
type GetAttendeesNotFound struct {
Payload *members_models.Error
}
@ -322,13 +326,11 @@ func (o *GetAttendeesNotFound) Code() int {
}
func (o *GetAttendeesNotFound) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /attendees][%d] getAttendeesNotFound %s", 404, payload)
return fmt.Sprintf("[GET /attendees][%d] getAttendeesNotFound %+v", 404, o.Payload)
}
func (o *GetAttendeesNotFound) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /attendees][%d] getAttendeesNotFound %s", 404, payload)
return fmt.Sprintf("[GET /attendees][%d] getAttendeesNotFound %+v", 404, o.Payload)
}
func (o *GetAttendeesNotFound) GetPayload() *members_models.Error {
@ -340,7 +342,7 @@ func (o *GetAttendeesNotFound) readResponse(response runtime.ClientResponse, con
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -352,9 +354,11 @@ func NewGetAttendeesUnprocessableEntity() *GetAttendeesUnprocessableEntity {
return &GetAttendeesUnprocessableEntity{}
}
// GetAttendeesUnprocessableEntity describes a response with status code 422, with default header values.
//
// Unprocessable Entity, likely a bad parameter
/*
GetAttendeesUnprocessableEntity describes a response with status code 422, with default header values.
Unprocessable Entity, likely a bad parameter
*/
type GetAttendeesUnprocessableEntity struct {
Payload *members_models.Error
}
@ -390,13 +394,11 @@ func (o *GetAttendeesUnprocessableEntity) Code() int {
}
func (o *GetAttendeesUnprocessableEntity) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /attendees][%d] getAttendeesUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[GET /attendees][%d] getAttendeesUnprocessableEntity %+v", 422, o.Payload)
}
func (o *GetAttendeesUnprocessableEntity) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /attendees][%d] getAttendeesUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[GET /attendees][%d] getAttendeesUnprocessableEntity %+v", 422, o.Payload)
}
func (o *GetAttendeesUnprocessableEntity) GetPayload() *members_models.Error {
@ -408,7 +410,7 @@ func (o *GetAttendeesUnprocessableEntity) readResponse(response runtime.ClientRe
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -420,9 +422,11 @@ func NewGetAttendeesInternalServerError() *GetAttendeesInternalServerError {
return &GetAttendeesInternalServerError{}
}
// GetAttendeesInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
/*
GetAttendeesInternalServerError describes a response with status code 500, with default header values.
Server Internal Error
*/
type GetAttendeesInternalServerError struct {
Payload *members_models.Error
}
@ -458,13 +462,11 @@ func (o *GetAttendeesInternalServerError) Code() int {
}
func (o *GetAttendeesInternalServerError) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /attendees][%d] getAttendeesInternalServerError %s", 500, payload)
return fmt.Sprintf("[GET /attendees][%d] getAttendeesInternalServerError %+v", 500, o.Payload)
}
func (o *GetAttendeesInternalServerError) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /attendees][%d] getAttendeesInternalServerError %s", 500, payload)
return fmt.Sprintf("[GET /attendees][%d] getAttendeesInternalServerError %+v", 500, o.Payload)
}
func (o *GetAttendeesInternalServerError) GetPayload() *members_models.Error {
@ -476,7 +478,7 @@ func (o *GetAttendeesInternalServerError) readResponse(response runtime.ClientRe
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}

View File

@ -6,16 +6,20 @@
package attendees
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"code.tnxs.net/vernonkeenan/lib/api/members/members_models"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/members/members_models"
)
// NewPostAttendeesParams creates a new PostAttendeesParams object,
@ -25,28 +29,24 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewPostAttendeesParams() *PostAttendeesParams {
return NewPostAttendeesParamsWithTimeout(cr.DefaultTimeout)
return &PostAttendeesParams{
timeout: cr.DefaultTimeout,
}
}
// NewPostAttendeesParamsWithTimeout creates a new PostAttendeesParams object
// with the ability to set a timeout on a request.
func NewPostAttendeesParamsWithTimeout(timeout time.Duration) *PostAttendeesParams {
return &PostAttendeesParams{
inner: innerParams{
timeout: timeout,
},
}
}
// NewPostAttendeesParamsWithContext creates a new PostAttendeesParams object
// with the ability to set a context for a request.
//
// Deprecated: use the operation call with context to pass the context instead of [PostAttendeesParams].
func NewPostAttendeesParamsWithContext(ctx context.Context) *PostAttendeesParams {
return &PostAttendeesParams{
inner: innerParams{
ctx: ctx,
},
Context: ctx,
}
}
@ -67,14 +67,15 @@ PostAttendeesParams contains all the parameters to send to the API endpoint
*/
type PostAttendeesParams struct {
// AttendeeRequest.
//
// An array of new Attendee records
/* AttendeeRequest.
An array of new Attendee records
*/
AttendeeRequest *members_models.AttendeeRequest
timeout time.Duration
Context context.Context
HTTPClient *http.Client
inner innerParams
}
// WithDefaults hydrates default values in the post attendees params (not the query body).
@ -92,57 +93,54 @@ func (o *PostAttendeesParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the post attendees params.
// WithTimeout adds the timeout to the post attendees params
func (o *PostAttendeesParams) WithTimeout(timeout time.Duration) *PostAttendeesParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the post attendees params.
// SetTimeout adds the timeout to the post attendees params
func (o *PostAttendeesParams) SetTimeout(timeout time.Duration) {
o.inner.timeout = timeout
o.timeout = timeout
}
// WithContext adds the context to the post attendees params.
//
// Deprecated: use the operation call with context to pass the context instead of [PostAttendeesParams].
// WithContext adds the context to the post attendees params
func (o *PostAttendeesParams) WithContext(ctx context.Context) *PostAttendeesParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the post attendees params.
//
// Deprecated: use the operation call with context to pass the context instead of [PostAttendeesParams].
// SetContext adds the context to the post attendees params
func (o *PostAttendeesParams) SetContext(ctx context.Context) {
o.inner.ctx = ctx
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the post attendees params.
// WithHTTPClient adds the HTTPClient to the post attendees params
func (o *PostAttendeesParams) WithHTTPClient(client *http.Client) *PostAttendeesParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the post attendees params.
// SetHTTPClient adds the HTTPClient to the post attendees params
func (o *PostAttendeesParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithAttendeeRequest adds the attendeeRequest to the post attendees params.
// WithAttendeeRequest adds the attendeeRequest to the post attendees params
func (o *PostAttendeesParams) WithAttendeeRequest(attendeeRequest *members_models.AttendeeRequest) *PostAttendeesParams {
o.SetAttendeeRequest(attendeeRequest)
return o
}
// SetAttendeeRequest adds the attendeeRequest to the post attendees params.
// SetAttendeeRequest adds the attendeeRequest to the post attendees params
func (o *PostAttendeesParams) SetAttendeeRequest(attendeeRequest *members_models.AttendeeRequest) {
o.AttendeeRequest = attendeeRequest
}
// WriteToRequest writes these params to a [runtime.ClientRequest].
// WriteToRequest writes these params to a swagger request
func (o *PostAttendeesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.inner.timeout); err != nil {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error

View File

@ -6,15 +6,17 @@
package attendees
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
stderrors "errors"
"fmt"
"io"
"code.tnxs.net/vernonkeenan/lib/api/members/members_models"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/members/members_models"
)
// PostAttendeesReader is a Reader for the PostAttendees structure.
@ -23,7 +25,7 @@ type PostAttendeesReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *PostAttendeesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
func (o *PostAttendeesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewPostAttendeesOK()
@ -62,7 +64,7 @@ func (o *PostAttendeesReader) ReadResponse(response runtime.ClientResponse, cons
}
return nil, result
default:
return nil, runtime.NewAPIError("[POST /attendees] postAttendees", response, response.Code())
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
@ -71,9 +73,11 @@ func NewPostAttendeesOK() *PostAttendeesOK {
return &PostAttendeesOK{}
}
// PostAttendeesOK describes a response with status code 200, with default header values.
//
// Attendee Response Object
/*
PostAttendeesOK describes a response with status code 200, with default header values.
Attendee Response Object
*/
type PostAttendeesOK struct {
Payload *members_models.AttendeeResponse
}
@ -109,13 +113,11 @@ func (o *PostAttendeesOK) Code() int {
}
func (o *PostAttendeesOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /attendees][%d] postAttendeesOK %s", 200, payload)
return fmt.Sprintf("[POST /attendees][%d] postAttendeesOK %+v", 200, o.Payload)
}
func (o *PostAttendeesOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /attendees][%d] postAttendeesOK %s", 200, payload)
return fmt.Sprintf("[POST /attendees][%d] postAttendeesOK %+v", 200, o.Payload)
}
func (o *PostAttendeesOK) GetPayload() *members_models.AttendeeResponse {
@ -127,7 +129,7 @@ func (o *PostAttendeesOK) readResponse(response runtime.ClientResponse, consumer
o.Payload = new(members_models.AttendeeResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -139,9 +141,11 @@ func NewPostAttendeesUnauthorized() *PostAttendeesUnauthorized {
return &PostAttendeesUnauthorized{}
}
// PostAttendeesUnauthorized describes a response with status code 401, with default header values.
//
// Access Unauthorized, invalid API-KEY was used
/*
PostAttendeesUnauthorized describes a response with status code 401, with default header values.
Access Unauthorized, invalid API-KEY was used
*/
type PostAttendeesUnauthorized struct {
Payload *members_models.Error
}
@ -177,13 +181,11 @@ func (o *PostAttendeesUnauthorized) Code() int {
}
func (o *PostAttendeesUnauthorized) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /attendees][%d] postAttendeesUnauthorized %s", 401, payload)
return fmt.Sprintf("[POST /attendees][%d] postAttendeesUnauthorized %+v", 401, o.Payload)
}
func (o *PostAttendeesUnauthorized) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /attendees][%d] postAttendeesUnauthorized %s", 401, payload)
return fmt.Sprintf("[POST /attendees][%d] postAttendeesUnauthorized %+v", 401, o.Payload)
}
func (o *PostAttendeesUnauthorized) GetPayload() *members_models.Error {
@ -195,7 +197,7 @@ func (o *PostAttendeesUnauthorized) readResponse(response runtime.ClientResponse
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -207,9 +209,11 @@ func NewPostAttendeesForbidden() *PostAttendeesForbidden {
return &PostAttendeesForbidden{}
}
// PostAttendeesForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
/*
PostAttendeesForbidden describes a response with status code 403, with default header values.
Access forbidden, account lacks access
*/
type PostAttendeesForbidden struct {
AccessControlAllowOrigin string
@ -247,13 +251,11 @@ func (o *PostAttendeesForbidden) Code() int {
}
func (o *PostAttendeesForbidden) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /attendees][%d] postAttendeesForbidden %s", 403, payload)
return fmt.Sprintf("[POST /attendees][%d] postAttendeesForbidden %+v", 403, o.Payload)
}
func (o *PostAttendeesForbidden) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /attendees][%d] postAttendeesForbidden %s", 403, payload)
return fmt.Sprintf("[POST /attendees][%d] postAttendeesForbidden %+v", 403, o.Payload)
}
func (o *PostAttendeesForbidden) GetPayload() *members_models.Error {
@ -272,7 +274,7 @@ func (o *PostAttendeesForbidden) readResponse(response runtime.ClientResponse, c
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -284,9 +286,11 @@ func NewPostAttendeesNotFound() *PostAttendeesNotFound {
return &PostAttendeesNotFound{}
}
// PostAttendeesNotFound describes a response with status code 404, with default header values.
//
// Resource was not found
/*
PostAttendeesNotFound describes a response with status code 404, with default header values.
Resource was not found
*/
type PostAttendeesNotFound struct {
Payload *members_models.Error
}
@ -322,13 +326,11 @@ func (o *PostAttendeesNotFound) Code() int {
}
func (o *PostAttendeesNotFound) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /attendees][%d] postAttendeesNotFound %s", 404, payload)
return fmt.Sprintf("[POST /attendees][%d] postAttendeesNotFound %+v", 404, o.Payload)
}
func (o *PostAttendeesNotFound) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /attendees][%d] postAttendeesNotFound %s", 404, payload)
return fmt.Sprintf("[POST /attendees][%d] postAttendeesNotFound %+v", 404, o.Payload)
}
func (o *PostAttendeesNotFound) GetPayload() *members_models.Error {
@ -340,7 +342,7 @@ func (o *PostAttendeesNotFound) readResponse(response runtime.ClientResponse, co
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -352,9 +354,11 @@ func NewPostAttendeesUnprocessableEntity() *PostAttendeesUnprocessableEntity {
return &PostAttendeesUnprocessableEntity{}
}
// PostAttendeesUnprocessableEntity describes a response with status code 422, with default header values.
//
// Unprocessable Entity, likely a bad parameter
/*
PostAttendeesUnprocessableEntity describes a response with status code 422, with default header values.
Unprocessable Entity, likely a bad parameter
*/
type PostAttendeesUnprocessableEntity struct {
Payload *members_models.Error
}
@ -390,13 +394,11 @@ func (o *PostAttendeesUnprocessableEntity) Code() int {
}
func (o *PostAttendeesUnprocessableEntity) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /attendees][%d] postAttendeesUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[POST /attendees][%d] postAttendeesUnprocessableEntity %+v", 422, o.Payload)
}
func (o *PostAttendeesUnprocessableEntity) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /attendees][%d] postAttendeesUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[POST /attendees][%d] postAttendeesUnprocessableEntity %+v", 422, o.Payload)
}
func (o *PostAttendeesUnprocessableEntity) GetPayload() *members_models.Error {
@ -408,7 +410,7 @@ func (o *PostAttendeesUnprocessableEntity) readResponse(response runtime.ClientR
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -420,9 +422,11 @@ func NewPostAttendeesInternalServerError() *PostAttendeesInternalServerError {
return &PostAttendeesInternalServerError{}
}
// PostAttendeesInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
/*
PostAttendeesInternalServerError describes a response with status code 500, with default header values.
Server Internal Error
*/
type PostAttendeesInternalServerError struct {
Payload *members_models.Error
}
@ -458,13 +462,11 @@ func (o *PostAttendeesInternalServerError) Code() int {
}
func (o *PostAttendeesInternalServerError) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /attendees][%d] postAttendeesInternalServerError %s", 500, payload)
return fmt.Sprintf("[POST /attendees][%d] postAttendeesInternalServerError %+v", 500, o.Payload)
}
func (o *PostAttendeesInternalServerError) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /attendees][%d] postAttendeesInternalServerError %s", 500, payload)
return fmt.Sprintf("[POST /attendees][%d] postAttendeesInternalServerError %+v", 500, o.Payload)
}
func (o *PostAttendeesInternalServerError) GetPayload() *members_models.Error {
@ -476,7 +478,7 @@ func (o *PostAttendeesInternalServerError) readResponse(response runtime.ClientR
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}

View File

@ -6,16 +6,20 @@
package attendees
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"code.tnxs.net/vernonkeenan/lib/api/members/members_models"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/members/members_models"
)
// NewPutAttendeesParams creates a new PutAttendeesParams object,
@ -25,28 +29,24 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewPutAttendeesParams() *PutAttendeesParams {
return NewPutAttendeesParamsWithTimeout(cr.DefaultTimeout)
return &PutAttendeesParams{
timeout: cr.DefaultTimeout,
}
}
// NewPutAttendeesParamsWithTimeout creates a new PutAttendeesParams object
// with the ability to set a timeout on a request.
func NewPutAttendeesParamsWithTimeout(timeout time.Duration) *PutAttendeesParams {
return &PutAttendeesParams{
inner: innerParams{
timeout: timeout,
},
}
}
// NewPutAttendeesParamsWithContext creates a new PutAttendeesParams object
// with the ability to set a context for a request.
//
// Deprecated: use the operation call with context to pass the context instead of [PutAttendeesParams].
func NewPutAttendeesParamsWithContext(ctx context.Context) *PutAttendeesParams {
return &PutAttendeesParams{
inner: innerParams{
ctx: ctx,
},
Context: ctx,
}
}
@ -67,14 +67,15 @@ PutAttendeesParams contains all the parameters to send to the API endpoint
*/
type PutAttendeesParams struct {
// AttendeeRequest.
//
// An array of new Attendee records
/* AttendeeRequest.
An array of new Attendee records
*/
AttendeeRequest *members_models.AttendeeRequest
timeout time.Duration
Context context.Context
HTTPClient *http.Client
inner innerParams
}
// WithDefaults hydrates default values in the put attendees params (not the query body).
@ -92,57 +93,54 @@ func (o *PutAttendeesParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the put attendees params.
// WithTimeout adds the timeout to the put attendees params
func (o *PutAttendeesParams) WithTimeout(timeout time.Duration) *PutAttendeesParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the put attendees params.
// SetTimeout adds the timeout to the put attendees params
func (o *PutAttendeesParams) SetTimeout(timeout time.Duration) {
o.inner.timeout = timeout
o.timeout = timeout
}
// WithContext adds the context to the put attendees params.
//
// Deprecated: use the operation call with context to pass the context instead of [PutAttendeesParams].
// WithContext adds the context to the put attendees params
func (o *PutAttendeesParams) WithContext(ctx context.Context) *PutAttendeesParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the put attendees params.
//
// Deprecated: use the operation call with context to pass the context instead of [PutAttendeesParams].
// SetContext adds the context to the put attendees params
func (o *PutAttendeesParams) SetContext(ctx context.Context) {
o.inner.ctx = ctx
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the put attendees params.
// WithHTTPClient adds the HTTPClient to the put attendees params
func (o *PutAttendeesParams) WithHTTPClient(client *http.Client) *PutAttendeesParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the put attendees params.
// SetHTTPClient adds the HTTPClient to the put attendees params
func (o *PutAttendeesParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithAttendeeRequest adds the attendeeRequest to the put attendees params.
// WithAttendeeRequest adds the attendeeRequest to the put attendees params
func (o *PutAttendeesParams) WithAttendeeRequest(attendeeRequest *members_models.AttendeeRequest) *PutAttendeesParams {
o.SetAttendeeRequest(attendeeRequest)
return o
}
// SetAttendeeRequest adds the attendeeRequest to the put attendees params.
// SetAttendeeRequest adds the attendeeRequest to the put attendees params
func (o *PutAttendeesParams) SetAttendeeRequest(attendeeRequest *members_models.AttendeeRequest) {
o.AttendeeRequest = attendeeRequest
}
// WriteToRequest writes these params to a [runtime.ClientRequest].
// WriteToRequest writes these params to a swagger request
func (o *PutAttendeesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.inner.timeout); err != nil {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error

View File

@ -6,15 +6,17 @@
package attendees
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
stderrors "errors"
"fmt"
"io"
"code.tnxs.net/vernonkeenan/lib/api/members/members_models"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/members/members_models"
)
// PutAttendeesReader is a Reader for the PutAttendees structure.
@ -23,7 +25,7 @@ type PutAttendeesReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *PutAttendeesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
func (o *PutAttendeesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewPutAttendeesOK()
@ -62,7 +64,7 @@ func (o *PutAttendeesReader) ReadResponse(response runtime.ClientResponse, consu
}
return nil, result
default:
return nil, runtime.NewAPIError("[PUT /attendees] putAttendees", response, response.Code())
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
@ -71,9 +73,11 @@ func NewPutAttendeesOK() *PutAttendeesOK {
return &PutAttendeesOK{}
}
// PutAttendeesOK describes a response with status code 200, with default header values.
//
// Attendee Response Object
/*
PutAttendeesOK describes a response with status code 200, with default header values.
Attendee Response Object
*/
type PutAttendeesOK struct {
Payload *members_models.AttendeeResponse
}
@ -109,13 +113,11 @@ func (o *PutAttendeesOK) Code() int {
}
func (o *PutAttendeesOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesOK %s", 200, payload)
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesOK %+v", 200, o.Payload)
}
func (o *PutAttendeesOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesOK %s", 200, payload)
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesOK %+v", 200, o.Payload)
}
func (o *PutAttendeesOK) GetPayload() *members_models.AttendeeResponse {
@ -127,7 +129,7 @@ func (o *PutAttendeesOK) readResponse(response runtime.ClientResponse, consumer
o.Payload = new(members_models.AttendeeResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -139,9 +141,11 @@ func NewPutAttendeesUnauthorized() *PutAttendeesUnauthorized {
return &PutAttendeesUnauthorized{}
}
// PutAttendeesUnauthorized describes a response with status code 401, with default header values.
//
// Access Unauthorized, invalid API-KEY was used
/*
PutAttendeesUnauthorized describes a response with status code 401, with default header values.
Access Unauthorized, invalid API-KEY was used
*/
type PutAttendeesUnauthorized struct {
Payload *members_models.Error
}
@ -177,13 +181,11 @@ func (o *PutAttendeesUnauthorized) Code() int {
}
func (o *PutAttendeesUnauthorized) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesUnauthorized %s", 401, payload)
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesUnauthorized %+v", 401, o.Payload)
}
func (o *PutAttendeesUnauthorized) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesUnauthorized %s", 401, payload)
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesUnauthorized %+v", 401, o.Payload)
}
func (o *PutAttendeesUnauthorized) GetPayload() *members_models.Error {
@ -195,7 +197,7 @@ func (o *PutAttendeesUnauthorized) readResponse(response runtime.ClientResponse,
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -207,9 +209,11 @@ func NewPutAttendeesForbidden() *PutAttendeesForbidden {
return &PutAttendeesForbidden{}
}
// PutAttendeesForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
/*
PutAttendeesForbidden describes a response with status code 403, with default header values.
Access forbidden, account lacks access
*/
type PutAttendeesForbidden struct {
AccessControlAllowOrigin string
@ -247,13 +251,11 @@ func (o *PutAttendeesForbidden) Code() int {
}
func (o *PutAttendeesForbidden) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesForbidden %s", 403, payload)
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesForbidden %+v", 403, o.Payload)
}
func (o *PutAttendeesForbidden) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesForbidden %s", 403, payload)
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesForbidden %+v", 403, o.Payload)
}
func (o *PutAttendeesForbidden) GetPayload() *members_models.Error {
@ -272,7 +274,7 @@ func (o *PutAttendeesForbidden) readResponse(response runtime.ClientResponse, co
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -284,9 +286,11 @@ func NewPutAttendeesNotFound() *PutAttendeesNotFound {
return &PutAttendeesNotFound{}
}
// PutAttendeesNotFound describes a response with status code 404, with default header values.
//
// Resource was not found
/*
PutAttendeesNotFound describes a response with status code 404, with default header values.
Resource was not found
*/
type PutAttendeesNotFound struct {
Payload *members_models.Error
}
@ -322,13 +326,11 @@ func (o *PutAttendeesNotFound) Code() int {
}
func (o *PutAttendeesNotFound) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesNotFound %s", 404, payload)
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesNotFound %+v", 404, o.Payload)
}
func (o *PutAttendeesNotFound) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesNotFound %s", 404, payload)
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesNotFound %+v", 404, o.Payload)
}
func (o *PutAttendeesNotFound) GetPayload() *members_models.Error {
@ -340,7 +342,7 @@ func (o *PutAttendeesNotFound) readResponse(response runtime.ClientResponse, con
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -352,9 +354,11 @@ func NewPutAttendeesUnprocessableEntity() *PutAttendeesUnprocessableEntity {
return &PutAttendeesUnprocessableEntity{}
}
// PutAttendeesUnprocessableEntity describes a response with status code 422, with default header values.
//
// Unprocessable Entity, likely a bad parameter
/*
PutAttendeesUnprocessableEntity describes a response with status code 422, with default header values.
Unprocessable Entity, likely a bad parameter
*/
type PutAttendeesUnprocessableEntity struct {
Payload *members_models.Error
}
@ -390,13 +394,11 @@ func (o *PutAttendeesUnprocessableEntity) Code() int {
}
func (o *PutAttendeesUnprocessableEntity) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesUnprocessableEntity %+v", 422, o.Payload)
}
func (o *PutAttendeesUnprocessableEntity) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesUnprocessableEntity %+v", 422, o.Payload)
}
func (o *PutAttendeesUnprocessableEntity) GetPayload() *members_models.Error {
@ -408,7 +410,7 @@ func (o *PutAttendeesUnprocessableEntity) readResponse(response runtime.ClientRe
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -420,9 +422,11 @@ func NewPutAttendeesInternalServerError() *PutAttendeesInternalServerError {
return &PutAttendeesInternalServerError{}
}
// PutAttendeesInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
/*
PutAttendeesInternalServerError describes a response with status code 500, with default header values.
Server Internal Error
*/
type PutAttendeesInternalServerError struct {
Payload *members_models.Error
}
@ -458,13 +462,11 @@ func (o *PutAttendeesInternalServerError) Code() int {
}
func (o *PutAttendeesInternalServerError) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesInternalServerError %s", 500, payload)
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesInternalServerError %+v", 500, o.Payload)
}
func (o *PutAttendeesInternalServerError) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesInternalServerError %s", 500, payload)
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesInternalServerError %+v", 500, o.Payload)
}
func (o *PutAttendeesInternalServerError) GetPayload() *members_models.Error {
@ -476,7 +478,7 @@ func (o *PutAttendeesInternalServerError) readResponse(response runtime.ClientRe
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}

View File

@ -6,111 +6,53 @@
package certificates
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"fmt"
"time"
"github.com/go-openapi/runtime"
httptransport "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// New creates a new certificates API client.
func New(transport runtime.ContextualTransport, formats strfmt.Registry) ClientService {
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
// New creates a new certificates API client with basic auth credentials.
//
// It takes the following parameters:
// - host: http host (github.com).
// - basePath: any base path for the API client ("/v1", "/v3").
// - scheme: http scheme ("http", "https").
// - user: user for basic authentication header.
// - password: password for basic authentication header.
func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService {
transport := httptransport.New(host, basePath, []string{scheme})
transport.DefaultAuthentication = httptransport.BasicAuth(user, password)
return &Client{transport: transport, formats: strfmt.Default}
}
// New creates a new certificates API client with a bearer token for authentication.
//
// It takes the following parameters:
// - host: http host (github.com).
// - basePath: any base path for the API client ("/v1", "/v3").
// - scheme: http scheme ("http", "https").
// - bearerToken: bearer token for Bearer authentication header.
func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService {
transport := httptransport.New(host, basePath, []string{scheme})
transport.DefaultAuthentication = httptransport.BearerToken(bearerToken)
return &Client{transport: transport, formats: strfmt.Default}
}
// Client for certificates API.
/*
Client for certificates API
*/
type Client struct {
transport runtime.ContextualTransport
transport runtime.ClientTransport
formats strfmt.Registry
}
// ClientOption may be used to customize the behavior of Client methods.
// ClientOption is the option for Client methods
type ClientOption func(*runtime.ClientOperation)
// ClientService is the interface for Client methods.
// ClientService is the interface for Client methods
type ClientService interface {
// GetCertificates get a list certificates.
GetCertificates(params *GetCertificatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCertificatesOK, error)
// GetCertificatesContext get a list certificates.
GetCertificatesContext(ctx context.Context, params *GetCertificatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCertificatesOK, error)
// PostCertificates create new certificates.
PostCertificates(params *PostCertificatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCertificatesOK, error)
// PostCertificatesContext create new certificates.
PostCertificatesContext(ctx context.Context, params *PostCertificatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCertificatesOK, error)
// PutCertificates update certificate.
PutCertificates(params *PutCertificatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutCertificatesOK, error)
// PutCertificatesContext update certificate.
PutCertificatesContext(ctx context.Context, params *PutCertificatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutCertificatesOK, error)
SetTransport(transport runtime.ContextualTransport)
SetTransport(transport runtime.ClientTransport)
}
// GetCertificates gets a list certificates.
//
// Return a list of Certificate records from the datastore.
//
// 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.GetCertificatesContext] instead.
/*
GetCertificates gets a list certificates
Return a list of Certificate records from the datastore
*/
func (a *Client) GetCertificates(params *GetCertificatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCertificatesOK, error) {
var ctx context.Context
if params.inner.ctx != nil {
ctx = params.inner.ctx
} else {
ctx = context.Background()
}
return a.GetCertificatesContext(ctx, params, authInfo, opts...)
}
// GetCertificatesContext gets a list certificates.
//
// Return a list of Certificate records from the datastore.
//
// Do not use the deprecated [GetCertificatesParams.Context] with this method: it would be ignored.
func (a *Client) GetCertificatesContext(ctx context.Context, params *GetCertificatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCertificatesOK, error) {
// NOTE: parameters are not validated before sending
// TODO: Validate the params before sending
if params == nil {
params = NewGetCertificatesParams()
}
op := &runtime.ClientOperation{
ID: "getCertificates",
Method: "GET",
@ -121,63 +63,37 @@ func (a *Client) GetCertificatesContext(ctx context.Context, params *GetCertific
Params: params,
Reader: &GetCertificatesReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.SubmitContext(ctx, op)
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*GetCertificatesOK)
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
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for getCertificates: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// PostCertificates creates new certificates.
//
// Create Certificates.
//
// 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.PostCertificatesContext] instead.
/*
PostCertificates creates new certificates
Create Certificates
*/
func (a *Client) PostCertificates(params *PostCertificatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCertificatesOK, error) {
var ctx context.Context
if params.inner.ctx != nil {
ctx = params.inner.ctx
} else {
ctx = context.Background()
}
return a.PostCertificatesContext(ctx, params, authInfo, opts...)
}
// PostCertificatesContext creates new certificates.
//
// Create Certificates.
//
// Do not use the deprecated [PostCertificatesParams.Context] with this method: it would be ignored.
func (a *Client) PostCertificatesContext(ctx context.Context, params *PostCertificatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCertificatesOK, error) {
// NOTE: parameters are not validated before sending
// TODO: Validate the params before sending
if params == nil {
params = NewPostCertificatesParams()
}
op := &runtime.ClientOperation{
ID: "postCertificates",
Method: "POST",
@ -188,63 +104,37 @@ func (a *Client) PostCertificatesContext(ctx context.Context, params *PostCertif
Params: params,
Reader: &PostCertificatesReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.SubmitContext(ctx, op)
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*PostCertificatesOK)
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
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for postCertificates: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// PutCertificates updates certificate.
//
// Update Certificate.
//
// 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.PutCertificatesContext] instead.
/*
PutCertificates updates certificate
Update Certificate
*/
func (a *Client) PutCertificates(params *PutCertificatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutCertificatesOK, error) {
var ctx context.Context
if params.inner.ctx != nil {
ctx = params.inner.ctx
} else {
ctx = context.Background()
}
return a.PutCertificatesContext(ctx, params, authInfo, opts...)
}
// PutCertificatesContext updates certificate.
//
// Update Certificate.
//
// Do not use the deprecated [PutCertificatesParams.Context] with this method: it would be ignored.
func (a *Client) PutCertificatesContext(ctx context.Context, params *PutCertificatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutCertificatesOK, error) {
// NOTE: parameters are not validated before sending
// TODO: Validate the params before sending
if params == nil {
params = NewPutCertificatesParams()
}
op := &runtime.ClientOperation{
ID: "putCertificates",
Method: "PUT",
@ -255,42 +145,28 @@ func (a *Client) PutCertificatesContext(ctx context.Context, params *PutCertific
Params: params,
Reader: &PutCertificatesReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.SubmitContext(ctx, op)
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*PutCertificatesOK)
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
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for putCertificates: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ContextualTransport) {
func (a *Client) SetTransport(transport runtime.ClientTransport) {
a.transport = transport
}
// innerParams captures internal fields so they don't conflict with user-supplied parameters.
type innerParams struct {
timeout time.Duration
// Deprecated: use the operation call with context to pass the context instead of [CertificatesParams].
ctx context.Context
}

View File

@ -6,6 +6,9 @@
package certificates
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
@ -15,7 +18,7 @@ import (
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/conv"
"github.com/go-openapi/swag"
)
// NewGetCertificatesParams creates a new GetCertificatesParams object,
@ -25,28 +28,24 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewGetCertificatesParams() *GetCertificatesParams {
return NewGetCertificatesParamsWithTimeout(cr.DefaultTimeout)
return &GetCertificatesParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetCertificatesParamsWithTimeout creates a new GetCertificatesParams object
// with the ability to set a timeout on a request.
func NewGetCertificatesParamsWithTimeout(timeout time.Duration) *GetCertificatesParams {
return &GetCertificatesParams{
inner: innerParams{
timeout: timeout,
},
}
}
// NewGetCertificatesParamsWithContext creates a new GetCertificatesParams object
// with the ability to set a context for a request.
//
// Deprecated: use the operation call with context to pass the context instead of [GetCertificatesParams].
func NewGetCertificatesParamsWithContext(ctx context.Context) *GetCertificatesParams {
return &GetCertificatesParams{
inner: innerParams{
ctx: ctx,
},
Context: ctx,
}
}
@ -67,28 +66,31 @@ GetCertificatesParams contains all the parameters to send to the API endpoint
*/
type GetCertificatesParams struct {
// ID.
//
// Unique Record ID
/* ID.
Unique Record ID
*/
ID *string
// Limit.
//
// How many objects to return at one time
//
// Format: int64
/* Limit.
How many objects to return at one time
Format: int64
*/
Limit *int64
// Offset.
//
// How many objects to skip?
//
// Format: int64
/* Offset.
How many objects to skip?
Format: int64
*/
Offset *int64
timeout time.Duration
Context context.Context
HTTPClient *http.Client
inner innerParams
}
// WithDefaults hydrates default values in the get certificates params (not the query body).
@ -106,79 +108,76 @@ func (o *GetCertificatesParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the get certificates params.
// WithTimeout adds the timeout to the get certificates params
func (o *GetCertificatesParams) WithTimeout(timeout time.Duration) *GetCertificatesParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get certificates params.
// SetTimeout adds the timeout to the get certificates params
func (o *GetCertificatesParams) SetTimeout(timeout time.Duration) {
o.inner.timeout = timeout
o.timeout = timeout
}
// WithContext adds the context to the get certificates params.
//
// Deprecated: use the operation call with context to pass the context instead of [GetCertificatesParams].
// WithContext adds the context to the get certificates params
func (o *GetCertificatesParams) WithContext(ctx context.Context) *GetCertificatesParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get certificates params.
//
// Deprecated: use the operation call with context to pass the context instead of [GetCertificatesParams].
// SetContext adds the context to the get certificates params
func (o *GetCertificatesParams) SetContext(ctx context.Context) {
o.inner.ctx = ctx
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get certificates params.
// WithHTTPClient adds the HTTPClient to the get certificates params
func (o *GetCertificatesParams) WithHTTPClient(client *http.Client) *GetCertificatesParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get certificates params.
// SetHTTPClient adds the HTTPClient to the get certificates params
func (o *GetCertificatesParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithID adds the id to the get certificates params.
// WithID adds the id to the get certificates params
func (o *GetCertificatesParams) WithID(id *string) *GetCertificatesParams {
o.SetID(id)
return o
}
// SetID adds the id to the get certificates params.
// SetID adds the id to the get certificates params
func (o *GetCertificatesParams) SetID(id *string) {
o.ID = id
}
// WithLimit adds the limit to the get certificates params.
// WithLimit adds the limit to the get certificates params
func (o *GetCertificatesParams) WithLimit(limit *int64) *GetCertificatesParams {
o.SetLimit(limit)
return o
}
// SetLimit adds the limit to the get certificates params.
// SetLimit adds the limit to the get certificates params
func (o *GetCertificatesParams) SetLimit(limit *int64) {
o.Limit = limit
}
// WithOffset adds the offset to the get certificates params.
// WithOffset adds the offset to the get certificates params
func (o *GetCertificatesParams) WithOffset(offset *int64) *GetCertificatesParams {
o.SetOffset(offset)
return o
}
// SetOffset adds the offset to the get certificates params.
// SetOffset adds the offset to the get certificates params
func (o *GetCertificatesParams) SetOffset(offset *int64) {
o.Offset = offset
}
// WriteToRequest writes these params to a [runtime.ClientRequest].
// WriteToRequest writes these params to a swagger request
func (o *GetCertificatesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.inner.timeout); err != nil {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
@ -208,7 +207,7 @@ func (o *GetCertificatesParams) WriteToRequest(r runtime.ClientRequest, reg strf
if o.Limit != nil {
qrLimit = *o.Limit
}
qLimit := conv.FormatInteger(qrLimit)
qLimit := swag.FormatInt64(qrLimit)
if qLimit != "" {
if err := r.SetQueryParam("limit", qLimit); err != nil {
@ -225,7 +224,7 @@ func (o *GetCertificatesParams) WriteToRequest(r runtime.ClientRequest, reg strf
if o.Offset != nil {
qrOffset = *o.Offset
}
qOffset := conv.FormatInteger(qrOffset)
qOffset := swag.FormatInt64(qrOffset)
if qOffset != "" {
if err := r.SetQueryParam("offset", qOffset); err != nil {

View File

@ -6,15 +6,17 @@
package certificates
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
stderrors "errors"
"fmt"
"io"
"code.tnxs.net/vernonkeenan/lib/api/members/members_models"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/members/members_models"
)
// GetCertificatesReader is a Reader for the GetCertificates structure.
@ -23,7 +25,7 @@ type GetCertificatesReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *GetCertificatesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
func (o *GetCertificatesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetCertificatesOK()
@ -62,7 +64,7 @@ func (o *GetCertificatesReader) ReadResponse(response runtime.ClientResponse, co
}
return nil, result
default:
return nil, runtime.NewAPIError("[GET /certificates] getCertificates", response, response.Code())
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
@ -71,9 +73,11 @@ func NewGetCertificatesOK() *GetCertificatesOK {
return &GetCertificatesOK{}
}
// GetCertificatesOK describes a response with status code 200, with default header values.
//
// Certificate Response Object
/*
GetCertificatesOK describes a response with status code 200, with default header values.
Certificate Response Object
*/
type GetCertificatesOK struct {
Payload *members_models.CertificateResponse
}
@ -109,13 +113,11 @@ func (o *GetCertificatesOK) Code() int {
}
func (o *GetCertificatesOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /certificates][%d] getCertificatesOK %s", 200, payload)
return fmt.Sprintf("[GET /certificates][%d] getCertificatesOK %+v", 200, o.Payload)
}
func (o *GetCertificatesOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /certificates][%d] getCertificatesOK %s", 200, payload)
return fmt.Sprintf("[GET /certificates][%d] getCertificatesOK %+v", 200, o.Payload)
}
func (o *GetCertificatesOK) GetPayload() *members_models.CertificateResponse {
@ -127,7 +129,7 @@ func (o *GetCertificatesOK) readResponse(response runtime.ClientResponse, consum
o.Payload = new(members_models.CertificateResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -139,9 +141,11 @@ func NewGetCertificatesUnauthorized() *GetCertificatesUnauthorized {
return &GetCertificatesUnauthorized{}
}
// GetCertificatesUnauthorized describes a response with status code 401, with default header values.
//
// Access Unauthorized, invalid API-KEY was used
/*
GetCertificatesUnauthorized describes a response with status code 401, with default header values.
Access Unauthorized, invalid API-KEY was used
*/
type GetCertificatesUnauthorized struct {
Payload *members_models.Error
}
@ -177,13 +181,11 @@ func (o *GetCertificatesUnauthorized) Code() int {
}
func (o *GetCertificatesUnauthorized) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /certificates][%d] getCertificatesUnauthorized %s", 401, payload)
return fmt.Sprintf("[GET /certificates][%d] getCertificatesUnauthorized %+v", 401, o.Payload)
}
func (o *GetCertificatesUnauthorized) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /certificates][%d] getCertificatesUnauthorized %s", 401, payload)
return fmt.Sprintf("[GET /certificates][%d] getCertificatesUnauthorized %+v", 401, o.Payload)
}
func (o *GetCertificatesUnauthorized) GetPayload() *members_models.Error {
@ -195,7 +197,7 @@ func (o *GetCertificatesUnauthorized) readResponse(response runtime.ClientRespon
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -207,9 +209,11 @@ func NewGetCertificatesForbidden() *GetCertificatesForbidden {
return &GetCertificatesForbidden{}
}
// GetCertificatesForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
/*
GetCertificatesForbidden describes a response with status code 403, with default header values.
Access forbidden, account lacks access
*/
type GetCertificatesForbidden struct {
AccessControlAllowOrigin string
@ -247,13 +251,11 @@ func (o *GetCertificatesForbidden) Code() int {
}
func (o *GetCertificatesForbidden) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /certificates][%d] getCertificatesForbidden %s", 403, payload)
return fmt.Sprintf("[GET /certificates][%d] getCertificatesForbidden %+v", 403, o.Payload)
}
func (o *GetCertificatesForbidden) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /certificates][%d] getCertificatesForbidden %s", 403, payload)
return fmt.Sprintf("[GET /certificates][%d] getCertificatesForbidden %+v", 403, o.Payload)
}
func (o *GetCertificatesForbidden) GetPayload() *members_models.Error {
@ -272,7 +274,7 @@ func (o *GetCertificatesForbidden) readResponse(response runtime.ClientResponse,
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -284,9 +286,11 @@ func NewGetCertificatesNotFound() *GetCertificatesNotFound {
return &GetCertificatesNotFound{}
}
// GetCertificatesNotFound describes a response with status code 404, with default header values.
//
// Resource was not found
/*
GetCertificatesNotFound describes a response with status code 404, with default header values.
Resource was not found
*/
type GetCertificatesNotFound struct {
Payload *members_models.Error
}
@ -322,13 +326,11 @@ func (o *GetCertificatesNotFound) Code() int {
}
func (o *GetCertificatesNotFound) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /certificates][%d] getCertificatesNotFound %s", 404, payload)
return fmt.Sprintf("[GET /certificates][%d] getCertificatesNotFound %+v", 404, o.Payload)
}
func (o *GetCertificatesNotFound) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /certificates][%d] getCertificatesNotFound %s", 404, payload)
return fmt.Sprintf("[GET /certificates][%d] getCertificatesNotFound %+v", 404, o.Payload)
}
func (o *GetCertificatesNotFound) GetPayload() *members_models.Error {
@ -340,7 +342,7 @@ func (o *GetCertificatesNotFound) readResponse(response runtime.ClientResponse,
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -352,9 +354,11 @@ func NewGetCertificatesUnprocessableEntity() *GetCertificatesUnprocessableEntity
return &GetCertificatesUnprocessableEntity{}
}
// GetCertificatesUnprocessableEntity describes a response with status code 422, with default header values.
//
// Unprocessable Entity, likely a bad parameter
/*
GetCertificatesUnprocessableEntity describes a response with status code 422, with default header values.
Unprocessable Entity, likely a bad parameter
*/
type GetCertificatesUnprocessableEntity struct {
Payload *members_models.Error
}
@ -390,13 +394,11 @@ func (o *GetCertificatesUnprocessableEntity) Code() int {
}
func (o *GetCertificatesUnprocessableEntity) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /certificates][%d] getCertificatesUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[GET /certificates][%d] getCertificatesUnprocessableEntity %+v", 422, o.Payload)
}
func (o *GetCertificatesUnprocessableEntity) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /certificates][%d] getCertificatesUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[GET /certificates][%d] getCertificatesUnprocessableEntity %+v", 422, o.Payload)
}
func (o *GetCertificatesUnprocessableEntity) GetPayload() *members_models.Error {
@ -408,7 +410,7 @@ func (o *GetCertificatesUnprocessableEntity) readResponse(response runtime.Clien
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -420,9 +422,11 @@ func NewGetCertificatesInternalServerError() *GetCertificatesInternalServerError
return &GetCertificatesInternalServerError{}
}
// GetCertificatesInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
/*
GetCertificatesInternalServerError describes a response with status code 500, with default header values.
Server Internal Error
*/
type GetCertificatesInternalServerError struct {
Payload *members_models.Error
}
@ -458,13 +462,11 @@ func (o *GetCertificatesInternalServerError) Code() int {
}
func (o *GetCertificatesInternalServerError) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /certificates][%d] getCertificatesInternalServerError %s", 500, payload)
return fmt.Sprintf("[GET /certificates][%d] getCertificatesInternalServerError %+v", 500, o.Payload)
}
func (o *GetCertificatesInternalServerError) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /certificates][%d] getCertificatesInternalServerError %s", 500, payload)
return fmt.Sprintf("[GET /certificates][%d] getCertificatesInternalServerError %+v", 500, o.Payload)
}
func (o *GetCertificatesInternalServerError) GetPayload() *members_models.Error {
@ -476,7 +478,7 @@ func (o *GetCertificatesInternalServerError) readResponse(response runtime.Clien
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}

View File

@ -6,16 +6,20 @@
package certificates
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"code.tnxs.net/vernonkeenan/lib/api/members/members_models"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/members/members_models"
)
// NewPostCertificatesParams creates a new PostCertificatesParams object,
@ -25,28 +29,24 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewPostCertificatesParams() *PostCertificatesParams {
return NewPostCertificatesParamsWithTimeout(cr.DefaultTimeout)
return &PostCertificatesParams{
timeout: cr.DefaultTimeout,
}
}
// NewPostCertificatesParamsWithTimeout creates a new PostCertificatesParams object
// with the ability to set a timeout on a request.
func NewPostCertificatesParamsWithTimeout(timeout time.Duration) *PostCertificatesParams {
return &PostCertificatesParams{
inner: innerParams{
timeout: timeout,
},
}
}
// NewPostCertificatesParamsWithContext creates a new PostCertificatesParams object
// with the ability to set a context for a request.
//
// Deprecated: use the operation call with context to pass the context instead of [PostCertificatesParams].
func NewPostCertificatesParamsWithContext(ctx context.Context) *PostCertificatesParams {
return &PostCertificatesParams{
inner: innerParams{
ctx: ctx,
},
Context: ctx,
}
}
@ -67,14 +67,15 @@ PostCertificatesParams contains all the parameters to send to the API endpoint
*/
type PostCertificatesParams struct {
// CertificateRequest.
//
// An array of new Certificate records
/* CertificateRequest.
An array of new Certificate records
*/
CertificateRequest *members_models.CertificateRequest
timeout time.Duration
Context context.Context
HTTPClient *http.Client
inner innerParams
}
// WithDefaults hydrates default values in the post certificates params (not the query body).
@ -92,57 +93,54 @@ func (o *PostCertificatesParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the post certificates params.
// WithTimeout adds the timeout to the post certificates params
func (o *PostCertificatesParams) WithTimeout(timeout time.Duration) *PostCertificatesParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the post certificates params.
// SetTimeout adds the timeout to the post certificates params
func (o *PostCertificatesParams) SetTimeout(timeout time.Duration) {
o.inner.timeout = timeout
o.timeout = timeout
}
// WithContext adds the context to the post certificates params.
//
// Deprecated: use the operation call with context to pass the context instead of [PostCertificatesParams].
// WithContext adds the context to the post certificates params
func (o *PostCertificatesParams) WithContext(ctx context.Context) *PostCertificatesParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the post certificates params.
//
// Deprecated: use the operation call with context to pass the context instead of [PostCertificatesParams].
// SetContext adds the context to the post certificates params
func (o *PostCertificatesParams) SetContext(ctx context.Context) {
o.inner.ctx = ctx
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the post certificates params.
// WithHTTPClient adds the HTTPClient to the post certificates params
func (o *PostCertificatesParams) WithHTTPClient(client *http.Client) *PostCertificatesParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the post certificates params.
// SetHTTPClient adds the HTTPClient to the post certificates params
func (o *PostCertificatesParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithCertificateRequest adds the certificateRequest to the post certificates params.
// WithCertificateRequest adds the certificateRequest to the post certificates params
func (o *PostCertificatesParams) WithCertificateRequest(certificateRequest *members_models.CertificateRequest) *PostCertificatesParams {
o.SetCertificateRequest(certificateRequest)
return o
}
// SetCertificateRequest adds the certificateRequest to the post certificates params.
// SetCertificateRequest adds the certificateRequest to the post certificates params
func (o *PostCertificatesParams) SetCertificateRequest(certificateRequest *members_models.CertificateRequest) {
o.CertificateRequest = certificateRequest
}
// WriteToRequest writes these params to a [runtime.ClientRequest].
// WriteToRequest writes these params to a swagger request
func (o *PostCertificatesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.inner.timeout); err != nil {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error

View File

@ -6,15 +6,17 @@
package certificates
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
stderrors "errors"
"fmt"
"io"
"code.tnxs.net/vernonkeenan/lib/api/members/members_models"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/members/members_models"
)
// PostCertificatesReader is a Reader for the PostCertificates structure.
@ -23,7 +25,7 @@ type PostCertificatesReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *PostCertificatesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
func (o *PostCertificatesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewPostCertificatesOK()
@ -62,7 +64,7 @@ func (o *PostCertificatesReader) ReadResponse(response runtime.ClientResponse, c
}
return nil, result
default:
return nil, runtime.NewAPIError("[POST /certificates] postCertificates", response, response.Code())
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
@ -71,9 +73,11 @@ func NewPostCertificatesOK() *PostCertificatesOK {
return &PostCertificatesOK{}
}
// PostCertificatesOK describes a response with status code 200, with default header values.
//
// Certificate Response Object
/*
PostCertificatesOK describes a response with status code 200, with default header values.
Certificate Response Object
*/
type PostCertificatesOK struct {
Payload *members_models.CertificateResponse
}
@ -109,13 +113,11 @@ func (o *PostCertificatesOK) Code() int {
}
func (o *PostCertificatesOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /certificates][%d] postCertificatesOK %s", 200, payload)
return fmt.Sprintf("[POST /certificates][%d] postCertificatesOK %+v", 200, o.Payload)
}
func (o *PostCertificatesOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /certificates][%d] postCertificatesOK %s", 200, payload)
return fmt.Sprintf("[POST /certificates][%d] postCertificatesOK %+v", 200, o.Payload)
}
func (o *PostCertificatesOK) GetPayload() *members_models.CertificateResponse {
@ -127,7 +129,7 @@ func (o *PostCertificatesOK) readResponse(response runtime.ClientResponse, consu
o.Payload = new(members_models.CertificateResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -139,9 +141,11 @@ func NewPostCertificatesUnauthorized() *PostCertificatesUnauthorized {
return &PostCertificatesUnauthorized{}
}
// PostCertificatesUnauthorized describes a response with status code 401, with default header values.
//
// Access Unauthorized, invalid API-KEY was used
/*
PostCertificatesUnauthorized describes a response with status code 401, with default header values.
Access Unauthorized, invalid API-KEY was used
*/
type PostCertificatesUnauthorized struct {
Payload *members_models.Error
}
@ -177,13 +181,11 @@ func (o *PostCertificatesUnauthorized) Code() int {
}
func (o *PostCertificatesUnauthorized) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /certificates][%d] postCertificatesUnauthorized %s", 401, payload)
return fmt.Sprintf("[POST /certificates][%d] postCertificatesUnauthorized %+v", 401, o.Payload)
}
func (o *PostCertificatesUnauthorized) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /certificates][%d] postCertificatesUnauthorized %s", 401, payload)
return fmt.Sprintf("[POST /certificates][%d] postCertificatesUnauthorized %+v", 401, o.Payload)
}
func (o *PostCertificatesUnauthorized) GetPayload() *members_models.Error {
@ -195,7 +197,7 @@ func (o *PostCertificatesUnauthorized) readResponse(response runtime.ClientRespo
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -207,9 +209,11 @@ func NewPostCertificatesForbidden() *PostCertificatesForbidden {
return &PostCertificatesForbidden{}
}
// PostCertificatesForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
/*
PostCertificatesForbidden describes a response with status code 403, with default header values.
Access forbidden, account lacks access
*/
type PostCertificatesForbidden struct {
AccessControlAllowOrigin string
@ -247,13 +251,11 @@ func (o *PostCertificatesForbidden) Code() int {
}
func (o *PostCertificatesForbidden) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /certificates][%d] postCertificatesForbidden %s", 403, payload)
return fmt.Sprintf("[POST /certificates][%d] postCertificatesForbidden %+v", 403, o.Payload)
}
func (o *PostCertificatesForbidden) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /certificates][%d] postCertificatesForbidden %s", 403, payload)
return fmt.Sprintf("[POST /certificates][%d] postCertificatesForbidden %+v", 403, o.Payload)
}
func (o *PostCertificatesForbidden) GetPayload() *members_models.Error {
@ -272,7 +274,7 @@ func (o *PostCertificatesForbidden) readResponse(response runtime.ClientResponse
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -284,9 +286,11 @@ func NewPostCertificatesNotFound() *PostCertificatesNotFound {
return &PostCertificatesNotFound{}
}
// PostCertificatesNotFound describes a response with status code 404, with default header values.
//
// Resource was not found
/*
PostCertificatesNotFound describes a response with status code 404, with default header values.
Resource was not found
*/
type PostCertificatesNotFound struct {
Payload *members_models.Error
}
@ -322,13 +326,11 @@ func (o *PostCertificatesNotFound) Code() int {
}
func (o *PostCertificatesNotFound) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /certificates][%d] postCertificatesNotFound %s", 404, payload)
return fmt.Sprintf("[POST /certificates][%d] postCertificatesNotFound %+v", 404, o.Payload)
}
func (o *PostCertificatesNotFound) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /certificates][%d] postCertificatesNotFound %s", 404, payload)
return fmt.Sprintf("[POST /certificates][%d] postCertificatesNotFound %+v", 404, o.Payload)
}
func (o *PostCertificatesNotFound) GetPayload() *members_models.Error {
@ -340,7 +342,7 @@ func (o *PostCertificatesNotFound) readResponse(response runtime.ClientResponse,
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -352,9 +354,11 @@ func NewPostCertificatesUnprocessableEntity() *PostCertificatesUnprocessableEnti
return &PostCertificatesUnprocessableEntity{}
}
// PostCertificatesUnprocessableEntity describes a response with status code 422, with default header values.
//
// Unprocessable Entity, likely a bad parameter
/*
PostCertificatesUnprocessableEntity describes a response with status code 422, with default header values.
Unprocessable Entity, likely a bad parameter
*/
type PostCertificatesUnprocessableEntity struct {
Payload *members_models.Error
}
@ -390,13 +394,11 @@ func (o *PostCertificatesUnprocessableEntity) Code() int {
}
func (o *PostCertificatesUnprocessableEntity) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /certificates][%d] postCertificatesUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[POST /certificates][%d] postCertificatesUnprocessableEntity %+v", 422, o.Payload)
}
func (o *PostCertificatesUnprocessableEntity) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /certificates][%d] postCertificatesUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[POST /certificates][%d] postCertificatesUnprocessableEntity %+v", 422, o.Payload)
}
func (o *PostCertificatesUnprocessableEntity) GetPayload() *members_models.Error {
@ -408,7 +410,7 @@ func (o *PostCertificatesUnprocessableEntity) readResponse(response runtime.Clie
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -420,9 +422,11 @@ func NewPostCertificatesInternalServerError() *PostCertificatesInternalServerErr
return &PostCertificatesInternalServerError{}
}
// PostCertificatesInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
/*
PostCertificatesInternalServerError describes a response with status code 500, with default header values.
Server Internal Error
*/
type PostCertificatesInternalServerError struct {
Payload *members_models.Error
}
@ -458,13 +462,11 @@ func (o *PostCertificatesInternalServerError) Code() int {
}
func (o *PostCertificatesInternalServerError) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /certificates][%d] postCertificatesInternalServerError %s", 500, payload)
return fmt.Sprintf("[POST /certificates][%d] postCertificatesInternalServerError %+v", 500, o.Payload)
}
func (o *PostCertificatesInternalServerError) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /certificates][%d] postCertificatesInternalServerError %s", 500, payload)
return fmt.Sprintf("[POST /certificates][%d] postCertificatesInternalServerError %+v", 500, o.Payload)
}
func (o *PostCertificatesInternalServerError) GetPayload() *members_models.Error {
@ -476,7 +478,7 @@ func (o *PostCertificatesInternalServerError) readResponse(response runtime.Clie
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}

View File

@ -6,16 +6,20 @@
package certificates
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"code.tnxs.net/vernonkeenan/lib/api/members/members_models"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/members/members_models"
)
// NewPutCertificatesParams creates a new PutCertificatesParams object,
@ -25,28 +29,24 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewPutCertificatesParams() *PutCertificatesParams {
return NewPutCertificatesParamsWithTimeout(cr.DefaultTimeout)
return &PutCertificatesParams{
timeout: cr.DefaultTimeout,
}
}
// NewPutCertificatesParamsWithTimeout creates a new PutCertificatesParams object
// with the ability to set a timeout on a request.
func NewPutCertificatesParamsWithTimeout(timeout time.Duration) *PutCertificatesParams {
return &PutCertificatesParams{
inner: innerParams{
timeout: timeout,
},
}
}
// NewPutCertificatesParamsWithContext creates a new PutCertificatesParams object
// with the ability to set a context for a request.
//
// Deprecated: use the operation call with context to pass the context instead of [PutCertificatesParams].
func NewPutCertificatesParamsWithContext(ctx context.Context) *PutCertificatesParams {
return &PutCertificatesParams{
inner: innerParams{
ctx: ctx,
},
Context: ctx,
}
}
@ -67,14 +67,15 @@ PutCertificatesParams contains all the parameters to send to the API endpoint
*/
type PutCertificatesParams struct {
// CertificateRequest.
//
// An array of new Certificate records
/* CertificateRequest.
An array of new Certificate records
*/
CertificateRequest *members_models.CertificateRequest
timeout time.Duration
Context context.Context
HTTPClient *http.Client
inner innerParams
}
// WithDefaults hydrates default values in the put certificates params (not the query body).
@ -92,57 +93,54 @@ func (o *PutCertificatesParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the put certificates params.
// WithTimeout adds the timeout to the put certificates params
func (o *PutCertificatesParams) WithTimeout(timeout time.Duration) *PutCertificatesParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the put certificates params.
// SetTimeout adds the timeout to the put certificates params
func (o *PutCertificatesParams) SetTimeout(timeout time.Duration) {
o.inner.timeout = timeout
o.timeout = timeout
}
// WithContext adds the context to the put certificates params.
//
// Deprecated: use the operation call with context to pass the context instead of [PutCertificatesParams].
// WithContext adds the context to the put certificates params
func (o *PutCertificatesParams) WithContext(ctx context.Context) *PutCertificatesParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the put certificates params.
//
// Deprecated: use the operation call with context to pass the context instead of [PutCertificatesParams].
// SetContext adds the context to the put certificates params
func (o *PutCertificatesParams) SetContext(ctx context.Context) {
o.inner.ctx = ctx
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the put certificates params.
// WithHTTPClient adds the HTTPClient to the put certificates params
func (o *PutCertificatesParams) WithHTTPClient(client *http.Client) *PutCertificatesParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the put certificates params.
// SetHTTPClient adds the HTTPClient to the put certificates params
func (o *PutCertificatesParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithCertificateRequest adds the certificateRequest to the put certificates params.
// WithCertificateRequest adds the certificateRequest to the put certificates params
func (o *PutCertificatesParams) WithCertificateRequest(certificateRequest *members_models.CertificateRequest) *PutCertificatesParams {
o.SetCertificateRequest(certificateRequest)
return o
}
// SetCertificateRequest adds the certificateRequest to the put certificates params.
// SetCertificateRequest adds the certificateRequest to the put certificates params
func (o *PutCertificatesParams) SetCertificateRequest(certificateRequest *members_models.CertificateRequest) {
o.CertificateRequest = certificateRequest
}
// WriteToRequest writes these params to a [runtime.ClientRequest].
// WriteToRequest writes these params to a swagger request
func (o *PutCertificatesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.inner.timeout); err != nil {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error

View File

@ -6,15 +6,17 @@
package certificates
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
stderrors "errors"
"fmt"
"io"
"code.tnxs.net/vernonkeenan/lib/api/members/members_models"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/members/members_models"
)
// PutCertificatesReader is a Reader for the PutCertificates structure.
@ -23,7 +25,7 @@ type PutCertificatesReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *PutCertificatesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
func (o *PutCertificatesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewPutCertificatesOK()
@ -62,7 +64,7 @@ func (o *PutCertificatesReader) ReadResponse(response runtime.ClientResponse, co
}
return nil, result
default:
return nil, runtime.NewAPIError("[PUT /certificates] putCertificates", response, response.Code())
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
@ -71,9 +73,11 @@ func NewPutCertificatesOK() *PutCertificatesOK {
return &PutCertificatesOK{}
}
// PutCertificatesOK describes a response with status code 200, with default header values.
//
// Certificate Response Object
/*
PutCertificatesOK describes a response with status code 200, with default header values.
Certificate Response Object
*/
type PutCertificatesOK struct {
Payload *members_models.CertificateResponse
}
@ -109,13 +113,11 @@ func (o *PutCertificatesOK) Code() int {
}
func (o *PutCertificatesOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesOK %s", 200, payload)
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesOK %+v", 200, o.Payload)
}
func (o *PutCertificatesOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesOK %s", 200, payload)
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesOK %+v", 200, o.Payload)
}
func (o *PutCertificatesOK) GetPayload() *members_models.CertificateResponse {
@ -127,7 +129,7 @@ func (o *PutCertificatesOK) readResponse(response runtime.ClientResponse, consum
o.Payload = new(members_models.CertificateResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -139,9 +141,11 @@ func NewPutCertificatesUnauthorized() *PutCertificatesUnauthorized {
return &PutCertificatesUnauthorized{}
}
// PutCertificatesUnauthorized describes a response with status code 401, with default header values.
//
// Access Unauthorized, invalid API-KEY was used
/*
PutCertificatesUnauthorized describes a response with status code 401, with default header values.
Access Unauthorized, invalid API-KEY was used
*/
type PutCertificatesUnauthorized struct {
Payload *members_models.Error
}
@ -177,13 +181,11 @@ func (o *PutCertificatesUnauthorized) Code() int {
}
func (o *PutCertificatesUnauthorized) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesUnauthorized %s", 401, payload)
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesUnauthorized %+v", 401, o.Payload)
}
func (o *PutCertificatesUnauthorized) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesUnauthorized %s", 401, payload)
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesUnauthorized %+v", 401, o.Payload)
}
func (o *PutCertificatesUnauthorized) GetPayload() *members_models.Error {
@ -195,7 +197,7 @@ func (o *PutCertificatesUnauthorized) readResponse(response runtime.ClientRespon
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -207,9 +209,11 @@ func NewPutCertificatesForbidden() *PutCertificatesForbidden {
return &PutCertificatesForbidden{}
}
// PutCertificatesForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
/*
PutCertificatesForbidden describes a response with status code 403, with default header values.
Access forbidden, account lacks access
*/
type PutCertificatesForbidden struct {
AccessControlAllowOrigin string
@ -247,13 +251,11 @@ func (o *PutCertificatesForbidden) Code() int {
}
func (o *PutCertificatesForbidden) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesForbidden %s", 403, payload)
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesForbidden %+v", 403, o.Payload)
}
func (o *PutCertificatesForbidden) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesForbidden %s", 403, payload)
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesForbidden %+v", 403, o.Payload)
}
func (o *PutCertificatesForbidden) GetPayload() *members_models.Error {
@ -272,7 +274,7 @@ func (o *PutCertificatesForbidden) readResponse(response runtime.ClientResponse,
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -284,9 +286,11 @@ func NewPutCertificatesNotFound() *PutCertificatesNotFound {
return &PutCertificatesNotFound{}
}
// PutCertificatesNotFound describes a response with status code 404, with default header values.
//
// Resource was not found
/*
PutCertificatesNotFound describes a response with status code 404, with default header values.
Resource was not found
*/
type PutCertificatesNotFound struct {
Payload *members_models.Error
}
@ -322,13 +326,11 @@ func (o *PutCertificatesNotFound) Code() int {
}
func (o *PutCertificatesNotFound) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesNotFound %s", 404, payload)
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesNotFound %+v", 404, o.Payload)
}
func (o *PutCertificatesNotFound) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesNotFound %s", 404, payload)
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesNotFound %+v", 404, o.Payload)
}
func (o *PutCertificatesNotFound) GetPayload() *members_models.Error {
@ -340,7 +342,7 @@ func (o *PutCertificatesNotFound) readResponse(response runtime.ClientResponse,
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -352,9 +354,11 @@ func NewPutCertificatesUnprocessableEntity() *PutCertificatesUnprocessableEntity
return &PutCertificatesUnprocessableEntity{}
}
// PutCertificatesUnprocessableEntity describes a response with status code 422, with default header values.
//
// Unprocessable Entity, likely a bad parameter
/*
PutCertificatesUnprocessableEntity describes a response with status code 422, with default header values.
Unprocessable Entity, likely a bad parameter
*/
type PutCertificatesUnprocessableEntity struct {
Payload *members_models.Error
}
@ -390,13 +394,11 @@ func (o *PutCertificatesUnprocessableEntity) Code() int {
}
func (o *PutCertificatesUnprocessableEntity) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesUnprocessableEntity %+v", 422, o.Payload)
}
func (o *PutCertificatesUnprocessableEntity) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesUnprocessableEntity %s", 422, payload)
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesUnprocessableEntity %+v", 422, o.Payload)
}
func (o *PutCertificatesUnprocessableEntity) GetPayload() *members_models.Error {
@ -408,7 +410,7 @@ func (o *PutCertificatesUnprocessableEntity) readResponse(response runtime.Clien
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
@ -420,9 +422,11 @@ func NewPutCertificatesInternalServerError() *PutCertificatesInternalServerError
return &PutCertificatesInternalServerError{}
}
// PutCertificatesInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
/*
PutCertificatesInternalServerError describes a response with status code 500, with default header values.
Server Internal Error
*/
type PutCertificatesInternalServerError struct {
Payload *members_models.Error
}
@ -458,13 +462,11 @@ func (o *PutCertificatesInternalServerError) Code() int {
}
func (o *PutCertificatesInternalServerError) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesInternalServerError %s", 500, payload)
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesInternalServerError %+v", 500, o.Payload)
}
func (o *PutCertificatesInternalServerError) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesInternalServerError %s", 500, payload)
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesInternalServerError %+v", 500, o.Payload)
}
func (o *PutCertificatesInternalServerError) GetPayload() *members_models.Error {
@ -476,7 +478,7 @@ func (o *PutCertificatesInternalServerError) readResponse(response runtime.Clien
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}

Some files were not shown because too many files have changed in this diff Show More