Compare commits

...

20 Commits

Author SHA1 Message Date
Vernon Keenan c818c034cd
Merge pull request #5 from vernonkeenan/feat/regen-clients-processor-token
regen: refresh all sibling clients (go-swagger v0.35.0)
2026-07-12 00:23:36 -07:00
Vernon Keenan add52157dd regen: refresh all sibling clients (go-swagger v0.35.0)
Runs scripts/release.sh regen against current origin/main specs for
auth, crm, stash, sf-gate, research, members, and plex. Picks up:

- members PaymentMethod: processor_token/tenant_id replace card_* columns
  (go/db v0.7.3, ADR-KV-014 first exercise) — generated model now carries
  ProcessorToken/TenantID with no Card* fields.
- sf-gate: PUT /researchprojectservices now has a tags: entry (sf-gate #3),
  so its operation generates into the research_projects package under
  --client-package instead of falling back to an untagged operations
  package that broke the build.
- members: session handoff endpoints and onboard_request model (current
  members spec); webhooks/clerk endpoints removed (retired upstream).

Also bumps go-openapi/runtime v0.26.2 -> v0.32.4 (go mod tidy) — go-swagger
v0.35.0 client templates reference runtime.ContextualTransport, which
v0.26.2 doesn't have; this is a genuine dependency floor bump, not the
known untagged-operation issue documented in release.sh (that issue is
resolved by sf-gate #3 and no longer reproduces here).

go build ./..., go vet ./..., and go test ./... all pass on the
regenerated tree.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-12 07:22:01 +00:00
Vernon Keenan e676f0e6b8
Update PaymentMethod swagger def for processor_token migration (#4)
go/db v0.7.3 replaced the card_* columns with processor_token. Drop
CardHolderName/CardNumber/CardType/ExpirationMonth/ExpirationYear and
add ProcessorToken + TenantID to match prod DDL truth (sql/members.sql).

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-12 00:01:14 -07:00
Vernon Keenan 05b7ffcca2
Merge pull request #3 from vernonkeenan/feat/scripted-release
feat: replace manual release ritual with make release (ADR-KV-014)
2026-07-11 23:52:07 -07:00
Vernon Keenan 8ef777c7e6 feat: replace manual release ritual with `make release` (ADR-KV-014)
The README's "Update Procedure" required three web UIs (GitHub branch
defaults, GitHub releases, Gitea "Synchronize Now") and a go-swagger CLI
installed nowhere. Now that lib is main+tags instead of branch-per-version,
replace it with scripts/release.sh driven through the Makefile:

- `make install-swagger` installs a pinned go-swagger (v0.35.0) and
  verifies the version.
- `make regen` copies the sibling service specs and regenerates api/
  clients exactly as the old `make swagger` ritual did, failing fast if
  a sibling spec is missing. Regen output is reviewed/committed as its
  own PR, same as any other change.
- `make release VERSION=vX.Y.Z` / `make release-dry-run VERSION=vX.Y.Z`
  validate semver + monotonicity, require a clean main checkout synced
  with origin/main, tag, push, `gh release create`, and POST to the
  Gitea mirror-sync API for the vernonkeenan/lib and work/lib mirrors
  (skipped with a loud warning if GITEA_TOKEN is unset).

Also scope the CI push trigger to `main` + `v*` tags instead of every
branch, so PRs (which already run via the `pull_request` trigger) stop
double-running.

Verified locally: bash -n + shellcheck clean; install-swagger into a
temp GOBIN across go-swagger v0.33.2-v0.35.0; semver/monotonicity/
tag-exists/branch/origin-sync validation failure paths; a full regen
against the real sibling specs in a scratch dir (never the checked-out
api/swagger). That regen surfaced a real go-swagger limitation --
documented in the README and as a warning in the script -- reproduced
across all four installable versions: an untagged operation in
sf-gate-vernonkeenan.yaml produces a client that doesn't compile.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-12 06:49:23 +00:00
Vernon Keenan a906d56678
Merge pull request #2 from vernonkeenan/test/app-service-helpers
Add unit tests for app/service-helpers.go pure helpers
2026-07-11 23:20:48 -07:00
Vernon Keenan 36d068664d Add table-driven unit tests for app/service-helpers.go pure helpers
GetFieldsAndValues, SqlDateToString, ParseDateTime, and IsZero had zero
test coverage even though they're pure, hermetic logic with several
non-obvious behaviors (e.g. strings always count as "non-zero", arrays
are compared by length only, and the dateTimeFormat's "-0800" suffix is
a Go reference-time artifact that behaves as a literal string rather
than a real timezone offset). Locking these in with tests now, ahead of
any future refactor of this file, so behavior changes are caught
instead of silently shipped.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-12 06:07:44 +00:00
Vernon Keenan 48d3f6a97a
Merge pull request #1 from vernonkeenan/ci/first-ci-gitleaks
ci: first-ever build/vet/test + gitleaks CI (ADR-KV-014)
2026-07-11 23:00:40 -07:00
Vernon Keenan c7327fd313 ci: add first-ever build/vet/test + gitleaks CI (ADR-KV-014)
lib is publicly mirrored on code.tnxs.net and had no CI at all. Add
.github/workflows/push.yml gating every push/PR on the private
self-hosted runner (ADR-KV-004): a test job (go build/vet/test) and a
gitleaks secret-scan job using the official docker image directly
(gitleaks/gitleaks-action needs an org license we don't have).

The gitleaks history scan surfaced 6 findings, all illustrative
`example:` JWTs hardcoded by swagger-codegen into the generated Kazoo
API client models and the vendored Kazoo swagger spec — placeholders
from the vendor's public docs, not real credentials. Added a minimal
.gitleaks.toml allowlist scoped to just those four generated files so
CI runs clean without masking real findings elsewhere.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-12 05:23:59 +00:00
Vernon Keenan a13ad35fe2 feat(api): Generate session management API client and models
- Added `get_me` and `refresh_session` parameters and responses for user session management.
- Implemented `sessions_client` for handling session-related API calls.
- Created models for `Credentials`, `Category`, `Product`, and `Service` with validation.
- Defined Swagger specifications for `Credentials`.
- Ensured all generated files are marked as non-editable to prevent manual changes.
2025-05-27 03:20:36 +00:00
Vernon Keenan 2e3fdeec39 Refactor Swagger definitions to use external references for Address, CompanyProduct, CompanyService, Factor, FinancialStatement, Industry, IndustryCompany, IndustryProduct, IndustryService, Observation, and Topic. This improves modularity and maintainability of the API specification. 2025-05-01 18:45:54 +00:00
Vernon Keenan 7b878f86d5 feat: Replace AccountID with CompanyID in GetIndustryCompaniesParams and update related Swagger definitions 2025-04-30 18:42:56 +00:00
Vernon Keenan 6f44181e08 feat: Add enrichment fields to Account, CompanyProduct, and CompanyService models 2025-04-29 04:48:58 +00:00
Vernon Keenan 18bfdecdbe Refactor code structure for improved readability and maintainability 2025-04-29 04:22:59 +00:00
Vernon Keenan e64482991c feat: Add Channels field to Account and Contact models
The code changes include adding the `Channels` field to the `Account` and `Contact` models in the `crm` and `sfgate` packages. This field is used to store the marketing channels for the respective entities.
2024-06-30 21:03:06 +00:00
Vernon Keenan 7eb2060c65 feat: Add AppExchange URL field to CompanyProduct model 2024-06-29 00:23:11 +00:00
Vernon Keenan 6846446ffa feat: Add AppExchange URL field to CompanyProduct model
The code changes include adding the `AppExchange` field to the `CompanyProduct` model in the `sfgate` package. This field is used to store the Salesforce AppExchange URL.
2024-06-28 23:09:29 +00:00
Vernon Keenan 4d2d5bf861 feat: Add AppExchange URL field to Account and Company models
The code changes include adding the `AppExchange` field to the `Account` and `Company` models in the `sfgate` and `plex` packages. This field is used to store the Salesforce AppExchange URL.
2024-06-28 22:40:38 +00:00
Vernon Keenan 29f3ad980d Add FullDescription field to Account model and related structs 2024-06-27 18:26:58 +00:00
Vernon Keenan 6d0cc3e67d Add FullDescription field to Industry model and related structs 2024-01-22 15:39:53 +00:00
957 changed files with 54087 additions and 35895 deletions

59
.github/workflows/push.yml vendored Normal file
View File

@ -0,0 +1,59 @@
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
- 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

20
.gitleaks.toml Normal file
View File

@ -0,0 +1,20 @@
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''',
]

188
Makefile
View File

@ -1,157 +1,35 @@
.PHONY: swagger
# 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
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
.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

View File

@ -4,24 +4,69 @@ vernonkeenan Shared Libraries (go)
## Dependent Systems
The Gitea server <https://code.tnxs.net> must be up and running with admin access.
The Gitea server <https://code.tnxs.net> must be up and running with admin access. It hosts world-readable
pull-mirrors of this repo at `vernonkeenan/lib` and `work/lib`.
## Update Procedure
## Release Procedure
Prerequisite: All the other repos are cloned locally in adjacent directories.
As of 2026-07-12 (ADR-KV-014, DT-KV-004) this repo is `main` + `v*` tags — branch-per-version is retired, and
so is the old three-web-UI-plus-CLI manual ritual. Releasing is one command: `make release VERSION=vX.Y.Z`.
* Increment branch number in local repo
### Prerequisites
* Generate all OpenAPI libraries and then cleanup modules
* All the sibling service repos (`auth`, `crm`, `stash`, `sf-gate`, `research`, `members`, `plex`) are cloned
locally in adjacent directories — `regen` reads each one's `swagger/<service>-vernonkeenan.yaml`.
* [`gh`](https://cli.github.com/) installed and authenticated (`gh auth login`) with push access to
`vernonkeenan/lib` — the release step calls `gh release create`.
* `GITEA_TOKEN` exported, set to a Gitea API token (Settings -> Applications on <https://code.tnxs.net>) with
rights to trigger a mirror-sync on `vernonkeenan/lib` and `work/lib`. If unset, `make release` still tags,
pushes, and publishes the GitHub release — it just skips the Gitea mirror-sync step with a loud warning, so
the mirrors will lag until someone clicks Synchronize Now manually or reruns with the token set. (There is
no existing Gitea/tnxs token variable defined anywhere in this workstation's env files today — `GITEA_TOKEN`
is a new name, not a rename of something already in use.)
### 1. Regenerate the API clients (its own PR)
```bash
make swagger
go get -u -f ./...
go mod tidy
make regen
```
* 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.
This installs the pinned go-swagger CLI (`SWAGGER_VERSION` in the `Makefile`, currently `v0.35.0` — bump
deliberately and update both places when you do), copies each sibling repo's `swagger/<service>-vernonkeenan.yaml`
into `./swagger` and `./swagger/external`, regenerates every client under `api/`, and rewrites the external
specs' scheme/host/path exactly as 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 not bundled into the release step itself. `make regen` runs a non-fatal `go build ./...` at the end as an
early warning; the real gate is CI on that PR.
**Known gap:** 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. As of
this writing that's `sf-gate-vernonkeenan.yaml`'s `PUT /researchprojectservices` (no `tags:`). Fix it at the
source (add a `tags:` entry in the `sf-gate` repo's spec) rather than hand-patching generated code, since the
next regen would just reintroduce it.
### 2. Cut the release (from a clean `main` checkout)
```bash
make release VERSION=v0.7.5
```
`scripts/release.sh` (invoked by the `release` target):
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 to the Gitea mirror-sync API for `vernonkeenan/lib` and `work/lib` (skipped with a warning if
`GITEA_TOKEN` is unset).
Use `make release-dry-run VERSION=v0.7.5` to run steps 1-3 and print what steps 4-5 would do, without tagging,
pushing, publishing, or syncing anything.
### 3. Downstream consumers
Update the `go.mod` line for `code.tnxs.net/vernonkeenan/lib` in each dependent project to the new tag, same
as before — that part of the old ritual is unchanged.

View File

@ -6,30 +6,26 @@
package auth_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"
"code.tnxs.net/vernonkeenan/lib/api/auth/auth_client/user"
"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.
@ -45,13 +41,16 @@ 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.ClientTransport, formats strfmt.Registry) *Auth {
// New creates a new auth client.
func New(transport runtime.ContextualTransport, formats strfmt.Registry) *Auth {
// ensure nullable parameters have default
if formats == nil {
formats = strfmt.Default
@ -60,6 +59,7 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) *Auth {
cli := new(Auth)
cli.Transport = transport
cli.User = user.New(transport, formats)
return cli
}
@ -76,9 +76,11 @@ func DefaultTransportConfig() *TransportConfig {
// TransportConfig contains the transport related info,
// found in the meta section of the spec file.
type TransportConfig struct {
Host string
BasePath string
Schemes []string
Host string
BasePath string
Schemes []string
Producers map[string]runtime.Producer
Consumers map[string]runtime.Consumer
}
// WithHost overrides the default host,
@ -102,15 +104,27 @@ func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig {
return cfg
}
// Auth is a client for auth
// 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.
type Auth struct {
User user.ClientService
Transport runtime.ClientTransport
Transport runtime.ContextualTransport
}
// SetTransport changes the transport on the client and all its subresources
func (c *Auth) SetTransport(transport runtime.ClientTransport) {
// SetTransport changes the transport on the client and all its subresources.
func (c *Auth) SetTransport(transport runtime.ContextualTransport) {
c.Transport = transport
c.User.SetTransport(transport)
}

View File

@ -6,9 +6,6 @@
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"
@ -27,24 +24,28 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewGetUsersParams() *GetUsersParams {
return &GetUsersParams{
timeout: cr.DefaultTimeout,
}
return NewGetUsersParamsWithTimeout(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{
timeout: timeout,
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{
Context: ctx,
inner: innerParams{
ctx: ctx,
},
}
}
@ -65,15 +66,14 @@ 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,54 +91,57 @@ 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.timeout = timeout
o.inner.timeout = timeout
}
// WithContext adds the context to the get users params
// WithContext adds the context to the get users params.
//
// Deprecated: use the operation call with context to pass the context instead of [GetUsersParams].
func (o *GetUsersParams) WithContext(ctx context.Context) *GetUsersParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get users params
// SetContext adds the context to the get users params.
//
// Deprecated: use the operation call with context to pass the context instead of [GetUsersParams].
func (o *GetUsersParams) SetContext(ctx context.Context) {
o.Context = ctx
o.inner.ctx = 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 swagger request
// WriteToRequest writes these params to a [runtime.ClientRequest].
func (o *GetUsersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
if err := r.SetTimeout(o.inner.timeout); err != nil {
return err
}
var res []error

View File

@ -6,17 +6,15 @@
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.
@ -25,7 +23,7 @@ type GetUsersReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *GetUsersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
func (o *GetUsersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
switch response.Code() {
case 200:
result := NewGetUsersOK()
@ -64,7 +62,7 @@ func (o *GetUsersReader) ReadResponse(response runtime.ClientResponse, consumer
}
return nil, result
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
return nil, runtime.NewAPIError("[GET /users] getUsers", response, response.Code())
}
}
@ -73,11 +71,9 @@ 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
}
@ -113,11 +109,13 @@ func (o *GetUsersOK) Code() int {
}
func (o *GetUsersOK) Error() string {
return fmt.Sprintf("[GET /users][%d] getUsersOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /users][%d] getUsersOK %s", 200, payload)
}
func (o *GetUsersOK) String() string {
return fmt.Sprintf("[GET /users][%d] getUsersOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /users][%d] getUsersOK %s", 200, payload)
}
func (o *GetUsersOK) GetPayload() *auth_models.UserResponse {
@ -129,7 +127,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -141,11 +139,9 @@ 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
}
@ -181,11 +177,13 @@ func (o *GetUsersUnauthorized) Code() int {
}
func (o *GetUsersUnauthorized) Error() string {
return fmt.Sprintf("[GET /users][%d] getUsersUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /users][%d] getUsersUnauthorized %s", 401, payload)
}
func (o *GetUsersUnauthorized) String() string {
return fmt.Sprintf("[GET /users][%d] getUsersUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /users][%d] getUsersUnauthorized %s", 401, payload)
}
func (o *GetUsersUnauthorized) GetPayload() *auth_models.Error {
@ -197,7 +195,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -209,11 +207,9 @@ 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
}
@ -249,11 +245,13 @@ func (o *GetUsersForbidden) Code() int {
}
func (o *GetUsersForbidden) Error() string {
return fmt.Sprintf("[GET /users][%d] getUsersForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /users][%d] getUsersForbidden %s", 403, payload)
}
func (o *GetUsersForbidden) String() string {
return fmt.Sprintf("[GET /users][%d] getUsersForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /users][%d] getUsersForbidden %s", 403, payload)
}
func (o *GetUsersForbidden) GetPayload() *auth_models.Error {
@ -265,7 +263,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -277,11 +275,9 @@ 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
}
@ -317,11 +313,13 @@ func (o *GetUsersNotFound) Code() int {
}
func (o *GetUsersNotFound) Error() string {
return fmt.Sprintf("[GET /users][%d] getUsersNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /users][%d] getUsersNotFound %s", 404, payload)
}
func (o *GetUsersNotFound) String() string {
return fmt.Sprintf("[GET /users][%d] getUsersNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /users][%d] getUsersNotFound %s", 404, payload)
}
func (o *GetUsersNotFound) GetPayload() *auth_models.Error {
@ -333,7 +331,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -345,11 +343,9 @@ 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
}
@ -385,11 +381,13 @@ func (o *GetUsersUnprocessableEntity) Code() int {
}
func (o *GetUsersUnprocessableEntity) Error() string {
return fmt.Sprintf("[GET /users][%d] getUsersUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /users][%d] getUsersUnprocessableEntity %s", 422, payload)
}
func (o *GetUsersUnprocessableEntity) String() string {
return fmt.Sprintf("[GET /users][%d] getUsersUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /users][%d] getUsersUnprocessableEntity %s", 422, payload)
}
func (o *GetUsersUnprocessableEntity) GetPayload() *auth_models.Error {
@ -401,7 +399,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -413,11 +411,9 @@ 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
}
@ -453,11 +449,13 @@ func (o *GetUsersInternalServerError) Code() int {
}
func (o *GetUsersInternalServerError) Error() string {
return fmt.Sprintf("[GET /users][%d] getUsersInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /users][%d] getUsersInternalServerError %s", 500, payload)
}
func (o *GetUsersInternalServerError) String() string {
return fmt.Sprintf("[GET /users][%d] getUsersInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /users][%d] getUsersInternalServerError %s", 500, payload)
}
func (o *GetUsersInternalServerError) GetPayload() *auth_models.Error {
@ -469,7 +467,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}

View File

@ -6,49 +6,99 @@
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.ClientTransport, formats strfmt.Registry) ClientService {
func New(transport runtime.ContextualTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
/*
Client for user API
*/
// 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.
type Client struct {
transport runtime.ClientTransport
transport runtime.ContextualTransport
formats strfmt.Registry
}
// ClientOption is the option for Client methods
// ClientOption may be used to customize the behavior of 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)
SetTransport(transport runtime.ClientTransport)
// GetUsersContext check API key.
GetUsersContext(ctx context.Context, params *GetUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetUsersOK, error)
SetTransport(transport runtime.ContextualTransport)
}
/*
GetUsers checks API key
Checks for a valid API key, and returns full user record
*/
// 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.
func (a *Client) GetUsers(params *GetUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetUsersOK, error) {
// TODO: Validate the params before sending
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
if params == nil {
params = NewGetUsersParams()
}
op := &runtime.ClientOperation{
ID: "getUsers",
Method: "GET",
@ -59,28 +109,42 @@ func (a *Client) GetUsers(params *GetUsersParams, authInfo runtime.ClientAuthInf
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.Submit(op)
result, err := a.transport.SubmitContext(ctx, op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*GetUsersOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
// unexpected success response.
// no default response is defined.
//
// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for 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.ClientTransport) {
func (a *Client) SetTransport(transport runtime.ContextualTransport) {
a.transport = transport
}
// innerParams captures internal fields so they don't conflict with user-supplied parameters.
type innerParams struct {
timeout time.Duration
// Deprecated: use the operation call with context to pass the context instead of [UserParams].
ctx context.Context
}

View File

@ -6,14 +6,11 @@
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"
"github.com/go-openapi/swag/jsonutils"
)
// Address address
@ -58,13 +55,13 @@ func (m *Address) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Address) UnmarshalBinary(b []byte) error {
var res Address
if err := swag.ReadJSON(b, &res); err != nil {
if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,14 +6,11 @@
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"
"github.com/go-openapi/swag/jsonutils"
)
// Error error
@ -46,13 +43,13 @@ func (m *Error) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Error) UnmarshalBinary(b []byte) error {
var res Error
if err := swag.ReadJSON(b, &res); err != nil {
if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,14 +6,11 @@
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"
"github.com/go-openapi/swag/jsonutils"
)
// ResponseMeta response meta
@ -70,13 +67,13 @@ func (m *ResponseMeta) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *ResponseMeta) UnmarshalBinary(b []byte) error {
var res ResponseMeta
if err := swag.ReadJSON(b, &res); err != nil {
if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,14 +6,11 @@
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"
"github.com/go-openapi/swag/jsonutils"
)
// TenantUser Relationship object that connects users to a tenant
@ -85,13 +82,13 @@ func (m *TenantUser) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *TenantUser) UnmarshalBinary(b []byte) error {
var res TenantUser
if err := swag.ReadJSON(b, &res); err != nil {
if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,16 +6,15 @@
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"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag/typeutils"
)
// User user
@ -221,17 +220,21 @@ func (m *User) Validate(formats strfmt.Registry) error {
}
func (m *User) validateAddress(formats strfmt.Registry) error {
if swag.IsZero(m.Address) { // not required
if typeutils.IsZero(m.Address) { // not required
return nil
}
if m.Address != nil {
if err := m.Address.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Address")
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Address")
}
return err
}
}
@ -240,22 +243,26 @@ func (m *User) validateAddress(formats strfmt.Registry) error {
}
func (m *User) validateTenantUsers(formats strfmt.Registry) error {
if swag.IsZero(m.TenantUsers) { // not required
if typeutils.IsZero(m.TenantUsers) { // not required
return nil
}
for i := 0; i < len(m.TenantUsers); i++ {
if swag.IsZero(m.TenantUsers[i]) { // not required
if typeutils.IsZero(m.TenantUsers[i]) { // not required
continue
}
if m.TenantUsers[i] != nil {
if err := m.TenantUsers[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("TenantUsers" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("TenantUsers" + "." + strconv.Itoa(i))
}
return err
}
}
@ -266,22 +273,26 @@ func (m *User) validateTenantUsers(formats strfmt.Registry) error {
}
func (m *User) validateUserRoles(formats strfmt.Registry) error {
if swag.IsZero(m.UserRoles) { // not required
if typeutils.IsZero(m.UserRoles) { // not required
return nil
}
for i := 0; i < len(m.UserRoles); i++ {
if swag.IsZero(m.UserRoles[i]) { // not required
if typeutils.IsZero(m.UserRoles[i]) { // not required
continue
}
if m.UserRoles[i] != nil {
if err := m.UserRoles[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("UserRoles" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("UserRoles" + "." + strconv.Itoa(i))
}
return err
}
}
@ -316,12 +327,21 @@ 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 {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Address")
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Address")
}
return err
}
}
@ -334,12 +354,21 @@ 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 {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("TenantUsers" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("TenantUsers" + "." + strconv.Itoa(i))
}
return err
}
}
@ -354,12 +383,21 @@ 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 {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("UserRoles" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("UserRoles" + "." + strconv.Itoa(i))
}
return err
}
}
@ -374,13 +412,13 @@ func (m *User) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *User) UnmarshalBinary(b []byte) error {
var res User
if err := swag.ReadJSON(b, &res); err != nil {
if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,16 +6,15 @@
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"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag/typeutils"
)
// UserResponse An array Taxnexus user objects
@ -49,22 +48,26 @@ func (m *UserResponse) Validate(formats strfmt.Registry) error {
}
func (m *UserResponse) validateData(formats strfmt.Registry) error {
if swag.IsZero(m.Data) { // not required
if typeutils.IsZero(m.Data) { // not required
return nil
}
for i := 0; i < len(m.Data); i++ {
if swag.IsZero(m.Data[i]) { // not required
if typeutils.IsZero(m.Data[i]) { // not required
continue
}
if m.Data[i] != nil {
if err := m.Data[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -75,17 +78,21 @@ func (m *UserResponse) validateData(formats strfmt.Registry) error {
}
func (m *UserResponse) validateMeta(formats strfmt.Registry) error {
if swag.IsZero(m.Meta) { // not required
if typeutils.IsZero(m.Meta) { // not required
return nil
}
if m.Meta != nil {
if err := m.Meta.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Meta")
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Meta")
}
return err
}
}
@ -116,12 +123,21 @@ 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 {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -134,12 +150,21 @@ 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 {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Meta")
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Meta")
}
return err
}
}
@ -152,13 +177,13 @@ func (m *UserResponse) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *UserResponse) UnmarshalBinary(b []byte) error {
var res UserResponse
if err := swag.ReadJSON(b, &res); err != nil {
if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,14 +6,11 @@
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"
"github.com/go-openapi/swag/jsonutils"
)
// UserRole Relationship object that connects user to a role
@ -76,13 +73,13 @@ func (m *UserRole) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *UserRole) UnmarshalBinary(b []byte) error {
var res UserRole
if err := swag.ReadJSON(b, &res); err != nil {
if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,55 +6,117 @@
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.ClientTransport, formats strfmt.Registry) ClientService {
func New(transport runtime.ContextualTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
/*
Client for accounts API
*/
// 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.
type Client struct {
transport runtime.ClientTransport
transport runtime.ContextualTransport
formats strfmt.Registry
}
// ClientOption is the option for Client methods
// ClientOption may be used to customize the behavior of 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)
SetTransport(transport runtime.ClientTransport)
// PutAccountsContext update a single account.
PutAccountsContext(ctx context.Context, params *PutAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutAccountsOK, error)
SetTransport(transport runtime.ContextualTransport)
}
/*
DeleteAccount deletes an account
Delete SalesforceDevops.net Account record
*/
// 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.
func (a *Client) DeleteAccount(params *DeleteAccountParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAccountOK, error) {
// TODO: Validate the params before sending
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
if params == nil {
params = NewDeleteAccountParams()
}
op := &runtime.ClientOperation{
ID: "deleteAccount",
Method: "DELETE",
@ -65,37 +127,63 @@ func (a *Client) DeleteAccount(params *DeleteAccountParams, authInfo runtime.Cli
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.Submit(op)
result, err := a.transport.SubmitContext(ctx, op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*DeleteAccountOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
// unexpected success response.
// no default response is defined.
//
// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for 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
*/
// 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.
func (a *Client) GetAccounts(params *GetAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAccountsOK, error) {
// TODO: Validate the params before sending
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
if params == nil {
params = NewGetAccountsParams()
}
op := &runtime.ClientOperation{
ID: "getAccounts",
Method: "GET",
@ -106,37 +194,63 @@ func (a *Client) GetAccounts(params *GetAccountsParams, authInfo runtime.ClientA
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.Submit(op)
result, err := a.transport.SubmitContext(ctx, op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*GetAccountsOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
// unexpected success response.
// no default response is defined.
//
// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for 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
*/
// 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.
func (a *Client) PostAccounts(params *PostAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAccountsOK, error) {
// TODO: Validate the params before sending
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
if params == nil {
params = NewPostAccountsParams()
}
op := &runtime.ClientOperation{
ID: "postAccounts",
Method: "POST",
@ -147,37 +261,63 @@ func (a *Client) PostAccounts(params *PostAccountsParams, authInfo runtime.Clien
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.Submit(op)
result, err := a.transport.SubmitContext(ctx, op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*PostAccountsOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
// unexpected success response.
// no default response is defined.
//
// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for 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
*/
// 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.
func (a *Client) PutAccounts(params *PutAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutAccountsOK, error) {
// TODO: Validate the params before sending
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
if params == nil {
params = NewPutAccountsParams()
}
op := &runtime.ClientOperation{
ID: "putAccounts",
Method: "PUT",
@ -188,28 +328,42 @@ func (a *Client) PutAccounts(params *PutAccountsParams, authInfo runtime.ClientA
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.Submit(op)
result, err := a.transport.SubmitContext(ctx, op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*PutAccountsOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
// unexpected success response.
// no default response is defined.
//
// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for 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.ClientTransport) {
func (a *Client) SetTransport(transport runtime.ContextualTransport) {
a.transport = transport
}
// innerParams captures internal fields so they don't conflict with user-supplied parameters.
type innerParams struct {
timeout time.Duration
// Deprecated: use the operation call with context to pass the context instead of [AccountsParams].
ctx context.Context
}

View File

@ -6,9 +6,6 @@
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"
@ -27,24 +24,28 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewDeleteAccountParams() *DeleteAccountParams {
return &DeleteAccountParams{
timeout: cr.DefaultTimeout,
}
return NewDeleteAccountParamsWithTimeout(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{
timeout: timeout,
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{
Context: ctx,
inner: innerParams{
ctx: ctx,
},
}
}
@ -65,15 +66,14 @@ 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,54 +91,57 @@ 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.timeout = timeout
o.inner.timeout = timeout
}
// WithContext adds the context to the delete account params
// WithContext adds the context to the delete account params.
//
// Deprecated: use the operation call with context to pass the context instead of [DeleteAccountParams].
func (o *DeleteAccountParams) WithContext(ctx context.Context) *DeleteAccountParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the delete account params
// SetContext adds the context to the delete account params.
//
// Deprecated: use the operation call with context to pass the context instead of [DeleteAccountParams].
func (o *DeleteAccountParams) SetContext(ctx context.Context) {
o.Context = ctx
o.inner.ctx = 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 swagger request
// WriteToRequest writes these params to a [runtime.ClientRequest].
func (o *DeleteAccountParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
if err := r.SetTimeout(o.inner.timeout); err != nil {
return err
}
var res []error

View File

@ -6,17 +6,15 @@
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.
@ -25,7 +23,7 @@ type DeleteAccountReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *DeleteAccountReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
func (o *DeleteAccountReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
switch response.Code() {
case 200:
result := NewDeleteAccountOK()
@ -64,7 +62,7 @@ func (o *DeleteAccountReader) ReadResponse(response runtime.ClientResponse, cons
}
return nil, result
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
return nil, runtime.NewAPIError("[DELETE /accounts] deleteAccount", response, response.Code())
}
}
@ -73,11 +71,9 @@ 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
@ -115,11 +111,13 @@ func (o *DeleteAccountOK) Code() int {
}
func (o *DeleteAccountOK) Error() string {
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountOK %s", 200, payload)
}
func (o *DeleteAccountOK) String() string {
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountOK %s", 200, payload)
}
func (o *DeleteAccountOK) GetPayload() *crm_models.DeleteResponse {
@ -138,7 +136,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -150,11 +148,9 @@ 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
@ -192,11 +188,13 @@ func (o *DeleteAccountUnauthorized) Code() int {
}
func (o *DeleteAccountUnauthorized) Error() string {
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountUnauthorized %s", 401, payload)
}
func (o *DeleteAccountUnauthorized) String() string {
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountUnauthorized %s", 401, payload)
}
func (o *DeleteAccountUnauthorized) GetPayload() *crm_models.Error {
@ -215,7 +213,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -227,11 +225,9 @@ 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
@ -269,11 +265,13 @@ func (o *DeleteAccountForbidden) Code() int {
}
func (o *DeleteAccountForbidden) Error() string {
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountForbidden %s", 403, payload)
}
func (o *DeleteAccountForbidden) String() string {
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountForbidden %s", 403, payload)
}
func (o *DeleteAccountForbidden) GetPayload() *crm_models.Error {
@ -292,7 +290,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -304,11 +302,9 @@ 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
@ -346,11 +342,13 @@ func (o *DeleteAccountNotFound) Code() int {
}
func (o *DeleteAccountNotFound) Error() string {
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountNotFound %s", 404, payload)
}
func (o *DeleteAccountNotFound) String() string {
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountNotFound %s", 404, payload)
}
func (o *DeleteAccountNotFound) GetPayload() *crm_models.Error {
@ -369,7 +367,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -381,11 +379,9 @@ 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
@ -423,11 +419,13 @@ func (o *DeleteAccountUnprocessableEntity) Code() int {
}
func (o *DeleteAccountUnprocessableEntity) Error() string {
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountUnprocessableEntity %s", 422, payload)
}
func (o *DeleteAccountUnprocessableEntity) String() string {
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountUnprocessableEntity %s", 422, payload)
}
func (o *DeleteAccountUnprocessableEntity) GetPayload() *crm_models.Error {
@ -446,7 +444,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -458,11 +456,9 @@ 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
@ -500,11 +496,13 @@ func (o *DeleteAccountInternalServerError) Code() int {
}
func (o *DeleteAccountInternalServerError) Error() string {
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountInternalServerError %s", 500, payload)
}
func (o *DeleteAccountInternalServerError) String() string {
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountInternalServerError %s", 500, payload)
}
func (o *DeleteAccountInternalServerError) GetPayload() *crm_models.Error {
@ -523,7 +521,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}

View File

@ -6,9 +6,6 @@
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"
@ -18,7 +15,7 @@ import (
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/swag/conv"
)
// NewGetAccountsParams creates a new GetAccountsParams object,
@ -28,24 +25,28 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewGetAccountsParams() *GetAccountsParams {
return &GetAccountsParams{
timeout: cr.DefaultTimeout,
}
return NewGetAccountsParamsWithTimeout(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{
timeout: timeout,
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{
Context: ctx,
inner: innerParams{
ctx: ctx,
},
}
}
@ -66,49 +67,43 @@ 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).
@ -126,109 +121,112 @@ 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.timeout = timeout
o.inner.timeout = timeout
}
// WithContext adds the context to the get accounts params
// WithContext adds the context to the get accounts params.
//
// Deprecated: use the operation call with context to pass the context instead of [GetAccountsParams].
func (o *GetAccountsParams) WithContext(ctx context.Context) *GetAccountsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get accounts params
// SetContext adds the context to the get accounts params.
//
// Deprecated: use the operation call with context to pass the context instead of [GetAccountsParams].
func (o *GetAccountsParams) SetContext(ctx context.Context) {
o.Context = ctx
o.inner.ctx = 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 swagger request
// WriteToRequest writes these params to a [runtime.ClientRequest].
func (o *GetAccountsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
if err := r.SetTimeout(o.inner.timeout); err != nil {
return err
}
var res []error
@ -258,7 +256,7 @@ func (o *GetAccountsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R
if o.Active != nil {
qrActive = *o.Active
}
qActive := swag.FormatBool(qrActive)
qActive := conv.FormatBool(qrActive)
if qActive != "" {
if err := r.SetQueryParam("active", qActive); err != nil {
@ -275,7 +273,7 @@ func (o *GetAccountsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R
if o.Limit != nil {
qrLimit = *o.Limit
}
qLimit := swag.FormatInt64(qrLimit)
qLimit := conv.FormatInteger(qrLimit)
if qLimit != "" {
if err := r.SetQueryParam("limit", qLimit); err != nil {
@ -309,7 +307,7 @@ func (o *GetAccountsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R
if o.Offset != nil {
qrOffset = *o.Offset
}
qOffset := swag.FormatInt64(qrOffset)
qOffset := conv.FormatInteger(qrOffset)
if qOffset != "" {
if err := r.SetQueryParam("offset", qOffset); err != nil {

View File

@ -6,17 +6,15 @@
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.
@ -25,7 +23,7 @@ type GetAccountsReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *GetAccountsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
func (o *GetAccountsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
switch response.Code() {
case 200:
result := NewGetAccountsOK()
@ -64,7 +62,7 @@ func (o *GetAccountsReader) ReadResponse(response runtime.ClientResponse, consum
}
return nil, result
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
return nil, runtime.NewAPIError("[GET /accounts] getAccounts", response, response.Code())
}
}
@ -73,11 +71,9 @@ 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
@ -116,11 +112,13 @@ func (o *GetAccountsOK) Code() int {
}
func (o *GetAccountsOK) Error() string {
return fmt.Sprintf("[GET /accounts][%d] getAccountsOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /accounts][%d] getAccountsOK %s", 200, payload)
}
func (o *GetAccountsOK) String() string {
return fmt.Sprintf("[GET /accounts][%d] getAccountsOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /accounts][%d] getAccountsOK %s", 200, payload)
}
func (o *GetAccountsOK) GetPayload() *crm_models.AccountResponse {
@ -146,7 +144,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -158,11 +156,9 @@ 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
@ -200,11 +196,13 @@ func (o *GetAccountsUnauthorized) Code() int {
}
func (o *GetAccountsUnauthorized) Error() string {
return fmt.Sprintf("[GET /accounts][%d] getAccountsUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /accounts][%d] getAccountsUnauthorized %s", 401, payload)
}
func (o *GetAccountsUnauthorized) String() string {
return fmt.Sprintf("[GET /accounts][%d] getAccountsUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /accounts][%d] getAccountsUnauthorized %s", 401, payload)
}
func (o *GetAccountsUnauthorized) GetPayload() *crm_models.Error {
@ -223,7 +221,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -235,11 +233,9 @@ 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
@ -277,11 +273,13 @@ func (o *GetAccountsForbidden) Code() int {
}
func (o *GetAccountsForbidden) Error() string {
return fmt.Sprintf("[GET /accounts][%d] getAccountsForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /accounts][%d] getAccountsForbidden %s", 403, payload)
}
func (o *GetAccountsForbidden) String() string {
return fmt.Sprintf("[GET /accounts][%d] getAccountsForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /accounts][%d] getAccountsForbidden %s", 403, payload)
}
func (o *GetAccountsForbidden) GetPayload() *crm_models.Error {
@ -300,7 +298,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -312,11 +310,9 @@ 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
@ -354,11 +350,13 @@ func (o *GetAccountsNotFound) Code() int {
}
func (o *GetAccountsNotFound) Error() string {
return fmt.Sprintf("[GET /accounts][%d] getAccountsNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /accounts][%d] getAccountsNotFound %s", 404, payload)
}
func (o *GetAccountsNotFound) String() string {
return fmt.Sprintf("[GET /accounts][%d] getAccountsNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /accounts][%d] getAccountsNotFound %s", 404, payload)
}
func (o *GetAccountsNotFound) GetPayload() *crm_models.Error {
@ -377,7 +375,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -389,11 +387,9 @@ 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
@ -431,11 +427,13 @@ func (o *GetAccountsUnprocessableEntity) Code() int {
}
func (o *GetAccountsUnprocessableEntity) Error() string {
return fmt.Sprintf("[GET /accounts][%d] getAccountsUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /accounts][%d] getAccountsUnprocessableEntity %s", 422, payload)
}
func (o *GetAccountsUnprocessableEntity) String() string {
return fmt.Sprintf("[GET /accounts][%d] getAccountsUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /accounts][%d] getAccountsUnprocessableEntity %s", 422, payload)
}
func (o *GetAccountsUnprocessableEntity) GetPayload() *crm_models.Error {
@ -454,7 +452,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -466,11 +464,9 @@ 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
@ -508,11 +504,13 @@ func (o *GetAccountsInternalServerError) Code() int {
}
func (o *GetAccountsInternalServerError) Error() string {
return fmt.Sprintf("[GET /accounts][%d] getAccountsInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /accounts][%d] getAccountsInternalServerError %s", 500, payload)
}
func (o *GetAccountsInternalServerError) String() string {
return fmt.Sprintf("[GET /accounts][%d] getAccountsInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /accounts][%d] getAccountsInternalServerError %s", 500, payload)
}
func (o *GetAccountsInternalServerError) GetPayload() *crm_models.Error {
@ -531,7 +529,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}

View File

@ -6,20 +6,16 @@
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,
@ -29,24 +25,28 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewPostAccountsParams() *PostAccountsParams {
return &PostAccountsParams{
timeout: cr.DefaultTimeout,
}
return NewPostAccountsParamsWithTimeout(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{
timeout: timeout,
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{
Context: ctx,
inner: innerParams{
ctx: ctx,
},
}
}
@ -67,15 +67,14 @@ 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).
@ -93,54 +92,57 @@ 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.timeout = timeout
o.inner.timeout = timeout
}
// WithContext adds the context to the post accounts params
// WithContext adds the context to the post accounts params.
//
// Deprecated: use the operation call with context to pass the context instead of [PostAccountsParams].
func (o *PostAccountsParams) WithContext(ctx context.Context) *PostAccountsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the post accounts params
// SetContext adds the context to the post accounts params.
//
// Deprecated: use the operation call with context to pass the context instead of [PostAccountsParams].
func (o *PostAccountsParams) SetContext(ctx context.Context) {
o.Context = ctx
o.inner.ctx = 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 swagger request
// WriteToRequest writes these params to a [runtime.ClientRequest].
func (o *PostAccountsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
if err := r.SetTimeout(o.inner.timeout); err != nil {
return err
}
var res []error

View File

@ -6,17 +6,15 @@
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.
@ -25,7 +23,7 @@ type PostAccountsReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *PostAccountsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
func (o *PostAccountsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
switch response.Code() {
case 200:
result := NewPostAccountsOK()
@ -64,7 +62,7 @@ func (o *PostAccountsReader) ReadResponse(response runtime.ClientResponse, consu
}
return nil, result
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
return nil, runtime.NewAPIError("[POST /accounts] postAccounts", response, response.Code())
}
}
@ -73,11 +71,9 @@ 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
@ -116,11 +112,13 @@ func (o *PostAccountsOK) Code() int {
}
func (o *PostAccountsOK) Error() string {
return fmt.Sprintf("[POST /accounts][%d] postAccountsOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /accounts][%d] postAccountsOK %s", 200, payload)
}
func (o *PostAccountsOK) String() string {
return fmt.Sprintf("[POST /accounts][%d] postAccountsOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /accounts][%d] postAccountsOK %s", 200, payload)
}
func (o *PostAccountsOK) GetPayload() *crm_models.AccountResponse {
@ -146,7 +144,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -158,11 +156,9 @@ 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
@ -200,11 +196,13 @@ func (o *PostAccountsUnauthorized) Code() int {
}
func (o *PostAccountsUnauthorized) Error() string {
return fmt.Sprintf("[POST /accounts][%d] postAccountsUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /accounts][%d] postAccountsUnauthorized %s", 401, payload)
}
func (o *PostAccountsUnauthorized) String() string {
return fmt.Sprintf("[POST /accounts][%d] postAccountsUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /accounts][%d] postAccountsUnauthorized %s", 401, payload)
}
func (o *PostAccountsUnauthorized) GetPayload() *crm_models.Error {
@ -223,7 +221,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -235,11 +233,9 @@ 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
@ -277,11 +273,13 @@ func (o *PostAccountsForbidden) Code() int {
}
func (o *PostAccountsForbidden) Error() string {
return fmt.Sprintf("[POST /accounts][%d] postAccountsForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /accounts][%d] postAccountsForbidden %s", 403, payload)
}
func (o *PostAccountsForbidden) String() string {
return fmt.Sprintf("[POST /accounts][%d] postAccountsForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /accounts][%d] postAccountsForbidden %s", 403, payload)
}
func (o *PostAccountsForbidden) GetPayload() *crm_models.Error {
@ -300,7 +298,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -312,11 +310,9 @@ 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
@ -354,11 +350,13 @@ func (o *PostAccountsNotFound) Code() int {
}
func (o *PostAccountsNotFound) Error() string {
return fmt.Sprintf("[POST /accounts][%d] postAccountsNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /accounts][%d] postAccountsNotFound %s", 404, payload)
}
func (o *PostAccountsNotFound) String() string {
return fmt.Sprintf("[POST /accounts][%d] postAccountsNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /accounts][%d] postAccountsNotFound %s", 404, payload)
}
func (o *PostAccountsNotFound) GetPayload() *crm_models.Error {
@ -377,7 +375,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -389,11 +387,9 @@ 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
@ -431,11 +427,13 @@ func (o *PostAccountsUnprocessableEntity) Code() int {
}
func (o *PostAccountsUnprocessableEntity) Error() string {
return fmt.Sprintf("[POST /accounts][%d] postAccountsUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /accounts][%d] postAccountsUnprocessableEntity %s", 422, payload)
}
func (o *PostAccountsUnprocessableEntity) String() string {
return fmt.Sprintf("[POST /accounts][%d] postAccountsUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /accounts][%d] postAccountsUnprocessableEntity %s", 422, payload)
}
func (o *PostAccountsUnprocessableEntity) GetPayload() *crm_models.Error {
@ -454,7 +452,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -466,11 +464,9 @@ 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
@ -508,11 +504,13 @@ func (o *PostAccountsInternalServerError) Code() int {
}
func (o *PostAccountsInternalServerError) Error() string {
return fmt.Sprintf("[POST /accounts][%d] postAccountsInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /accounts][%d] postAccountsInternalServerError %s", 500, payload)
}
func (o *PostAccountsInternalServerError) String() string {
return fmt.Sprintf("[POST /accounts][%d] postAccountsInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /accounts][%d] postAccountsInternalServerError %s", 500, payload)
}
func (o *PostAccountsInternalServerError) GetPayload() *crm_models.Error {
@ -531,7 +529,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}

View File

@ -6,20 +6,16 @@
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,
@ -29,24 +25,28 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewPutAccountsParams() *PutAccountsParams {
return &PutAccountsParams{
timeout: cr.DefaultTimeout,
}
return NewPutAccountsParamsWithTimeout(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{
timeout: timeout,
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{
Context: ctx,
inner: innerParams{
ctx: ctx,
},
}
}
@ -67,15 +67,14 @@ 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).
@ -93,54 +92,57 @@ 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.timeout = timeout
o.inner.timeout = timeout
}
// WithContext adds the context to the put accounts params
// WithContext adds the context to the put accounts params.
//
// Deprecated: use the operation call with context to pass the context instead of [PutAccountsParams].
func (o *PutAccountsParams) WithContext(ctx context.Context) *PutAccountsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the put accounts params
// SetContext adds the context to the put accounts params.
//
// Deprecated: use the operation call with context to pass the context instead of [PutAccountsParams].
func (o *PutAccountsParams) SetContext(ctx context.Context) {
o.Context = ctx
o.inner.ctx = 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 swagger request
// WriteToRequest writes these params to a [runtime.ClientRequest].
func (o *PutAccountsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
if err := r.SetTimeout(o.inner.timeout); err != nil {
return err
}
var res []error

View File

@ -6,17 +6,15 @@
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.
@ -25,7 +23,7 @@ type PutAccountsReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *PutAccountsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
func (o *PutAccountsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
switch response.Code() {
case 200:
result := NewPutAccountsOK()
@ -64,7 +62,7 @@ func (o *PutAccountsReader) ReadResponse(response runtime.ClientResponse, consum
}
return nil, result
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
return nil, runtime.NewAPIError("[PUT /accounts] putAccounts", response, response.Code())
}
}
@ -73,11 +71,9 @@ 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
@ -116,11 +112,13 @@ func (o *PutAccountsOK) Code() int {
}
func (o *PutAccountsOK) Error() string {
return fmt.Sprintf("[PUT /accounts][%d] putAccountsOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /accounts][%d] putAccountsOK %s", 200, payload)
}
func (o *PutAccountsOK) String() string {
return fmt.Sprintf("[PUT /accounts][%d] putAccountsOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /accounts][%d] putAccountsOK %s", 200, payload)
}
func (o *PutAccountsOK) GetPayload() *crm_models.AccountResponse {
@ -146,7 +144,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -158,11 +156,9 @@ 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
@ -200,11 +196,13 @@ func (o *PutAccountsUnauthorized) Code() int {
}
func (o *PutAccountsUnauthorized) Error() string {
return fmt.Sprintf("[PUT /accounts][%d] putAccountsUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /accounts][%d] putAccountsUnauthorized %s", 401, payload)
}
func (o *PutAccountsUnauthorized) String() string {
return fmt.Sprintf("[PUT /accounts][%d] putAccountsUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /accounts][%d] putAccountsUnauthorized %s", 401, payload)
}
func (o *PutAccountsUnauthorized) GetPayload() *crm_models.Error {
@ -223,7 +221,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -235,11 +233,9 @@ 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
@ -277,11 +273,13 @@ func (o *PutAccountsForbidden) Code() int {
}
func (o *PutAccountsForbidden) Error() string {
return fmt.Sprintf("[PUT /accounts][%d] putAccountsForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /accounts][%d] putAccountsForbidden %s", 403, payload)
}
func (o *PutAccountsForbidden) String() string {
return fmt.Sprintf("[PUT /accounts][%d] putAccountsForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /accounts][%d] putAccountsForbidden %s", 403, payload)
}
func (o *PutAccountsForbidden) GetPayload() *crm_models.Error {
@ -300,7 +298,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -312,11 +310,9 @@ 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
@ -354,11 +350,13 @@ func (o *PutAccountsNotFound) Code() int {
}
func (o *PutAccountsNotFound) Error() string {
return fmt.Sprintf("[PUT /accounts][%d] putAccountsNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /accounts][%d] putAccountsNotFound %s", 404, payload)
}
func (o *PutAccountsNotFound) String() string {
return fmt.Sprintf("[PUT /accounts][%d] putAccountsNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /accounts][%d] putAccountsNotFound %s", 404, payload)
}
func (o *PutAccountsNotFound) GetPayload() *crm_models.Error {
@ -377,7 +375,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -389,11 +387,9 @@ 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
@ -431,11 +427,13 @@ func (o *PutAccountsUnprocessableEntity) Code() int {
}
func (o *PutAccountsUnprocessableEntity) Error() string {
return fmt.Sprintf("[PUT /accounts][%d] putAccountsUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /accounts][%d] putAccountsUnprocessableEntity %s", 422, payload)
}
func (o *PutAccountsUnprocessableEntity) String() string {
return fmt.Sprintf("[PUT /accounts][%d] putAccountsUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /accounts][%d] putAccountsUnprocessableEntity %s", 422, payload)
}
func (o *PutAccountsUnprocessableEntity) GetPayload() *crm_models.Error {
@ -454,7 +452,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -466,11 +464,9 @@ 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
@ -508,11 +504,13 @@ func (o *PutAccountsInternalServerError) Code() int {
}
func (o *PutAccountsInternalServerError) Error() string {
return fmt.Sprintf("[PUT /accounts][%d] putAccountsInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /accounts][%d] putAccountsInternalServerError %s", 500, payload)
}
func (o *PutAccountsInternalServerError) String() string {
return fmt.Sprintf("[PUT /accounts][%d] putAccountsInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /accounts][%d] putAccountsInternalServerError %s", 500, payload)
}
func (o *PutAccountsInternalServerError) GetPayload() *crm_models.Error {
@ -531,7 +529,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}

View File

@ -6,55 +6,117 @@
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.ClientTransport, formats strfmt.Registry) ClientService {
func New(transport runtime.ContextualTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
/*
Client for assets API
*/
// 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.
type Client struct {
transport runtime.ClientTransport
transport runtime.ContextualTransport
formats strfmt.Registry
}
// ClientOption is the option for Client methods
// ClientOption may be used to customize the behavior of 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 to salesforce devops net.
PostAssets(params *PostAssetsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAssetsOK, error)
// PostAssetsContext add a new asset to salesforce devops net.
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)
SetTransport(transport runtime.ClientTransport)
// PutAssetContext update a single asset.
PutAssetContext(ctx context.Context, params *PutAssetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutAssetOK, error)
SetTransport(transport runtime.ContextualTransport)
}
/*
DeleteAsset deletes an asset
Delete SalesforceDevops.net Asset record
*/
// 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.
func (a *Client) DeleteAsset(params *DeleteAssetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAssetOK, error) {
// TODO: Validate the params before sending
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
if params == nil {
params = NewDeleteAssetParams()
}
op := &runtime.ClientOperation{
ID: "deleteAsset",
Method: "DELETE",
@ -65,37 +127,63 @@ func (a *Client) DeleteAsset(params *DeleteAssetParams, authInfo runtime.ClientA
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.Submit(op)
result, err := a.transport.SubmitContext(ctx, op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*DeleteAssetOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
// unexpected success response.
// no default response is defined.
//
// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for 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 a list of all available Assets
*/
// GetAssets gets a list of assets.
//
// Return a list of all available Assets.
//
// 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.
func (a *Client) GetAssets(params *GetAssetsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAssetsOK, error) {
// TODO: Validate the params before sending
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 a list of all available Assets.
//
// 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
if params == nil {
params = NewGetAssetsParams()
}
op := &runtime.ClientOperation{
ID: "getAssets",
Method: "GET",
@ -106,37 +194,63 @@ func (a *Client) GetAssets(params *GetAssetsParams, authInfo runtime.ClientAuthI
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.Submit(op)
result, err := a.transport.SubmitContext(ctx, op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*GetAssetsOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
// unexpected success response.
// no default response is defined.
//
// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for getAssets: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PostAssets adds a new asset to salesforce devops net
Asset record to be added
*/
// PostAssets adds a new asset to salesforce devops net.
//
// Asset 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.PostAssetsContext] instead.
func (a *Client) PostAssets(params *PostAssetsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAssetsOK, error) {
// TODO: Validate the params before sending
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 to salesforce devops net.
//
// Asset record to be added.
//
// 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
if params == nil {
params = NewPostAssetsParams()
}
op := &runtime.ClientOperation{
ID: "postAssets",
Method: "POST",
@ -147,37 +261,63 @@ func (a *Client) PostAssets(params *PostAssetsParams, authInfo runtime.ClientAut
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.Submit(op)
result, err := a.transport.SubmitContext(ctx, op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*PostAssetsOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
// unexpected success response.
// no default response is defined.
//
// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for postAssets: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PutAsset updates a single asset
Update a single asset specified by assetId
*/
// PutAsset updates a single asset.
//
// Update a single asset specified by assetId.
//
// 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.
func (a *Client) PutAsset(params *PutAssetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutAssetOK, error) {
// TODO: Validate the params before sending
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.
//
// Update a single asset specified by assetId.
//
// 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
if params == nil {
params = NewPutAssetParams()
}
op := &runtime.ClientOperation{
ID: "putAsset",
Method: "PUT",
@ -188,28 +328,42 @@ func (a *Client) PutAsset(params *PutAssetParams, authInfo runtime.ClientAuthInf
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.Submit(op)
result, err := a.transport.SubmitContext(ctx, op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*PutAssetOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
// unexpected success response.
// no default response is defined.
//
// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for 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.ClientTransport) {
func (a *Client) SetTransport(transport runtime.ContextualTransport) {
a.transport = transport
}
// innerParams captures internal fields so they don't conflict with user-supplied parameters.
type innerParams struct {
timeout time.Duration
// Deprecated: use the operation call with context to pass the context instead of [AssetsParams].
ctx context.Context
}

View File

@ -6,9 +6,6 @@
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"
@ -27,24 +24,28 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewDeleteAssetParams() *DeleteAssetParams {
return &DeleteAssetParams{
timeout: cr.DefaultTimeout,
}
return NewDeleteAssetParamsWithTimeout(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{
timeout: timeout,
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{
Context: ctx,
inner: innerParams{
ctx: ctx,
},
}
}
@ -65,15 +66,14 @@ 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,54 +91,57 @@ 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.timeout = timeout
o.inner.timeout = timeout
}
// WithContext adds the context to the delete asset params
// WithContext adds the context to the delete asset params.
//
// Deprecated: use the operation call with context to pass the context instead of [DeleteAssetParams].
func (o *DeleteAssetParams) WithContext(ctx context.Context) *DeleteAssetParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the delete asset params
// SetContext adds the context to the delete asset params.
//
// Deprecated: use the operation call with context to pass the context instead of [DeleteAssetParams].
func (o *DeleteAssetParams) SetContext(ctx context.Context) {
o.Context = ctx
o.inner.ctx = 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 swagger request
// WriteToRequest writes these params to a [runtime.ClientRequest].
func (o *DeleteAssetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
if err := r.SetTimeout(o.inner.timeout); err != nil {
return err
}
var res []error

View File

@ -6,17 +6,15 @@
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.
@ -25,7 +23,7 @@ type DeleteAssetReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *DeleteAssetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
func (o *DeleteAssetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
switch response.Code() {
case 200:
result := NewDeleteAssetOK()
@ -64,7 +62,7 @@ func (o *DeleteAssetReader) ReadResponse(response runtime.ClientResponse, consum
}
return nil, result
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
return nil, runtime.NewAPIError("[DELETE /assets] deleteAsset", response, response.Code())
}
}
@ -73,11 +71,9 @@ 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
@ -115,11 +111,13 @@ func (o *DeleteAssetOK) Code() int {
}
func (o *DeleteAssetOK) Error() string {
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetOK %s", 200, payload)
}
func (o *DeleteAssetOK) String() string {
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetOK %s", 200, payload)
}
func (o *DeleteAssetOK) GetPayload() *crm_models.DeleteResponse {
@ -138,7 +136,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -150,11 +148,9 @@ 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
@ -192,11 +188,13 @@ func (o *DeleteAssetUnauthorized) Code() int {
}
func (o *DeleteAssetUnauthorized) Error() string {
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetUnauthorized %s", 401, payload)
}
func (o *DeleteAssetUnauthorized) String() string {
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetUnauthorized %s", 401, payload)
}
func (o *DeleteAssetUnauthorized) GetPayload() *crm_models.Error {
@ -215,7 +213,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -227,11 +225,9 @@ 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
@ -269,11 +265,13 @@ func (o *DeleteAssetForbidden) Code() int {
}
func (o *DeleteAssetForbidden) Error() string {
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetForbidden %s", 403, payload)
}
func (o *DeleteAssetForbidden) String() string {
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetForbidden %s", 403, payload)
}
func (o *DeleteAssetForbidden) GetPayload() *crm_models.Error {
@ -292,7 +290,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -304,11 +302,9 @@ 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
@ -346,11 +342,13 @@ func (o *DeleteAssetNotFound) Code() int {
}
func (o *DeleteAssetNotFound) Error() string {
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetNotFound %s", 404, payload)
}
func (o *DeleteAssetNotFound) String() string {
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetNotFound %s", 404, payload)
}
func (o *DeleteAssetNotFound) GetPayload() *crm_models.Error {
@ -369,7 +367,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -381,11 +379,9 @@ 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
@ -423,11 +419,13 @@ func (o *DeleteAssetUnprocessableEntity) Code() int {
}
func (o *DeleteAssetUnprocessableEntity) Error() string {
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetUnprocessableEntity %s", 422, payload)
}
func (o *DeleteAssetUnprocessableEntity) String() string {
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetUnprocessableEntity %s", 422, payload)
}
func (o *DeleteAssetUnprocessableEntity) GetPayload() *crm_models.Error {
@ -446,7 +444,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -458,11 +456,9 @@ 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
@ -500,11 +496,13 @@ func (o *DeleteAssetInternalServerError) Code() int {
}
func (o *DeleteAssetInternalServerError) Error() string {
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetInternalServerError %s", 500, payload)
}
func (o *DeleteAssetInternalServerError) String() string {
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetInternalServerError %s", 500, payload)
}
func (o *DeleteAssetInternalServerError) GetPayload() *crm_models.Error {
@ -523,7 +521,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}

View File

@ -6,9 +6,6 @@
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"
@ -18,7 +15,7 @@ import (
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/swag/conv"
)
// NewGetAssetsParams creates a new GetAssetsParams object,
@ -28,24 +25,28 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewGetAssetsParams() *GetAssetsParams {
return &GetAssetsParams{
timeout: cr.DefaultTimeout,
}
return NewGetAssetsParamsWithTimeout(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{
timeout: timeout,
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{
Context: ctx,
inner: innerParams{
ctx: ctx,
},
}
}
@ -66,37 +67,33 @@ 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).
@ -114,87 +111,90 @@ 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.timeout = timeout
o.inner.timeout = timeout
}
// WithContext adds the context to the get assets params
// WithContext adds the context to the get assets params.
//
// Deprecated: use the operation call with context to pass the context instead of [GetAssetsParams].
func (o *GetAssetsParams) WithContext(ctx context.Context) *GetAssetsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get assets params
// SetContext adds the context to the get assets params.
//
// Deprecated: use the operation call with context to pass the context instead of [GetAssetsParams].
func (o *GetAssetsParams) SetContext(ctx context.Context) {
o.Context = ctx
o.inner.ctx = 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 swagger request
// WriteToRequest writes these params to a [runtime.ClientRequest].
func (o *GetAssetsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
if err := r.SetTimeout(o.inner.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 := swag.FormatInt64(qrLimit)
qLimit := conv.FormatInteger(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 := swag.FormatInt64(qrOffset)
qOffset := conv.FormatInteger(qrOffset)
if qOffset != "" {
if err := r.SetQueryParam("offset", qOffset); err != nil {

View File

@ -6,17 +6,15 @@
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.
@ -25,7 +23,7 @@ type GetAssetsReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *GetAssetsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
func (o *GetAssetsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
switch response.Code() {
case 200:
result := NewGetAssetsOK()
@ -64,7 +62,7 @@ func (o *GetAssetsReader) ReadResponse(response runtime.ClientResponse, consumer
}
return nil, result
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
return nil, runtime.NewAPIError("[GET /assets] getAssets", response, response.Code())
}
}
@ -73,11 +71,9 @@ 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
@ -116,11 +112,13 @@ func (o *GetAssetsOK) Code() int {
}
func (o *GetAssetsOK) Error() string {
return fmt.Sprintf("[GET /assets][%d] getAssetsOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /assets][%d] getAssetsOK %s", 200, payload)
}
func (o *GetAssetsOK) String() string {
return fmt.Sprintf("[GET /assets][%d] getAssetsOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /assets][%d] getAssetsOK %s", 200, payload)
}
func (o *GetAssetsOK) GetPayload() *crm_models.AssetResponse {
@ -146,7 +144,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -158,11 +156,9 @@ 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
@ -200,11 +196,13 @@ func (o *GetAssetsUnauthorized) Code() int {
}
func (o *GetAssetsUnauthorized) Error() string {
return fmt.Sprintf("[GET /assets][%d] getAssetsUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /assets][%d] getAssetsUnauthorized %s", 401, payload)
}
func (o *GetAssetsUnauthorized) String() string {
return fmt.Sprintf("[GET /assets][%d] getAssetsUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /assets][%d] getAssetsUnauthorized %s", 401, payload)
}
func (o *GetAssetsUnauthorized) GetPayload() *crm_models.Error {
@ -223,7 +221,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -235,11 +233,9 @@ 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
@ -277,11 +273,13 @@ func (o *GetAssetsForbidden) Code() int {
}
func (o *GetAssetsForbidden) Error() string {
return fmt.Sprintf("[GET /assets][%d] getAssetsForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /assets][%d] getAssetsForbidden %s", 403, payload)
}
func (o *GetAssetsForbidden) String() string {
return fmt.Sprintf("[GET /assets][%d] getAssetsForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /assets][%d] getAssetsForbidden %s", 403, payload)
}
func (o *GetAssetsForbidden) GetPayload() *crm_models.Error {
@ -300,7 +298,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -312,11 +310,9 @@ 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
@ -354,11 +350,13 @@ func (o *GetAssetsNotFound) Code() int {
}
func (o *GetAssetsNotFound) Error() string {
return fmt.Sprintf("[GET /assets][%d] getAssetsNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /assets][%d] getAssetsNotFound %s", 404, payload)
}
func (o *GetAssetsNotFound) String() string {
return fmt.Sprintf("[GET /assets][%d] getAssetsNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /assets][%d] getAssetsNotFound %s", 404, payload)
}
func (o *GetAssetsNotFound) GetPayload() *crm_models.Error {
@ -377,7 +375,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -389,11 +387,9 @@ 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
@ -431,11 +427,13 @@ func (o *GetAssetsUnprocessableEntity) Code() int {
}
func (o *GetAssetsUnprocessableEntity) Error() string {
return fmt.Sprintf("[GET /assets][%d] getAssetsUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /assets][%d] getAssetsUnprocessableEntity %s", 422, payload)
}
func (o *GetAssetsUnprocessableEntity) String() string {
return fmt.Sprintf("[GET /assets][%d] getAssetsUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /assets][%d] getAssetsUnprocessableEntity %s", 422, payload)
}
func (o *GetAssetsUnprocessableEntity) GetPayload() *crm_models.Error {
@ -454,7 +452,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -466,11 +464,9 @@ 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
@ -508,11 +504,13 @@ func (o *GetAssetsInternalServerError) Code() int {
}
func (o *GetAssetsInternalServerError) Error() string {
return fmt.Sprintf("[GET /assets][%d] getAssetsInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /assets][%d] getAssetsInternalServerError %s", 500, payload)
}
func (o *GetAssetsInternalServerError) String() string {
return fmt.Sprintf("[GET /assets][%d] getAssetsInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /assets][%d] getAssetsInternalServerError %s", 500, payload)
}
func (o *GetAssetsInternalServerError) GetPayload() *crm_models.Error {
@ -531,7 +529,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}

View File

@ -6,20 +6,16 @@
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,
@ -29,24 +25,28 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewPostAssetsParams() *PostAssetsParams {
return &PostAssetsParams{
timeout: cr.DefaultTimeout,
}
return NewPostAssetsParamsWithTimeout(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{
timeout: timeout,
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{
Context: ctx,
inner: innerParams{
ctx: ctx,
},
}
}
@ -67,15 +67,14 @@ 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).
@ -93,54 +92,57 @@ 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.timeout = timeout
o.inner.timeout = timeout
}
// WithContext adds the context to the post assets params
// WithContext adds the context to the post assets params.
//
// Deprecated: use the operation call with context to pass the context instead of [PostAssetsParams].
func (o *PostAssetsParams) WithContext(ctx context.Context) *PostAssetsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the post assets params
// SetContext adds the context to the post assets params.
//
// Deprecated: use the operation call with context to pass the context instead of [PostAssetsParams].
func (o *PostAssetsParams) SetContext(ctx context.Context) {
o.Context = ctx
o.inner.ctx = 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 swagger request
// WriteToRequest writes these params to a [runtime.ClientRequest].
func (o *PostAssetsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
if err := r.SetTimeout(o.inner.timeout); err != nil {
return err
}
var res []error

View File

@ -6,17 +6,15 @@
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.
@ -25,7 +23,7 @@ type PostAssetsReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *PostAssetsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
func (o *PostAssetsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
switch response.Code() {
case 200:
result := NewPostAssetsOK()
@ -64,7 +62,7 @@ func (o *PostAssetsReader) ReadResponse(response runtime.ClientResponse, consume
}
return nil, result
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
return nil, runtime.NewAPIError("[POST /assets] postAssets", response, response.Code())
}
}
@ -73,11 +71,9 @@ 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
@ -116,11 +112,13 @@ func (o *PostAssetsOK) Code() int {
}
func (o *PostAssetsOK) Error() string {
return fmt.Sprintf("[POST /assets][%d] postAssetsOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /assets][%d] postAssetsOK %s", 200, payload)
}
func (o *PostAssetsOK) String() string {
return fmt.Sprintf("[POST /assets][%d] postAssetsOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /assets][%d] postAssetsOK %s", 200, payload)
}
func (o *PostAssetsOK) GetPayload() *crm_models.AssetResponse {
@ -146,7 +144,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -158,11 +156,9 @@ 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
@ -200,11 +196,13 @@ func (o *PostAssetsUnauthorized) Code() int {
}
func (o *PostAssetsUnauthorized) Error() string {
return fmt.Sprintf("[POST /assets][%d] postAssetsUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /assets][%d] postAssetsUnauthorized %s", 401, payload)
}
func (o *PostAssetsUnauthorized) String() string {
return fmt.Sprintf("[POST /assets][%d] postAssetsUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /assets][%d] postAssetsUnauthorized %s", 401, payload)
}
func (o *PostAssetsUnauthorized) GetPayload() *crm_models.Error {
@ -223,7 +221,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -235,11 +233,9 @@ 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
@ -277,11 +273,13 @@ func (o *PostAssetsForbidden) Code() int {
}
func (o *PostAssetsForbidden) Error() string {
return fmt.Sprintf("[POST /assets][%d] postAssetsForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /assets][%d] postAssetsForbidden %s", 403, payload)
}
func (o *PostAssetsForbidden) String() string {
return fmt.Sprintf("[POST /assets][%d] postAssetsForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /assets][%d] postAssetsForbidden %s", 403, payload)
}
func (o *PostAssetsForbidden) GetPayload() *crm_models.Error {
@ -300,7 +298,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -312,11 +310,9 @@ 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
@ -354,11 +350,13 @@ func (o *PostAssetsNotFound) Code() int {
}
func (o *PostAssetsNotFound) Error() string {
return fmt.Sprintf("[POST /assets][%d] postAssetsNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /assets][%d] postAssetsNotFound %s", 404, payload)
}
func (o *PostAssetsNotFound) String() string {
return fmt.Sprintf("[POST /assets][%d] postAssetsNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /assets][%d] postAssetsNotFound %s", 404, payload)
}
func (o *PostAssetsNotFound) GetPayload() *crm_models.Error {
@ -377,7 +375,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -389,11 +387,9 @@ 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
@ -431,11 +427,13 @@ func (o *PostAssetsUnprocessableEntity) Code() int {
}
func (o *PostAssetsUnprocessableEntity) Error() string {
return fmt.Sprintf("[POST /assets][%d] postAssetsUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /assets][%d] postAssetsUnprocessableEntity %s", 422, payload)
}
func (o *PostAssetsUnprocessableEntity) String() string {
return fmt.Sprintf("[POST /assets][%d] postAssetsUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /assets][%d] postAssetsUnprocessableEntity %s", 422, payload)
}
func (o *PostAssetsUnprocessableEntity) GetPayload() *crm_models.Error {
@ -454,7 +452,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -466,11 +464,9 @@ 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
@ -508,11 +504,13 @@ func (o *PostAssetsInternalServerError) Code() int {
}
func (o *PostAssetsInternalServerError) Error() string {
return fmt.Sprintf("[POST /assets][%d] postAssetsInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /assets][%d] postAssetsInternalServerError %s", 500, payload)
}
func (o *PostAssetsInternalServerError) String() string {
return fmt.Sprintf("[POST /assets][%d] postAssetsInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /assets][%d] postAssetsInternalServerError %s", 500, payload)
}
func (o *PostAssetsInternalServerError) GetPayload() *crm_models.Error {
@ -531,7 +529,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}

View File

@ -6,20 +6,16 @@
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,
@ -29,24 +25,28 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewPutAssetParams() *PutAssetParams {
return &PutAssetParams{
timeout: cr.DefaultTimeout,
}
return NewPutAssetParamsWithTimeout(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{
timeout: timeout,
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{
Context: ctx,
inner: innerParams{
ctx: ctx,
},
}
}
@ -67,15 +67,14 @@ 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).
@ -93,54 +92,57 @@ 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.timeout = timeout
o.inner.timeout = timeout
}
// WithContext adds the context to the put asset params
// WithContext adds the context to the put asset params.
//
// Deprecated: use the operation call with context to pass the context instead of [PutAssetParams].
func (o *PutAssetParams) WithContext(ctx context.Context) *PutAssetParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the put asset params
// SetContext adds the context to the put asset params.
//
// Deprecated: use the operation call with context to pass the context instead of [PutAssetParams].
func (o *PutAssetParams) SetContext(ctx context.Context) {
o.Context = ctx
o.inner.ctx = 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 swagger request
// WriteToRequest writes these params to a [runtime.ClientRequest].
func (o *PutAssetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
if err := r.SetTimeout(o.inner.timeout); err != nil {
return err
}
var res []error

View File

@ -6,17 +6,15 @@
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.
@ -25,7 +23,7 @@ type PutAssetReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *PutAssetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
func (o *PutAssetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
switch response.Code() {
case 200:
result := NewPutAssetOK()
@ -64,7 +62,7 @@ func (o *PutAssetReader) ReadResponse(response runtime.ClientResponse, consumer
}
return nil, result
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
return nil, runtime.NewAPIError("[PUT /assets] putAsset", response, response.Code())
}
}
@ -73,11 +71,9 @@ 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
@ -116,11 +112,13 @@ func (o *PutAssetOK) Code() int {
}
func (o *PutAssetOK) Error() string {
return fmt.Sprintf("[PUT /assets][%d] putAssetOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /assets][%d] putAssetOK %s", 200, payload)
}
func (o *PutAssetOK) String() string {
return fmt.Sprintf("[PUT /assets][%d] putAssetOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /assets][%d] putAssetOK %s", 200, payload)
}
func (o *PutAssetOK) GetPayload() *crm_models.AssetResponse {
@ -146,7 +144,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -158,11 +156,9 @@ 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
@ -200,11 +196,13 @@ func (o *PutAssetUnauthorized) Code() int {
}
func (o *PutAssetUnauthorized) Error() string {
return fmt.Sprintf("[PUT /assets][%d] putAssetUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /assets][%d] putAssetUnauthorized %s", 401, payload)
}
func (o *PutAssetUnauthorized) String() string {
return fmt.Sprintf("[PUT /assets][%d] putAssetUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /assets][%d] putAssetUnauthorized %s", 401, payload)
}
func (o *PutAssetUnauthorized) GetPayload() *crm_models.Error {
@ -223,7 +221,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -235,11 +233,9 @@ 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
@ -277,11 +273,13 @@ func (o *PutAssetForbidden) Code() int {
}
func (o *PutAssetForbidden) Error() string {
return fmt.Sprintf("[PUT /assets][%d] putAssetForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /assets][%d] putAssetForbidden %s", 403, payload)
}
func (o *PutAssetForbidden) String() string {
return fmt.Sprintf("[PUT /assets][%d] putAssetForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /assets][%d] putAssetForbidden %s", 403, payload)
}
func (o *PutAssetForbidden) GetPayload() *crm_models.Error {
@ -300,7 +298,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -312,11 +310,9 @@ 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
@ -354,11 +350,13 @@ func (o *PutAssetNotFound) Code() int {
}
func (o *PutAssetNotFound) Error() string {
return fmt.Sprintf("[PUT /assets][%d] putAssetNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /assets][%d] putAssetNotFound %s", 404, payload)
}
func (o *PutAssetNotFound) String() string {
return fmt.Sprintf("[PUT /assets][%d] putAssetNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /assets][%d] putAssetNotFound %s", 404, payload)
}
func (o *PutAssetNotFound) GetPayload() *crm_models.Error {
@ -377,7 +375,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -389,11 +387,9 @@ 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
@ -431,11 +427,13 @@ func (o *PutAssetUnprocessableEntity) Code() int {
}
func (o *PutAssetUnprocessableEntity) Error() string {
return fmt.Sprintf("[PUT /assets][%d] putAssetUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /assets][%d] putAssetUnprocessableEntity %s", 422, payload)
}
func (o *PutAssetUnprocessableEntity) String() string {
return fmt.Sprintf("[PUT /assets][%d] putAssetUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /assets][%d] putAssetUnprocessableEntity %s", 422, payload)
}
func (o *PutAssetUnprocessableEntity) GetPayload() *crm_models.Error {
@ -454,7 +452,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -466,11 +464,9 @@ 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
@ -508,11 +504,13 @@ func (o *PutAssetInternalServerError) Code() int {
}
func (o *PutAssetInternalServerError) Error() string {
return fmt.Sprintf("[PUT /assets][%d] putAssetInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /assets][%d] putAssetInternalServerError %s", 500, payload)
}
func (o *PutAssetInternalServerError) String() string {
return fmt.Sprintf("[PUT /assets][%d] putAssetInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /assets][%d] putAssetInternalServerError %s", 500, payload)
}
func (o *PutAssetInternalServerError) GetPayload() *crm_models.Error {
@ -531,7 +529,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}

View File

@ -6,55 +6,117 @@
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.ClientTransport, formats strfmt.Registry) ClientService {
func New(transport runtime.ContextualTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
/*
Client for contacts API
*/
// 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.
type Client struct {
transport runtime.ClientTransport
transport runtime.ContextualTransport
formats strfmt.Registry
}
// ClientOption is the option for Client methods
// ClientOption may be used to customize the behavior of 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)
SetTransport(transport runtime.ClientTransport)
// PutContactsContext update contact.
PutContactsContext(ctx context.Context, params *PutContactsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutContactsOK, error)
SetTransport(transport runtime.ContextualTransport)
}
/*
DeleteContact deletes a contact
Delete SalesforceDevops.net Contact record
*/
// 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.
func (a *Client) DeleteContact(params *DeleteContactParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteContactOK, error) {
// TODO: Validate the params before sending
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
if params == nil {
params = NewDeleteContactParams()
}
op := &runtime.ClientOperation{
ID: "deleteContact",
Method: "DELETE",
@ -65,37 +127,63 @@ func (a *Client) DeleteContact(params *DeleteContactParams, authInfo runtime.Cli
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.Submit(op)
result, err := a.transport.SubmitContext(ctx, op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*DeleteContactOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
// unexpected success response.
// no default response is defined.
//
// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for 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
*/
// 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.
func (a *Client) GetContacts(params *GetContactsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetContactsOK, error) {
// TODO: Validate the params before sending
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
if params == nil {
params = NewGetContactsParams()
}
op := &runtime.ClientOperation{
ID: "getContacts",
Method: "GET",
@ -106,37 +194,63 @@ func (a *Client) GetContacts(params *GetContactsParams, authInfo runtime.ClientA
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.Submit(op)
result, err := a.transport.SubmitContext(ctx, op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*GetContactsOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
// unexpected success response.
// no default response is defined.
//
// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for 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
*/
// 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.
func (a *Client) PostContacts(params *PostContactsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostContactsOK, error) {
// TODO: Validate the params before sending
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
if params == nil {
params = NewPostContactsParams()
}
op := &runtime.ClientOperation{
ID: "postContacts",
Method: "POST",
@ -147,37 +261,63 @@ func (a *Client) PostContacts(params *PostContactsParams, authInfo runtime.Clien
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.Submit(op)
result, err := a.transport.SubmitContext(ctx, op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*PostContactsOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
// unexpected success response.
// no default response is defined.
//
// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for 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
*/
// 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.
func (a *Client) PutContacts(params *PutContactsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutContactsOK, error) {
// TODO: Validate the params before sending
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
if params == nil {
params = NewPutContactsParams()
}
op := &runtime.ClientOperation{
ID: "putContacts",
Method: "PUT",
@ -188,28 +328,42 @@ func (a *Client) PutContacts(params *PutContactsParams, authInfo runtime.ClientA
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.Submit(op)
result, err := a.transport.SubmitContext(ctx, op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*PutContactsOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
// unexpected success response.
// no default response is defined.
//
// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for 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.ClientTransport) {
func (a *Client) SetTransport(transport runtime.ContextualTransport) {
a.transport = transport
}
// innerParams captures internal fields so they don't conflict with user-supplied parameters.
type innerParams struct {
timeout time.Duration
// Deprecated: use the operation call with context to pass the context instead of [ContactsParams].
ctx context.Context
}

View File

@ -6,9 +6,6 @@
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"
@ -27,24 +24,28 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewDeleteContactParams() *DeleteContactParams {
return &DeleteContactParams{
timeout: cr.DefaultTimeout,
}
return NewDeleteContactParamsWithTimeout(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{
timeout: timeout,
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{
Context: ctx,
inner: innerParams{
ctx: ctx,
},
}
}
@ -65,15 +66,14 @@ 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,54 +91,57 @@ 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.timeout = timeout
o.inner.timeout = timeout
}
// WithContext adds the context to the delete contact params
// WithContext adds the context to the delete contact params.
//
// Deprecated: use the operation call with context to pass the context instead of [DeleteContactParams].
func (o *DeleteContactParams) WithContext(ctx context.Context) *DeleteContactParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the delete contact params
// SetContext adds the context to the delete contact params.
//
// Deprecated: use the operation call with context to pass the context instead of [DeleteContactParams].
func (o *DeleteContactParams) SetContext(ctx context.Context) {
o.Context = ctx
o.inner.ctx = 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 swagger request
// WriteToRequest writes these params to a [runtime.ClientRequest].
func (o *DeleteContactParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
if err := r.SetTimeout(o.inner.timeout); err != nil {
return err
}
var res []error

View File

@ -6,17 +6,15 @@
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.
@ -25,7 +23,7 @@ type DeleteContactReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *DeleteContactReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
func (o *DeleteContactReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
switch response.Code() {
case 200:
result := NewDeleteContactOK()
@ -64,7 +62,7 @@ func (o *DeleteContactReader) ReadResponse(response runtime.ClientResponse, cons
}
return nil, result
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
return nil, runtime.NewAPIError("[DELETE /contacts] deleteContact", response, response.Code())
}
}
@ -73,11 +71,9 @@ 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
@ -115,11 +111,13 @@ func (o *DeleteContactOK) Code() int {
}
func (o *DeleteContactOK) Error() string {
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactOK %s", 200, payload)
}
func (o *DeleteContactOK) String() string {
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactOK %s", 200, payload)
}
func (o *DeleteContactOK) GetPayload() *crm_models.DeleteResponse {
@ -138,7 +136,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -150,11 +148,9 @@ 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
@ -192,11 +188,13 @@ func (o *DeleteContactUnauthorized) Code() int {
}
func (o *DeleteContactUnauthorized) Error() string {
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactUnauthorized %s", 401, payload)
}
func (o *DeleteContactUnauthorized) String() string {
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactUnauthorized %s", 401, payload)
}
func (o *DeleteContactUnauthorized) GetPayload() *crm_models.Error {
@ -215,7 +213,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -227,11 +225,9 @@ 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
@ -269,11 +265,13 @@ func (o *DeleteContactForbidden) Code() int {
}
func (o *DeleteContactForbidden) Error() string {
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactForbidden %s", 403, payload)
}
func (o *DeleteContactForbidden) String() string {
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactForbidden %s", 403, payload)
}
func (o *DeleteContactForbidden) GetPayload() *crm_models.Error {
@ -292,7 +290,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -304,11 +302,9 @@ 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
@ -346,11 +342,13 @@ func (o *DeleteContactNotFound) Code() int {
}
func (o *DeleteContactNotFound) Error() string {
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactNotFound %s", 404, payload)
}
func (o *DeleteContactNotFound) String() string {
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactNotFound %s", 404, payload)
}
func (o *DeleteContactNotFound) GetPayload() *crm_models.Error {
@ -369,7 +367,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -381,11 +379,9 @@ 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
@ -423,11 +419,13 @@ func (o *DeleteContactUnprocessableEntity) Code() int {
}
func (o *DeleteContactUnprocessableEntity) Error() string {
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactUnprocessableEntity %s", 422, payload)
}
func (o *DeleteContactUnprocessableEntity) String() string {
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactUnprocessableEntity %s", 422, payload)
}
func (o *DeleteContactUnprocessableEntity) GetPayload() *crm_models.Error {
@ -446,7 +444,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -458,11 +456,9 @@ 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
@ -500,11 +496,13 @@ func (o *DeleteContactInternalServerError) Code() int {
}
func (o *DeleteContactInternalServerError) Error() string {
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactInternalServerError %s", 500, payload)
}
func (o *DeleteContactInternalServerError) String() string {
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactInternalServerError %s", 500, payload)
}
func (o *DeleteContactInternalServerError) GetPayload() *crm_models.Error {
@ -523,7 +521,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}

View File

@ -6,9 +6,6 @@
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"
@ -18,7 +15,7 @@ import (
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/swag/conv"
)
// NewGetContactsParams creates a new GetContactsParams object,
@ -28,24 +25,28 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewGetContactsParams() *GetContactsParams {
return &GetContactsParams{
timeout: cr.DefaultTimeout,
}
return NewGetContactsParamsWithTimeout(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{
timeout: timeout,
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{
Context: ctx,
inner: innerParams{
ctx: ctx,
},
}
}
@ -66,49 +67,43 @@ 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).
@ -126,109 +121,112 @@ 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.timeout = timeout
o.inner.timeout = timeout
}
// WithContext adds the context to the get contacts params
// WithContext adds the context to the get contacts params.
//
// Deprecated: use the operation call with context to pass the context instead of [GetContactsParams].
func (o *GetContactsParams) WithContext(ctx context.Context) *GetContactsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get contacts params
// SetContext adds the context to the get contacts params.
//
// Deprecated: use the operation call with context to pass the context instead of [GetContactsParams].
func (o *GetContactsParams) SetContext(ctx context.Context) {
o.Context = ctx
o.inner.ctx = 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 swagger request
// WriteToRequest writes these params to a [runtime.ClientRequest].
func (o *GetContactsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
if err := r.SetTimeout(o.inner.timeout); err != nil {
return err
}
var res []error
@ -241,7 +239,7 @@ func (o *GetContactsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R
if o.Active != nil {
qrActive = *o.Active
}
qActive := swag.FormatBool(qrActive)
qActive := conv.FormatBool(qrActive)
if qActive != "" {
if err := r.SetQueryParam("active", qActive); err != nil {
@ -292,7 +290,7 @@ func (o *GetContactsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R
if o.Limit != nil {
qrLimit = *o.Limit
}
qLimit := swag.FormatInt64(qrLimit)
qLimit := conv.FormatInteger(qrLimit)
if qLimit != "" {
if err := r.SetQueryParam("limit", qLimit); err != nil {
@ -309,7 +307,7 @@ func (o *GetContactsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R
if o.Offset != nil {
qrOffset = *o.Offset
}
qOffset := swag.FormatInt64(qrOffset)
qOffset := conv.FormatInteger(qrOffset)
if qOffset != "" {
if err := r.SetQueryParam("offset", qOffset); err != nil {

View File

@ -6,17 +6,15 @@
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.
@ -25,7 +23,7 @@ type GetContactsReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *GetContactsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
func (o *GetContactsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
switch response.Code() {
case 200:
result := NewGetContactsOK()
@ -64,7 +62,7 @@ func (o *GetContactsReader) ReadResponse(response runtime.ClientResponse, consum
}
return nil, result
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
return nil, runtime.NewAPIError("[GET /contacts] getContacts", response, response.Code())
}
}
@ -73,11 +71,9 @@ 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
@ -116,11 +112,13 @@ func (o *GetContactsOK) Code() int {
}
func (o *GetContactsOK) Error() string {
return fmt.Sprintf("[GET /contacts][%d] getContactsOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contacts][%d] getContactsOK %s", 200, payload)
}
func (o *GetContactsOK) String() string {
return fmt.Sprintf("[GET /contacts][%d] getContactsOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contacts][%d] getContactsOK %s", 200, payload)
}
func (o *GetContactsOK) GetPayload() *crm_models.ContactResponse {
@ -146,7 +144,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -158,11 +156,9 @@ 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
@ -200,11 +196,13 @@ func (o *GetContactsUnauthorized) Code() int {
}
func (o *GetContactsUnauthorized) Error() string {
return fmt.Sprintf("[GET /contacts][%d] getContactsUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contacts][%d] getContactsUnauthorized %s", 401, payload)
}
func (o *GetContactsUnauthorized) String() string {
return fmt.Sprintf("[GET /contacts][%d] getContactsUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contacts][%d] getContactsUnauthorized %s", 401, payload)
}
func (o *GetContactsUnauthorized) GetPayload() *crm_models.Error {
@ -223,7 +221,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -235,11 +233,9 @@ 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
@ -277,11 +273,13 @@ func (o *GetContactsForbidden) Code() int {
}
func (o *GetContactsForbidden) Error() string {
return fmt.Sprintf("[GET /contacts][%d] getContactsForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contacts][%d] getContactsForbidden %s", 403, payload)
}
func (o *GetContactsForbidden) String() string {
return fmt.Sprintf("[GET /contacts][%d] getContactsForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contacts][%d] getContactsForbidden %s", 403, payload)
}
func (o *GetContactsForbidden) GetPayload() *crm_models.Error {
@ -300,7 +298,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -312,11 +310,9 @@ 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
@ -354,11 +350,13 @@ func (o *GetContactsNotFound) Code() int {
}
func (o *GetContactsNotFound) Error() string {
return fmt.Sprintf("[GET /contacts][%d] getContactsNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contacts][%d] getContactsNotFound %s", 404, payload)
}
func (o *GetContactsNotFound) String() string {
return fmt.Sprintf("[GET /contacts][%d] getContactsNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contacts][%d] getContactsNotFound %s", 404, payload)
}
func (o *GetContactsNotFound) GetPayload() *crm_models.Error {
@ -377,7 +375,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -389,11 +387,9 @@ 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
@ -431,11 +427,13 @@ func (o *GetContactsUnprocessableEntity) Code() int {
}
func (o *GetContactsUnprocessableEntity) Error() string {
return fmt.Sprintf("[GET /contacts][%d] getContactsUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contacts][%d] getContactsUnprocessableEntity %s", 422, payload)
}
func (o *GetContactsUnprocessableEntity) String() string {
return fmt.Sprintf("[GET /contacts][%d] getContactsUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contacts][%d] getContactsUnprocessableEntity %s", 422, payload)
}
func (o *GetContactsUnprocessableEntity) GetPayload() *crm_models.Error {
@ -454,7 +452,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -466,11 +464,9 @@ 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
@ -508,11 +504,13 @@ func (o *GetContactsInternalServerError) Code() int {
}
func (o *GetContactsInternalServerError) Error() string {
return fmt.Sprintf("[GET /contacts][%d] getContactsInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contacts][%d] getContactsInternalServerError %s", 500, payload)
}
func (o *GetContactsInternalServerError) String() string {
return fmt.Sprintf("[GET /contacts][%d] getContactsInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contacts][%d] getContactsInternalServerError %s", 500, payload)
}
func (o *GetContactsInternalServerError) GetPayload() *crm_models.Error {
@ -531,7 +529,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}

View File

@ -6,20 +6,16 @@
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,
@ -29,24 +25,28 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewPostContactsParams() *PostContactsParams {
return &PostContactsParams{
timeout: cr.DefaultTimeout,
}
return NewPostContactsParamsWithTimeout(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{
timeout: timeout,
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{
Context: ctx,
inner: innerParams{
ctx: ctx,
},
}
}
@ -67,15 +67,14 @@ 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).
@ -93,54 +92,57 @@ 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.timeout = timeout
o.inner.timeout = timeout
}
// WithContext adds the context to the post contacts params
// WithContext adds the context to the post contacts params.
//
// Deprecated: use the operation call with context to pass the context instead of [PostContactsParams].
func (o *PostContactsParams) WithContext(ctx context.Context) *PostContactsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the post contacts params
// SetContext adds the context to the post contacts params.
//
// Deprecated: use the operation call with context to pass the context instead of [PostContactsParams].
func (o *PostContactsParams) SetContext(ctx context.Context) {
o.Context = ctx
o.inner.ctx = 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 swagger request
// WriteToRequest writes these params to a [runtime.ClientRequest].
func (o *PostContactsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
if err := r.SetTimeout(o.inner.timeout); err != nil {
return err
}
var res []error

View File

@ -6,17 +6,15 @@
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.
@ -25,7 +23,7 @@ type PostContactsReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *PostContactsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
func (o *PostContactsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
switch response.Code() {
case 200:
result := NewPostContactsOK()
@ -64,7 +62,7 @@ func (o *PostContactsReader) ReadResponse(response runtime.ClientResponse, consu
}
return nil, result
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
return nil, runtime.NewAPIError("[POST /contacts] postContacts", response, response.Code())
}
}
@ -73,11 +71,9 @@ 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
@ -116,11 +112,13 @@ func (o *PostContactsOK) Code() int {
}
func (o *PostContactsOK) Error() string {
return fmt.Sprintf("[POST /contacts][%d] postContactsOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contacts][%d] postContactsOK %s", 200, payload)
}
func (o *PostContactsOK) String() string {
return fmt.Sprintf("[POST /contacts][%d] postContactsOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contacts][%d] postContactsOK %s", 200, payload)
}
func (o *PostContactsOK) GetPayload() *crm_models.ContactResponse {
@ -146,7 +144,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -158,11 +156,9 @@ 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
@ -200,11 +196,13 @@ func (o *PostContactsUnauthorized) Code() int {
}
func (o *PostContactsUnauthorized) Error() string {
return fmt.Sprintf("[POST /contacts][%d] postContactsUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contacts][%d] postContactsUnauthorized %s", 401, payload)
}
func (o *PostContactsUnauthorized) String() string {
return fmt.Sprintf("[POST /contacts][%d] postContactsUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contacts][%d] postContactsUnauthorized %s", 401, payload)
}
func (o *PostContactsUnauthorized) GetPayload() *crm_models.Error {
@ -223,7 +221,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -235,11 +233,9 @@ 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
@ -277,11 +273,13 @@ func (o *PostContactsForbidden) Code() int {
}
func (o *PostContactsForbidden) Error() string {
return fmt.Sprintf("[POST /contacts][%d] postContactsForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contacts][%d] postContactsForbidden %s", 403, payload)
}
func (o *PostContactsForbidden) String() string {
return fmt.Sprintf("[POST /contacts][%d] postContactsForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contacts][%d] postContactsForbidden %s", 403, payload)
}
func (o *PostContactsForbidden) GetPayload() *crm_models.Error {
@ -300,7 +298,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -312,11 +310,9 @@ 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
@ -354,11 +350,13 @@ func (o *PostContactsNotFound) Code() int {
}
func (o *PostContactsNotFound) Error() string {
return fmt.Sprintf("[POST /contacts][%d] postContactsNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contacts][%d] postContactsNotFound %s", 404, payload)
}
func (o *PostContactsNotFound) String() string {
return fmt.Sprintf("[POST /contacts][%d] postContactsNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contacts][%d] postContactsNotFound %s", 404, payload)
}
func (o *PostContactsNotFound) GetPayload() *crm_models.Error {
@ -377,7 +375,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -389,11 +387,9 @@ 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
@ -431,11 +427,13 @@ func (o *PostContactsUnprocessableEntity) Code() int {
}
func (o *PostContactsUnprocessableEntity) Error() string {
return fmt.Sprintf("[POST /contacts][%d] postContactsUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contacts][%d] postContactsUnprocessableEntity %s", 422, payload)
}
func (o *PostContactsUnprocessableEntity) String() string {
return fmt.Sprintf("[POST /contacts][%d] postContactsUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contacts][%d] postContactsUnprocessableEntity %s", 422, payload)
}
func (o *PostContactsUnprocessableEntity) GetPayload() *crm_models.Error {
@ -454,7 +452,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -466,11 +464,9 @@ 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
@ -508,11 +504,13 @@ func (o *PostContactsInternalServerError) Code() int {
}
func (o *PostContactsInternalServerError) Error() string {
return fmt.Sprintf("[POST /contacts][%d] postContactsInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contacts][%d] postContactsInternalServerError %s", 500, payload)
}
func (o *PostContactsInternalServerError) String() string {
return fmt.Sprintf("[POST /contacts][%d] postContactsInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contacts][%d] postContactsInternalServerError %s", 500, payload)
}
func (o *PostContactsInternalServerError) GetPayload() *crm_models.Error {
@ -531,7 +529,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}

View File

@ -6,20 +6,16 @@
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,
@ -29,24 +25,28 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewPutContactsParams() *PutContactsParams {
return &PutContactsParams{
timeout: cr.DefaultTimeout,
}
return NewPutContactsParamsWithTimeout(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{
timeout: timeout,
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{
Context: ctx,
inner: innerParams{
ctx: ctx,
},
}
}
@ -67,15 +67,14 @@ 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).
@ -93,54 +92,57 @@ 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.timeout = timeout
o.inner.timeout = timeout
}
// WithContext adds the context to the put contacts params
// WithContext adds the context to the put contacts params.
//
// Deprecated: use the operation call with context to pass the context instead of [PutContactsParams].
func (o *PutContactsParams) WithContext(ctx context.Context) *PutContactsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the put contacts params
// SetContext adds the context to the put contacts params.
//
// Deprecated: use the operation call with context to pass the context instead of [PutContactsParams].
func (o *PutContactsParams) SetContext(ctx context.Context) {
o.Context = ctx
o.inner.ctx = 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 swagger request
// WriteToRequest writes these params to a [runtime.ClientRequest].
func (o *PutContactsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
if err := r.SetTimeout(o.inner.timeout); err != nil {
return err
}
var res []error

View File

@ -6,17 +6,15 @@
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.
@ -25,7 +23,7 @@ type PutContactsReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *PutContactsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
func (o *PutContactsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
switch response.Code() {
case 200:
result := NewPutContactsOK()
@ -64,7 +62,7 @@ func (o *PutContactsReader) ReadResponse(response runtime.ClientResponse, consum
}
return nil, result
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
return nil, runtime.NewAPIError("[PUT /contacts] putContacts", response, response.Code())
}
}
@ -73,11 +71,9 @@ 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
@ -116,11 +112,13 @@ func (o *PutContactsOK) Code() int {
}
func (o *PutContactsOK) Error() string {
return fmt.Sprintf("[PUT /contacts][%d] putContactsOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contacts][%d] putContactsOK %s", 200, payload)
}
func (o *PutContactsOK) String() string {
return fmt.Sprintf("[PUT /contacts][%d] putContactsOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contacts][%d] putContactsOK %s", 200, payload)
}
func (o *PutContactsOK) GetPayload() *crm_models.ContactResponse {
@ -146,7 +144,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -158,11 +156,9 @@ 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
@ -200,11 +196,13 @@ func (o *PutContactsUnauthorized) Code() int {
}
func (o *PutContactsUnauthorized) Error() string {
return fmt.Sprintf("[PUT /contacts][%d] putContactsUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contacts][%d] putContactsUnauthorized %s", 401, payload)
}
func (o *PutContactsUnauthorized) String() string {
return fmt.Sprintf("[PUT /contacts][%d] putContactsUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contacts][%d] putContactsUnauthorized %s", 401, payload)
}
func (o *PutContactsUnauthorized) GetPayload() *crm_models.Error {
@ -223,7 +221,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -235,11 +233,9 @@ 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
@ -277,11 +273,13 @@ func (o *PutContactsForbidden) Code() int {
}
func (o *PutContactsForbidden) Error() string {
return fmt.Sprintf("[PUT /contacts][%d] putContactsForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contacts][%d] putContactsForbidden %s", 403, payload)
}
func (o *PutContactsForbidden) String() string {
return fmt.Sprintf("[PUT /contacts][%d] putContactsForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contacts][%d] putContactsForbidden %s", 403, payload)
}
func (o *PutContactsForbidden) GetPayload() *crm_models.Error {
@ -300,7 +298,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -312,11 +310,9 @@ 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
@ -354,11 +350,13 @@ func (o *PutContactsNotFound) Code() int {
}
func (o *PutContactsNotFound) Error() string {
return fmt.Sprintf("[PUT /contacts][%d] putContactsNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contacts][%d] putContactsNotFound %s", 404, payload)
}
func (o *PutContactsNotFound) String() string {
return fmt.Sprintf("[PUT /contacts][%d] putContactsNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contacts][%d] putContactsNotFound %s", 404, payload)
}
func (o *PutContactsNotFound) GetPayload() *crm_models.Error {
@ -377,7 +375,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -389,11 +387,9 @@ 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
@ -431,11 +427,13 @@ func (o *PutContactsUnprocessableEntity) Code() int {
}
func (o *PutContactsUnprocessableEntity) Error() string {
return fmt.Sprintf("[PUT /contacts][%d] putContactsUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contacts][%d] putContactsUnprocessableEntity %s", 422, payload)
}
func (o *PutContactsUnprocessableEntity) String() string {
return fmt.Sprintf("[PUT /contacts][%d] putContactsUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contacts][%d] putContactsUnprocessableEntity %s", 422, payload)
}
func (o *PutContactsUnprocessableEntity) GetPayload() *crm_models.Error {
@ -454,7 +452,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -466,11 +464,9 @@ 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
@ -508,11 +504,13 @@ func (o *PutContactsInternalServerError) Code() int {
}
func (o *PutContactsInternalServerError) Error() string {
return fmt.Sprintf("[PUT /contacts][%d] putContactsInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contacts][%d] putContactsInternalServerError %s", 500, payload)
}
func (o *PutContactsInternalServerError) String() string {
return fmt.Sprintf("[PUT /contacts][%d] putContactsInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contacts][%d] putContactsInternalServerError %s", 500, payload)
}
func (o *PutContactsInternalServerError) GetPayload() *crm_models.Error {
@ -531,7 +529,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}

View File

@ -6,55 +6,117 @@
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.ClientTransport, formats strfmt.Registry) ClientService {
func New(transport runtime.ContextualTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
/*
Client for contracts API
*/
// 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.
type Client struct {
transport runtime.ClientTransport
transport runtime.ContextualTransport
formats strfmt.Registry
}
// ClientOption is the option for Client methods
// ClientOption may be used to customize the behavior of 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)
SetTransport(transport runtime.ClientTransport)
// PutContractContext update a single contract.
PutContractContext(ctx context.Context, params *PutContractParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutContractOK, error)
SetTransport(transport runtime.ContextualTransport)
}
/*
DeleteContract deletes an contract
Delete SalesforceDevops.net Contract record
*/
// 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.
func (a *Client) DeleteContract(params *DeleteContractParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteContractOK, error) {
// TODO: Validate the params before sending
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
if params == nil {
params = NewDeleteContractParams()
}
op := &runtime.ClientOperation{
ID: "deleteContract",
Method: "DELETE",
@ -65,37 +127,63 @@ func (a *Client) DeleteContract(params *DeleteContractParams, authInfo runtime.C
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.Submit(op)
result, err := a.transport.SubmitContext(ctx, op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*DeleteContractOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
// unexpected success response.
// no default response is defined.
//
// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for 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
*/
// 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.
func (a *Client) GetContracts(params *GetContractsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetContractsOK, error) {
// TODO: Validate the params before sending
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
if params == nil {
params = NewGetContractsParams()
}
op := &runtime.ClientOperation{
ID: "getContracts",
Method: "GET",
@ -106,37 +194,63 @@ func (a *Client) GetContracts(params *GetContractsParams, authInfo runtime.Clien
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.Submit(op)
result, err := a.transport.SubmitContext(ctx, op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*GetContractsOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
// unexpected success response.
// no default response is defined.
//
// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for 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
*/
// 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.
func (a *Client) PostContracts(params *PostContractsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostContractsOK, error) {
// TODO: Validate the params before sending
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
if params == nil {
params = NewPostContractsParams()
}
op := &runtime.ClientOperation{
ID: "postContracts",
Method: "POST",
@ -147,37 +261,63 @@ func (a *Client) PostContracts(params *PostContractsParams, authInfo runtime.Cli
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.Submit(op)
result, err := a.transport.SubmitContext(ctx, op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*PostContractsOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
// unexpected success response.
// no default response is defined.
//
// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for 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
*/
// 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.
func (a *Client) PutContract(params *PutContractParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutContractOK, error) {
// TODO: Validate the params before sending
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
if params == nil {
params = NewPutContractParams()
}
op := &runtime.ClientOperation{
ID: "putContract",
Method: "PUT",
@ -188,28 +328,42 @@ func (a *Client) PutContract(params *PutContractParams, authInfo runtime.ClientA
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.Submit(op)
result, err := a.transport.SubmitContext(ctx, op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*PutContractOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
// unexpected success response.
// no default response is defined.
//
// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for 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.ClientTransport) {
func (a *Client) SetTransport(transport runtime.ContextualTransport) {
a.transport = transport
}
// innerParams captures internal fields so they don't conflict with user-supplied parameters.
type innerParams struct {
timeout time.Duration
// Deprecated: use the operation call with context to pass the context instead of [ContractsParams].
ctx context.Context
}

View File

@ -6,9 +6,6 @@
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"
@ -27,24 +24,28 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewDeleteContractParams() *DeleteContractParams {
return &DeleteContractParams{
timeout: cr.DefaultTimeout,
}
return NewDeleteContractParamsWithTimeout(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{
timeout: timeout,
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{
Context: ctx,
inner: innerParams{
ctx: ctx,
},
}
}
@ -65,15 +66,14 @@ 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,54 +91,57 @@ 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.timeout = timeout
o.inner.timeout = timeout
}
// WithContext adds the context to the delete contract params
// WithContext adds the context to the delete contract params.
//
// Deprecated: use the operation call with context to pass the context instead of [DeleteContractParams].
func (o *DeleteContractParams) WithContext(ctx context.Context) *DeleteContractParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the delete contract params
// SetContext adds the context to the delete contract params.
//
// Deprecated: use the operation call with context to pass the context instead of [DeleteContractParams].
func (o *DeleteContractParams) SetContext(ctx context.Context) {
o.Context = ctx
o.inner.ctx = 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 swagger request
// WriteToRequest writes these params to a [runtime.ClientRequest].
func (o *DeleteContractParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
if err := r.SetTimeout(o.inner.timeout); err != nil {
return err
}
var res []error

View File

@ -6,17 +6,15 @@
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.
@ -25,7 +23,7 @@ type DeleteContractReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *DeleteContractReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
func (o *DeleteContractReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
switch response.Code() {
case 200:
result := NewDeleteContractOK()
@ -64,7 +62,7 @@ func (o *DeleteContractReader) ReadResponse(response runtime.ClientResponse, con
}
return nil, result
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
return nil, runtime.NewAPIError("[DELETE /contracts] deleteContract", response, response.Code())
}
}
@ -73,11 +71,9 @@ 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
@ -115,11 +111,13 @@ func (o *DeleteContractOK) Code() int {
}
func (o *DeleteContractOK) Error() string {
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractOK %s", 200, payload)
}
func (o *DeleteContractOK) String() string {
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractOK %s", 200, payload)
}
func (o *DeleteContractOK) GetPayload() *crm_models.DeleteResponse {
@ -138,7 +136,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -150,11 +148,9 @@ 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
@ -192,11 +188,13 @@ func (o *DeleteContractUnauthorized) Code() int {
}
func (o *DeleteContractUnauthorized) Error() string {
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractUnauthorized %s", 401, payload)
}
func (o *DeleteContractUnauthorized) String() string {
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractUnauthorized %s", 401, payload)
}
func (o *DeleteContractUnauthorized) GetPayload() *crm_models.Error {
@ -215,7 +213,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -227,11 +225,9 @@ 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
@ -269,11 +265,13 @@ func (o *DeleteContractForbidden) Code() int {
}
func (o *DeleteContractForbidden) Error() string {
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractForbidden %s", 403, payload)
}
func (o *DeleteContractForbidden) String() string {
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractForbidden %s", 403, payload)
}
func (o *DeleteContractForbidden) GetPayload() *crm_models.Error {
@ -292,7 +290,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -304,11 +302,9 @@ 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
@ -346,11 +342,13 @@ func (o *DeleteContractNotFound) Code() int {
}
func (o *DeleteContractNotFound) Error() string {
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractNotFound %s", 404, payload)
}
func (o *DeleteContractNotFound) String() string {
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractNotFound %s", 404, payload)
}
func (o *DeleteContractNotFound) GetPayload() *crm_models.Error {
@ -369,7 +367,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -381,11 +379,9 @@ 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
@ -423,11 +419,13 @@ func (o *DeleteContractUnprocessableEntity) Code() int {
}
func (o *DeleteContractUnprocessableEntity) Error() string {
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractUnprocessableEntity %s", 422, payload)
}
func (o *DeleteContractUnprocessableEntity) String() string {
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractUnprocessableEntity %s", 422, payload)
}
func (o *DeleteContractUnprocessableEntity) GetPayload() *crm_models.Error {
@ -446,7 +444,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -458,11 +456,9 @@ 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
@ -500,11 +496,13 @@ func (o *DeleteContractInternalServerError) Code() int {
}
func (o *DeleteContractInternalServerError) Error() string {
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractInternalServerError %s", 500, payload)
}
func (o *DeleteContractInternalServerError) String() string {
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /contracts][%d] deleteContractInternalServerError %s", 500, payload)
}
func (o *DeleteContractInternalServerError) GetPayload() *crm_models.Error {
@ -523,7 +521,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}

View File

@ -6,9 +6,6 @@
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"
@ -18,7 +15,7 @@ import (
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/swag/conv"
)
// NewGetContractsParams creates a new GetContractsParams object,
@ -28,24 +25,28 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewGetContractsParams() *GetContractsParams {
return &GetContractsParams{
timeout: cr.DefaultTimeout,
}
return NewGetContractsParamsWithTimeout(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{
timeout: timeout,
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{
Context: ctx,
inner: innerParams{
ctx: ctx,
},
}
}
@ -66,37 +67,33 @@ 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).
@ -114,87 +111,90 @@ 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.timeout = timeout
o.inner.timeout = timeout
}
// WithContext adds the context to the get contracts params
// WithContext adds the context to the get contracts params.
//
// Deprecated: use the operation call with context to pass the context instead of [GetContractsParams].
func (o *GetContractsParams) WithContext(ctx context.Context) *GetContractsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get contracts params
// SetContext adds the context to the get contracts params.
//
// Deprecated: use the operation call with context to pass the context instead of [GetContractsParams].
func (o *GetContractsParams) SetContext(ctx context.Context) {
o.Context = ctx
o.inner.ctx = 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 swagger request
// WriteToRequest writes these params to a [runtime.ClientRequest].
func (o *GetContractsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
if err := r.SetTimeout(o.inner.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 := swag.FormatBool(qrActive)
qActive := conv.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 := swag.FormatInt64(qrLimit)
qLimit := conv.FormatInteger(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 := swag.FormatInt64(qrOffset)
qOffset := conv.FormatInteger(qrOffset)
if qOffset != "" {
if err := r.SetQueryParam("offset", qOffset); err != nil {

View File

@ -6,17 +6,15 @@
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.
@ -25,7 +23,7 @@ type GetContractsReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *GetContractsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
func (o *GetContractsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
switch response.Code() {
case 200:
result := NewGetContractsOK()
@ -64,7 +62,7 @@ func (o *GetContractsReader) ReadResponse(response runtime.ClientResponse, consu
}
return nil, result
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
return nil, runtime.NewAPIError("[GET /contracts] getContracts", response, response.Code())
}
}
@ -73,11 +71,9 @@ 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
@ -116,11 +112,13 @@ func (o *GetContractsOK) Code() int {
}
func (o *GetContractsOK) Error() string {
return fmt.Sprintf("[GET /contracts][%d] getContractsOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsOK %s", 200, payload)
}
func (o *GetContractsOK) String() string {
return fmt.Sprintf("[GET /contracts][%d] getContractsOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsOK %s", 200, payload)
}
func (o *GetContractsOK) GetPayload() *crm_models.ContractResponse {
@ -146,7 +144,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -158,11 +156,9 @@ 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
@ -200,11 +196,13 @@ func (o *GetContractsUnauthorized) Code() int {
}
func (o *GetContractsUnauthorized) Error() string {
return fmt.Sprintf("[GET /contracts][%d] getContractsUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsUnauthorized %s", 401, payload)
}
func (o *GetContractsUnauthorized) String() string {
return fmt.Sprintf("[GET /contracts][%d] getContractsUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsUnauthorized %s", 401, payload)
}
func (o *GetContractsUnauthorized) GetPayload() *crm_models.Error {
@ -223,7 +221,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -235,11 +233,9 @@ 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
@ -277,11 +273,13 @@ func (o *GetContractsForbidden) Code() int {
}
func (o *GetContractsForbidden) Error() string {
return fmt.Sprintf("[GET /contracts][%d] getContractsForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsForbidden %s", 403, payload)
}
func (o *GetContractsForbidden) String() string {
return fmt.Sprintf("[GET /contracts][%d] getContractsForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsForbidden %s", 403, payload)
}
func (o *GetContractsForbidden) GetPayload() *crm_models.Error {
@ -300,7 +298,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -312,11 +310,9 @@ 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
@ -354,11 +350,13 @@ func (o *GetContractsNotFound) Code() int {
}
func (o *GetContractsNotFound) Error() string {
return fmt.Sprintf("[GET /contracts][%d] getContractsNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsNotFound %s", 404, payload)
}
func (o *GetContractsNotFound) String() string {
return fmt.Sprintf("[GET /contracts][%d] getContractsNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsNotFound %s", 404, payload)
}
func (o *GetContractsNotFound) GetPayload() *crm_models.Error {
@ -377,7 +375,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -389,11 +387,9 @@ 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
@ -431,11 +427,13 @@ func (o *GetContractsUnprocessableEntity) Code() int {
}
func (o *GetContractsUnprocessableEntity) Error() string {
return fmt.Sprintf("[GET /contracts][%d] getContractsUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsUnprocessableEntity %s", 422, payload)
}
func (o *GetContractsUnprocessableEntity) String() string {
return fmt.Sprintf("[GET /contracts][%d] getContractsUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsUnprocessableEntity %s", 422, payload)
}
func (o *GetContractsUnprocessableEntity) GetPayload() *crm_models.Error {
@ -454,7 +452,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -466,11 +464,9 @@ 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
@ -508,11 +504,13 @@ func (o *GetContractsInternalServerError) Code() int {
}
func (o *GetContractsInternalServerError) Error() string {
return fmt.Sprintf("[GET /contracts][%d] getContractsInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsInternalServerError %s", 500, payload)
}
func (o *GetContractsInternalServerError) String() string {
return fmt.Sprintf("[GET /contracts][%d] getContractsInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsInternalServerError %s", 500, payload)
}
func (o *GetContractsInternalServerError) GetPayload() *crm_models.Error {
@ -531,7 +529,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}

View File

@ -6,20 +6,16 @@
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,
@ -29,24 +25,28 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewPostContractsParams() *PostContractsParams {
return &PostContractsParams{
timeout: cr.DefaultTimeout,
}
return NewPostContractsParamsWithTimeout(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{
timeout: timeout,
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{
Context: ctx,
inner: innerParams{
ctx: ctx,
},
}
}
@ -67,15 +67,14 @@ 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).
@ -93,54 +92,57 @@ 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.timeout = timeout
o.inner.timeout = timeout
}
// WithContext adds the context to the post contracts params
// WithContext adds the context to the post contracts params.
//
// Deprecated: use the operation call with context to pass the context instead of [PostContractsParams].
func (o *PostContractsParams) WithContext(ctx context.Context) *PostContractsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the post contracts params
// SetContext adds the context to the post contracts params.
//
// Deprecated: use the operation call with context to pass the context instead of [PostContractsParams].
func (o *PostContractsParams) SetContext(ctx context.Context) {
o.Context = ctx
o.inner.ctx = 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 swagger request
// WriteToRequest writes these params to a [runtime.ClientRequest].
func (o *PostContractsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
if err := r.SetTimeout(o.inner.timeout); err != nil {
return err
}
var res []error

View File

@ -6,17 +6,15 @@
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.
@ -25,7 +23,7 @@ type PostContractsReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *PostContractsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
func (o *PostContractsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
switch response.Code() {
case 200:
result := NewPostContractsOK()
@ -64,7 +62,7 @@ func (o *PostContractsReader) ReadResponse(response runtime.ClientResponse, cons
}
return nil, result
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
return nil, runtime.NewAPIError("[POST /contracts] postContracts", response, response.Code())
}
}
@ -73,11 +71,9 @@ 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
@ -116,11 +112,13 @@ func (o *PostContractsOK) Code() int {
}
func (o *PostContractsOK) Error() string {
return fmt.Sprintf("[POST /contracts][%d] postContractsOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contracts][%d] postContractsOK %s", 200, payload)
}
func (o *PostContractsOK) String() string {
return fmt.Sprintf("[POST /contracts][%d] postContractsOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contracts][%d] postContractsOK %s", 200, payload)
}
func (o *PostContractsOK) GetPayload() *crm_models.ContractResponse {
@ -146,7 +144,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -158,11 +156,9 @@ 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
@ -200,11 +196,13 @@ func (o *PostContractsUnauthorized) Code() int {
}
func (o *PostContractsUnauthorized) Error() string {
return fmt.Sprintf("[POST /contracts][%d] postContractsUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contracts][%d] postContractsUnauthorized %s", 401, payload)
}
func (o *PostContractsUnauthorized) String() string {
return fmt.Sprintf("[POST /contracts][%d] postContractsUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contracts][%d] postContractsUnauthorized %s", 401, payload)
}
func (o *PostContractsUnauthorized) GetPayload() *crm_models.Error {
@ -223,7 +221,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -235,11 +233,9 @@ 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
@ -277,11 +273,13 @@ func (o *PostContractsForbidden) Code() int {
}
func (o *PostContractsForbidden) Error() string {
return fmt.Sprintf("[POST /contracts][%d] postContractsForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contracts][%d] postContractsForbidden %s", 403, payload)
}
func (o *PostContractsForbidden) String() string {
return fmt.Sprintf("[POST /contracts][%d] postContractsForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contracts][%d] postContractsForbidden %s", 403, payload)
}
func (o *PostContractsForbidden) GetPayload() *crm_models.Error {
@ -300,7 +298,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -312,11 +310,9 @@ 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
@ -354,11 +350,13 @@ func (o *PostContractsNotFound) Code() int {
}
func (o *PostContractsNotFound) Error() string {
return fmt.Sprintf("[POST /contracts][%d] postContractsNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contracts][%d] postContractsNotFound %s", 404, payload)
}
func (o *PostContractsNotFound) String() string {
return fmt.Sprintf("[POST /contracts][%d] postContractsNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contracts][%d] postContractsNotFound %s", 404, payload)
}
func (o *PostContractsNotFound) GetPayload() *crm_models.Error {
@ -377,7 +375,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -389,11 +387,9 @@ 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
@ -431,11 +427,13 @@ func (o *PostContractsUnprocessableEntity) Code() int {
}
func (o *PostContractsUnprocessableEntity) Error() string {
return fmt.Sprintf("[POST /contracts][%d] postContractsUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contracts][%d] postContractsUnprocessableEntity %s", 422, payload)
}
func (o *PostContractsUnprocessableEntity) String() string {
return fmt.Sprintf("[POST /contracts][%d] postContractsUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contracts][%d] postContractsUnprocessableEntity %s", 422, payload)
}
func (o *PostContractsUnprocessableEntity) GetPayload() *crm_models.Error {
@ -454,7 +452,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -466,11 +464,9 @@ 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
@ -508,11 +504,13 @@ func (o *PostContractsInternalServerError) Code() int {
}
func (o *PostContractsInternalServerError) Error() string {
return fmt.Sprintf("[POST /contracts][%d] postContractsInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contracts][%d] postContractsInternalServerError %s", 500, payload)
}
func (o *PostContractsInternalServerError) String() string {
return fmt.Sprintf("[POST /contracts][%d] postContractsInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /contracts][%d] postContractsInternalServerError %s", 500, payload)
}
func (o *PostContractsInternalServerError) GetPayload() *crm_models.Error {
@ -531,7 +529,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}

View File

@ -6,20 +6,16 @@
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,
@ -29,24 +25,28 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewPutContractParams() *PutContractParams {
return &PutContractParams{
timeout: cr.DefaultTimeout,
}
return NewPutContractParamsWithTimeout(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{
timeout: timeout,
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{
Context: ctx,
inner: innerParams{
ctx: ctx,
},
}
}
@ -67,15 +67,14 @@ 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).
@ -93,54 +92,57 @@ 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.timeout = timeout
o.inner.timeout = timeout
}
// WithContext adds the context to the put contract params
// WithContext adds the context to the put contract params.
//
// Deprecated: use the operation call with context to pass the context instead of [PutContractParams].
func (o *PutContractParams) WithContext(ctx context.Context) *PutContractParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the put contract params
// SetContext adds the context to the put contract params.
//
// Deprecated: use the operation call with context to pass the context instead of [PutContractParams].
func (o *PutContractParams) SetContext(ctx context.Context) {
o.Context = ctx
o.inner.ctx = 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 swagger request
// WriteToRequest writes these params to a [runtime.ClientRequest].
func (o *PutContractParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
if err := r.SetTimeout(o.inner.timeout); err != nil {
return err
}
var res []error

View File

@ -6,17 +6,15 @@
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.
@ -25,7 +23,7 @@ type PutContractReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *PutContractReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
func (o *PutContractReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
switch response.Code() {
case 200:
result := NewPutContractOK()
@ -64,7 +62,7 @@ func (o *PutContractReader) ReadResponse(response runtime.ClientResponse, consum
}
return nil, result
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
return nil, runtime.NewAPIError("[PUT /contracts] putContract", response, response.Code())
}
}
@ -73,11 +71,9 @@ 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
@ -116,11 +112,13 @@ func (o *PutContractOK) Code() int {
}
func (o *PutContractOK) Error() string {
return fmt.Sprintf("[PUT /contracts][%d] putContractOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractOK %s", 200, payload)
}
func (o *PutContractOK) String() string {
return fmt.Sprintf("[PUT /contracts][%d] putContractOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractOK %s", 200, payload)
}
func (o *PutContractOK) GetPayload() *crm_models.ContractResponse {
@ -146,7 +144,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -158,11 +156,9 @@ 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
@ -200,11 +196,13 @@ func (o *PutContractUnauthorized) Code() int {
}
func (o *PutContractUnauthorized) Error() string {
return fmt.Sprintf("[PUT /contracts][%d] putContractUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractUnauthorized %s", 401, payload)
}
func (o *PutContractUnauthorized) String() string {
return fmt.Sprintf("[PUT /contracts][%d] putContractUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractUnauthorized %s", 401, payload)
}
func (o *PutContractUnauthorized) GetPayload() *crm_models.Error {
@ -223,7 +221,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -235,11 +233,9 @@ 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
@ -277,11 +273,13 @@ func (o *PutContractForbidden) Code() int {
}
func (o *PutContractForbidden) Error() string {
return fmt.Sprintf("[PUT /contracts][%d] putContractForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractForbidden %s", 403, payload)
}
func (o *PutContractForbidden) String() string {
return fmt.Sprintf("[PUT /contracts][%d] putContractForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractForbidden %s", 403, payload)
}
func (o *PutContractForbidden) GetPayload() *crm_models.Error {
@ -300,7 +298,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -312,11 +310,9 @@ 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
@ -354,11 +350,13 @@ func (o *PutContractNotFound) Code() int {
}
func (o *PutContractNotFound) Error() string {
return fmt.Sprintf("[PUT /contracts][%d] putContractNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractNotFound %s", 404, payload)
}
func (o *PutContractNotFound) String() string {
return fmt.Sprintf("[PUT /contracts][%d] putContractNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractNotFound %s", 404, payload)
}
func (o *PutContractNotFound) GetPayload() *crm_models.Error {
@ -377,7 +375,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -389,11 +387,9 @@ 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
@ -431,11 +427,13 @@ func (o *PutContractUnprocessableEntity) Code() int {
}
func (o *PutContractUnprocessableEntity) Error() string {
return fmt.Sprintf("[PUT /contracts][%d] putContractUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractUnprocessableEntity %s", 422, payload)
}
func (o *PutContractUnprocessableEntity) String() string {
return fmt.Sprintf("[PUT /contracts][%d] putContractUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractUnprocessableEntity %s", 422, payload)
}
func (o *PutContractUnprocessableEntity) GetPayload() *crm_models.Error {
@ -454,7 +452,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -466,11 +464,9 @@ 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
@ -508,11 +504,13 @@ func (o *PutContractInternalServerError) Code() int {
}
func (o *PutContractInternalServerError) Error() string {
return fmt.Sprintf("[PUT /contracts][%d] putContractInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractInternalServerError %s", 500, payload)
}
func (o *PutContractInternalServerError) String() string {
return fmt.Sprintf("[PUT /contracts][%d] putContractInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractInternalServerError %s", 500, payload)
}
func (o *PutContractInternalServerError) GetPayload() *crm_models.Error {
@ -531,7 +529,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}

View File

@ -6,34 +6,30 @@
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 (
"github.com/go-openapi/runtime"
httptransport "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"maps"
"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.
@ -49,13 +45,16 @@ 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.ClientTransport, formats strfmt.Registry) *Crm {
// New creates a new crm client.
func New(transport runtime.ContextualTransport, formats strfmt.Registry) *Crm {
// ensure nullable parameters have default
if formats == nil {
formats = strfmt.Default
@ -68,6 +67,7 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) *Crm {
cli.Contacts = contacts.New(transport, formats)
cli.Contracts = contracts.New(transport, formats)
cli.Leads = leads.New(transport, formats)
return cli
}
@ -84,9 +84,11 @@ func DefaultTransportConfig() *TransportConfig {
// TransportConfig contains the transport related info,
// found in the meta section of the spec file.
type TransportConfig struct {
Host string
BasePath string
Schemes []string
Host string
BasePath string
Schemes []string
Producers map[string]runtime.Producer
Consumers map[string]runtime.Consumer
}
// WithHost overrides the default host,
@ -110,7 +112,19 @@ func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig {
return cfg
}
// Crm is a client for crm
// 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.
type Crm struct {
Accounts accounts.ClientService
@ -122,11 +136,11 @@ type Crm struct {
Leads leads.ClientService
Transport runtime.ClientTransport
Transport runtime.ContextualTransport
}
// SetTransport changes the transport on the client and all its subresources
func (c *Crm) SetTransport(transport runtime.ClientTransport) {
// SetTransport changes the transport on the client and all its subresources.
func (c *Crm) SetTransport(transport runtime.ContextualTransport) {
c.Transport = transport
c.Accounts.SetTransport(transport)
c.Assets.SetTransport(transport)

View File

@ -6,9 +6,6 @@
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"
@ -27,24 +24,28 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewDeleteLeadParams() *DeleteLeadParams {
return &DeleteLeadParams{
timeout: cr.DefaultTimeout,
}
return NewDeleteLeadParamsWithTimeout(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{
timeout: timeout,
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{
Context: ctx,
inner: innerParams{
ctx: ctx,
},
}
}
@ -65,15 +66,14 @@ 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,54 +91,57 @@ 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.timeout = timeout
o.inner.timeout = timeout
}
// WithContext adds the context to the delete lead params
// WithContext adds the context to the delete lead params.
//
// Deprecated: use the operation call with context to pass the context instead of [DeleteLeadParams].
func (o *DeleteLeadParams) WithContext(ctx context.Context) *DeleteLeadParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the delete lead params
// SetContext adds the context to the delete lead params.
//
// Deprecated: use the operation call with context to pass the context instead of [DeleteLeadParams].
func (o *DeleteLeadParams) SetContext(ctx context.Context) {
o.Context = ctx
o.inner.ctx = 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 swagger request
// WriteToRequest writes these params to a [runtime.ClientRequest].
func (o *DeleteLeadParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
if err := r.SetTimeout(o.inner.timeout); err != nil {
return err
}
var res []error

View File

@ -6,17 +6,15 @@
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.
@ -25,7 +23,7 @@ type DeleteLeadReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *DeleteLeadReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
func (o *DeleteLeadReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
switch response.Code() {
case 200:
result := NewDeleteLeadOK()
@ -64,7 +62,7 @@ func (o *DeleteLeadReader) ReadResponse(response runtime.ClientResponse, consume
}
return nil, result
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
return nil, runtime.NewAPIError("[DELETE /leads] deleteLead", response, response.Code())
}
}
@ -73,11 +71,9 @@ 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
@ -115,11 +111,13 @@ func (o *DeleteLeadOK) Code() int {
}
func (o *DeleteLeadOK) Error() string {
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadOK %s", 200, payload)
}
func (o *DeleteLeadOK) String() string {
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadOK %s", 200, payload)
}
func (o *DeleteLeadOK) GetPayload() *crm_models.DeleteResponse {
@ -138,7 +136,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -150,11 +148,9 @@ 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
@ -192,11 +188,13 @@ func (o *DeleteLeadUnauthorized) Code() int {
}
func (o *DeleteLeadUnauthorized) Error() string {
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadUnauthorized %s", 401, payload)
}
func (o *DeleteLeadUnauthorized) String() string {
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadUnauthorized %s", 401, payload)
}
func (o *DeleteLeadUnauthorized) GetPayload() *crm_models.Error {
@ -215,7 +213,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -227,11 +225,9 @@ 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
@ -269,11 +265,13 @@ func (o *DeleteLeadForbidden) Code() int {
}
func (o *DeleteLeadForbidden) Error() string {
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadForbidden %s", 403, payload)
}
func (o *DeleteLeadForbidden) String() string {
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadForbidden %s", 403, payload)
}
func (o *DeleteLeadForbidden) GetPayload() *crm_models.Error {
@ -292,7 +290,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -304,11 +302,9 @@ 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
@ -346,11 +342,13 @@ func (o *DeleteLeadNotFound) Code() int {
}
func (o *DeleteLeadNotFound) Error() string {
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadNotFound %s", 404, payload)
}
func (o *DeleteLeadNotFound) String() string {
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadNotFound %s", 404, payload)
}
func (o *DeleteLeadNotFound) GetPayload() *crm_models.Error {
@ -369,7 +367,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -381,11 +379,9 @@ 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
@ -423,11 +419,13 @@ func (o *DeleteLeadUnprocessableEntity) Code() int {
}
func (o *DeleteLeadUnprocessableEntity) Error() string {
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadUnprocessableEntity %s", 422, payload)
}
func (o *DeleteLeadUnprocessableEntity) String() string {
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadUnprocessableEntity %s", 422, payload)
}
func (o *DeleteLeadUnprocessableEntity) GetPayload() *crm_models.Error {
@ -446,7 +444,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -458,11 +456,9 @@ 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
@ -500,11 +496,13 @@ func (o *DeleteLeadInternalServerError) Code() int {
}
func (o *DeleteLeadInternalServerError) Error() string {
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadInternalServerError %s", 500, payload)
}
func (o *DeleteLeadInternalServerError) String() string {
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadInternalServerError %s", 500, payload)
}
func (o *DeleteLeadInternalServerError) GetPayload() *crm_models.Error {
@ -523,7 +521,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}

View File

@ -6,9 +6,6 @@
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"
@ -18,7 +15,7 @@ import (
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/swag/conv"
)
// NewGetLeadsParams creates a new GetLeadsParams object,
@ -28,24 +25,28 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewGetLeadsParams() *GetLeadsParams {
return &GetLeadsParams{
timeout: cr.DefaultTimeout,
}
return NewGetLeadsParamsWithTimeout(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{
timeout: timeout,
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{
Context: ctx,
inner: innerParams{
ctx: ctx,
},
}
}
@ -66,43 +67,38 @@ 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).
@ -120,98 +116,101 @@ 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.timeout = timeout
o.inner.timeout = timeout
}
// WithContext adds the context to the get leads params
// WithContext adds the context to the get leads params.
//
// Deprecated: use the operation call with context to pass the context instead of [GetLeadsParams].
func (o *GetLeadsParams) WithContext(ctx context.Context) *GetLeadsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get leads params
// SetContext adds the context to the get leads params.
//
// Deprecated: use the operation call with context to pass the context instead of [GetLeadsParams].
func (o *GetLeadsParams) SetContext(ctx context.Context) {
o.Context = ctx
o.inner.ctx = 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 swagger request
// WriteToRequest writes these params to a [runtime.ClientRequest].
func (o *GetLeadsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
if err := r.SetTimeout(o.inner.timeout); err != nil {
return err
}
var res []error
@ -258,7 +257,7 @@ func (o *GetLeadsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regi
if o.Limit != nil {
qrLimit = *o.Limit
}
qLimit := swag.FormatInt64(qrLimit)
qLimit := conv.FormatInteger(qrLimit)
if qLimit != "" {
if err := r.SetQueryParam("limit", qLimit); err != nil {
@ -292,7 +291,7 @@ func (o *GetLeadsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regi
if o.Offset != nil {
qrOffset = *o.Offset
}
qOffset := swag.FormatInt64(qrOffset)
qOffset := conv.FormatInteger(qrOffset)
if qOffset != "" {
if err := r.SetQueryParam("offset", qOffset); err != nil {

View File

@ -6,17 +6,15 @@
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.
@ -25,7 +23,7 @@ type GetLeadsReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *GetLeadsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
func (o *GetLeadsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
switch response.Code() {
case 200:
result := NewGetLeadsOK()
@ -64,7 +62,7 @@ func (o *GetLeadsReader) ReadResponse(response runtime.ClientResponse, consumer
}
return nil, result
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
return nil, runtime.NewAPIError("[GET /leads] getLeads", response, response.Code())
}
}
@ -73,11 +71,9 @@ 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
@ -116,11 +112,13 @@ func (o *GetLeadsOK) Code() int {
}
func (o *GetLeadsOK) Error() string {
return fmt.Sprintf("[GET /leads][%d] getLeadsOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /leads][%d] getLeadsOK %s", 200, payload)
}
func (o *GetLeadsOK) String() string {
return fmt.Sprintf("[GET /leads][%d] getLeadsOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /leads][%d] getLeadsOK %s", 200, payload)
}
func (o *GetLeadsOK) GetPayload() *crm_models.LeadResponse {
@ -146,7 +144,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -158,11 +156,9 @@ 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
@ -200,11 +196,13 @@ func (o *GetLeadsUnauthorized) Code() int {
}
func (o *GetLeadsUnauthorized) Error() string {
return fmt.Sprintf("[GET /leads][%d] getLeadsUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /leads][%d] getLeadsUnauthorized %s", 401, payload)
}
func (o *GetLeadsUnauthorized) String() string {
return fmt.Sprintf("[GET /leads][%d] getLeadsUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /leads][%d] getLeadsUnauthorized %s", 401, payload)
}
func (o *GetLeadsUnauthorized) GetPayload() *crm_models.Error {
@ -223,7 +221,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -235,11 +233,9 @@ 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
@ -277,11 +273,13 @@ func (o *GetLeadsForbidden) Code() int {
}
func (o *GetLeadsForbidden) Error() string {
return fmt.Sprintf("[GET /leads][%d] getLeadsForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /leads][%d] getLeadsForbidden %s", 403, payload)
}
func (o *GetLeadsForbidden) String() string {
return fmt.Sprintf("[GET /leads][%d] getLeadsForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /leads][%d] getLeadsForbidden %s", 403, payload)
}
func (o *GetLeadsForbidden) GetPayload() *crm_models.Error {
@ -300,7 +298,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -312,11 +310,9 @@ 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
@ -354,11 +350,13 @@ func (o *GetLeadsNotFound) Code() int {
}
func (o *GetLeadsNotFound) Error() string {
return fmt.Sprintf("[GET /leads][%d] getLeadsNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /leads][%d] getLeadsNotFound %s", 404, payload)
}
func (o *GetLeadsNotFound) String() string {
return fmt.Sprintf("[GET /leads][%d] getLeadsNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /leads][%d] getLeadsNotFound %s", 404, payload)
}
func (o *GetLeadsNotFound) GetPayload() *crm_models.Error {
@ -377,7 +375,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -389,11 +387,9 @@ 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
@ -431,11 +427,13 @@ func (o *GetLeadsUnprocessableEntity) Code() int {
}
func (o *GetLeadsUnprocessableEntity) Error() string {
return fmt.Sprintf("[GET /leads][%d] getLeadsUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /leads][%d] getLeadsUnprocessableEntity %s", 422, payload)
}
func (o *GetLeadsUnprocessableEntity) String() string {
return fmt.Sprintf("[GET /leads][%d] getLeadsUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /leads][%d] getLeadsUnprocessableEntity %s", 422, payload)
}
func (o *GetLeadsUnprocessableEntity) GetPayload() *crm_models.Error {
@ -454,7 +452,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -466,11 +464,9 @@ 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
@ -508,11 +504,13 @@ func (o *GetLeadsInternalServerError) Code() int {
}
func (o *GetLeadsInternalServerError) Error() string {
return fmt.Sprintf("[GET /leads][%d] getLeadsInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /leads][%d] getLeadsInternalServerError %s", 500, payload)
}
func (o *GetLeadsInternalServerError) String() string {
return fmt.Sprintf("[GET /leads][%d] getLeadsInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /leads][%d] getLeadsInternalServerError %s", 500, payload)
}
func (o *GetLeadsInternalServerError) GetPayload() *crm_models.Error {
@ -531,7 +529,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}

View File

@ -6,55 +6,117 @@
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.ClientTransport, formats strfmt.Registry) ClientService {
func New(transport runtime.ContextualTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
/*
Client for leads API
*/
// 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.
type Client struct {
transport runtime.ClientTransport
transport runtime.ContextualTransport
formats strfmt.Registry
}
// ClientOption is the option for Client methods
// ClientOption may be used to customize the behavior of 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)
SetTransport(transport runtime.ClientTransport)
// PutLeadsContext update leads.
PutLeadsContext(ctx context.Context, params *PutLeadsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutLeadsOK, error)
SetTransport(transport runtime.ContextualTransport)
}
/*
DeleteLead deletes a contact
Delete SalesforceDevops.net Lead record
*/
// 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.
func (a *Client) DeleteLead(params *DeleteLeadParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteLeadOK, error) {
// TODO: Validate the params before sending
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
if params == nil {
params = NewDeleteLeadParams()
}
op := &runtime.ClientOperation{
ID: "deleteLead",
Method: "DELETE",
@ -65,37 +127,63 @@ func (a *Client) DeleteLead(params *DeleteLeadParams, authInfo runtime.ClientAut
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.Submit(op)
result, err := a.transport.SubmitContext(ctx, op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*DeleteLeadOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
// unexpected success response.
// no default response is defined.
//
// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for 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
*/
// 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.
func (a *Client) GetLeads(params *GetLeadsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLeadsOK, error) {
// TODO: Validate the params before sending
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
if params == nil {
params = NewGetLeadsParams()
}
op := &runtime.ClientOperation{
ID: "getLeads",
Method: "GET",
@ -106,37 +194,63 @@ func (a *Client) GetLeads(params *GetLeadsParams, authInfo runtime.ClientAuthInf
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.Submit(op)
result, err := a.transport.SubmitContext(ctx, op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*GetLeadsOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
// unexpected success response.
// no default response is defined.
//
// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for 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
*/
// 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.
func (a *Client) PostLeads(params *PostLeadsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostLeadsOK, error) {
// TODO: Validate the params before sending
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
if params == nil {
params = NewPostLeadsParams()
}
op := &runtime.ClientOperation{
ID: "postLeads",
Method: "POST",
@ -147,37 +261,63 @@ func (a *Client) PostLeads(params *PostLeadsParams, authInfo runtime.ClientAuthI
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.Submit(op)
result, err := a.transport.SubmitContext(ctx, op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*PostLeadsOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
// unexpected success response.
// no default response is defined.
//
// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for 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
*/
// 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.
func (a *Client) PutLeads(params *PutLeadsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutLeadsOK, error) {
// TODO: Validate the params before sending
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
if params == nil {
params = NewPutLeadsParams()
}
op := &runtime.ClientOperation{
ID: "putLeads",
Method: "PUT",
@ -188,28 +328,42 @@ func (a *Client) PutLeads(params *PutLeadsParams, authInfo runtime.ClientAuthInf
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.Submit(op)
result, err := a.transport.SubmitContext(ctx, op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*PutLeadsOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
// unexpected success response.
// no default response is defined.
//
// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for 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.ClientTransport) {
func (a *Client) SetTransport(transport runtime.ContextualTransport) {
a.transport = transport
}
// innerParams captures internal fields so they don't conflict with user-supplied parameters.
type innerParams struct {
timeout time.Duration
// Deprecated: use the operation call with context to pass the context instead of [LeadsParams].
ctx context.Context
}

View File

@ -6,20 +6,16 @@
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,
@ -29,24 +25,28 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewPostLeadsParams() *PostLeadsParams {
return &PostLeadsParams{
timeout: cr.DefaultTimeout,
}
return NewPostLeadsParamsWithTimeout(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{
timeout: timeout,
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{
Context: ctx,
inner: innerParams{
ctx: ctx,
},
}
}
@ -67,15 +67,14 @@ 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).
@ -93,54 +92,57 @@ 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.timeout = timeout
o.inner.timeout = timeout
}
// WithContext adds the context to the post leads params
// WithContext adds the context to the post leads params.
//
// Deprecated: use the operation call with context to pass the context instead of [PostLeadsParams].
func (o *PostLeadsParams) WithContext(ctx context.Context) *PostLeadsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the post leads params
// SetContext adds the context to the post leads params.
//
// Deprecated: use the operation call with context to pass the context instead of [PostLeadsParams].
func (o *PostLeadsParams) SetContext(ctx context.Context) {
o.Context = ctx
o.inner.ctx = 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 swagger request
// WriteToRequest writes these params to a [runtime.ClientRequest].
func (o *PostLeadsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
if err := r.SetTimeout(o.inner.timeout); err != nil {
return err
}
var res []error

View File

@ -6,17 +6,15 @@
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.
@ -25,7 +23,7 @@ type PostLeadsReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *PostLeadsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
func (o *PostLeadsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
switch response.Code() {
case 200:
result := NewPostLeadsOK()
@ -64,7 +62,7 @@ func (o *PostLeadsReader) ReadResponse(response runtime.ClientResponse, consumer
}
return nil, result
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
return nil, runtime.NewAPIError("[POST /leads] postLeads", response, response.Code())
}
}
@ -73,11 +71,9 @@ 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
@ -116,11 +112,13 @@ func (o *PostLeadsOK) Code() int {
}
func (o *PostLeadsOK) Error() string {
return fmt.Sprintf("[POST /leads][%d] postLeadsOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /leads][%d] postLeadsOK %s", 200, payload)
}
func (o *PostLeadsOK) String() string {
return fmt.Sprintf("[POST /leads][%d] postLeadsOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /leads][%d] postLeadsOK %s", 200, payload)
}
func (o *PostLeadsOK) GetPayload() *crm_models.LeadResponse {
@ -146,7 +144,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -158,11 +156,9 @@ 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
@ -200,11 +196,13 @@ func (o *PostLeadsUnauthorized) Code() int {
}
func (o *PostLeadsUnauthorized) Error() string {
return fmt.Sprintf("[POST /leads][%d] postLeadsUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /leads][%d] postLeadsUnauthorized %s", 401, payload)
}
func (o *PostLeadsUnauthorized) String() string {
return fmt.Sprintf("[POST /leads][%d] postLeadsUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /leads][%d] postLeadsUnauthorized %s", 401, payload)
}
func (o *PostLeadsUnauthorized) GetPayload() *crm_models.Error {
@ -223,7 +221,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -235,11 +233,9 @@ 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
@ -277,11 +273,13 @@ func (o *PostLeadsForbidden) Code() int {
}
func (o *PostLeadsForbidden) Error() string {
return fmt.Sprintf("[POST /leads][%d] postLeadsForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /leads][%d] postLeadsForbidden %s", 403, payload)
}
func (o *PostLeadsForbidden) String() string {
return fmt.Sprintf("[POST /leads][%d] postLeadsForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /leads][%d] postLeadsForbidden %s", 403, payload)
}
func (o *PostLeadsForbidden) GetPayload() *crm_models.Error {
@ -300,7 +298,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -312,11 +310,9 @@ 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
@ -354,11 +350,13 @@ func (o *PostLeadsNotFound) Code() int {
}
func (o *PostLeadsNotFound) Error() string {
return fmt.Sprintf("[POST /leads][%d] postLeadsNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /leads][%d] postLeadsNotFound %s", 404, payload)
}
func (o *PostLeadsNotFound) String() string {
return fmt.Sprintf("[POST /leads][%d] postLeadsNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /leads][%d] postLeadsNotFound %s", 404, payload)
}
func (o *PostLeadsNotFound) GetPayload() *crm_models.Error {
@ -377,7 +375,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -389,11 +387,9 @@ 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
@ -431,11 +427,13 @@ func (o *PostLeadsUnprocessableEntity) Code() int {
}
func (o *PostLeadsUnprocessableEntity) Error() string {
return fmt.Sprintf("[POST /leads][%d] postLeadsUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /leads][%d] postLeadsUnprocessableEntity %s", 422, payload)
}
func (o *PostLeadsUnprocessableEntity) String() string {
return fmt.Sprintf("[POST /leads][%d] postLeadsUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /leads][%d] postLeadsUnprocessableEntity %s", 422, payload)
}
func (o *PostLeadsUnprocessableEntity) GetPayload() *crm_models.Error {
@ -454,7 +452,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -466,11 +464,9 @@ 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
@ -508,11 +504,13 @@ func (o *PostLeadsInternalServerError) Code() int {
}
func (o *PostLeadsInternalServerError) Error() string {
return fmt.Sprintf("[POST /leads][%d] postLeadsInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /leads][%d] postLeadsInternalServerError %s", 500, payload)
}
func (o *PostLeadsInternalServerError) String() string {
return fmt.Sprintf("[POST /leads][%d] postLeadsInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /leads][%d] postLeadsInternalServerError %s", 500, payload)
}
func (o *PostLeadsInternalServerError) GetPayload() *crm_models.Error {
@ -531,7 +529,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}

View File

@ -6,20 +6,16 @@
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,
@ -29,24 +25,28 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewPutLeadsParams() *PutLeadsParams {
return &PutLeadsParams{
timeout: cr.DefaultTimeout,
}
return NewPutLeadsParamsWithTimeout(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{
timeout: timeout,
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{
Context: ctx,
inner: innerParams{
ctx: ctx,
},
}
}
@ -67,15 +67,14 @@ 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).
@ -93,54 +92,57 @@ 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.timeout = timeout
o.inner.timeout = timeout
}
// WithContext adds the context to the put leads params
// WithContext adds the context to the put leads params.
//
// Deprecated: use the operation call with context to pass the context instead of [PutLeadsParams].
func (o *PutLeadsParams) WithContext(ctx context.Context) *PutLeadsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the put leads params
// SetContext adds the context to the put leads params.
//
// Deprecated: use the operation call with context to pass the context instead of [PutLeadsParams].
func (o *PutLeadsParams) SetContext(ctx context.Context) {
o.Context = ctx
o.inner.ctx = 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 swagger request
// WriteToRequest writes these params to a [runtime.ClientRequest].
func (o *PutLeadsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
if err := r.SetTimeout(o.inner.timeout); err != nil {
return err
}
var res []error

View File

@ -6,17 +6,15 @@
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.
@ -25,7 +23,7 @@ type PutLeadsReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *PutLeadsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
func (o *PutLeadsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
switch response.Code() {
case 200:
result := NewPutLeadsOK()
@ -64,7 +62,7 @@ func (o *PutLeadsReader) ReadResponse(response runtime.ClientResponse, consumer
}
return nil, result
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
return nil, runtime.NewAPIError("[PUT /leads] putLeads", response, response.Code())
}
}
@ -73,11 +71,9 @@ 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
@ -116,11 +112,13 @@ func (o *PutLeadsOK) Code() int {
}
func (o *PutLeadsOK) Error() string {
return fmt.Sprintf("[PUT /leads][%d] putLeadsOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /leads][%d] putLeadsOK %s", 200, payload)
}
func (o *PutLeadsOK) String() string {
return fmt.Sprintf("[PUT /leads][%d] putLeadsOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /leads][%d] putLeadsOK %s", 200, payload)
}
func (o *PutLeadsOK) GetPayload() *crm_models.LeadResponse {
@ -146,7 +144,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -158,11 +156,9 @@ 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
@ -200,11 +196,13 @@ func (o *PutLeadsUnauthorized) Code() int {
}
func (o *PutLeadsUnauthorized) Error() string {
return fmt.Sprintf("[PUT /leads][%d] putLeadsUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /leads][%d] putLeadsUnauthorized %s", 401, payload)
}
func (o *PutLeadsUnauthorized) String() string {
return fmt.Sprintf("[PUT /leads][%d] putLeadsUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /leads][%d] putLeadsUnauthorized %s", 401, payload)
}
func (o *PutLeadsUnauthorized) GetPayload() *crm_models.Error {
@ -223,7 +221,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -235,11 +233,9 @@ 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
@ -277,11 +273,13 @@ func (o *PutLeadsForbidden) Code() int {
}
func (o *PutLeadsForbidden) Error() string {
return fmt.Sprintf("[PUT /leads][%d] putLeadsForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /leads][%d] putLeadsForbidden %s", 403, payload)
}
func (o *PutLeadsForbidden) String() string {
return fmt.Sprintf("[PUT /leads][%d] putLeadsForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /leads][%d] putLeadsForbidden %s", 403, payload)
}
func (o *PutLeadsForbidden) GetPayload() *crm_models.Error {
@ -300,7 +298,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -312,11 +310,9 @@ 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
@ -354,11 +350,13 @@ func (o *PutLeadsNotFound) Code() int {
}
func (o *PutLeadsNotFound) Error() string {
return fmt.Sprintf("[PUT /leads][%d] putLeadsNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /leads][%d] putLeadsNotFound %s", 404, payload)
}
func (o *PutLeadsNotFound) String() string {
return fmt.Sprintf("[PUT /leads][%d] putLeadsNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /leads][%d] putLeadsNotFound %s", 404, payload)
}
func (o *PutLeadsNotFound) GetPayload() *crm_models.Error {
@ -377,7 +375,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -389,11 +387,9 @@ 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
@ -431,11 +427,13 @@ func (o *PutLeadsUnprocessableEntity) Code() int {
}
func (o *PutLeadsUnprocessableEntity) Error() string {
return fmt.Sprintf("[PUT /leads][%d] putLeadsUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /leads][%d] putLeadsUnprocessableEntity %s", 422, payload)
}
func (o *PutLeadsUnprocessableEntity) String() string {
return fmt.Sprintf("[PUT /leads][%d] putLeadsUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /leads][%d] putLeadsUnprocessableEntity %s", 422, payload)
}
func (o *PutLeadsUnprocessableEntity) GetPayload() *crm_models.Error {
@ -454,7 +452,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -466,11 +464,9 @@ 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
@ -508,11 +504,13 @@ func (o *PutLeadsInternalServerError) Code() int {
}
func (o *PutLeadsInternalServerError) Error() string {
return fmt.Sprintf("[PUT /leads][%d] putLeadsInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /leads][%d] putLeadsInternalServerError %s", 500, payload)
}
func (o *PutLeadsInternalServerError) String() string {
return fmt.Sprintf("[PUT /leads][%d] putLeadsInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /leads][%d] putLeadsInternalServerError %s", 500, payload)
}
func (o *PutLeadsInternalServerError) GetPayload() *crm_models.Error {
@ -531,7 +529,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}

View File

@ -6,15 +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"
stderrors "errors"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag/typeutils"
)
// Account account
@ -43,6 +42,9 @@ type Account struct {
// Contact ID
BillingContactID *string `json:"BillingContactID,omitempty"`
// Channels
Channels *string `json:"Channels,omitempty"`
// Closed Date
ClosedDate *string `json:"ClosedDate,omitempty"`
@ -76,6 +78,9 @@ 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"`
@ -88,6 +93,9 @@ 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"`
@ -106,6 +114,12 @@ 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"`
@ -210,17 +224,21 @@ func (m *Account) Validate(formats strfmt.Registry) error {
}
func (m *Account) validateBillingAddress(formats strfmt.Registry) error {
if swag.IsZero(m.BillingAddress) { // not required
if typeutils.IsZero(m.BillingAddress) { // not required
return nil
}
if m.BillingAddress != nil {
if err := m.BillingAddress.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("BillingAddress")
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("BillingAddress")
}
return err
}
}
@ -229,17 +247,21 @@ func (m *Account) validateBillingAddress(formats strfmt.Registry) error {
}
func (m *Account) validateShippingAddress(formats strfmt.Registry) error {
if swag.IsZero(m.ShippingAddress) { // not required
if typeutils.IsZero(m.ShippingAddress) { // not required
return nil
}
if m.ShippingAddress != nil {
if err := m.ShippingAddress.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("ShippingAddress")
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("ShippingAddress")
}
return err
}
}
@ -268,12 +290,21 @@ 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 {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("BillingAddress")
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("BillingAddress")
}
return err
}
}
@ -284,12 +315,21 @@ 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 {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("ShippingAddress")
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("ShippingAddress")
}
return err
}
}
@ -302,13 +342,13 @@ func (m *Account) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Account) UnmarshalBinary(b []byte) error {
var res Account
if err := swag.ReadJSON(b, &res); err != nil {
if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,16 +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"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag/typeutils"
)
// AccountRequest An array of Account objects with Contacts
@ -42,22 +41,26 @@ func (m *AccountRequest) Validate(formats strfmt.Registry) error {
}
func (m *AccountRequest) validateData(formats strfmt.Registry) error {
if swag.IsZero(m.Data) { // not required
if typeutils.IsZero(m.Data) { // not required
return nil
}
for i := 0; i < len(m.Data); i++ {
if swag.IsZero(m.Data[i]) { // not required
if typeutils.IsZero(m.Data[i]) { // not required
continue
}
if m.Data[i] != nil {
if err := m.Data[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -86,12 +89,21 @@ 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 {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -106,13 +118,13 @@ func (m *AccountRequest) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *AccountRequest) UnmarshalBinary(b []byte) error {
var res AccountRequest
if err := swag.ReadJSON(b, &res); err != nil {
if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,16 +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"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag/typeutils"
)
// AccountResponse An array of Account objects with Contacts
@ -49,22 +48,26 @@ func (m *AccountResponse) Validate(formats strfmt.Registry) error {
}
func (m *AccountResponse) validateData(formats strfmt.Registry) error {
if swag.IsZero(m.Data) { // not required
if typeutils.IsZero(m.Data) { // not required
return nil
}
for i := 0; i < len(m.Data); i++ {
if swag.IsZero(m.Data[i]) { // not required
if typeutils.IsZero(m.Data[i]) { // not required
continue
}
if m.Data[i] != nil {
if err := m.Data[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -75,17 +78,21 @@ func (m *AccountResponse) validateData(formats strfmt.Registry) error {
}
func (m *AccountResponse) validateMeta(formats strfmt.Registry) error {
if swag.IsZero(m.Meta) { // not required
if typeutils.IsZero(m.Meta) { // not required
return nil
}
if m.Meta != nil {
if err := m.Meta.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Meta")
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Meta")
}
return err
}
}
@ -116,12 +123,21 @@ 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 {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -134,12 +150,21 @@ 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 {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Meta")
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Meta")
}
return err
}
}
@ -152,13 +177,13 @@ func (m *AccountResponse) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *AccountResponse) UnmarshalBinary(b []byte) error {
var res AccountResponse
if err := swag.ReadJSON(b, &res); err != nil {
if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,14 +6,11 @@
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"
"github.com/go-openapi/swag/jsonutils"
)
// Address address
@ -58,13 +55,13 @@ func (m *Address) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Address) UnmarshalBinary(b []byte) error {
var res Address
if err := swag.ReadJSON(b, &res); err != nil {
if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,15 +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"
stderrors "errors"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag/typeutils"
)
// Asset asset
@ -176,17 +175,21 @@ func (m *Asset) Validate(formats strfmt.Registry) error {
}
func (m *Asset) validateAddress(formats strfmt.Registry) error {
if swag.IsZero(m.Address) { // not required
if typeutils.IsZero(m.Address) { // not required
return nil
}
if m.Address != nil {
if err := m.Address.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Address")
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Address")
}
return err
}
}
@ -211,12 +214,21 @@ 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 {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Address")
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Address")
}
return err
}
}
@ -229,13 +241,13 @@ func (m *Asset) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Asset) UnmarshalBinary(b []byte) error {
var res Asset
if err := swag.ReadJSON(b, &res); err != nil {
if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,16 +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"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag/typeutils"
)
// AssetRequest An array of Asset objects with Contacts
@ -42,22 +41,26 @@ func (m *AssetRequest) Validate(formats strfmt.Registry) error {
}
func (m *AssetRequest) validateData(formats strfmt.Registry) error {
if swag.IsZero(m.Data) { // not required
if typeutils.IsZero(m.Data) { // not required
return nil
}
for i := 0; i < len(m.Data); i++ {
if swag.IsZero(m.Data[i]) { // not required
if typeutils.IsZero(m.Data[i]) { // not required
continue
}
if m.Data[i] != nil {
if err := m.Data[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -86,12 +89,21 @@ 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 {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -106,13 +118,13 @@ func (m *AssetRequest) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *AssetRequest) UnmarshalBinary(b []byte) error {
var res AssetRequest
if err := swag.ReadJSON(b, &res); err != nil {
if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,16 +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"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag/typeutils"
)
// AssetResponse An array of Asset objects with Contacts
@ -49,22 +48,26 @@ func (m *AssetResponse) Validate(formats strfmt.Registry) error {
}
func (m *AssetResponse) validateData(formats strfmt.Registry) error {
if swag.IsZero(m.Data) { // not required
if typeutils.IsZero(m.Data) { // not required
return nil
}
for i := 0; i < len(m.Data); i++ {
if swag.IsZero(m.Data[i]) { // not required
if typeutils.IsZero(m.Data[i]) { // not required
continue
}
if m.Data[i] != nil {
if err := m.Data[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -75,17 +78,21 @@ func (m *AssetResponse) validateData(formats strfmt.Registry) error {
}
func (m *AssetResponse) validateMeta(formats strfmt.Registry) error {
if swag.IsZero(m.Meta) { // not required
if typeutils.IsZero(m.Meta) { // not required
return nil
}
if m.Meta != nil {
if err := m.Meta.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Meta")
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Meta")
}
return err
}
}
@ -116,12 +123,21 @@ 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 {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -134,12 +150,21 @@ 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 {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Meta")
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Meta")
}
return err
}
}
@ -152,13 +177,13 @@ func (m *AssetResponse) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *AssetResponse) UnmarshalBinary(b []byte) error {
var res AssetResponse
if err := swag.ReadJSON(b, &res); err != nil {
if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,15 +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"
stderrors "errors"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag/typeutils"
)
// Contact contact
@ -34,6 +33,9 @@ type Contact struct {
// Birthdate
BirthDate *string `json:"BirthDate,omitempty"`
// Channels
Channels *string `json:"Channels,omitempty"`
// Created By User ID
CreatedByID *string `json:"CreatedByID,omitempty"`
@ -168,17 +170,21 @@ func (m *Contact) Validate(formats strfmt.Registry) error {
}
func (m *Contact) validateMailingAddress(formats strfmt.Registry) error {
if swag.IsZero(m.MailingAddress) { // not required
if typeutils.IsZero(m.MailingAddress) { // not required
return nil
}
if m.MailingAddress != nil {
if err := m.MailingAddress.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("MailingAddress")
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("MailingAddress")
}
return err
}
}
@ -187,17 +193,21 @@ func (m *Contact) validateMailingAddress(formats strfmt.Registry) error {
}
func (m *Contact) validateOtherAddress(formats strfmt.Registry) error {
if swag.IsZero(m.OtherAddress) { // not required
if typeutils.IsZero(m.OtherAddress) { // not required
return nil
}
if m.OtherAddress != nil {
if err := m.OtherAddress.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("OtherAddress")
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("OtherAddress")
}
return err
}
}
@ -226,12 +236,21 @@ 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 {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("MailingAddress")
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("MailingAddress")
}
return err
}
}
@ -242,12 +261,21 @@ 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 {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("OtherAddress")
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("OtherAddress")
}
return err
}
}
@ -260,13 +288,13 @@ func (m *Contact) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Contact) UnmarshalBinary(b []byte) error {
var res Contact
if err := swag.ReadJSON(b, &res); err != nil {
if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,16 +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"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag/typeutils"
)
// ContactRequest contact request
@ -42,22 +41,26 @@ func (m *ContactRequest) Validate(formats strfmt.Registry) error {
}
func (m *ContactRequest) validateData(formats strfmt.Registry) error {
if swag.IsZero(m.Data) { // not required
if typeutils.IsZero(m.Data) { // not required
return nil
}
for i := 0; i < len(m.Data); i++ {
if swag.IsZero(m.Data[i]) { // not required
if typeutils.IsZero(m.Data[i]) { // not required
continue
}
if m.Data[i] != nil {
if err := m.Data[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -86,12 +89,21 @@ 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 {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -106,13 +118,13 @@ func (m *ContactRequest) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *ContactRequest) UnmarshalBinary(b []byte) error {
var res ContactRequest
if err := swag.ReadJSON(b, &res); err != nil {
if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,16 +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"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag/typeutils"
)
// ContactResponse contact response
@ -49,22 +48,26 @@ func (m *ContactResponse) Validate(formats strfmt.Registry) error {
}
func (m *ContactResponse) validateData(formats strfmt.Registry) error {
if swag.IsZero(m.Data) { // not required
if typeutils.IsZero(m.Data) { // not required
return nil
}
for i := 0; i < len(m.Data); i++ {
if swag.IsZero(m.Data[i]) { // not required
if typeutils.IsZero(m.Data[i]) { // not required
continue
}
if m.Data[i] != nil {
if err := m.Data[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -75,17 +78,21 @@ func (m *ContactResponse) validateData(formats strfmt.Registry) error {
}
func (m *ContactResponse) validateMeta(formats strfmt.Registry) error {
if swag.IsZero(m.Meta) { // not required
if typeutils.IsZero(m.Meta) { // not required
return nil
}
if m.Meta != nil {
if err := m.Meta.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Meta")
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Meta")
}
return err
}
}
@ -116,12 +123,21 @@ 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 {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -134,12 +150,21 @@ 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 {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Meta")
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Meta")
}
return err
}
}
@ -152,13 +177,13 @@ func (m *ContactResponse) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *ContactResponse) UnmarshalBinary(b []byte) error {
var res ContactResponse
if err := swag.ReadJSON(b, &res); err != nil {
if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,15 +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"
stderrors "errors"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag/typeutils"
)
// Contract contract
@ -135,17 +134,21 @@ func (m *Contract) Validate(formats strfmt.Registry) error {
}
func (m *Contract) validateBillingAddress(formats strfmt.Registry) error {
if swag.IsZero(m.BillingAddress) { // not required
if typeutils.IsZero(m.BillingAddress) { // not required
return nil
}
if m.BillingAddress != nil {
if err := m.BillingAddress.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("BillingAddress")
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("BillingAddress")
}
return err
}
}
@ -154,17 +157,21 @@ func (m *Contract) validateBillingAddress(formats strfmt.Registry) error {
}
func (m *Contract) validateShippingAddress(formats strfmt.Registry) error {
if swag.IsZero(m.ShippingAddress) { // not required
if typeutils.IsZero(m.ShippingAddress) { // not required
return nil
}
if m.ShippingAddress != nil {
if err := m.ShippingAddress.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("ShippingAddress")
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("ShippingAddress")
}
return err
}
}
@ -193,12 +200,21 @@ 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 {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("BillingAddress")
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("BillingAddress")
}
return err
}
}
@ -209,12 +225,21 @@ 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 {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("ShippingAddress")
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("ShippingAddress")
}
return err
}
}
@ -227,13 +252,13 @@ func (m *Contract) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Contract) UnmarshalBinary(b []byte) error {
var res Contract
if err := swag.ReadJSON(b, &res); err != nil {
if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,16 +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"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag/typeutils"
)
// ContractRequest contract request
@ -42,22 +41,26 @@ func (m *ContractRequest) Validate(formats strfmt.Registry) error {
}
func (m *ContractRequest) validateData(formats strfmt.Registry) error {
if swag.IsZero(m.Data) { // not required
if typeutils.IsZero(m.Data) { // not required
return nil
}
for i := 0; i < len(m.Data); i++ {
if swag.IsZero(m.Data[i]) { // not required
if typeutils.IsZero(m.Data[i]) { // not required
continue
}
if m.Data[i] != nil {
if err := m.Data[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -86,12 +89,21 @@ 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 {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -106,13 +118,13 @@ func (m *ContractRequest) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *ContractRequest) UnmarshalBinary(b []byte) error {
var res ContractRequest
if err := swag.ReadJSON(b, &res); err != nil {
if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,16 +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"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag/typeutils"
)
// ContractResponse contract response
@ -49,22 +48,26 @@ func (m *ContractResponse) Validate(formats strfmt.Registry) error {
}
func (m *ContractResponse) validateData(formats strfmt.Registry) error {
if swag.IsZero(m.Data) { // not required
if typeutils.IsZero(m.Data) { // not required
return nil
}
for i := 0; i < len(m.Data); i++ {
if swag.IsZero(m.Data[i]) { // not required
if typeutils.IsZero(m.Data[i]) { // not required
continue
}
if m.Data[i] != nil {
if err := m.Data[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -75,17 +78,21 @@ func (m *ContractResponse) validateData(formats strfmt.Registry) error {
}
func (m *ContractResponse) validateMeta(formats strfmt.Registry) error {
if swag.IsZero(m.Meta) { // not required
if typeutils.IsZero(m.Meta) { // not required
return nil
}
if m.Meta != nil {
if err := m.Meta.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Meta")
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Meta")
}
return err
}
}
@ -116,12 +123,21 @@ 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 {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -134,12 +150,21 @@ 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 {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Meta")
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Meta")
}
return err
}
}
@ -152,13 +177,13 @@ func (m *ContractResponse) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *ContractResponse) UnmarshalBinary(b []byte) error {
var res ContractResponse
if err := swag.ReadJSON(b, &res); err != nil {
if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,16 +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"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag/typeutils"
)
// DeleteResponse delete response
@ -49,22 +48,26 @@ func (m *DeleteResponse) Validate(formats strfmt.Registry) error {
}
func (m *DeleteResponse) validateData(formats strfmt.Registry) error {
if swag.IsZero(m.Data) { // not required
if typeutils.IsZero(m.Data) { // not required
return nil
}
for i := 0; i < len(m.Data); i++ {
if swag.IsZero(m.Data[i]) { // not required
if typeutils.IsZero(m.Data[i]) { // not required
continue
}
if m.Data[i] != nil {
if err := m.Data[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -75,17 +78,21 @@ func (m *DeleteResponse) validateData(formats strfmt.Registry) error {
}
func (m *DeleteResponse) validateMeta(formats strfmt.Registry) error {
if swag.IsZero(m.Meta) { // not required
if typeutils.IsZero(m.Meta) { // not required
return nil
}
if m.Meta != nil {
if err := m.Meta.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Meta")
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Meta")
}
return err
}
}
@ -116,12 +123,21 @@ 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 {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -134,12 +150,21 @@ 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 {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Meta")
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Meta")
}
return err
}
}
@ -152,13 +177,13 @@ func (m *DeleteResponse) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *DeleteResponse) UnmarshalBinary(b []byte) error {
var res DeleteResponse
if err := swag.ReadJSON(b, &res); err != nil {
if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,14 +6,11 @@
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"
"github.com/go-openapi/swag/jsonutils"
)
// Error error
@ -46,13 +43,13 @@ func (m *Error) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Error) UnmarshalBinary(b []byte) error {
var res Error
if err := swag.ReadJSON(b, &res); err != nil {
if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,15 +6,12 @@
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"
"github.com/go-openapi/swag/jsonutils"
)
// InvalidError invalid error
@ -31,7 +28,7 @@ type InvalidError struct {
func (m *InvalidError) UnmarshalJSON(raw []byte) error {
// AO0
var aO0 Error
if err := swag.ReadJSON(raw, &aO0); err != nil {
if err := jsonutils.ReadJSON(raw, &aO0); err != nil {
return err
}
m.Error = aO0
@ -40,7 +37,7 @@ func (m *InvalidError) UnmarshalJSON(raw []byte) error {
var dataAO1 struct {
Details []string `json:"details"`
}
if err := swag.ReadJSON(raw, &dataAO1); err != nil {
if err := jsonutils.ReadJSON(raw, &dataAO1); err != nil {
return err
}
@ -53,7 +50,7 @@ func (m *InvalidError) UnmarshalJSON(raw []byte) error {
func (m InvalidError) MarshalJSON() ([]byte, error) {
_parts := make([][]byte, 0, 2)
aO0, err := swag.WriteJSON(m.Error)
aO0, err := jsonutils.WriteJSON(m.Error)
if err != nil {
return nil, err
}
@ -64,12 +61,12 @@ func (m InvalidError) MarshalJSON() ([]byte, error) {
dataAO1.Details = m.Details
jsonDataAO1, errAO1 := swag.WriteJSON(dataAO1)
jsonDataAO1, errAO1 := jsonutils.WriteJSON(dataAO1)
if errAO1 != nil {
return nil, errAO1
}
_parts = append(_parts, jsonDataAO1)
return swag.ConcatJSON(_parts...), nil
return jsonutils.ConcatJSON(_parts...), nil
}
// Validate validates this invalid error
@ -107,13 +104,13 @@ func (m *InvalidError) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *InvalidError) UnmarshalBinary(b []byte) error {
var res InvalidError
if err := swag.ReadJSON(b, &res); err != nil {
if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,15 +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"
stderrors "errors"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag/typeutils"
)
// Lead lead
@ -122,17 +121,21 @@ func (m *Lead) Validate(formats strfmt.Registry) error {
}
func (m *Lead) validateAddress(formats strfmt.Registry) error {
if swag.IsZero(m.Address) { // not required
if typeutils.IsZero(m.Address) { // not required
return nil
}
if m.Address != nil {
if err := m.Address.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Address")
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Address")
}
return err
}
}
@ -157,12 +160,21 @@ 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 {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Address")
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Address")
}
return err
}
}
@ -175,13 +187,13 @@ func (m *Lead) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Lead) UnmarshalBinary(b []byte) error {
var res Lead
if err := swag.ReadJSON(b, &res); err != nil {
if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,16 +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"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag/typeutils"
)
// LeadRequest lead request
@ -42,22 +41,26 @@ func (m *LeadRequest) Validate(formats strfmt.Registry) error {
}
func (m *LeadRequest) validateData(formats strfmt.Registry) error {
if swag.IsZero(m.Data) { // not required
if typeutils.IsZero(m.Data) { // not required
return nil
}
for i := 0; i < len(m.Data); i++ {
if swag.IsZero(m.Data[i]) { // not required
if typeutils.IsZero(m.Data[i]) { // not required
continue
}
if m.Data[i] != nil {
if err := m.Data[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -86,12 +89,21 @@ 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 {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -106,13 +118,13 @@ func (m *LeadRequest) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *LeadRequest) UnmarshalBinary(b []byte) error {
var res LeadRequest
if err := swag.ReadJSON(b, &res); err != nil {
if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,16 +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"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag/typeutils"
)
// LeadResponse lead response
@ -49,22 +48,26 @@ func (m *LeadResponse) Validate(formats strfmt.Registry) error {
}
func (m *LeadResponse) validateData(formats strfmt.Registry) error {
if swag.IsZero(m.Data) { // not required
if typeutils.IsZero(m.Data) { // not required
return nil
}
for i := 0; i < len(m.Data); i++ {
if swag.IsZero(m.Data[i]) { // not required
if typeutils.IsZero(m.Data[i]) { // not required
continue
}
if m.Data[i] != nil {
if err := m.Data[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -75,17 +78,21 @@ func (m *LeadResponse) validateData(formats strfmt.Registry) error {
}
func (m *LeadResponse) validateMeta(formats strfmt.Registry) error {
if swag.IsZero(m.Meta) { // not required
if typeutils.IsZero(m.Meta) { // not required
return nil
}
if m.Meta != nil {
if err := m.Meta.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Meta")
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Meta")
}
return err
}
}
@ -116,12 +123,21 @@ 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 {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
@ -134,12 +150,21 @@ 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 {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Meta")
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Meta")
}
return err
}
}
@ -152,13 +177,13 @@ func (m *LeadResponse) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *LeadResponse) UnmarshalBinary(b []byte) error {
var res LeadResponse
if err := swag.ReadJSON(b, &res); err != nil {
if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,14 +6,11 @@
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"
"github.com/go-openapi/swag/jsonutils"
)
// Message message
@ -46,13 +43,13 @@ func (m *Message) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Message) UnmarshalBinary(b []byte) error {
var res Message
if err := swag.ReadJSON(b, &res); err != nil {
if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,14 +6,11 @@
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"
"github.com/go-openapi/swag/jsonutils"
)
// Pagination pagination
@ -49,13 +46,13 @@ func (m *Pagination) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Pagination) UnmarshalBinary(b []byte) error {
var res Pagination
if err := swag.ReadJSON(b, &res); err != nil {
if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,15 +6,12 @@
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"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/validate"
)
@ -61,13 +58,13 @@ func (m *RequestMeta) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *RequestMeta) UnmarshalBinary(b []byte) error {
var res RequestMeta
if err := swag.ReadJSON(b, &res); err != nil {
if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,15 +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"
stderrors "errors"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag/typeutils"
)
// ResponseMeta response meta
@ -74,17 +73,21 @@ func (m *ResponseMeta) Validate(formats strfmt.Registry) error {
}
func (m *ResponseMeta) validatePagination(formats strfmt.Registry) error {
if swag.IsZero(m.Pagination) { // not required
if typeutils.IsZero(m.Pagination) { // not required
return nil
}
if m.Pagination != nil {
if err := m.Pagination.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Pagination")
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Pagination")
}
return err
}
}
@ -109,12 +112,21 @@ 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 {
if ve, ok := err.(*errors.Validation); ok {
ve := new(errors.Validation)
if stderrors.As(err, &ve) {
return ve.ValidateName("Pagination")
} else if ce, ok := err.(*errors.CompositeError); ok {
}
ce := new(errors.CompositeError)
if stderrors.As(err, &ce) {
return ce.ValidateName("Pagination")
}
return err
}
}
@ -127,13 +139,13 @@ func (m *ResponseMeta) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *ResponseMeta) UnmarshalBinary(b []byte) error {
var res ResponseMeta
if err := swag.ReadJSON(b, &res); err != nil {
if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res

View File

@ -6,53 +6,111 @@
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.ClientTransport, formats strfmt.Registry) ClientService {
func New(transport runtime.ContextualTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
/*
Client for attendees API
*/
// 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.
type Client struct {
transport runtime.ClientTransport
transport runtime.ContextualTransport
formats strfmt.Registry
}
// ClientOption is the option for Client methods
// ClientOption may be used to customize the behavior of 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)
SetTransport(transport runtime.ClientTransport)
// PutAttendeesContext update attendee.
PutAttendeesContext(ctx context.Context, params *PutAttendeesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutAttendeesOK, error)
SetTransport(transport runtime.ContextualTransport)
}
/*
GetAttendees gets a list attendees
Return a list of Attendee records from the datastore
*/
// 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.
func (a *Client) GetAttendees(params *GetAttendeesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAttendeesOK, error) {
// TODO: Validate the params before sending
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
if params == nil {
params = NewGetAttendeesParams()
}
op := &runtime.ClientOperation{
ID: "getAttendees",
Method: "GET",
@ -63,37 +121,63 @@ func (a *Client) GetAttendees(params *GetAttendeesParams, authInfo runtime.Clien
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.Submit(op)
result, err := a.transport.SubmitContext(ctx, op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*GetAttendeesOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
// unexpected success response.
// no default response is defined.
//
// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for 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
*/
// 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.
func (a *Client) PostAttendees(params *PostAttendeesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAttendeesOK, error) {
// TODO: Validate the params before sending
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
if params == nil {
params = NewPostAttendeesParams()
}
op := &runtime.ClientOperation{
ID: "postAttendees",
Method: "POST",
@ -104,37 +188,63 @@ func (a *Client) PostAttendees(params *PostAttendeesParams, authInfo runtime.Cli
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.Submit(op)
result, err := a.transport.SubmitContext(ctx, op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*PostAttendeesOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
// unexpected success response.
// no default response is defined.
//
// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for postAttendees: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PutAttendees updates attendee
Update Attendee
*/
// 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.
func (a *Client) PutAttendees(params *PutAttendeesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutAttendeesOK, error) {
// TODO: Validate the params before sending
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
if params == nil {
params = NewPutAttendeesParams()
}
op := &runtime.ClientOperation{
ID: "putAttendees",
Method: "PUT",
@ -145,28 +255,42 @@ func (a *Client) PutAttendees(params *PutAttendeesParams, authInfo runtime.Clien
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.Submit(op)
result, err := a.transport.SubmitContext(ctx, op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*PutAttendeesOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
// unexpected success response.
// no default response is defined.
//
// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for 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.ClientTransport) {
func (a *Client) SetTransport(transport runtime.ContextualTransport) {
a.transport = transport
}
// innerParams captures internal fields so they don't conflict with user-supplied parameters.
type innerParams struct {
timeout time.Duration
// Deprecated: use the operation call with context to pass the context instead of [AttendeesParams].
ctx context.Context
}

View File

@ -6,9 +6,6 @@
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"
@ -18,7 +15,7 @@ import (
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/swag/conv"
)
// NewGetAttendeesParams creates a new GetAttendeesParams object,
@ -28,24 +25,28 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewGetAttendeesParams() *GetAttendeesParams {
return &GetAttendeesParams{
timeout: cr.DefaultTimeout,
}
return NewGetAttendeesParamsWithTimeout(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{
timeout: timeout,
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{
Context: ctx,
inner: innerParams{
ctx: ctx,
},
}
}
@ -66,31 +67,28 @@ 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).
@ -108,76 +106,79 @@ 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.timeout = timeout
o.inner.timeout = timeout
}
// WithContext adds the context to the get attendees params
// WithContext adds the context to the get attendees params.
//
// Deprecated: use the operation call with context to pass the context instead of [GetAttendeesParams].
func (o *GetAttendeesParams) WithContext(ctx context.Context) *GetAttendeesParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get attendees params
// SetContext adds the context to the get attendees params.
//
// Deprecated: use the operation call with context to pass the context instead of [GetAttendeesParams].
func (o *GetAttendeesParams) SetContext(ctx context.Context) {
o.Context = ctx
o.inner.ctx = 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 swagger request
// WriteToRequest writes these params to a [runtime.ClientRequest].
func (o *GetAttendeesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
if err := r.SetTimeout(o.inner.timeout); err != nil {
return err
}
var res []error
@ -207,7 +208,7 @@ func (o *GetAttendeesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.
if o.Limit != nil {
qrLimit = *o.Limit
}
qLimit := swag.FormatInt64(qrLimit)
qLimit := conv.FormatInteger(qrLimit)
if qLimit != "" {
if err := r.SetQueryParam("limit", qLimit); err != nil {
@ -224,7 +225,7 @@ func (o *GetAttendeesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.
if o.Offset != nil {
qrOffset = *o.Offset
}
qOffset := swag.FormatInt64(qrOffset)
qOffset := conv.FormatInteger(qrOffset)
if qOffset != "" {
if err := r.SetQueryParam("offset", qOffset); err != nil {

View File

@ -6,17 +6,15 @@
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.
@ -25,7 +23,7 @@ type GetAttendeesReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *GetAttendeesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
func (o *GetAttendeesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
switch response.Code() {
case 200:
result := NewGetAttendeesOK()
@ -64,7 +62,7 @@ func (o *GetAttendeesReader) ReadResponse(response runtime.ClientResponse, consu
}
return nil, result
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
return nil, runtime.NewAPIError("[GET /attendees] getAttendees", response, response.Code())
}
}
@ -73,11 +71,9 @@ 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
}
@ -113,11 +109,13 @@ func (o *GetAttendeesOK) Code() int {
}
func (o *GetAttendeesOK) Error() string {
return fmt.Sprintf("[GET /attendees][%d] getAttendeesOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /attendees][%d] getAttendeesOK %s", 200, payload)
}
func (o *GetAttendeesOK) String() string {
return fmt.Sprintf("[GET /attendees][%d] getAttendeesOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /attendees][%d] getAttendeesOK %s", 200, payload)
}
func (o *GetAttendeesOK) GetPayload() *members_models.AttendeeResponse {
@ -129,7 +127,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -141,11 +139,9 @@ 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
}
@ -181,11 +177,13 @@ func (o *GetAttendeesUnauthorized) Code() int {
}
func (o *GetAttendeesUnauthorized) Error() string {
return fmt.Sprintf("[GET /attendees][%d] getAttendeesUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /attendees][%d] getAttendeesUnauthorized %s", 401, payload)
}
func (o *GetAttendeesUnauthorized) String() string {
return fmt.Sprintf("[GET /attendees][%d] getAttendeesUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /attendees][%d] getAttendeesUnauthorized %s", 401, payload)
}
func (o *GetAttendeesUnauthorized) GetPayload() *members_models.Error {
@ -197,7 +195,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -209,11 +207,9 @@ 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
@ -251,11 +247,13 @@ func (o *GetAttendeesForbidden) Code() int {
}
func (o *GetAttendeesForbidden) Error() string {
return fmt.Sprintf("[GET /attendees][%d] getAttendeesForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /attendees][%d] getAttendeesForbidden %s", 403, payload)
}
func (o *GetAttendeesForbidden) String() string {
return fmt.Sprintf("[GET /attendees][%d] getAttendeesForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /attendees][%d] getAttendeesForbidden %s", 403, payload)
}
func (o *GetAttendeesForbidden) GetPayload() *members_models.Error {
@ -274,7 +272,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -286,11 +284,9 @@ 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
}
@ -326,11 +322,13 @@ func (o *GetAttendeesNotFound) Code() int {
}
func (o *GetAttendeesNotFound) Error() string {
return fmt.Sprintf("[GET /attendees][%d] getAttendeesNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /attendees][%d] getAttendeesNotFound %s", 404, payload)
}
func (o *GetAttendeesNotFound) String() string {
return fmt.Sprintf("[GET /attendees][%d] getAttendeesNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /attendees][%d] getAttendeesNotFound %s", 404, payload)
}
func (o *GetAttendeesNotFound) GetPayload() *members_models.Error {
@ -342,7 +340,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -354,11 +352,9 @@ 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
}
@ -394,11 +390,13 @@ func (o *GetAttendeesUnprocessableEntity) Code() int {
}
func (o *GetAttendeesUnprocessableEntity) Error() string {
return fmt.Sprintf("[GET /attendees][%d] getAttendeesUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /attendees][%d] getAttendeesUnprocessableEntity %s", 422, payload)
}
func (o *GetAttendeesUnprocessableEntity) String() string {
return fmt.Sprintf("[GET /attendees][%d] getAttendeesUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /attendees][%d] getAttendeesUnprocessableEntity %s", 422, payload)
}
func (o *GetAttendeesUnprocessableEntity) GetPayload() *members_models.Error {
@ -410,7 +408,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -422,11 +420,9 @@ 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
}
@ -462,11 +458,13 @@ func (o *GetAttendeesInternalServerError) Code() int {
}
func (o *GetAttendeesInternalServerError) Error() string {
return fmt.Sprintf("[GET /attendees][%d] getAttendeesInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /attendees][%d] getAttendeesInternalServerError %s", 500, payload)
}
func (o *GetAttendeesInternalServerError) String() string {
return fmt.Sprintf("[GET /attendees][%d] getAttendeesInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /attendees][%d] getAttendeesInternalServerError %s", 500, payload)
}
func (o *GetAttendeesInternalServerError) GetPayload() *members_models.Error {
@ -478,7 +476,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}

View File

@ -6,20 +6,16 @@
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,
@ -29,24 +25,28 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewPostAttendeesParams() *PostAttendeesParams {
return &PostAttendeesParams{
timeout: cr.DefaultTimeout,
}
return NewPostAttendeesParamsWithTimeout(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{
timeout: timeout,
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{
Context: ctx,
inner: innerParams{
ctx: ctx,
},
}
}
@ -67,15 +67,14 @@ 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).
@ -93,54 +92,57 @@ 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.timeout = timeout
o.inner.timeout = timeout
}
// WithContext adds the context to the post attendees params
// WithContext adds the context to the post attendees params.
//
// Deprecated: use the operation call with context to pass the context instead of [PostAttendeesParams].
func (o *PostAttendeesParams) WithContext(ctx context.Context) *PostAttendeesParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the post attendees params
// SetContext adds the context to the post attendees params.
//
// Deprecated: use the operation call with context to pass the context instead of [PostAttendeesParams].
func (o *PostAttendeesParams) SetContext(ctx context.Context) {
o.Context = ctx
o.inner.ctx = 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 swagger request
// WriteToRequest writes these params to a [runtime.ClientRequest].
func (o *PostAttendeesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
if err := r.SetTimeout(o.inner.timeout); err != nil {
return err
}
var res []error

View File

@ -6,17 +6,15 @@
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.
@ -25,7 +23,7 @@ type PostAttendeesReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *PostAttendeesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
func (o *PostAttendeesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
switch response.Code() {
case 200:
result := NewPostAttendeesOK()
@ -64,7 +62,7 @@ func (o *PostAttendeesReader) ReadResponse(response runtime.ClientResponse, cons
}
return nil, result
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
return nil, runtime.NewAPIError("[POST /attendees] postAttendees", response, response.Code())
}
}
@ -73,11 +71,9 @@ 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
}
@ -113,11 +109,13 @@ func (o *PostAttendeesOK) Code() int {
}
func (o *PostAttendeesOK) Error() string {
return fmt.Sprintf("[POST /attendees][%d] postAttendeesOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /attendees][%d] postAttendeesOK %s", 200, payload)
}
func (o *PostAttendeesOK) String() string {
return fmt.Sprintf("[POST /attendees][%d] postAttendeesOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /attendees][%d] postAttendeesOK %s", 200, payload)
}
func (o *PostAttendeesOK) GetPayload() *members_models.AttendeeResponse {
@ -129,7 +127,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -141,11 +139,9 @@ 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
}
@ -181,11 +177,13 @@ func (o *PostAttendeesUnauthorized) Code() int {
}
func (o *PostAttendeesUnauthorized) Error() string {
return fmt.Sprintf("[POST /attendees][%d] postAttendeesUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /attendees][%d] postAttendeesUnauthorized %s", 401, payload)
}
func (o *PostAttendeesUnauthorized) String() string {
return fmt.Sprintf("[POST /attendees][%d] postAttendeesUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /attendees][%d] postAttendeesUnauthorized %s", 401, payload)
}
func (o *PostAttendeesUnauthorized) GetPayload() *members_models.Error {
@ -197,7 +195,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -209,11 +207,9 @@ 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
@ -251,11 +247,13 @@ func (o *PostAttendeesForbidden) Code() int {
}
func (o *PostAttendeesForbidden) Error() string {
return fmt.Sprintf("[POST /attendees][%d] postAttendeesForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /attendees][%d] postAttendeesForbidden %s", 403, payload)
}
func (o *PostAttendeesForbidden) String() string {
return fmt.Sprintf("[POST /attendees][%d] postAttendeesForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /attendees][%d] postAttendeesForbidden %s", 403, payload)
}
func (o *PostAttendeesForbidden) GetPayload() *members_models.Error {
@ -274,7 +272,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -286,11 +284,9 @@ 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
}
@ -326,11 +322,13 @@ func (o *PostAttendeesNotFound) Code() int {
}
func (o *PostAttendeesNotFound) Error() string {
return fmt.Sprintf("[POST /attendees][%d] postAttendeesNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /attendees][%d] postAttendeesNotFound %s", 404, payload)
}
func (o *PostAttendeesNotFound) String() string {
return fmt.Sprintf("[POST /attendees][%d] postAttendeesNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /attendees][%d] postAttendeesNotFound %s", 404, payload)
}
func (o *PostAttendeesNotFound) GetPayload() *members_models.Error {
@ -342,7 +340,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -354,11 +352,9 @@ 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
}
@ -394,11 +390,13 @@ func (o *PostAttendeesUnprocessableEntity) Code() int {
}
func (o *PostAttendeesUnprocessableEntity) Error() string {
return fmt.Sprintf("[POST /attendees][%d] postAttendeesUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /attendees][%d] postAttendeesUnprocessableEntity %s", 422, payload)
}
func (o *PostAttendeesUnprocessableEntity) String() string {
return fmt.Sprintf("[POST /attendees][%d] postAttendeesUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /attendees][%d] postAttendeesUnprocessableEntity %s", 422, payload)
}
func (o *PostAttendeesUnprocessableEntity) GetPayload() *members_models.Error {
@ -410,7 +408,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -422,11 +420,9 @@ 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
}
@ -462,11 +458,13 @@ func (o *PostAttendeesInternalServerError) Code() int {
}
func (o *PostAttendeesInternalServerError) Error() string {
return fmt.Sprintf("[POST /attendees][%d] postAttendeesInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /attendees][%d] postAttendeesInternalServerError %s", 500, payload)
}
func (o *PostAttendeesInternalServerError) String() string {
return fmt.Sprintf("[POST /attendees][%d] postAttendeesInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /attendees][%d] postAttendeesInternalServerError %s", 500, payload)
}
func (o *PostAttendeesInternalServerError) GetPayload() *members_models.Error {
@ -478,7 +476,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}

View File

@ -6,20 +6,16 @@
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,
@ -29,24 +25,28 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewPutAttendeesParams() *PutAttendeesParams {
return &PutAttendeesParams{
timeout: cr.DefaultTimeout,
}
return NewPutAttendeesParamsWithTimeout(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{
timeout: timeout,
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{
Context: ctx,
inner: innerParams{
ctx: ctx,
},
}
}
@ -67,15 +67,14 @@ 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).
@ -93,54 +92,57 @@ 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.timeout = timeout
o.inner.timeout = timeout
}
// WithContext adds the context to the put attendees params
// WithContext adds the context to the put attendees params.
//
// Deprecated: use the operation call with context to pass the context instead of [PutAttendeesParams].
func (o *PutAttendeesParams) WithContext(ctx context.Context) *PutAttendeesParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the put attendees params
// SetContext adds the context to the put attendees params.
//
// Deprecated: use the operation call with context to pass the context instead of [PutAttendeesParams].
func (o *PutAttendeesParams) SetContext(ctx context.Context) {
o.Context = ctx
o.inner.ctx = 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 swagger request
// WriteToRequest writes these params to a [runtime.ClientRequest].
func (o *PutAttendeesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
if err := r.SetTimeout(o.inner.timeout); err != nil {
return err
}
var res []error

View File

@ -6,17 +6,15 @@
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.
@ -25,7 +23,7 @@ type PutAttendeesReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *PutAttendeesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
func (o *PutAttendeesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
switch response.Code() {
case 200:
result := NewPutAttendeesOK()
@ -64,7 +62,7 @@ func (o *PutAttendeesReader) ReadResponse(response runtime.ClientResponse, consu
}
return nil, result
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
return nil, runtime.NewAPIError("[PUT /attendees] putAttendees", response, response.Code())
}
}
@ -73,11 +71,9 @@ 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
}
@ -113,11 +109,13 @@ func (o *PutAttendeesOK) Code() int {
}
func (o *PutAttendeesOK) Error() string {
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesOK %s", 200, payload)
}
func (o *PutAttendeesOK) String() string {
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesOK %s", 200, payload)
}
func (o *PutAttendeesOK) GetPayload() *members_models.AttendeeResponse {
@ -129,7 +127,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -141,11 +139,9 @@ 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
}
@ -181,11 +177,13 @@ func (o *PutAttendeesUnauthorized) Code() int {
}
func (o *PutAttendeesUnauthorized) Error() string {
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesUnauthorized %s", 401, payload)
}
func (o *PutAttendeesUnauthorized) String() string {
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesUnauthorized %s", 401, payload)
}
func (o *PutAttendeesUnauthorized) GetPayload() *members_models.Error {
@ -197,7 +195,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -209,11 +207,9 @@ 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
@ -251,11 +247,13 @@ func (o *PutAttendeesForbidden) Code() int {
}
func (o *PutAttendeesForbidden) Error() string {
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesForbidden %s", 403, payload)
}
func (o *PutAttendeesForbidden) String() string {
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesForbidden %s", 403, payload)
}
func (o *PutAttendeesForbidden) GetPayload() *members_models.Error {
@ -274,7 +272,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -286,11 +284,9 @@ 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
}
@ -326,11 +322,13 @@ func (o *PutAttendeesNotFound) Code() int {
}
func (o *PutAttendeesNotFound) Error() string {
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesNotFound %s", 404, payload)
}
func (o *PutAttendeesNotFound) String() string {
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesNotFound %s", 404, payload)
}
func (o *PutAttendeesNotFound) GetPayload() *members_models.Error {
@ -342,7 +340,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -354,11 +352,9 @@ 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
}
@ -394,11 +390,13 @@ func (o *PutAttendeesUnprocessableEntity) Code() int {
}
func (o *PutAttendeesUnprocessableEntity) Error() string {
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesUnprocessableEntity %s", 422, payload)
}
func (o *PutAttendeesUnprocessableEntity) String() string {
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesUnprocessableEntity %s", 422, payload)
}
func (o *PutAttendeesUnprocessableEntity) GetPayload() *members_models.Error {
@ -410,7 +408,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -422,11 +420,9 @@ 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
}
@ -462,11 +458,13 @@ func (o *PutAttendeesInternalServerError) Code() int {
}
func (o *PutAttendeesInternalServerError) Error() string {
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesInternalServerError %s", 500, payload)
}
func (o *PutAttendeesInternalServerError) String() string {
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /attendees][%d] putAttendeesInternalServerError %s", 500, payload)
}
func (o *PutAttendeesInternalServerError) GetPayload() *members_models.Error {
@ -478,7 +476,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}

View File

@ -6,53 +6,111 @@
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.ClientTransport, formats strfmt.Registry) ClientService {
func New(transport runtime.ContextualTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
/*
Client for certificates API
*/
// 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.
type Client struct {
transport runtime.ClientTransport
transport runtime.ContextualTransport
formats strfmt.Registry
}
// ClientOption is the option for Client methods
// ClientOption may be used to customize the behavior of 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)
SetTransport(transport runtime.ClientTransport)
// PutCertificatesContext update certificate.
PutCertificatesContext(ctx context.Context, params *PutCertificatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutCertificatesOK, error)
SetTransport(transport runtime.ContextualTransport)
}
/*
GetCertificates gets a list certificates
Return a list of Certificate records from the datastore
*/
// 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.
func (a *Client) GetCertificates(params *GetCertificatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCertificatesOK, error) {
// TODO: Validate the params before sending
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
if params == nil {
params = NewGetCertificatesParams()
}
op := &runtime.ClientOperation{
ID: "getCertificates",
Method: "GET",
@ -63,37 +121,63 @@ func (a *Client) GetCertificates(params *GetCertificatesParams, authInfo runtime
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.Submit(op)
result, err := a.transport.SubmitContext(ctx, op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*GetCertificatesOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
// unexpected success response.
// no default response is defined.
//
// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for 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
*/
// 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.
func (a *Client) PostCertificates(params *PostCertificatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCertificatesOK, error) {
// TODO: Validate the params before sending
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
if params == nil {
params = NewPostCertificatesParams()
}
op := &runtime.ClientOperation{
ID: "postCertificates",
Method: "POST",
@ -104,37 +188,63 @@ func (a *Client) PostCertificates(params *PostCertificatesParams, authInfo runti
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.Submit(op)
result, err := a.transport.SubmitContext(ctx, op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*PostCertificatesOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
// unexpected success response.
// no default response is defined.
//
// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for postCertificates: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PutCertificates updates certificate
Update Certificate
*/
// 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.
func (a *Client) PutCertificates(params *PutCertificatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutCertificatesOK, error) {
// TODO: Validate the params before sending
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
if params == nil {
params = NewPutCertificatesParams()
}
op := &runtime.ClientOperation{
ID: "putCertificates",
Method: "PUT",
@ -145,28 +255,42 @@ func (a *Client) PutCertificates(params *PutCertificatesParams, authInfo runtime
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.Submit(op)
result, err := a.transport.SubmitContext(ctx, op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*PutCertificatesOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
// unexpected success response.
// no default response is defined.
//
// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for 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.ClientTransport) {
func (a *Client) SetTransport(transport runtime.ContextualTransport) {
a.transport = transport
}
// innerParams captures internal fields so they don't conflict with user-supplied parameters.
type innerParams struct {
timeout time.Duration
// Deprecated: use the operation call with context to pass the context instead of [CertificatesParams].
ctx context.Context
}

View File

@ -6,9 +6,6 @@
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"
@ -18,7 +15,7 @@ import (
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/swag/conv"
)
// NewGetCertificatesParams creates a new GetCertificatesParams object,
@ -28,24 +25,28 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewGetCertificatesParams() *GetCertificatesParams {
return &GetCertificatesParams{
timeout: cr.DefaultTimeout,
}
return NewGetCertificatesParamsWithTimeout(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{
timeout: timeout,
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{
Context: ctx,
inner: innerParams{
ctx: ctx,
},
}
}
@ -66,31 +67,28 @@ 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).
@ -108,76 +106,79 @@ 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.timeout = timeout
o.inner.timeout = timeout
}
// WithContext adds the context to the get certificates params
// WithContext adds the context to the get certificates params.
//
// Deprecated: use the operation call with context to pass the context instead of [GetCertificatesParams].
func (o *GetCertificatesParams) WithContext(ctx context.Context) *GetCertificatesParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get certificates params
// SetContext adds the context to the get certificates params.
//
// Deprecated: use the operation call with context to pass the context instead of [GetCertificatesParams].
func (o *GetCertificatesParams) SetContext(ctx context.Context) {
o.Context = ctx
o.inner.ctx = 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 swagger request
// WriteToRequest writes these params to a [runtime.ClientRequest].
func (o *GetCertificatesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
if err := r.SetTimeout(o.inner.timeout); err != nil {
return err
}
var res []error
@ -207,7 +208,7 @@ func (o *GetCertificatesParams) WriteToRequest(r runtime.ClientRequest, reg strf
if o.Limit != nil {
qrLimit = *o.Limit
}
qLimit := swag.FormatInt64(qrLimit)
qLimit := conv.FormatInteger(qrLimit)
if qLimit != "" {
if err := r.SetQueryParam("limit", qLimit); err != nil {
@ -224,7 +225,7 @@ func (o *GetCertificatesParams) WriteToRequest(r runtime.ClientRequest, reg strf
if o.Offset != nil {
qrOffset = *o.Offset
}
qOffset := swag.FormatInt64(qrOffset)
qOffset := conv.FormatInteger(qrOffset)
if qOffset != "" {
if err := r.SetQueryParam("offset", qOffset); err != nil {

View File

@ -6,17 +6,15 @@
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.
@ -25,7 +23,7 @@ type GetCertificatesReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *GetCertificatesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
func (o *GetCertificatesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
switch response.Code() {
case 200:
result := NewGetCertificatesOK()
@ -64,7 +62,7 @@ func (o *GetCertificatesReader) ReadResponse(response runtime.ClientResponse, co
}
return nil, result
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
return nil, runtime.NewAPIError("[GET /certificates] getCertificates", response, response.Code())
}
}
@ -73,11 +71,9 @@ 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
}
@ -113,11 +109,13 @@ func (o *GetCertificatesOK) Code() int {
}
func (o *GetCertificatesOK) Error() string {
return fmt.Sprintf("[GET /certificates][%d] getCertificatesOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /certificates][%d] getCertificatesOK %s", 200, payload)
}
func (o *GetCertificatesOK) String() string {
return fmt.Sprintf("[GET /certificates][%d] getCertificatesOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /certificates][%d] getCertificatesOK %s", 200, payload)
}
func (o *GetCertificatesOK) GetPayload() *members_models.CertificateResponse {
@ -129,7 +127,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -141,11 +139,9 @@ 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
}
@ -181,11 +177,13 @@ func (o *GetCertificatesUnauthorized) Code() int {
}
func (o *GetCertificatesUnauthorized) Error() string {
return fmt.Sprintf("[GET /certificates][%d] getCertificatesUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /certificates][%d] getCertificatesUnauthorized %s", 401, payload)
}
func (o *GetCertificatesUnauthorized) String() string {
return fmt.Sprintf("[GET /certificates][%d] getCertificatesUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /certificates][%d] getCertificatesUnauthorized %s", 401, payload)
}
func (o *GetCertificatesUnauthorized) GetPayload() *members_models.Error {
@ -197,7 +195,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -209,11 +207,9 @@ 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
@ -251,11 +247,13 @@ func (o *GetCertificatesForbidden) Code() int {
}
func (o *GetCertificatesForbidden) Error() string {
return fmt.Sprintf("[GET /certificates][%d] getCertificatesForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /certificates][%d] getCertificatesForbidden %s", 403, payload)
}
func (o *GetCertificatesForbidden) String() string {
return fmt.Sprintf("[GET /certificates][%d] getCertificatesForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /certificates][%d] getCertificatesForbidden %s", 403, payload)
}
func (o *GetCertificatesForbidden) GetPayload() *members_models.Error {
@ -274,7 +272,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -286,11 +284,9 @@ 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
}
@ -326,11 +322,13 @@ func (o *GetCertificatesNotFound) Code() int {
}
func (o *GetCertificatesNotFound) Error() string {
return fmt.Sprintf("[GET /certificates][%d] getCertificatesNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /certificates][%d] getCertificatesNotFound %s", 404, payload)
}
func (o *GetCertificatesNotFound) String() string {
return fmt.Sprintf("[GET /certificates][%d] getCertificatesNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /certificates][%d] getCertificatesNotFound %s", 404, payload)
}
func (o *GetCertificatesNotFound) GetPayload() *members_models.Error {
@ -342,7 +340,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -354,11 +352,9 @@ 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
}
@ -394,11 +390,13 @@ func (o *GetCertificatesUnprocessableEntity) Code() int {
}
func (o *GetCertificatesUnprocessableEntity) Error() string {
return fmt.Sprintf("[GET /certificates][%d] getCertificatesUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /certificates][%d] getCertificatesUnprocessableEntity %s", 422, payload)
}
func (o *GetCertificatesUnprocessableEntity) String() string {
return fmt.Sprintf("[GET /certificates][%d] getCertificatesUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /certificates][%d] getCertificatesUnprocessableEntity %s", 422, payload)
}
func (o *GetCertificatesUnprocessableEntity) GetPayload() *members_models.Error {
@ -410,7 +408,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -422,11 +420,9 @@ 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
}
@ -462,11 +458,13 @@ func (o *GetCertificatesInternalServerError) Code() int {
}
func (o *GetCertificatesInternalServerError) Error() string {
return fmt.Sprintf("[GET /certificates][%d] getCertificatesInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /certificates][%d] getCertificatesInternalServerError %s", 500, payload)
}
func (o *GetCertificatesInternalServerError) String() string {
return fmt.Sprintf("[GET /certificates][%d] getCertificatesInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /certificates][%d] getCertificatesInternalServerError %s", 500, payload)
}
func (o *GetCertificatesInternalServerError) GetPayload() *members_models.Error {
@ -478,7 +476,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}

View File

@ -6,20 +6,16 @@
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,
@ -29,24 +25,28 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewPostCertificatesParams() *PostCertificatesParams {
return &PostCertificatesParams{
timeout: cr.DefaultTimeout,
}
return NewPostCertificatesParamsWithTimeout(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{
timeout: timeout,
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{
Context: ctx,
inner: innerParams{
ctx: ctx,
},
}
}
@ -67,15 +67,14 @@ 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).
@ -93,54 +92,57 @@ 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.timeout = timeout
o.inner.timeout = timeout
}
// WithContext adds the context to the post certificates params
// WithContext adds the context to the post certificates params.
//
// Deprecated: use the operation call with context to pass the context instead of [PostCertificatesParams].
func (o *PostCertificatesParams) WithContext(ctx context.Context) *PostCertificatesParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the post certificates params
// SetContext adds the context to the post certificates params.
//
// Deprecated: use the operation call with context to pass the context instead of [PostCertificatesParams].
func (o *PostCertificatesParams) SetContext(ctx context.Context) {
o.Context = ctx
o.inner.ctx = 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 swagger request
// WriteToRequest writes these params to a [runtime.ClientRequest].
func (o *PostCertificatesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
if err := r.SetTimeout(o.inner.timeout); err != nil {
return err
}
var res []error

View File

@ -6,17 +6,15 @@
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.
@ -25,7 +23,7 @@ type PostCertificatesReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *PostCertificatesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
func (o *PostCertificatesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
switch response.Code() {
case 200:
result := NewPostCertificatesOK()
@ -64,7 +62,7 @@ func (o *PostCertificatesReader) ReadResponse(response runtime.ClientResponse, c
}
return nil, result
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
return nil, runtime.NewAPIError("[POST /certificates] postCertificates", response, response.Code())
}
}
@ -73,11 +71,9 @@ 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
}
@ -113,11 +109,13 @@ func (o *PostCertificatesOK) Code() int {
}
func (o *PostCertificatesOK) Error() string {
return fmt.Sprintf("[POST /certificates][%d] postCertificatesOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /certificates][%d] postCertificatesOK %s", 200, payload)
}
func (o *PostCertificatesOK) String() string {
return fmt.Sprintf("[POST /certificates][%d] postCertificatesOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /certificates][%d] postCertificatesOK %s", 200, payload)
}
func (o *PostCertificatesOK) GetPayload() *members_models.CertificateResponse {
@ -129,7 +127,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -141,11 +139,9 @@ 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
}
@ -181,11 +177,13 @@ func (o *PostCertificatesUnauthorized) Code() int {
}
func (o *PostCertificatesUnauthorized) Error() string {
return fmt.Sprintf("[POST /certificates][%d] postCertificatesUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /certificates][%d] postCertificatesUnauthorized %s", 401, payload)
}
func (o *PostCertificatesUnauthorized) String() string {
return fmt.Sprintf("[POST /certificates][%d] postCertificatesUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /certificates][%d] postCertificatesUnauthorized %s", 401, payload)
}
func (o *PostCertificatesUnauthorized) GetPayload() *members_models.Error {
@ -197,7 +195,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -209,11 +207,9 @@ 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
@ -251,11 +247,13 @@ func (o *PostCertificatesForbidden) Code() int {
}
func (o *PostCertificatesForbidden) Error() string {
return fmt.Sprintf("[POST /certificates][%d] postCertificatesForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /certificates][%d] postCertificatesForbidden %s", 403, payload)
}
func (o *PostCertificatesForbidden) String() string {
return fmt.Sprintf("[POST /certificates][%d] postCertificatesForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /certificates][%d] postCertificatesForbidden %s", 403, payload)
}
func (o *PostCertificatesForbidden) GetPayload() *members_models.Error {
@ -274,7 +272,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -286,11 +284,9 @@ 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
}
@ -326,11 +322,13 @@ func (o *PostCertificatesNotFound) Code() int {
}
func (o *PostCertificatesNotFound) Error() string {
return fmt.Sprintf("[POST /certificates][%d] postCertificatesNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /certificates][%d] postCertificatesNotFound %s", 404, payload)
}
func (o *PostCertificatesNotFound) String() string {
return fmt.Sprintf("[POST /certificates][%d] postCertificatesNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /certificates][%d] postCertificatesNotFound %s", 404, payload)
}
func (o *PostCertificatesNotFound) GetPayload() *members_models.Error {
@ -342,7 +340,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -354,11 +352,9 @@ 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
}
@ -394,11 +390,13 @@ func (o *PostCertificatesUnprocessableEntity) Code() int {
}
func (o *PostCertificatesUnprocessableEntity) Error() string {
return fmt.Sprintf("[POST /certificates][%d] postCertificatesUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /certificates][%d] postCertificatesUnprocessableEntity %s", 422, payload)
}
func (o *PostCertificatesUnprocessableEntity) String() string {
return fmt.Sprintf("[POST /certificates][%d] postCertificatesUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /certificates][%d] postCertificatesUnprocessableEntity %s", 422, payload)
}
func (o *PostCertificatesUnprocessableEntity) GetPayload() *members_models.Error {
@ -410,7 +408,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -422,11 +420,9 @@ 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
}
@ -462,11 +458,13 @@ func (o *PostCertificatesInternalServerError) Code() int {
}
func (o *PostCertificatesInternalServerError) Error() string {
return fmt.Sprintf("[POST /certificates][%d] postCertificatesInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /certificates][%d] postCertificatesInternalServerError %s", 500, payload)
}
func (o *PostCertificatesInternalServerError) String() string {
return fmt.Sprintf("[POST /certificates][%d] postCertificatesInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /certificates][%d] postCertificatesInternalServerError %s", 500, payload)
}
func (o *PostCertificatesInternalServerError) GetPayload() *members_models.Error {
@ -478,7 +476,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}

View File

@ -6,20 +6,16 @@
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,
@ -29,24 +25,28 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewPutCertificatesParams() *PutCertificatesParams {
return &PutCertificatesParams{
timeout: cr.DefaultTimeout,
}
return NewPutCertificatesParamsWithTimeout(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{
timeout: timeout,
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{
Context: ctx,
inner: innerParams{
ctx: ctx,
},
}
}
@ -67,15 +67,14 @@ 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).
@ -93,54 +92,57 @@ 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.timeout = timeout
o.inner.timeout = timeout
}
// WithContext adds the context to the put certificates params
// WithContext adds the context to the put certificates params.
//
// Deprecated: use the operation call with context to pass the context instead of [PutCertificatesParams].
func (o *PutCertificatesParams) WithContext(ctx context.Context) *PutCertificatesParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the put certificates params
// SetContext adds the context to the put certificates params.
//
// Deprecated: use the operation call with context to pass the context instead of [PutCertificatesParams].
func (o *PutCertificatesParams) SetContext(ctx context.Context) {
o.Context = ctx
o.inner.ctx = 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 swagger request
// WriteToRequest writes these params to a [runtime.ClientRequest].
func (o *PutCertificatesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
if err := r.SetTimeout(o.inner.timeout); err != nil {
return err
}
var res []error

View File

@ -6,17 +6,15 @@
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.
@ -25,7 +23,7 @@ type PutCertificatesReader struct {
}
// ReadResponse reads a server response into the received o.
func (o *PutCertificatesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
func (o *PutCertificatesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
switch response.Code() {
case 200:
result := NewPutCertificatesOK()
@ -64,7 +62,7 @@ func (o *PutCertificatesReader) ReadResponse(response runtime.ClientResponse, co
}
return nil, result
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
return nil, runtime.NewAPIError("[PUT /certificates] putCertificates", response, response.Code())
}
}
@ -73,11 +71,9 @@ 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
}
@ -113,11 +109,13 @@ func (o *PutCertificatesOK) Code() int {
}
func (o *PutCertificatesOK) Error() string {
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesOK %s", 200, payload)
}
func (o *PutCertificatesOK) String() string {
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesOK %+v", 200, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesOK %s", 200, payload)
}
func (o *PutCertificatesOK) GetPayload() *members_models.CertificateResponse {
@ -129,7 +127,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -141,11 +139,9 @@ 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
}
@ -181,11 +177,13 @@ func (o *PutCertificatesUnauthorized) Code() int {
}
func (o *PutCertificatesUnauthorized) Error() string {
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesUnauthorized %s", 401, payload)
}
func (o *PutCertificatesUnauthorized) String() string {
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesUnauthorized %+v", 401, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesUnauthorized %s", 401, payload)
}
func (o *PutCertificatesUnauthorized) GetPayload() *members_models.Error {
@ -197,7 +195,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -209,11 +207,9 @@ 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
@ -251,11 +247,13 @@ func (o *PutCertificatesForbidden) Code() int {
}
func (o *PutCertificatesForbidden) Error() string {
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesForbidden %s", 403, payload)
}
func (o *PutCertificatesForbidden) String() string {
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesForbidden %+v", 403, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesForbidden %s", 403, payload)
}
func (o *PutCertificatesForbidden) GetPayload() *members_models.Error {
@ -274,7 +272,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -286,11 +284,9 @@ 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
}
@ -326,11 +322,13 @@ func (o *PutCertificatesNotFound) Code() int {
}
func (o *PutCertificatesNotFound) Error() string {
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesNotFound %s", 404, payload)
}
func (o *PutCertificatesNotFound) String() string {
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesNotFound %+v", 404, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesNotFound %s", 404, payload)
}
func (o *PutCertificatesNotFound) GetPayload() *members_models.Error {
@ -342,7 +340,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -354,11 +352,9 @@ 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
}
@ -394,11 +390,13 @@ func (o *PutCertificatesUnprocessableEntity) Code() int {
}
func (o *PutCertificatesUnprocessableEntity) Error() string {
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesUnprocessableEntity %s", 422, payload)
}
func (o *PutCertificatesUnprocessableEntity) String() string {
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesUnprocessableEntity %+v", 422, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesUnprocessableEntity %s", 422, payload)
}
func (o *PutCertificatesUnprocessableEntity) GetPayload() *members_models.Error {
@ -410,7 +408,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
@ -422,11 +420,9 @@ 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
}
@ -462,11 +458,13 @@ func (o *PutCertificatesInternalServerError) Code() int {
}
func (o *PutCertificatesInternalServerError) Error() string {
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesInternalServerError %s", 500, payload)
}
func (o *PutCertificatesInternalServerError) String() string {
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesInternalServerError %+v", 500, o.Payload)
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /certificates][%d] putCertificatesInternalServerError %s", 500, payload)
}
func (o *PutCertificatesInternalServerError) GetPayload() *members_models.Error {
@ -478,7 +476,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 && err != io.EOF {
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}

View File

@ -6,53 +6,111 @@
package clusters
// 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 clusters API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
func New(transport runtime.ContextualTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
/*
Client for clusters API
*/
// New creates a new clusters 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 clusters 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 clusters API.
type Client struct {
transport runtime.ClientTransport
transport runtime.ContextualTransport
formats strfmt.Registry
}
// ClientOption is the option for Client methods
// ClientOption may be used to customize the behavior of Client methods.
type ClientOption func(*runtime.ClientOperation)
// ClientService is the interface for Client methods
// ClientService is the interface for Client methods.
type ClientService interface {
// GetClusters get a list clusters.
GetClusters(params *GetClustersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetClustersOK, error)
// GetClustersContext get a list clusters.
GetClustersContext(ctx context.Context, params *GetClustersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetClustersOK, error)
// PostClusters create new clusters.
PostClusters(params *PostClustersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostClustersOK, error)
// PostClustersContext create new clusters.
PostClustersContext(ctx context.Context, params *PostClustersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostClustersOK, error)
// PutClusters update clustera.
PutClusters(params *PutClustersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutClustersOK, error)
SetTransport(transport runtime.ClientTransport)
// PutClustersContext update clustera.
PutClustersContext(ctx context.Context, params *PutClustersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutClustersOK, error)
SetTransport(transport runtime.ContextualTransport)
}
/*
GetClusters gets a list clusters
Return a list of Cluster records from the datastore
*/
// GetClusters gets a list clusters.
//
// Return a list of Cluster 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.GetClustersContext] instead.
func (a *Client) GetClusters(params *GetClustersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetClustersOK, error) {
// TODO: Validate the params before sending
var ctx context.Context
if params.inner.ctx != nil {
ctx = params.inner.ctx
} else {
ctx = context.Background()
}
return a.GetClustersContext(ctx, params, authInfo, opts...)
}
// GetClustersContext gets a list clusters.
//
// Return a list of Cluster records from the datastore.
//
// Do not use the deprecated [GetClustersParams.Context] with this method: it would be ignored.
func (a *Client) GetClustersContext(ctx context.Context, params *GetClustersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetClustersOK, error) {
// NOTE: parameters are not validated before sending
if params == nil {
params = NewGetClustersParams()
}
op := &runtime.ClientOperation{
ID: "getClusters",
Method: "GET",
@ -63,37 +121,63 @@ func (a *Client) GetClusters(params *GetClustersParams, authInfo runtime.ClientA
Params: params,
Reader: &GetClustersReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
result, err := a.transport.SubmitContext(ctx, op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*GetClustersOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
// unexpected success response.
// no default response is defined.
//
// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for getClusters: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PostClusters creates new clusters
Create Clusters
*/
// PostClusters creates new clusters.
//
// Create Clusters.
//
// 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.PostClustersContext] instead.
func (a *Client) PostClusters(params *PostClustersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostClustersOK, error) {
// TODO: Validate the params before sending
var ctx context.Context
if params.inner.ctx != nil {
ctx = params.inner.ctx
} else {
ctx = context.Background()
}
return a.PostClustersContext(ctx, params, authInfo, opts...)
}
// PostClustersContext creates new clusters.
//
// Create Clusters.
//
// Do not use the deprecated [PostClustersParams.Context] with this method: it would be ignored.
func (a *Client) PostClustersContext(ctx context.Context, params *PostClustersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostClustersOK, error) {
// NOTE: parameters are not validated before sending
if params == nil {
params = NewPostClustersParams()
}
op := &runtime.ClientOperation{
ID: "postClusters",
Method: "POST",
@ -104,37 +188,63 @@ func (a *Client) PostClusters(params *PostClustersParams, authInfo runtime.Clien
Params: params,
Reader: &PostClustersReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
result, err := a.transport.SubmitContext(ctx, op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*PostClustersOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
// unexpected success response.
// no default response is defined.
//
// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for postClusters: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PutClusters updates clustera
Update Cluster
*/
// PutClusters updates clustera.
//
// Update Cluster.
//
// 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.PutClustersContext] instead.
func (a *Client) PutClusters(params *PutClustersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutClustersOK, error) {
// TODO: Validate the params before sending
var ctx context.Context
if params.inner.ctx != nil {
ctx = params.inner.ctx
} else {
ctx = context.Background()
}
return a.PutClustersContext(ctx, params, authInfo, opts...)
}
// PutClustersContext updates clustera.
//
// Update Cluster.
//
// Do not use the deprecated [PutClustersParams.Context] with this method: it would be ignored.
func (a *Client) PutClustersContext(ctx context.Context, params *PutClustersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutClustersOK, error) {
// NOTE: parameters are not validated before sending
if params == nil {
params = NewPutClustersParams()
}
op := &runtime.ClientOperation{
ID: "putClusters",
Method: "PUT",
@ -145,28 +255,42 @@ func (a *Client) PutClusters(params *PutClustersParams, authInfo runtime.ClientA
Params: params,
Reader: &PutClustersReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
result, err := a.transport.SubmitContext(ctx, op)
if err != nil {
return nil, err
}
// only one success response has to be checked
success, ok := result.(*PutClustersOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
// unexpected success response.
// no default response is defined.
//
// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for putClusters: 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.ClientTransport) {
func (a *Client) SetTransport(transport runtime.ContextualTransport) {
a.transport = transport
}
// innerParams captures internal fields so they don't conflict with user-supplied parameters.
type innerParams struct {
timeout time.Duration
// Deprecated: use the operation call with context to pass the context instead of [ClustersParams].
ctx context.Context
}

View File

@ -6,9 +6,6 @@
package clusters
// 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"
@ -18,7 +15,7 @@ import (
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/swag/conv"
)
// NewGetClustersParams creates a new GetClustersParams object,
@ -28,24 +25,28 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewGetClustersParams() *GetClustersParams {
return &GetClustersParams{
timeout: cr.DefaultTimeout,
}
return NewGetClustersParamsWithTimeout(cr.DefaultTimeout)
}
// NewGetClustersParamsWithTimeout creates a new GetClustersParams object
// with the ability to set a timeout on a request.
func NewGetClustersParamsWithTimeout(timeout time.Duration) *GetClustersParams {
return &GetClustersParams{
timeout: timeout,
inner: innerParams{
timeout: timeout,
},
}
}
// NewGetClustersParamsWithContext creates a new GetClustersParams object
// with the ability to set a context for a request.
//
// Deprecated: use the operation call with context to pass the context instead of [GetClustersParams].
func NewGetClustersParamsWithContext(ctx context.Context) *GetClustersParams {
return &GetClustersParams{
Context: ctx,
inner: innerParams{
ctx: ctx,
},
}
}
@ -66,31 +67,28 @@ GetClustersParams contains all the parameters to send to the API endpoint
*/
type GetClustersParams struct {
/* ClusterID.
Record Id of a Cluster
*/
// ClusterID.
//
// Record Id of a Cluster
ClusterID *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 clusters params (not the query body).
@ -108,76 +106,79 @@ func (o *GetClustersParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the get clusters params
// WithTimeout adds the timeout to the get clusters params.
func (o *GetClustersParams) WithTimeout(timeout time.Duration) *GetClustersParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get clusters params
// SetTimeout adds the timeout to the get clusters params.
func (o *GetClustersParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
o.inner.timeout = timeout
}
// WithContext adds the context to the get clusters params
// WithContext adds the context to the get clusters params.
//
// Deprecated: use the operation call with context to pass the context instead of [GetClustersParams].
func (o *GetClustersParams) WithContext(ctx context.Context) *GetClustersParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get clusters params
// SetContext adds the context to the get clusters params.
//
// Deprecated: use the operation call with context to pass the context instead of [GetClustersParams].
func (o *GetClustersParams) SetContext(ctx context.Context) {
o.Context = ctx
o.inner.ctx = ctx
}
// WithHTTPClient adds the HTTPClient to the get clusters params
// WithHTTPClient adds the HTTPClient to the get clusters params.
func (o *GetClustersParams) WithHTTPClient(client *http.Client) *GetClustersParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get clusters params
// SetHTTPClient adds the HTTPClient to the get clusters params.
func (o *GetClustersParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithClusterID adds the clusterID to the get clusters params
// WithClusterID adds the clusterID to the get clusters params.
func (o *GetClustersParams) WithClusterID(clusterID *string) *GetClustersParams {
o.SetClusterID(clusterID)
return o
}
// SetClusterID adds the clusterId to the get clusters params
// SetClusterID adds the clusterId to the get clusters params.
func (o *GetClustersParams) SetClusterID(clusterID *string) {
o.ClusterID = clusterID
}
// WithLimit adds the limit to the get clusters params
// WithLimit adds the limit to the get clusters params.
func (o *GetClustersParams) WithLimit(limit *int64) *GetClustersParams {
o.SetLimit(limit)
return o
}
// SetLimit adds the limit to the get clusters params
// SetLimit adds the limit to the get clusters params.
func (o *GetClustersParams) SetLimit(limit *int64) {
o.Limit = limit
}
// WithOffset adds the offset to the get clusters params
// WithOffset adds the offset to the get clusters params.
func (o *GetClustersParams) WithOffset(offset *int64) *GetClustersParams {
o.SetOffset(offset)
return o
}
// SetOffset adds the offset to the get clusters params
// SetOffset adds the offset to the get clusters params.
func (o *GetClustersParams) SetOffset(offset *int64) {
o.Offset = offset
}
// WriteToRequest writes these params to a swagger request
// WriteToRequest writes these params to a [runtime.ClientRequest].
func (o *GetClustersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
if err := r.SetTimeout(o.inner.timeout); err != nil {
return err
}
var res []error
@ -207,7 +208,7 @@ func (o *GetClustersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R
if o.Limit != nil {
qrLimit = *o.Limit
}
qLimit := swag.FormatInt64(qrLimit)
qLimit := conv.FormatInteger(qrLimit)
if qLimit != "" {
if err := r.SetQueryParam("limit", qLimit); err != nil {
@ -224,7 +225,7 @@ func (o *GetClustersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R
if o.Offset != nil {
qrOffset = *o.Offset
}
qOffset := swag.FormatInt64(qrOffset)
qOffset := conv.FormatInteger(qrOffset)
if qOffset != "" {
if err := r.SetQueryParam("offset", qOffset); err != nil {

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