summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--golang/.gitignore3
-rw-r--r--golang/Gopkg.lock377
-rw-r--r--golang/Gopkg.toml66
-rw-r--r--golang/README.md65
-rw-r--r--golang/TODO18
-rw-r--r--golang/api/handlers/editing.go96
-rw-r--r--golang/api/handlers/entities.go151
-rw-r--r--golang/cmd/fatcatd/main.go9
-rw-r--r--golang/cmd/fatcatd/reinit.go51
-rw-r--r--golang/cmd/fatcatd/root.go72
-rw-r--r--golang/cmd/fatcatd/serve.go89
-rw-r--r--golang/fatcat-openapi2.yml271
-rw-r--r--golang/fatcatd.toml2
-rw-r--r--golang/gen/models/changelogentry.go88
-rw-r--r--golang/gen/models/creator_edit.go52
-rw-r--r--golang/gen/models/creator_entity.go121
-rw-r--r--golang/gen/models/editgroup.go81
-rw-r--r--golang/gen/models/editor.go64
-rw-r--r--golang/gen/models/entity_edit.go52
-rw-r--r--golang/gen/models/error.go64
-rw-r--r--golang/gen/models/release_entity.go136
-rw-r--r--golang/gen/models/success.go64
-rw-r--r--golang/gen/restapi/configure_fatcat.go89
-rw-r--r--golang/gen/restapi/doc.go22
-rw-r--r--golang/gen/restapi/embedded_spec.go934
-rw-r--r--golang/gen/restapi/operations/fatcat_api.go372
-rw-r--r--golang/gen/restapi/operations/get_creator_id.go58
-rw-r--r--golang/gen/restapi/operations/get_creator_id_parameters.go72
-rw-r--r--golang/gen/restapi/operations/get_creator_id_responses.go160
-rw-r--r--golang/gen/restapi/operations/get_creator_id_urlbuilder.go99
-rw-r--r--golang/gen/restapi/operations/get_creator_lookup.go58
-rw-r--r--golang/gen/restapi/operations/get_creator_lookup_parameters.go82
-rw-r--r--golang/gen/restapi/operations/get_creator_lookup_responses.go160
-rw-r--r--golang/gen/restapi/operations/get_creator_lookup_urlbuilder.go100
-rw-r--r--golang/gen/restapi/operations/get_editgroup_id.go58
-rw-r--r--golang/gen/restapi/operations/get_editgroup_id_parameters.go77
-rw-r--r--golang/gen/restapi/operations/get_editgroup_id_responses.go160
-rw-r--r--golang/gen/restapi/operations/get_editgroup_id_urlbuilder.go101
-rw-r--r--golang/gen/restapi/operations/get_editor_username.go58
-rw-r--r--golang/gen/restapi/operations/get_editor_username_changelog.go58
-rw-r--r--golang/gen/restapi/operations/get_editor_username_changelog_parameters.go72
-rw-r--r--golang/gen/restapi/operations/get_editor_username_changelog_responses.go160
-rw-r--r--golang/gen/restapi/operations/get_editor_username_changelog_urlbuilder.go99
-rw-r--r--golang/gen/restapi/operations/get_editor_username_parameters.go72
-rw-r--r--golang/gen/restapi/operations/get_editor_username_responses.go160
-rw-r--r--golang/gen/restapi/operations/get_editor_username_urlbuilder.go99
-rw-r--r--golang/gen/restapi/operations/post_creator.go58
-rw-r--r--golang/gen/restapi/operations/post_creator_parameters.go70
-rw-r--r--golang/gen/restapi/operations/post_creator_responses.go160
-rw-r--r--golang/gen/restapi/operations/post_creator_urlbuilder.go87
-rw-r--r--golang/gen/restapi/operations/post_editgroup.go58
-rw-r--r--golang/gen/restapi/operations/post_editgroup_id_accept.go58
-rw-r--r--golang/gen/restapi/operations/post_editgroup_id_accept_parameters.go77
-rw-r--r--golang/gen/restapi/operations/post_editgroup_id_accept_responses.go204
-rw-r--r--golang/gen/restapi/operations/post_editgroup_id_accept_urlbuilder.go101
-rw-r--r--golang/gen/restapi/operations/post_editgroup_parameters.go45
-rw-r--r--golang/gen/restapi/operations/post_editgroup_responses.go160
-rw-r--r--golang/gen/restapi/operations/post_editgroup_urlbuilder.go87
-rw-r--r--golang/gen/restapi/server.go447
-rw-r--r--golang/gen/restapi/test.go13
-rwxr-xr-xgolang/regen.sh7
-rw-r--r--golang/sql/dummy-data.sql42
-rw-r--r--golang/sql/fatcat-schema.sql68
-rwxr-xr-xgolang/test.sh12
64 files changed, 0 insertions, 7126 deletions
diff --git a/golang/.gitignore b/golang/.gitignore
deleted file mode 100644
index 3caab53e..00000000
--- a/golang/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-vendor/
-coverage.txt
-fatcat-openapi2.json
diff --git a/golang/Gopkg.lock b/golang/Gopkg.lock
deleted file mode 100644
index eedeab82..00000000
--- a/golang/Gopkg.lock
+++ /dev/null
@@ -1,377 +0,0 @@
-# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
-
-
-[[projects]]
- name = "github.com/PuerkitoBio/purell"
- packages = ["."]
- revision = "0bcb03f4b4d0a9428594752bd2a3b9aa0a9d4bd4"
- version = "v1.1.0"
-
-[[projects]]
- branch = "master"
- name = "github.com/PuerkitoBio/urlesc"
- packages = ["."]
- revision = "de5bf2ad457846296e2031421a34e2568e304e35"
-
-[[projects]]
- name = "github.com/asaskevich/govalidator"
- packages = ["."]
- revision = "ccb8e960c48f04d6935e72476ae4a51028f9e22f"
- version = "v9"
-
-[[projects]]
- branch = "master"
- name = "github.com/bradleyg/go-sentroni"
- packages = ["."]
- revision = "16e7bf48e1494134ac32000c9e22f3cd3e54c85f"
-
-[[projects]]
- branch = "master"
- name = "github.com/carbocation/interpose"
- packages = [
- ".",
- "adaptors"
- ]
- revision = "723534742ba3bbda66268b735aaa41634468acc6"
-
-[[projects]]
- name = "github.com/certifi/gocertifi"
- packages = ["."]
- revision = "deb3ae2ef2610fde3330947281941c562861188b"
- version = "2018.01.18"
-
-[[projects]]
- name = "github.com/codegangsta/inject"
- packages = ["."]
- revision = "37d7f8432a3e684eef9b2edece76bdfa6ac85b39"
- version = "v1.0-rc1"
-
-[[projects]]
- name = "github.com/davecgh/go-spew"
- packages = ["spew"]
- revision = "346938d642f2ec3594ed81d874461961cd0faa76"
- version = "v1.1.0"
-
-[[projects]]
- name = "github.com/docker/go-units"
- packages = ["."]
- revision = "47565b4f722fb6ceae66b95f853feed578a4a51c"
- version = "v0.3.3"
-
-[[projects]]
- name = "github.com/fsnotify/fsnotify"
- packages = ["."]
- revision = "c2828203cd70a50dcccfb2761f8b1f8ceef9a8e9"
- version = "v1.4.7"
-
-[[projects]]
- branch = "master"
- name = "github.com/getsentry/raven-go"
- packages = ["."]
- revision = "263040ce1a362270b5897a5982572ddc1fe807be"
-
-[[projects]]
- name = "github.com/go-martini/martini"
- packages = ["."]
- revision = "49411a5b646861ad29a6ddd5351717a0a9c49b94"
- version = "v1.0"
-
-[[projects]]
- branch = "master"
- name = "github.com/go-openapi/analysis"
- packages = ["."]
- revision = "863ac7f90e00e88e507095639a8457bbbf3c2ec9"
-
-[[projects]]
- branch = "master"
- name = "github.com/go-openapi/errors"
- packages = ["."]
- revision = "7bcb96a367bac6b76e6e42fa84155bb5581dcff8"
-
-[[projects]]
- branch = "master"
- name = "github.com/go-openapi/jsonpointer"
- packages = ["."]
- revision = "3a0015ad55fa9873f41605d3e8f28cd279c32ab2"
-
-[[projects]]
- branch = "master"
- name = "github.com/go-openapi/jsonreference"
- packages = ["."]
- revision = "3fb327e6747da3043567ee86abd02bb6376b6be2"
-
-[[projects]]
- branch = "master"
- name = "github.com/go-openapi/loads"
- packages = ["."]
- revision = "2a2b323bab96e6b1fdee110e57d959322446e9c9"
-
-[[projects]]
- branch = "master"
- name = "github.com/go-openapi/runtime"
- packages = [
- ".",
- "flagext",
- "logger",
- "middleware",
- "middleware/denco",
- "middleware/header",
- "middleware/untyped",
- "security"
- ]
- revision = "c0cae94704c76c8643896d8054080f91e920105b"
-
-[[projects]]
- branch = "master"
- name = "github.com/go-openapi/spec"
- packages = ["."]
- revision = "bcff419492eeeb01f76e77d2ebc714dc97b607f5"
-
-[[projects]]
- branch = "master"
- name = "github.com/go-openapi/strfmt"
- packages = ["."]
- revision = "481808443b00a14745fada967cb5eeff0f9b1df2"
-
-[[projects]]
- branch = "master"
- name = "github.com/go-openapi/swag"
- packages = ["."]
- revision = "811b1089cde9dad18d4d0c2d09fbdbf28dbd27a5"
-
-[[projects]]
- branch = "master"
- name = "github.com/go-openapi/validate"
- packages = ["."]
- revision = "9286f6d0e5c1ffc7cf2bda1d59291dc3c4f2f828"
-
-[[projects]]
- name = "github.com/go-pg/pg"
- packages = [
- ".",
- "internal",
- "internal/parser",
- "internal/pool",
- "orm",
- "types"
- ]
- revision = "5b73ce88484575f3480edf393237f6bf79d5f166"
- version = "v6.11.2"
-
-[[projects]]
- name = "github.com/gobuffalo/packr"
- packages = ["."]
- revision = "7f4074995d431987caaa35088199f13c44b24440"
- version = "v1.11.0"
-
-[[projects]]
- branch = "master"
- name = "github.com/hashicorp/hcl"
- packages = [
- ".",
- "hcl/ast",
- "hcl/parser",
- "hcl/printer",
- "hcl/scanner",
- "hcl/strconv",
- "hcl/token",
- "json/parser",
- "json/scanner",
- "json/token"
- ]
- revision = "ef8a98b0bbce4a65b5aa4c368430a80ddc533168"
-
-[[projects]]
- name = "github.com/inconshreveable/mousetrap"
- packages = ["."]
- revision = "76626ae9c91c4f2a10f34cad8ce83ea42c93bb75"
- version = "v1.0"
-
-[[projects]]
- name = "github.com/jessevdk/go-flags"
- packages = ["."]
- revision = "c6ca198ec95c841fdb89fc0de7496fed11ab854e"
- version = "v1.4.0"
-
-[[projects]]
- branch = "master"
- name = "github.com/jinzhu/inflection"
- packages = ["."]
- revision = "04140366298a54a039076d798123ffa108fff46c"
-
-[[projects]]
- name = "github.com/magiconair/properties"
- packages = ["."]
- revision = "c3beff4c2358b44d0493c7dda585e7db7ff28ae6"
- version = "v1.7.6"
-
-[[projects]]
- branch = "master"
- name = "github.com/mailru/easyjson"
- packages = [
- "buffer",
- "jlexer",
- "jwriter"
- ]
- revision = "8b799c424f57fa123fc63a99d6383bc6e4c02578"
-
-[[projects]]
- branch = "master"
- name = "github.com/meatballhat/negroni-logrus"
- packages = ["."]
- revision = "31067281800f66f57548a7a32d9c6c5f963fef83"
-
-[[projects]]
- branch = "master"
- name = "github.com/mitchellh/mapstructure"
- packages = ["."]
- revision = "00c29f56e2386353d58c599509e8dc3801b0d716"
-
-[[projects]]
- name = "github.com/pelletier/go-toml"
- packages = ["."]
- revision = "acdc4509485b587f5e675510c4f2c63e90ff68a8"
- version = "v1.1.0"
-
-[[projects]]
- name = "github.com/pkg/errors"
- packages = ["."]
- revision = "645ef00459ed84a119197bfb8d8205042c6df63d"
- version = "v0.8.0"
-
-[[projects]]
- name = "github.com/pmezard/go-difflib"
- packages = ["difflib"]
- revision = "792786c7400a136282c1664665ae0a8db921c6c2"
- version = "v1.0.0"
-
-[[projects]]
- name = "github.com/sirupsen/logrus"
- packages = ["."]
- revision = "c155da19408a8799da419ed3eeb0cb5db0ad5dbc"
- version = "v1.0.5"
-
-[[projects]]
- name = "github.com/spf13/afero"
- packages = [
- ".",
- "mem"
- ]
- revision = "63644898a8da0bc22138abf860edaf5277b6102e"
- version = "v1.1.0"
-
-[[projects]]
- name = "github.com/spf13/cast"
- packages = ["."]
- revision = "8965335b8c7107321228e3e3702cab9832751bac"
- version = "v1.2.0"
-
-[[projects]]
- name = "github.com/spf13/cobra"
- packages = ["."]
- revision = "a1f051bc3eba734da4772d60e2d677f47cf93ef4"
- version = "v0.0.2"
-
-[[projects]]
- branch = "master"
- name = "github.com/spf13/jwalterweatherman"
- packages = ["."]
- revision = "7c0cea34c8ece3fbeb2b27ab9b59511d360fb394"
-
-[[projects]]
- name = "github.com/spf13/pflag"
- packages = ["."]
- revision = "583c0c0531f06d5278b7d917446061adc344b5cd"
- version = "v1.0.1"
-
-[[projects]]
- name = "github.com/spf13/viper"
- packages = ["."]
- revision = "b5e8006cbee93ec955a89ab31e0e3ce3204f3736"
- version = "v1.0.2"
-
-[[projects]]
- name = "github.com/stretchr/testify"
- packages = ["assert"]
- revision = "12b6f73e6084dad08a7c6e575284b177ecafbc71"
- version = "v1.2.1"
-
-[[projects]]
- name = "github.com/tylerb/graceful"
- packages = ["."]
- revision = "4654dfbb6ad53cb5e27f37d99b02e16c1872fbbb"
- version = "v1.2.15"
-
-[[projects]]
- name = "github.com/urfave/negroni"
- packages = ["."]
- revision = "5dbbc83f748fc3ad38585842b0aedab546d0ea1e"
- version = "v0.3.0"
-
-[[projects]]
- branch = "master"
- name = "golang.org/x/crypto"
- packages = ["ssh/terminal"]
- revision = "2d027ae1dddd4694d54f7a8b6cbe78dca8720226"
-
-[[projects]]
- branch = "master"
- name = "golang.org/x/net"
- packages = [
- "context",
- "idna"
- ]
- revision = "f73e4c9ed3b7ebdd5f699a16a880c2b1994e50dd"
-
-[[projects]]
- branch = "master"
- name = "golang.org/x/sys"
- packages = [
- "unix",
- "windows"
- ]
- revision = "64746a42f36bf0832f86b76004f1699dbeb33e4f"
-
-[[projects]]
- name = "golang.org/x/text"
- packages = [
- "collate",
- "collate/build",
- "internal/colltab",
- "internal/gen",
- "internal/tag",
- "internal/triegen",
- "internal/ucd",
- "language",
- "secure/bidirule",
- "transform",
- "unicode/bidi",
- "unicode/cldr",
- "unicode/norm",
- "unicode/rangetable",
- "width"
- ]
- revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0"
- version = "v0.3.0"
-
-[[projects]]
- branch = "v2"
- name = "gopkg.in/mgo.v2"
- packages = [
- "bson",
- "internal/json"
- ]
- revision = "3f83fa5005286a7fe593b055f0d7771a7dce4655"
-
-[[projects]]
- name = "gopkg.in/yaml.v2"
- packages = ["."]
- revision = "5420a8b6744d3b0345ab293f6fcba19c978f1183"
- version = "v2.2.1"
-
-[solve-meta]
- analyzer-name = "dep"
- analyzer-version = 1
- inputs-digest = "551e8d9bd6a848cc1a77d0706bb2275d4ff4052d83c7e2a82494ee2ee8821805"
- solver-name = "gps-cdcl"
- solver-version = 1
diff --git a/golang/Gopkg.toml b/golang/Gopkg.toml
deleted file mode 100644
index 5da2f710..00000000
--- a/golang/Gopkg.toml
+++ /dev/null
@@ -1,66 +0,0 @@
-# Gopkg.toml example
-#
-# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
-# for detailed Gopkg.toml documentation.
-#
-# required = ["github.com/user/thing/cmd/thing"]
-# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
-#
-# [[constraint]]
-# name = "github.com/user/project"
-# version = "1.0.0"
-#
-# [[constraint]]
-# name = "github.com/user/project2"
-# branch = "dev"
-# source = "github.com/myfork/project2"
-#
-# [[override]]
-# name = "github.com/x/y"
-# version = "2.4.0"
-#
-# [prune]
-# non-go = false
-# go-tests = true
-# unused-packages = true
-
-
-[[constraint]]
- branch = "master"
- name = "github.com/go-openapi/errors"
-
-[[constraint]]
- branch = "master"
- name = "github.com/go-openapi/loads"
-
-[[constraint]]
- branch = "master"
- name = "github.com/go-openapi/runtime"
-
-[[constraint]]
- branch = "master"
- name = "github.com/go-openapi/spec"
-
-[[constraint]]
- branch = "master"
- name = "github.com/go-openapi/strfmt"
-
-[[constraint]]
- branch = "master"
- name = "github.com/go-openapi/swag"
-
-[[constraint]]
- branch = "master"
- name = "github.com/go-openapi/validate"
-
-[[constraint]]
- name = "github.com/jessevdk/go-flags"
- version = "1.4.0"
-
-[[constraint]]
- name = "github.com/tylerb/graceful"
- version = "1.2.15"
-
-[prune]
- go-tests = true
- unused-packages = true
diff --git a/golang/README.md b/golang/README.md
deleted file mode 100644
index 9bcfdfb5..00000000
--- a/golang/README.md
+++ /dev/null
@@ -1,65 +0,0 @@
-
-This folder contains source for the fatcat API daemon ("fatcatd"), written in
-golang.
-
-
-## Structure
-
-fatcatd is essentially just glue between two declarative schemas:
-
-- a postgres-flavor SQL database schema
-- an OpenAPI/Swagger REST API definition
-
-## Dev Setup
-
-- postgres 9.6+ running locally
-- golang environment configured
- - https://github.com/golang/dep
-- checkout (or symlink) this repo to $GOPATH/src/git.archive.org/bnewbold/fatcat
-- dep ensure
-
-On debian/ubuntu:
-
- sudo -u postgres createuser -s `whoami`
- createdb -O `whoami` fatcat
- psql fatcat -f fatcat-schema.sql
-
-Build with:
-
- go build ./cmd/*/
-
-## Simplifications
-
-In early development, we'll make at least the following simplifications:
-
-- authentication (authn and authz) are not enforced and don't have user
- interfaces. actual authentication will be eased in via a microservice and/or
- oauth to gitlab/github/orcid.org
-- "extra" metadata is stored in-entity as JSONB. In the future this might be
- broken out to a separate table
-- libraries won't be vendored; in the future they will be via a git submodule
-
-
-## OpenAPI Code Generation
-
- cat fatcat-openapi2.yml | python3 -c 'import sys, yaml, json; json.dump(yaml.load(sys.stdin), sys.stdout, indent=4)' > fatcat-openapi2.json
-
-Install the go-swagger tool:
-
- go get -u github.com/go-swagger/go-swagger/cmd/swagger
-
-
-"Simple" server:
-
- swagger generate server -A Fatcat -f fatcat-openapi2.json
-
-"Custom" server:
-
- swagger generate server -A fatcat -f ./fatcat-openapi2.json --exclude-main -t gen
-
-## Future
-
-Could refactor the API side to use gRPC and grpc-gateway instead of swagger
-(which would result in a compatible REST JSON interface). For faster bots and
-import, and lower latency between webface and backend.
-
diff --git a/golang/TODO b/golang/TODO
deleted file mode 100644
index 117bcf4d..00000000
--- a/golang/TODO
+++ /dev/null
@@ -1,18 +0,0 @@
-
-plan:
-x rename directory (fatcat/golang?)
-x "custom" swagger base command (not auto-generated)
- -> "main" wrapper pulling in libraries
-x some form of dependency management: dep
-x logging
-x config
-x sentry
-x cobra command line parsing?
-x database creation and access
-x 404, not panic, when empty result
-- creator post
-- test framework
-
-later:
-- panic recovery middleware
-- metrics
diff --git a/golang/api/handlers/editing.go b/golang/api/handlers/editing.go
deleted file mode 100644
index 5c267e9e..00000000
--- a/golang/api/handlers/editing.go
+++ /dev/null
@@ -1,96 +0,0 @@
-
-package handlers
-
-import (
- "github.com/go-pg/pg"
- //"github.com/go-openapi/swag"
- "github.com/go-openapi/runtime/middleware"
- //log "github.com/sirupsen/logrus"
-
- //"git.archive.org/bnewbold/fatcat/golang/gen/models"
- "git.archive.org/bnewbold/fatcat/golang/gen/restapi/operations"
-)
-
-type Editor struct {
- Id int64
- Username string
- IsAdmin bool
- ActiveEditgroupId int64
- ActiveEditgroup *Editgroup
-}
-
-type Editgroup struct {
- Id int64
- ExtraJson string
- EditorId int64
- Editor *Editor
- Description string
-}
-
-type Changelog struct {
- Id int64
- EditgroupId int64
- Editgroup *Editgroup
- Timestamp string // XXX: timestamp
-}
-
-func GetOrCreateEditgroup() Editgroup {
- // XXX
- eg := Editgroup{}
- return eg
-}
-
-////
-func NewGetEditorUsernameHandler(db *pg.DB) operations.GetEditorUsernameHandler {
- return &getEditorUsername{db: db}
-}
-type getEditorUsername struct {
- db *pg.DB
-}
-func (d *getEditorUsername) Handle(params operations.GetEditorUsernameParams) middleware.Responder {
- return middleware.NotImplemented("operation .PostCreatorID has not yet been implemented")
-}
-
-////
-func NewGetEditorUsernameChangelogHandler(db *pg.DB) operations.GetEditorUsernameChangelogHandler {
- return &getEditorUsernameChangelog{db: db}
-}
-type getEditorUsernameChangelog struct {
- db *pg.DB
-}
-func (d *getEditorUsernameChangelog) Handle(params operations.GetEditorUsernameChangelogParams) middleware.Responder {
- return middleware.NotImplemented("operation .PostCreatorID has not yet been implemented")
-}
-
-////
-func NewGetEditgroupIDHandler(db *pg.DB) operations.GetEditgroupIDHandler {
- return &getEditgroupID{db: db}
-}
-type getEditgroupID struct {
- db *pg.DB
-}
-func (d *getEditgroupID) Handle(params operations.GetEditgroupIDParams) middleware.Responder {
- return middleware.NotImplemented("operation .PostCreatorID has not yet been implemented")
-}
-
-////
-func NewPostEditgroupHandler(db *pg.DB) operations.PostEditgroupHandler {
- return &postEditgroup{db: db}
-}
-type postEditgroup struct {
- db *pg.DB
-}
-func (d *postEditgroup) Handle(params operations.PostEditgroupParams) middleware.Responder {
- return middleware.NotImplemented("operation .PostEditgroupID has not yet been implemented")
-}
-
-////
-func NewPostEditgroupIDAcceptHandler(db *pg.DB) operations.PostEditgroupIDAcceptHandler {
- return &postEditgroupIDAccept{db: db}
-}
-type postEditgroupIDAccept struct {
- db *pg.DB
-}
-func (d *postEditgroupIDAccept) Handle(params operations.PostEditgroupIDAcceptParams) middleware.Responder {
- return middleware.NotImplemented("operation .PostEditgroupIDAcceptID has not yet been implemented")
-}
diff --git a/golang/api/handlers/entities.go b/golang/api/handlers/entities.go
deleted file mode 100644
index 708aebdf..00000000
--- a/golang/api/handlers/entities.go
+++ /dev/null
@@ -1,151 +0,0 @@
-
-package handlers
-
-import (
- "github.com/go-pg/pg"
- "github.com/go-openapi/swag"
- "github.com/go-openapi/runtime/middleware"
- log "github.com/sirupsen/logrus"
-
- "git.archive.org/bnewbold/fatcat/golang/gen/models"
- "git.archive.org/bnewbold/fatcat/golang/gen/restapi/operations"
-)
-
-type CreatorRev struct {
- Id int64
- ExtraJson string
- Name string
- Orcid string
- tableName struct{} `sql:"creator_rev"`
-}
-
-type CreatorIdent struct {
- Id string
- IsLive bool
- RevId int64
- Rev *CreatorRev
- RedirectId string
- Redirect *CreatorIdent
- tableName struct{} `sql:"creator_ident"`
-}
-
-type CreatorEdit struct {
- Id int64
- ExtraJson string
- IdentId string
- Ident *CreatorIdent
- RevId int64
- Rev *CreatorRev
- RedirectId string
- Redirect *CreatorIdent
- EditgroupId int64
- Editgroup *Editgroup
- tableName struct{} `sql:"creator_edit"`
-}
-
-func (ci *CreatorIdent) State() string {
- if ci.IsLive && (ci.RedirectId == "") && (ci.RevId == 0) {
- return "deleted"
- } else if ci.IsLive && (ci.RedirectId != "") {
- return "redirect"
- } else if ci.IsLive && (ci.RedirectId == "") && (ci.RevId != 0) {
- return "active"
- } else if !ci.IsLive && (ci.RedirectId == "") && (ci.RevId != 0) {
- return "wip"
- } else {
- log.Fatalf("Invalid CreatorIdent state: %v", ci)
- panic("fail")
- }
-}
-
-////
-func NewGetCreatorIDHandler(db *pg.DB) operations.GetCreatorIDHandler {
- return &getCreatorID{db: db}
-}
-type getCreatorID struct {
- db *pg.DB
-}
-func (d *getCreatorID) Handle(params operations.GetCreatorIDParams) middleware.Responder {
- // "get or 404" using params.ID. join creator_ident and creator_rev.
- // populate result data
- // return that
- db_entity_ident := &CreatorIdent{}
- err := d.db.Model(db_entity_ident).
- Column("creator_ident.*", "Rev").
- Where("creator_ident.id = ?", swag.StringValue(&params.ID)).
- First()
- if err == pg.ErrNoRows {
- return operations.NewGetCreatorIDNotFound().WithPayload(&models.Error{Message: swag.String("no such entity")})
- } else if err != nil {
- log.Fatal(err)
- }
- api_entity := &models.CreatorEntity{
- Ident: db_entity_ident.Id,
- State: db_entity_ident.State(),
- Name: db_entity_ident.Rev.Name,
- Orcid: db_entity_ident.Rev.Orcid,
- }
- return operations.NewGetCreatorIDOK().WithPayload(api_entity)
-}
-
-////
-func NewGetCreatorLookupHandler(db *pg.DB) operations.GetCreatorLookupHandler {
- return &getCreatorLookup{db: db}
-}
-type getCreatorLookup struct {
- db *pg.DB
-}
-func (d *getCreatorLookup) Handle(params operations.GetCreatorLookupParams) middleware.Responder {
- // get-or-create editgroup based on current editor (session)
- // insert new rev, ident, and edit
- return middleware.NotImplemented("operation .GetCreatorLookup has not yet been implemented")
-}
-
-////
-func NewPostCreatorHandler(db *pg.DB) operations.PostCreatorHandler {
- return &postCreator{db: db}
-}
-type postCreator struct {
- db *pg.DB
-}
-func (d *postCreator) Handle(params operations.PostCreatorParams) middleware.Responder {
- // get-or-create editgroup based on current editor (session)
- var eg Editgroup
- if true {
- eg = Editgroup{Id: 1}
- } else {
- eg = GetOrCreateEditgroup()
- }
- ce := CreatorEdit{}
-
- // big honking SQL to update 3 tables in a single INSERT
- _, err := d.db.QueryOne(
- //Model(ce).ExecOne(
- &ce,
- `WITH rev AS ( INSERT INTO creator_rev (name, orcid)
- VALUES (?, ?)
- RETURNING id ),
- ident AS ( INSERT INTO creator_ident (rev_id)
- VALUES ((SELECT rev.id FROM rev))
- RETURNING id )
- INSERT INTO creator_edit (editgroup_id, ident_id, rev_id) VALUES
- (?, (SELECT ident.id FROM ident), (SELECT rev.id FROM rev))
- RETURNING *`,
- params.Body.Name,
- params.Body.Orcid,
- eg.Id)
- if err != nil {
- log.Fatal(err)
- }
- if err != nil {
- log.Fatal(err)
- }
- // redirect? or return the edit?
- api_edit:= models.EntityEdit {
- ID: ce.Id,
- Ident: ce.IdentId,
- Revision: ce.RevId,
- EditgroupID: ce.EditgroupId,
- }
- return operations.NewPostCreatorCreated().WithPayload(&api_edit)
-}
diff --git a/golang/cmd/fatcatd/main.go b/golang/cmd/fatcatd/main.go
deleted file mode 100644
index a2ad8ee2..00000000
--- a/golang/cmd/fatcatd/main.go
+++ /dev/null
@@ -1,9 +0,0 @@
-
-package main
-
-import (
-)
-
-func main() {
- Execute()
-}
diff --git a/golang/cmd/fatcatd/reinit.go b/golang/cmd/fatcatd/reinit.go
deleted file mode 100644
index 60726df0..00000000
--- a/golang/cmd/fatcatd/reinit.go
+++ /dev/null
@@ -1,51 +0,0 @@
-
-package main
-
-import (
- "github.com/spf13/viper"
- log "github.com/sirupsen/logrus"
- "github.com/go-pg/pg"
- "github.com/spf13/cobra"
- "github.com/gobuffalo/packr"
-)
-
-var reinitCmd = &cobra.Command{
- Use: "reinit [options]",
- Short: "Reset database schema",
- Run: func(cmd *cobra.Command, args[] string) {
- main_reinit()
- },
-}
-
-func main_reinit() {
-
- box := packr.NewBox("../../sql")
- sql_schema, err := box.MustString("fatcat-schema.sql")
- if err != nil {
- log.Panicf("finding SQL file: %v", err)
- }
-
- db_options, err := pg.ParseURL(viper.GetString("db_url"))
- if err != nil {
- log.Panicf("parsing DB string: %v", err)
- }
- db := pg.Connect(db_options)
- defer db.Close()
-
- log.Info("Starting load...")
- _, err = db.Exec(sql_schema)
- if err != nil {
- log.Fatalf("Error loading SQL: %v", err)
- }
- log.Info("Loading dummy data...")
- sql_dummy, err := box.MustString("dummy-data.sql")
- if err != nil {
- log.Panicf("finding SQL file: %v", err)
- }
- _, err = db.Exec(sql_dummy)
- if err != nil {
- log.Fatalf("Error loading SQL: %v", err)
- }
- log.Info("Success!")
-
-}
diff --git a/golang/cmd/fatcatd/root.go b/golang/cmd/fatcatd/root.go
deleted file mode 100644
index 12be35b3..00000000
--- a/golang/cmd/fatcatd/root.go
+++ /dev/null
@@ -1,72 +0,0 @@
-
-package main
-
-import (
- "os"
- "fmt"
-
- log "github.com/sirupsen/logrus"
- "github.com/spf13/viper"
- "github.com/spf13/cobra"
- "github.com/getsentry/raven-go"
-)
-
-var cfgFile = "";
-
-var rootCmd = &cobra.Command{
- Use: "fatcatd",
- Short: "REST API Server",
- Long: "A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata",
- Version: "0.1.0",
-}
-
-func init() {
- cobra.OnInitialize(initConfig)
- rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is ./fatcatd.toml)")
- rootCmd.PersistentFlags().BoolP("verbose", "v", false, "increase logging volume")
- viper.BindPFlag("verbose", rootCmd.PersistentFlags().Lookup("verbose"))
-
- serveCmd.Flags().String("db-url", "postgres://", "database connecion string")
-
- rootCmd.AddCommand(serveCmd)
- rootCmd.AddCommand(reinitCmd)
-}
-
-func initConfig() {
-
- viper.SetDefault("port", 9411)
- viper.SetEnvPrefix("FATCAT")
- viper.AutomaticEnv()
-
- if cfgFile != "" {
- // Use config file from the flag.
- viper.SetConfigFile(cfgFile)
- } else {
- viper.SetConfigType("toml")
- viper.AddConfigPath(".")
- viper.SetConfigName("fatcatd")
- }
-
- err := viper.ReadInConfig()
- if err != nil {
- log.Fatalf("Error loading config: %s \n", err)
- }
-
- // not default of stderr
- log.SetOutput(os.Stdout);
-
- if viper.GetBool("verbose") == true {
- log.SetLevel(log.DebugLevel)
- }
- log.Debug("It's verbose!")
-
- raven.SetDSN(viper.GetString("sentry_dsn"));
-
-}
-
-func Execute() {
- if err := rootCmd.Execute(); err != nil {
- fmt.Println(err)
- os.Exit(1)
- }
-}
diff --git a/golang/cmd/fatcatd/serve.go b/golang/cmd/fatcatd/serve.go
deleted file mode 100644
index 73eb1f86..00000000
--- a/golang/cmd/fatcatd/serve.go
+++ /dev/null
@@ -1,89 +0,0 @@
-
-package main
-
-import (
- "net/http"
-
- "github.com/spf13/viper"
- log "github.com/sirupsen/logrus"
- loads "github.com/go-openapi/loads"
- "github.com/carbocation/interpose"
- "github.com/carbocation/interpose/adaptors"
- "github.com/meatballhat/negroni-logrus"
- "github.com/bradleyg/go-sentroni"
- "github.com/go-pg/pg"
- "github.com/spf13/cobra"
-
- "git.archive.org/bnewbold/fatcat/golang/api/handlers"
- "git.archive.org/bnewbold/fatcat/golang/gen/restapi"
- "git.archive.org/bnewbold/fatcat/golang/gen/restapi/operations"
-)
-
-var serveCmd = &cobra.Command{
- Use: "serve [options]",
- Short: "Run fatcat REST API server",
- Run: func(cmd *cobra.Command, args[] string) {
- main_serve()
- },
-}
-
-func main_serve() {
-
- // load embedded swagger file
- swaggerSpec, err := loads.Analyzed(restapi.SwaggerJSON, "")
- if err != nil {
- log.Fatalln(err)
- }
-
- // create new service API
- api := operations.NewFatcatAPI(swaggerSpec)
-
- // Set your custom logger if needed. Default one is log.Printf
- // Expected interface func(string, ...interface{})
- api.Logger = log.Printf
-
- server := restapi.NewServer(api)
- defer server.Shutdown()
-
- server.Port = viper.GetInt("port")
-
- db_options, err := pg.ParseURL(viper.GetString("db_url"))
- if err != nil {
- log.Panicf("parsing DB string: %v", err)
- }
- db := pg.Connect(db_options)
- defer db.Close()
-
- // register all the many handlers here
- api.GetCreatorIDHandler = handlers.NewGetCreatorIDHandler(db);
- api.PostCreatorHandler = handlers.NewPostCreatorHandler(db);
- api.GetCreatorLookupHandler = handlers.NewGetCreatorLookupHandler(db);
-
- api.GetEditgroupIDHandler = handlers.NewGetEditgroupIDHandler(db);
- api.GetEditorUsernameHandler = handlers.NewGetEditorUsernameHandler(db);
- api.GetEditorUsernameChangelogHandler = handlers.NewGetEditorUsernameChangelogHandler(db);
- api.PostEditgroupHandler = handlers.NewPostEditgroupHandler(db);
- api.PostEditgroupIDAcceptHandler = handlers.NewPostEditgroupIDAcceptHandler(db);
-
- middle := interpose.New()
-
- // sentry
- middle.Use(adaptors.FromNegroni(sentroni.NewRecovery(viper.GetString("sentry_dsn"))))
-
- // logging
- middle.Use(adaptors.FromNegroni(negronilogrus.NewMiddleware()))
-
- // add clacks
- middle.UseHandler(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
- rw.Header().Set("X-Clacks-Overhead:", "GNU Aaron Swartz, John Perry Barlow")
- }))
-
- // actual handler
- middle.UseHandler(api.Serve(nil))
- server.SetHandler(middle)
-
- if err := server.Serve(); err != nil {
- log.Fatalln(err)
- }
-
-}
diff --git a/golang/fatcat-openapi2.yml b/golang/fatcat-openapi2.yml
deleted file mode 100644
index 6075940b..00000000
--- a/golang/fatcat-openapi2.yml
+++ /dev/null
@@ -1,271 +0,0 @@
----
-swagger: "2.0"
-info:
- title: fatcat
- description: A scalable, versioned, API-oriented catalog of bibliographic entities
- and file metadata
- version: 0.1.0
-schemes: [http]
-basePath: /v0
-host: api.fatcat.wiki
-consumes:
- - application/json
-produces:
- - application/json
-
-# Common properties across entities
-x-entity-props: &ENTITYPROPS
- state:
- type: string
- enum: ["wip", "active", "redirect", "deleted"]
- ident:
- type: string
- #format: uuid
- revision:
- type: integer
- redirect:
- type: string
- #format: uuid
-x-entity-edit-props: &ENTITYEDITPROPS
- id:
- type: integer
- ident:
- type: string
- revision:
- type: integer
- editgroup_id:
- type: integer
-
-definitions:
- error:
- type: object
- required:
- - message
- properties:
- message:
- type: string
- success:
- type: object
- required:
- - message
- properties:
- message:
- type: string
- release_entity:
- type: object
- required:
- - ident
- - state
- properties:
- <<: *ENTITYPROPS
- name:
- type: string
- orcid:
- type: string
- #format: custom
- creator_entity:
- type: object
- properties:
- <<: *ENTITYPROPS
- name:
- type: string
- orcid:
- type: string
- #format: custom
- entity_edit:
- type: object
- properties:
- <<: *ENTITYEDITPROPS
- editor:
- type: object
- required:
- - username
- properties:
- username:
- type: string
- editgroup:
- type: object
- required:
- - id
- - editor_id
- properties:
- id:
- type: integer
- editor_id:
- type: integer
- changelogentry:
- type: object
- required:
- - index
- properties:
- index:
- type: integer
- editgroup_id:
- type: integer
- timestamp:
- type: string
- format: date-time
-
-paths:
- /creator:
- post:
- parameters:
- - name: body
- in: body
- schema:
- $ref: "#/definitions/creator_entity"
- #- name: editgroup
- # in: body
- # type: string
- responses:
- 201:
- description: created
- schema:
- $ref: "#/definitions/entity_edit"
- 400:
- description: bad request
- schema:
- $ref: "#/definitions/error"
- default:
- description: generic error response
- schema:
- $ref: "#/definitions/error"
- /creator/{id}:
- parameters:
- - name: id
- in: path
- type: string
- required: true
- get:
- responses:
- 200:
- description: fetch a single creator by id
- schema:
- $ref: "#/definitions/creator_entity"
- 404:
- description: no such creator
- schema:
- $ref: "#/definitions/error"
- default:
- description: generic error response
- schema:
- $ref: "#/definitions/error"
- /creator/lookup:
- get:
- parameters:
- - name: orcid
- in: query
- type: string
- required: true
- responses:
- 200:
- description: find a single creator by external identifer
- schema:
- $ref: "#/definitions/creator_entity"
- 404:
- description: no such creator
- schema:
- $ref: "#/definitions/error"
- default:
- description: generic error response
- schema:
- $ref: "#/definitions/error"
- /editor/{username}:
- parameters:
- - name: username
- in: path
- type: string
- required: true
- get:
- responses:
- 200:
- description: fetch generic information about an editor
- schema:
- $ref: "#/definitions/editor"
- 404:
- description: username not found
- schema:
- $ref: "#/definitions/error"
- default:
- description: generic error response
- schema:
- $ref: "#/definitions/error"
- /editor/{username}/changelog:
- parameters:
- - name: username
- in: path
- type: string
- required: true
- get:
- responses:
- 200:
- description: find changes (editgroups) by this editor which have been merged
- schema:
- $ref: "#/definitions/changelogentry"
- 404:
- description: username not found
- schema:
- $ref: "#/definitions/error"
- default:
- description: generic error response
- schema:
- $ref: "#/definitions/error"
- /editgroup:
- post:
- responses:
- 201:
- description: successfully created
- schema:
- $ref: "#/definitions/editgroup"
- 400:
- description: invalid request parameters
- schema:
- $ref: "#/definitions/error"
- default:
- description: generic error response
- schema:
- $ref: "#/definitions/error"
- /editgroup/{id}:
- parameters:
- - name: id
- in: path
- type: integer
- required: true
- get:
- responses:
- 200:
- description: fetch editgroup by identifier
- schema:
- $ref: "#/definitions/editgroup"
- 404:
- description: no such editgroup
- schema:
- $ref: "#/definitions/error"
- default:
- description: generic error response
- schema:
- $ref: "#/definitions/error"
- /editgroup/{id}/accept:
- parameters:
- - name: id
- in: path
- type: integer
- required: true
- post:
- responses:
- 200:
- description: merged editgroup successfully ("live")
- schema:
- $ref: "#/definitions/success"
- 400:
- description: editgroup is in an unmergable state
- schema:
- $ref: "#/definitions/error"
- 404:
- description: no such editgroup
- schema:
- $ref: "#/definitions/error"
- default:
- description: generic error response
- schema:
- $ref: "#/definitions/error"
diff --git a/golang/fatcatd.toml b/golang/fatcatd.toml
deleted file mode 100644
index 56316061..00000000
--- a/golang/fatcatd.toml
+++ /dev/null
@@ -1,2 +0,0 @@
-verbose = false
-db_url = "postgres://fatcat:tactaf@localhost/fatcat"
diff --git a/golang/gen/models/changelogentry.go b/golang/gen/models/changelogentry.go
deleted file mode 100644
index acf93e60..00000000
--- a/golang/gen/models/changelogentry.go
+++ /dev/null
@@ -1,88 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package models
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the swagger generate command
-
-import (
- strfmt "github.com/go-openapi/strfmt"
-
- "github.com/go-openapi/errors"
- "github.com/go-openapi/swag"
- "github.com/go-openapi/validate"
-)
-
-// Changelogentry changelogentry
-// swagger:model changelogentry
-type Changelogentry struct {
-
- // editgroup id
- EditgroupID int64 `json:"editgroup_id,omitempty"`
-
- // index
- // Required: true
- Index *int64 `json:"index"`
-
- // timestamp
- // Format: date-time
- Timestamp strfmt.DateTime `json:"timestamp,omitempty"`
-}
-
-// Validate validates this changelogentry
-func (m *Changelogentry) Validate(formats strfmt.Registry) error {
- var res []error
-
- if err := m.validateIndex(formats); err != nil {
- res = append(res, err)
- }
-
- if err := m.validateTimestamp(formats); err != nil {
- res = append(res, err)
- }
-
- if len(res) > 0 {
- return errors.CompositeValidationError(res...)
- }
- return nil
-}
-
-func (m *Changelogentry) validateIndex(formats strfmt.Registry) error {
-
- if err := validate.Required("index", "body", m.Index); err != nil {
- return err
- }
-
- return nil
-}
-
-func (m *Changelogentry) validateTimestamp(formats strfmt.Registry) error {
-
- if swag.IsZero(m.Timestamp) { // not required
- return nil
- }
-
- if err := validate.FormatOf("timestamp", "body", "date-time", m.Timestamp.String(), formats); err != nil {
- return err
- }
-
- return nil
-}
-
-// MarshalBinary interface implementation
-func (m *Changelogentry) MarshalBinary() ([]byte, error) {
- if m == nil {
- return nil, nil
- }
- return swag.WriteJSON(m)
-}
-
-// UnmarshalBinary interface implementation
-func (m *Changelogentry) UnmarshalBinary(b []byte) error {
- var res Changelogentry
- if err := swag.ReadJSON(b, &res); err != nil {
- return err
- }
- *m = res
- return nil
-}
diff --git a/golang/gen/models/creator_edit.go b/golang/gen/models/creator_edit.go
deleted file mode 100644
index 05bfbf75..00000000
--- a/golang/gen/models/creator_edit.go
+++ /dev/null
@@ -1,52 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package models
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the swagger generate command
-
-import (
- strfmt "github.com/go-openapi/strfmt"
-
- "github.com/go-openapi/swag"
-)
-
-// CreatorEdit creator edit
-// swagger:model creator_edit
-type CreatorEdit struct {
-
- // editgroup id
- EditgroupID int64 `json:"editgroup_id,omitempty"`
-
- // id
- ID int64 `json:"id,omitempty"`
-
- // ident
- Ident string `json:"ident,omitempty"`
-
- // revision
- Revision int64 `json:"revision,omitempty"`
-}
-
-// Validate validates this creator edit
-func (m *CreatorEdit) Validate(formats strfmt.Registry) error {
- return nil
-}
-
-// MarshalBinary interface implementation
-func (m *CreatorEdit) MarshalBinary() ([]byte, error) {
- if m == nil {
- return nil, nil
- }
- return swag.WriteJSON(m)
-}
-
-// UnmarshalBinary interface implementation
-func (m *CreatorEdit) UnmarshalBinary(b []byte) error {
- var res CreatorEdit
- if err := swag.ReadJSON(b, &res); err != nil {
- return err
- }
- *m = res
- return nil
-}
diff --git a/golang/gen/models/creator_entity.go b/golang/gen/models/creator_entity.go
deleted file mode 100644
index 47ba34a6..00000000
--- a/golang/gen/models/creator_entity.go
+++ /dev/null
@@ -1,121 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package models
-
-// 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"
-
- strfmt "github.com/go-openapi/strfmt"
-
- "github.com/go-openapi/errors"
- "github.com/go-openapi/swag"
- "github.com/go-openapi/validate"
-)
-
-// CreatorEntity creator entity
-// swagger:model creator_entity
-type CreatorEntity struct {
-
- // ident
- Ident string `json:"ident,omitempty"`
-
- // name
- Name string `json:"name,omitempty"`
-
- // orcid
- Orcid string `json:"orcid,omitempty"`
-
- // redirect
- Redirect string `json:"redirect,omitempty"`
-
- // revision
- Revision int64 `json:"revision,omitempty"`
-
- // state
- // Enum: [wip active redirect deleted]
- State string `json:"state,omitempty"`
-}
-
-// Validate validates this creator entity
-func (m *CreatorEntity) Validate(formats strfmt.Registry) error {
- var res []error
-
- if err := m.validateState(formats); err != nil {
- res = append(res, err)
- }
-
- if len(res) > 0 {
- return errors.CompositeValidationError(res...)
- }
- return nil
-}
-
-var creatorEntityTypeStatePropEnum []interface{}
-
-func init() {
- var res []string
- if err := json.Unmarshal([]byte(`["wip","active","redirect","deleted"]`), &res); err != nil {
- panic(err)
- }
- for _, v := range res {
- creatorEntityTypeStatePropEnum = append(creatorEntityTypeStatePropEnum, v)
- }
-}
-
-const (
-
- // CreatorEntityStateWip captures enum value "wip"
- CreatorEntityStateWip string = "wip"
-
- // CreatorEntityStateActive captures enum value "active"
- CreatorEntityStateActive string = "active"
-
- // CreatorEntityStateRedirect captures enum value "redirect"
- CreatorEntityStateRedirect string = "redirect"
-
- // CreatorEntityStateDeleted captures enum value "deleted"
- CreatorEntityStateDeleted string = "deleted"
-)
-
-// prop value enum
-func (m *CreatorEntity) validateStateEnum(path, location string, value string) error {
- if err := validate.Enum(path, location, value, creatorEntityTypeStatePropEnum); err != nil {
- return err
- }
- return nil
-}
-
-func (m *CreatorEntity) validateState(formats strfmt.Registry) error {
-
- if swag.IsZero(m.State) { // not required
- return nil
- }
-
- // value enum
- if err := m.validateStateEnum("state", "body", m.State); err != nil {
- return err
- }
-
- return nil
-}
-
-// MarshalBinary interface implementation
-func (m *CreatorEntity) MarshalBinary() ([]byte, error) {
- if m == nil {
- return nil, nil
- }
- return swag.WriteJSON(m)
-}
-
-// UnmarshalBinary interface implementation
-func (m *CreatorEntity) UnmarshalBinary(b []byte) error {
- var res CreatorEntity
- if err := swag.ReadJSON(b, &res); err != nil {
- return err
- }
- *m = res
- return nil
-}
diff --git a/golang/gen/models/editgroup.go b/golang/gen/models/editgroup.go
deleted file mode 100644
index 67be219c..00000000
--- a/golang/gen/models/editgroup.go
+++ /dev/null
@@ -1,81 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package models
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the swagger generate command
-
-import (
- strfmt "github.com/go-openapi/strfmt"
-
- "github.com/go-openapi/errors"
- "github.com/go-openapi/swag"
- "github.com/go-openapi/validate"
-)
-
-// Editgroup editgroup
-// swagger:model editgroup
-type Editgroup struct {
-
- // editor id
- // Required: true
- EditorID *int64 `json:"editor_id"`
-
- // id
- // Required: true
- ID *int64 `json:"id"`
-}
-
-// Validate validates this editgroup
-func (m *Editgroup) Validate(formats strfmt.Registry) error {
- var res []error
-
- if err := m.validateEditorID(formats); err != nil {
- res = append(res, err)
- }
-
- if err := m.validateID(formats); err != nil {
- res = append(res, err)
- }
-
- if len(res) > 0 {
- return errors.CompositeValidationError(res...)
- }
- return nil
-}
-
-func (m *Editgroup) validateEditorID(formats strfmt.Registry) error {
-
- if err := validate.Required("editor_id", "body", m.EditorID); err != nil {
- return err
- }
-
- return nil
-}
-
-func (m *Editgroup) validateID(formats strfmt.Registry) error {
-
- if err := validate.Required("id", "body", m.ID); err != nil {
- return err
- }
-
- return nil
-}
-
-// MarshalBinary interface implementation
-func (m *Editgroup) MarshalBinary() ([]byte, error) {
- if m == nil {
- return nil, nil
- }
- return swag.WriteJSON(m)
-}
-
-// UnmarshalBinary interface implementation
-func (m *Editgroup) UnmarshalBinary(b []byte) error {
- var res Editgroup
- if err := swag.ReadJSON(b, &res); err != nil {
- return err
- }
- *m = res
- return nil
-}
diff --git a/golang/gen/models/editor.go b/golang/gen/models/editor.go
deleted file mode 100644
index 865de3ff..00000000
--- a/golang/gen/models/editor.go
+++ /dev/null
@@ -1,64 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package models
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the swagger generate command
-
-import (
- strfmt "github.com/go-openapi/strfmt"
-
- "github.com/go-openapi/errors"
- "github.com/go-openapi/swag"
- "github.com/go-openapi/validate"
-)
-
-// Editor editor
-// swagger:model editor
-type Editor struct {
-
- // username
- // Required: true
- Username *string `json:"username"`
-}
-
-// Validate validates this editor
-func (m *Editor) Validate(formats strfmt.Registry) error {
- var res []error
-
- if err := m.validateUsername(formats); err != nil {
- res = append(res, err)
- }
-
- if len(res) > 0 {
- return errors.CompositeValidationError(res...)
- }
- return nil
-}
-
-func (m *Editor) validateUsername(formats strfmt.Registry) error {
-
- if err := validate.Required("username", "body", m.Username); err != nil {
- return err
- }
-
- return nil
-}
-
-// MarshalBinary interface implementation
-func (m *Editor) MarshalBinary() ([]byte, error) {
- if m == nil {
- return nil, nil
- }
- return swag.WriteJSON(m)
-}
-
-// UnmarshalBinary interface implementation
-func (m *Editor) UnmarshalBinary(b []byte) error {
- var res Editor
- if err := swag.ReadJSON(b, &res); err != nil {
- return err
- }
- *m = res
- return nil
-}
diff --git a/golang/gen/models/entity_edit.go b/golang/gen/models/entity_edit.go
deleted file mode 100644
index a9b9ae9f..00000000
--- a/golang/gen/models/entity_edit.go
+++ /dev/null
@@ -1,52 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package models
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the swagger generate command
-
-import (
- strfmt "github.com/go-openapi/strfmt"
-
- "github.com/go-openapi/swag"
-)
-
-// EntityEdit entity edit
-// swagger:model entity_edit
-type EntityEdit struct {
-
- // editgroup id
- EditgroupID int64 `json:"editgroup_id,omitempty"`
-
- // id
- ID int64 `json:"id,omitempty"`
-
- // ident
- Ident string `json:"ident,omitempty"`
-
- // revision
- Revision int64 `json:"revision,omitempty"`
-}
-
-// Validate validates this entity edit
-func (m *EntityEdit) Validate(formats strfmt.Registry) error {
- return nil
-}
-
-// MarshalBinary interface implementation
-func (m *EntityEdit) MarshalBinary() ([]byte, error) {
- if m == nil {
- return nil, nil
- }
- return swag.WriteJSON(m)
-}
-
-// UnmarshalBinary interface implementation
-func (m *EntityEdit) UnmarshalBinary(b []byte) error {
- var res EntityEdit
- if err := swag.ReadJSON(b, &res); err != nil {
- return err
- }
- *m = res
- return nil
-}
diff --git a/golang/gen/models/error.go b/golang/gen/models/error.go
deleted file mode 100644
index d8c11da2..00000000
--- a/golang/gen/models/error.go
+++ /dev/null
@@ -1,64 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package models
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the swagger generate command
-
-import (
- strfmt "github.com/go-openapi/strfmt"
-
- "github.com/go-openapi/errors"
- "github.com/go-openapi/swag"
- "github.com/go-openapi/validate"
-)
-
-// Error error
-// swagger:model error
-type Error struct {
-
- // message
- // Required: true
- Message *string `json:"message"`
-}
-
-// Validate validates this error
-func (m *Error) Validate(formats strfmt.Registry) error {
- var res []error
-
- if err := m.validateMessage(formats); err != nil {
- res = append(res, err)
- }
-
- if len(res) > 0 {
- return errors.CompositeValidationError(res...)
- }
- return nil
-}
-
-func (m *Error) validateMessage(formats strfmt.Registry) error {
-
- if err := validate.Required("message", "body", m.Message); err != nil {
- return err
- }
-
- return nil
-}
-
-// MarshalBinary interface implementation
-func (m *Error) MarshalBinary() ([]byte, error) {
- if m == nil {
- return nil, nil
- }
- return swag.WriteJSON(m)
-}
-
-// UnmarshalBinary interface implementation
-func (m *Error) UnmarshalBinary(b []byte) error {
- var res Error
- if err := swag.ReadJSON(b, &res); err != nil {
- return err
- }
- *m = res
- return nil
-}
diff --git a/golang/gen/models/release_entity.go b/golang/gen/models/release_entity.go
deleted file mode 100644
index fa6a345c..00000000
--- a/golang/gen/models/release_entity.go
+++ /dev/null
@@ -1,136 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package models
-
-// 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"
-
- strfmt "github.com/go-openapi/strfmt"
-
- "github.com/go-openapi/errors"
- "github.com/go-openapi/swag"
- "github.com/go-openapi/validate"
-)
-
-// ReleaseEntity release entity
-// swagger:model release_entity
-type ReleaseEntity struct {
-
- // ident
- // Required: true
- Ident *string `json:"ident"`
-
- // name
- Name string `json:"name,omitempty"`
-
- // orcid
- Orcid string `json:"orcid,omitempty"`
-
- // redirect
- Redirect string `json:"redirect,omitempty"`
-
- // revision
- Revision int64 `json:"revision,omitempty"`
-
- // state
- // Required: true
- // Enum: [wip active redirect deleted]
- State *string `json:"state"`
-}
-
-// Validate validates this release entity
-func (m *ReleaseEntity) Validate(formats strfmt.Registry) error {
- var res []error
-
- if err := m.validateIdent(formats); err != nil {
- res = append(res, err)
- }
-
- if err := m.validateState(formats); err != nil {
- res = append(res, err)
- }
-
- if len(res) > 0 {
- return errors.CompositeValidationError(res...)
- }
- return nil
-}
-
-func (m *ReleaseEntity) validateIdent(formats strfmt.Registry) error {
-
- if err := validate.Required("ident", "body", m.Ident); err != nil {
- return err
- }
-
- return nil
-}
-
-var releaseEntityTypeStatePropEnum []interface{}
-
-func init() {
- var res []string
- if err := json.Unmarshal([]byte(`["wip","active","redirect","deleted"]`), &res); err != nil {
- panic(err)
- }
- for _, v := range res {
- releaseEntityTypeStatePropEnum = append(releaseEntityTypeStatePropEnum, v)
- }
-}
-
-const (
-
- // ReleaseEntityStateWip captures enum value "wip"
- ReleaseEntityStateWip string = "wip"
-
- // ReleaseEntityStateActive captures enum value "active"
- ReleaseEntityStateActive string = "active"
-
- // ReleaseEntityStateRedirect captures enum value "redirect"
- ReleaseEntityStateRedirect string = "redirect"
-
- // ReleaseEntityStateDeleted captures enum value "deleted"
- ReleaseEntityStateDeleted string = "deleted"
-)
-
-// prop value enum
-func (m *ReleaseEntity) validateStateEnum(path, location string, value string) error {
- if err := validate.Enum(path, location, value, releaseEntityTypeStatePropEnum); err != nil {
- return err
- }
- return nil
-}
-
-func (m *ReleaseEntity) validateState(formats strfmt.Registry) error {
-
- if err := validate.Required("state", "body", m.State); err != nil {
- return err
- }
-
- // value enum
- if err := m.validateStateEnum("state", "body", *m.State); err != nil {
- return err
- }
-
- return nil
-}
-
-// MarshalBinary interface implementation
-func (m *ReleaseEntity) MarshalBinary() ([]byte, error) {
- if m == nil {
- return nil, nil
- }
- return swag.WriteJSON(m)
-}
-
-// UnmarshalBinary interface implementation
-func (m *ReleaseEntity) UnmarshalBinary(b []byte) error {
- var res ReleaseEntity
- if err := swag.ReadJSON(b, &res); err != nil {
- return err
- }
- *m = res
- return nil
-}
diff --git a/golang/gen/models/success.go b/golang/gen/models/success.go
deleted file mode 100644
index 47aac304..00000000
--- a/golang/gen/models/success.go
+++ /dev/null
@@ -1,64 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package models
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the swagger generate command
-
-import (
- strfmt "github.com/go-openapi/strfmt"
-
- "github.com/go-openapi/errors"
- "github.com/go-openapi/swag"
- "github.com/go-openapi/validate"
-)
-
-// Success success
-// swagger:model success
-type Success struct {
-
- // message
- // Required: true
- Message *string `json:"message"`
-}
-
-// Validate validates this success
-func (m *Success) Validate(formats strfmt.Registry) error {
- var res []error
-
- if err := m.validateMessage(formats); err != nil {
- res = append(res, err)
- }
-
- if len(res) > 0 {
- return errors.CompositeValidationError(res...)
- }
- return nil
-}
-
-func (m *Success) validateMessage(formats strfmt.Registry) error {
-
- if err := validate.Required("message", "body", m.Message); err != nil {
- return err
- }
-
- return nil
-}
-
-// MarshalBinary interface implementation
-func (m *Success) MarshalBinary() ([]byte, error) {
- if m == nil {
- return nil, nil
- }
- return swag.WriteJSON(m)
-}
-
-// UnmarshalBinary interface implementation
-func (m *Success) UnmarshalBinary(b []byte) error {
- var res Success
- if err := swag.ReadJSON(b, &res); err != nil {
- return err
- }
- *m = res
- return nil
-}
diff --git a/golang/gen/restapi/configure_fatcat.go b/golang/gen/restapi/configure_fatcat.go
deleted file mode 100644
index e101a019..00000000
--- a/golang/gen/restapi/configure_fatcat.go
+++ /dev/null
@@ -1,89 +0,0 @@
-// This file is safe to edit. Once it exists it will not be overwritten
-
-package restapi
-
-import (
- "crypto/tls"
- "net/http"
-
- errors "github.com/go-openapi/errors"
- runtime "github.com/go-openapi/runtime"
- middleware "github.com/go-openapi/runtime/middleware"
- graceful "github.com/tylerb/graceful"
-
- "git.archive.org/bnewbold/fatcat/golang/gen/restapi/operations"
-)
-
-//go:generate swagger generate server --target ../gen --name fatcat --spec ../fatcat-openapi2.json --exclude-main
-
-func configureFlags(api *operations.FatcatAPI) {
- // api.CommandLineOptionsGroups = []swag.CommandLineOptionsGroup{ ... }
-}
-
-func configureAPI(api *operations.FatcatAPI) http.Handler {
- // configure the api here
- api.ServeError = errors.ServeError
-
- // Set your custom logger if needed. Default one is log.Printf
- // Expected interface func(string, ...interface{})
- //
- // Example:
- // api.Logger = log.Printf
-
- api.JSONConsumer = runtime.JSONConsumer()
-
- api.JSONProducer = runtime.JSONProducer()
-
- api.GetCreatorIDHandler = operations.GetCreatorIDHandlerFunc(func(params operations.GetCreatorIDParams) middleware.Responder {
- return middleware.NotImplemented("operation .GetCreatorID has not yet been implemented")
- })
- api.GetCreatorLookupHandler = operations.GetCreatorLookupHandlerFunc(func(params operations.GetCreatorLookupParams) middleware.Responder {
- return middleware.NotImplemented("operation .GetCreatorLookup has not yet been implemented")
- })
- api.GetEditgroupIDHandler = operations.GetEditgroupIDHandlerFunc(func(params operations.GetEditgroupIDParams) middleware.Responder {
- return middleware.NotImplemented("operation .GetEditgroupID has not yet been implemented")
- })
- api.GetEditorUsernameHandler = operations.GetEditorUsernameHandlerFunc(func(params operations.GetEditorUsernameParams) middleware.Responder {
- return middleware.NotImplemented("operation .GetEditorUsername has not yet been implemented")
- })
- api.GetEditorUsernameChangelogHandler = operations.GetEditorUsernameChangelogHandlerFunc(func(params operations.GetEditorUsernameChangelogParams) middleware.Responder {
- return middleware.NotImplemented("operation .GetEditorUsernameChangelog has not yet been implemented")
- })
- api.PostCreatorHandler = operations.PostCreatorHandlerFunc(func(params operations.PostCreatorParams) middleware.Responder {
- return middleware.NotImplemented("operation .PostCreator has not yet been implemented")
- })
- api.PostEditgroupHandler = operations.PostEditgroupHandlerFunc(func(params operations.PostEditgroupParams) middleware.Responder {
- return middleware.NotImplemented("operation .PostEditgroup has not yet been implemented")
- })
- api.PostEditgroupIDAcceptHandler = operations.PostEditgroupIDAcceptHandlerFunc(func(params operations.PostEditgroupIDAcceptParams) middleware.Responder {
- return middleware.NotImplemented("operation .PostEditgroupIDAccept has not yet been implemented")
- })
-
- api.ServerShutdown = func() {}
-
- return setupGlobalMiddleware(api.Serve(setupMiddlewares))
-}
-
-// The TLS configuration before HTTPS server starts.
-func configureTLS(tlsConfig *tls.Config) {
- // Make all necessary changes to the TLS configuration here.
-}
-
-// As soon as server is initialized but not run yet, this function will be called.
-// If you need to modify a config, store server instance to stop it individually later, this is the place.
-// This function can be called multiple times, depending on the number of serving schemes.
-// scheme value will be set accordingly: "http", "https" or "unix"
-func configureServer(s *graceful.Server, scheme, addr string) {
-}
-
-// The middleware configuration is for the handler executors. These do not apply to the swagger.json document.
-// The middleware executes after routing but before authentication, binding and validation
-func setupMiddlewares(handler http.Handler) http.Handler {
- return handler
-}
-
-// The middleware configuration happens before anything, this middleware also applies to serving the swagger.json document.
-// So this is a good place to plug in a panic handling middleware, logging and metrics
-func setupGlobalMiddleware(handler http.Handler) http.Handler {
- return handler
-}
diff --git a/golang/gen/restapi/doc.go b/golang/gen/restapi/doc.go
deleted file mode 100644
index e18461a8..00000000
--- a/golang/gen/restapi/doc.go
+++ /dev/null
@@ -1,22 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-/*
-Package restapi fatcat
-A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata
-
-
- Schemes:
- http
- Host: api.fatcat.wiki
- BasePath: /v0
- Version: 0.1.0
-
- Consumes:
- - application/json
-
- Produces:
- - application/json
-
-swagger:meta
-*/
-package restapi
diff --git a/golang/gen/restapi/embedded_spec.go b/golang/gen/restapi/embedded_spec.go
deleted file mode 100644
index cec33018..00000000
--- a/golang/gen/restapi/embedded_spec.go
+++ /dev/null
@@ -1,934 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package restapi
-
-// 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"
-)
-
-var (
- // SwaggerJSON embedded version of the swagger document used at generation time
- SwaggerJSON json.RawMessage
- // FlatSwaggerJSON embedded flattened version of the swagger document used at generation time
- FlatSwaggerJSON json.RawMessage
-)
-
-func init() {
- SwaggerJSON = json.RawMessage([]byte(`{
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "schemes": [
- "http"
- ],
- "swagger": "2.0",
- "info": {
- "description": "A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata",
- "title": "fatcat",
- "version": "0.1.0"
- },
- "host": "api.fatcat.wiki",
- "basePath": "/v0",
- "paths": {
- "/creator": {
- "post": {
- "parameters": [
- {
- "name": "body",
- "in": "body",
- "schema": {
- "$ref": "#/definitions/creator_entity"
- }
- }
- ],
- "responses": {
- "201": {
- "description": "created",
- "schema": {
- "$ref": "#/definitions/entity_edit"
- }
- },
- "400": {
- "description": "bad request",
- "schema": {
- "$ref": "#/definitions/error"
- }
- },
- "default": {
- "description": "generic error response",
- "schema": {
- "$ref": "#/definitions/error"
- }
- }
- }
- }
- },
- "/creator/lookup": {
- "get": {
- "parameters": [
- {
- "type": "string",
- "name": "orcid",
- "in": "query",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "find a single creator by external identifer",
- "schema": {
- "$ref": "#/definitions/creator_entity"
- }
- },
- "404": {
- "description": "no such creator",
- "schema": {
- "$ref": "#/definitions/error"
- }
- },
- "default": {
- "description": "generic error response",
- "schema": {
- "$ref": "#/definitions/error"
- }
- }
- }
- }
- },
- "/creator/{id}": {
- "get": {
- "responses": {
- "200": {
- "description": "fetch a single creator by id",
- "schema": {
- "$ref": "#/definitions/creator_entity"
- }
- },
- "404": {
- "description": "no such creator",
- "schema": {
- "$ref": "#/definitions/error"
- }
- },
- "default": {
- "description": "generic error response",
- "schema": {
- "$ref": "#/definitions/error"
- }
- }
- }
- },
- "parameters": [
- {
- "type": "string",
- "name": "id",
- "in": "path",
- "required": true
- }
- ]
- },
- "/editgroup": {
- "post": {
- "responses": {
- "201": {
- "description": "successfully created",
- "schema": {
- "$ref": "#/definitions/editgroup"
- }
- },
- "400": {
- "description": "invalid request parameters",
- "schema": {
- "$ref": "#/definitions/error"
- }
- },
- "default": {
- "description": "generic error response",
- "schema": {
- "$ref": "#/definitions/error"
- }
- }
- }
- }
- },
- "/editgroup/{id}": {
- "get": {
- "responses": {
- "200": {
- "description": "fetch editgroup by identifier",
- "schema": {
- "$ref": "#/definitions/editgroup"
- }
- },
- "404": {
- "description": "no such editgroup",
- "schema": {
- "$ref": "#/definitions/error"
- }
- },
- "default": {
- "description": "generic error response",
- "schema": {
- "$ref": "#/definitions/error"
- }
- }
- }
- },
- "parameters": [
- {
- "type": "integer",
- "name": "id",
- "in": "path",
- "required": true
- }
- ]
- },
- "/editgroup/{id}/accept": {
- "post": {
- "responses": {
- "200": {
- "description": "merged editgroup successfully (\"live\")",
- "schema": {
- "$ref": "#/definitions/success"
- }
- },
- "400": {
- "description": "editgroup is in an unmergable state",
- "schema": {
- "$ref": "#/definitions/error"
- }
- },
- "404": {
- "description": "no such editgroup",
- "schema": {
- "$ref": "#/definitions/error"
- }
- },
- "default": {
- "description": "generic error response",
- "schema": {
- "$ref": "#/definitions/error"
- }
- }
- }
- },
- "parameters": [
- {
- "type": "integer",
- "name": "id",
- "in": "path",
- "required": true
- }
- ]
- },
- "/editor/{username}": {
- "get": {
- "responses": {
- "200": {
- "description": "fetch generic information about an editor",
- "schema": {
- "$ref": "#/definitions/editor"
- }
- },
- "404": {
- "description": "username not found",
- "schema": {
- "$ref": "#/definitions/error"
- }
- },
- "default": {
- "description": "generic error response",
- "schema": {
- "$ref": "#/definitions/error"
- }
- }
- }
- },
- "parameters": [
- {
- "type": "string",
- "name": "username",
- "in": "path",
- "required": true
- }
- ]
- },
- "/editor/{username}/changelog": {
- "get": {
- "responses": {
- "200": {
- "description": "find changes (editgroups) by this editor which have been merged",
- "schema": {
- "$ref": "#/definitions/changelogentry"
- }
- },
- "404": {
- "description": "username not found",
- "schema": {
- "$ref": "#/definitions/error"
- }
- },
- "default": {
- "description": "generic error response",
- "schema": {
- "$ref": "#/definitions/error"
- }
- }
- }
- },
- "parameters": [
- {
- "type": "string",
- "name": "username",
- "in": "path",
- "required": true
- }
- ]
- }
- },
- "definitions": {
- "changelogentry": {
- "type": "object",
- "required": [
- "index"
- ],
- "properties": {
- "editgroup_id": {
- "type": "integer"
- },
- "index": {
- "type": "integer"
- },
- "timestamp": {
- "type": "string",
- "format": "date-time"
- }
- }
- },
- "creator_entity": {
- "type": "object",
- "properties": {
- "ident": {
- "type": "string"
- },
- "name": {
- "type": "string"
- },
- "orcid": {
- "type": "string"
- },
- "redirect": {
- "type": "string"
- },
- "revision": {
- "type": "integer"
- },
- "state": {
- "type": "string",
- "enum": [
- "wip",
- "active",
- "redirect",
- "deleted"
- ]
- }
- }
- },
- "editgroup": {
- "type": "object",
- "required": [
- "id",
- "editor_id"
- ],
- "properties": {
- "editor_id": {
- "type": "integer"
- },
- "id": {
- "type": "integer"
- }
- }
- },
- "editor": {
- "type": "object",
- "required": [
- "username"
- ],
- "properties": {
- "username": {
- "type": "string"
- }
- }
- },
- "entity_edit": {
- "type": "object",
- "properties": {
- "editgroup_id": {
- "type": "integer"
- },
- "id": {
- "type": "integer"
- },
- "ident": {
- "type": "string"
- },
- "revision": {
- "type": "integer"
- }
- }
- },
- "error": {
- "type": "object",
- "required": [
- "message"
- ],
- "properties": {
- "message": {
- "type": "string"
- }
- }
- },
- "release_entity": {
- "type": "object",
- "required": [
- "ident",
- "state"
- ],
- "properties": {
- "ident": {
- "type": "string"
- },
- "name": {
- "type": "string"
- },
- "orcid": {
- "type": "string"
- },
- "redirect": {
- "type": "string"
- },
- "revision": {
- "type": "integer"
- },
- "state": {
- "type": "string",
- "enum": [
- "wip",
- "active",
- "redirect",
- "deleted"
- ]
- }
- }
- },
- "success": {
- "type": "object",
- "required": [
- "message"
- ],
- "properties": {
- "message": {
- "type": "string"
- }
- }
- }
- },
- "x-entity-edit-props": {
- "editgroup_id": {
- "type": "integer"
- },
- "id": {
- "type": "integer"
- },
- "ident": {
- "type": "string"
- },
- "revision": {
- "type": "integer"
- }
- },
- "x-entity-props": {
- "ident": {
- "type": "string"
- },
- "redirect": {
- "type": "string"
- },
- "revision": {
- "type": "integer"
- },
- "state": {
- "enum": [
- "wip",
- "active",
- "redirect",
- "deleted"
- ],
- "type": "string"
- }
- }
-}`))
- FlatSwaggerJSON = json.RawMessage([]byte(`{
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "schemes": [
- "http"
- ],
- "swagger": "2.0",
- "info": {
- "description": "A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata",
- "title": "fatcat",
- "version": "0.1.0"
- },
- "host": "api.fatcat.wiki",
- "basePath": "/v0",
- "paths": {
- "/creator": {
- "post": {
- "parameters": [
- {
- "name": "body",
- "in": "body",
- "schema": {
- "$ref": "#/definitions/creator_entity"
- }
- }
- ],
- "responses": {
- "201": {
- "description": "created",
- "schema": {
- "$ref": "#/definitions/entity_edit"
- }
- },
- "400": {
- "description": "bad request",
- "schema": {
- "$ref": "#/definitions/error"
- }
- },
- "default": {
- "description": "generic error response",
- "schema": {
- "$ref": "#/definitions/error"
- }
- }
- }
- }
- },
- "/creator/lookup": {
- "get": {
- "parameters": [
- {
- "type": "string",
- "name": "orcid",
- "in": "query",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "find a single creator by external identifer",
- "schema": {
- "$ref": "#/definitions/creator_entity"
- }
- },
- "404": {
- "description": "no such creator",
- "schema": {
- "$ref": "#/definitions/error"
- }
- },
- "default": {
- "description": "generic error response",
- "schema": {
- "$ref": "#/definitions/error"
- }
- }
- }
- }
- },
- "/creator/{id}": {
- "get": {
- "responses": {
- "200": {
- "description": "fetch a single creator by id",
- "schema": {
- "$ref": "#/definitions/creator_entity"
- }
- },
- "404": {
- "description": "no such creator",
- "schema": {
- "$ref": "#/definitions/error"
- }
- },
- "default": {
- "description": "generic error response",
- "schema": {
- "$ref": "#/definitions/error"
- }
- }
- }
- },
- "parameters": [
- {
- "type": "string",
- "name": "id",
- "in": "path",
- "required": true
- }
- ]
- },
- "/editgroup": {
- "post": {
- "responses": {
- "201": {
- "description": "successfully created",
- "schema": {
- "$ref": "#/definitions/editgroup"
- }
- },
- "400": {
- "description": "invalid request parameters",
- "schema": {
- "$ref": "#/definitions/error"
- }
- },
- "default": {
- "description": "generic error response",
- "schema": {
- "$ref": "#/definitions/error"
- }
- }
- }
- }
- },
- "/editgroup/{id}": {
- "get": {
- "responses": {
- "200": {
- "description": "fetch editgroup by identifier",
- "schema": {
- "$ref": "#/definitions/editgroup"
- }
- },
- "404": {
- "description": "no such editgroup",
- "schema": {
- "$ref": "#/definitions/error"
- }
- },
- "default": {
- "description": "generic error response",
- "schema": {
- "$ref": "#/definitions/error"
- }
- }
- }
- },
- "parameters": [
- {
- "type": "integer",
- "name": "id",
- "in": "path",
- "required": true
- }
- ]
- },
- "/editgroup/{id}/accept": {
- "post": {
- "responses": {
- "200": {
- "description": "merged editgroup successfully (\"live\")",
- "schema": {
- "$ref": "#/definitions/success"
- }
- },
- "400": {
- "description": "editgroup is in an unmergable state",
- "schema": {
- "$ref": "#/definitions/error"
- }
- },
- "404": {
- "description": "no such editgroup",
- "schema": {
- "$ref": "#/definitions/error"
- }
- },
- "default": {
- "description": "generic error response",
- "schema": {
- "$ref": "#/definitions/error"
- }
- }
- }
- },
- "parameters": [
- {
- "type": "integer",
- "name": "id",
- "in": "path",
- "required": true
- }
- ]
- },
- "/editor/{username}": {
- "get": {
- "responses": {
- "200": {
- "description": "fetch generic information about an editor",
- "schema": {
- "$ref": "#/definitions/editor"
- }
- },
- "404": {
- "description": "username not found",
- "schema": {
- "$ref": "#/definitions/error"
- }
- },
- "default": {
- "description": "generic error response",
- "schema": {
- "$ref": "#/definitions/error"
- }
- }
- }
- },
- "parameters": [
- {
- "type": "string",
- "name": "username",
- "in": "path",
- "required": true
- }
- ]
- },
- "/editor/{username}/changelog": {
- "get": {
- "responses": {
- "200": {
- "description": "find changes (editgroups) by this editor which have been merged",
- "schema": {
- "$ref": "#/definitions/changelogentry"
- }
- },
- "404": {
- "description": "username not found",
- "schema": {
- "$ref": "#/definitions/error"
- }
- },
- "default": {
- "description": "generic error response",
- "schema": {
- "$ref": "#/definitions/error"
- }
- }
- }
- },
- "parameters": [
- {
- "type": "string",
- "name": "username",
- "in": "path",
- "required": true
- }
- ]
- }
- },
- "definitions": {
- "changelogentry": {
- "type": "object",
- "required": [
- "index"
- ],
- "properties": {
- "editgroup_id": {
- "type": "integer"
- },
- "index": {
- "type": "integer"
- },
- "timestamp": {
- "type": "string",
- "format": "date-time"
- }
- }
- },
- "creator_entity": {
- "type": "object",
- "properties": {
- "ident": {
- "type": "string"
- },
- "name": {
- "type": "string"
- },
- "orcid": {
- "type": "string"
- },
- "redirect": {
- "type": "string"
- },
- "revision": {
- "type": "integer"
- },
- "state": {
- "type": "string",
- "enum": [
- "wip",
- "active",
- "redirect",
- "deleted"
- ]
- }
- }
- },
- "editgroup": {
- "type": "object",
- "required": [
- "id",
- "editor_id"
- ],
- "properties": {
- "editor_id": {
- "type": "integer"
- },
- "id": {
- "type": "integer"
- }
- }
- },
- "editor": {
- "type": "object",
- "required": [
- "username"
- ],
- "properties": {
- "username": {
- "type": "string"
- }
- }
- },
- "entity_edit": {
- "type": "object",
- "properties": {
- "editgroup_id": {
- "type": "integer"
- },
- "id": {
- "type": "integer"
- },
- "ident": {
- "type": "string"
- },
- "revision": {
- "type": "integer"
- }
- }
- },
- "error": {
- "type": "object",
- "required": [
- "message"
- ],
- "properties": {
- "message": {
- "type": "string"
- }
- }
- },
- "release_entity": {
- "type": "object",
- "required": [
- "ident",
- "state"
- ],
- "properties": {
- "ident": {
- "type": "string"
- },
- "name": {
- "type": "string"
- },
- "orcid": {
- "type": "string"
- },
- "redirect": {
- "type": "string"
- },
- "revision": {
- "type": "integer"
- },
- "state": {
- "type": "string",
- "enum": [
- "wip",
- "active",
- "redirect",
- "deleted"
- ]
- }
- }
- },
- "success": {
- "type": "object",
- "required": [
- "message"
- ],
- "properties": {
- "message": {
- "type": "string"
- }
- }
- }
- },
- "x-entity-edit-props": {
- "editgroup_id": {
- "type": "integer"
- },
- "id": {
- "type": "integer"
- },
- "ident": {
- "type": "string"
- },
- "revision": {
- "type": "integer"
- }
- },
- "x-entity-props": {
- "ident": {
- "type": "string"
- },
- "redirect": {
- "type": "string"
- },
- "revision": {
- "type": "integer"
- },
- "state": {
- "enum": [
- "wip",
- "active",
- "redirect",
- "deleted"
- ],
- "type": "string"
- }
- }
-}`))
-}
diff --git a/golang/gen/restapi/operations/fatcat_api.go b/golang/gen/restapi/operations/fatcat_api.go
deleted file mode 100644
index 1b6b465d..00000000
--- a/golang/gen/restapi/operations/fatcat_api.go
+++ /dev/null
@@ -1,372 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package operations
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the swagger generate command
-
-import (
- "fmt"
- "net/http"
- "strings"
-
- errors "github.com/go-openapi/errors"
- loads "github.com/go-openapi/loads"
- runtime "github.com/go-openapi/runtime"
- middleware "github.com/go-openapi/runtime/middleware"
- security "github.com/go-openapi/runtime/security"
- spec "github.com/go-openapi/spec"
- strfmt "github.com/go-openapi/strfmt"
- "github.com/go-openapi/swag"
-)
-
-// NewFatcatAPI creates a new Fatcat instance
-func NewFatcatAPI(spec *loads.Document) *FatcatAPI {
- return &FatcatAPI{
- handlers: make(map[string]map[string]http.Handler),
- formats: strfmt.Default,
- defaultConsumes: "application/json",
- defaultProduces: "application/json",
- customConsumers: make(map[string]runtime.Consumer),
- customProducers: make(map[string]runtime.Producer),
- ServerShutdown: func() {},
- spec: spec,
- ServeError: errors.ServeError,
- BasicAuthenticator: security.BasicAuth,
- APIKeyAuthenticator: security.APIKeyAuth,
- BearerAuthenticator: security.BearerAuth,
- JSONConsumer: runtime.JSONConsumer(),
- JSONProducer: runtime.JSONProducer(),
- GetCreatorIDHandler: GetCreatorIDHandlerFunc(func(params GetCreatorIDParams) middleware.Responder {
- return middleware.NotImplemented("operation GetCreatorID has not yet been implemented")
- }),
- GetCreatorLookupHandler: GetCreatorLookupHandlerFunc(func(params GetCreatorLookupParams) middleware.Responder {
- return middleware.NotImplemented("operation GetCreatorLookup has not yet been implemented")
- }),
- GetEditgroupIDHandler: GetEditgroupIDHandlerFunc(func(params GetEditgroupIDParams) middleware.Responder {
- return middleware.NotImplemented("operation GetEditgroupID has not yet been implemented")
- }),
- GetEditorUsernameHandler: GetEditorUsernameHandlerFunc(func(params GetEditorUsernameParams) middleware.Responder {
- return middleware.NotImplemented("operation GetEditorUsername has not yet been implemented")
- }),
- GetEditorUsernameChangelogHandler: GetEditorUsernameChangelogHandlerFunc(func(params GetEditorUsernameChangelogParams) middleware.Responder {
- return middleware.NotImplemented("operation GetEditorUsernameChangelog has not yet been implemented")
- }),
- PostCreatorHandler: PostCreatorHandlerFunc(func(params PostCreatorParams) middleware.Responder {
- return middleware.NotImplemented("operation PostCreator has not yet been implemented")
- }),
- PostEditgroupHandler: PostEditgroupHandlerFunc(func(params PostEditgroupParams) middleware.Responder {
- return middleware.NotImplemented("operation PostEditgroup has not yet been implemented")
- }),
- PostEditgroupIDAcceptHandler: PostEditgroupIDAcceptHandlerFunc(func(params PostEditgroupIDAcceptParams) middleware.Responder {
- return middleware.NotImplemented("operation PostEditgroupIDAccept has not yet been implemented")
- }),
- }
-}
-
-/*FatcatAPI A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata */
-type FatcatAPI struct {
- spec *loads.Document
- context *middleware.Context
- handlers map[string]map[string]http.Handler
- formats strfmt.Registry
- customConsumers map[string]runtime.Consumer
- customProducers map[string]runtime.Producer
- defaultConsumes string
- defaultProduces string
- Middleware func(middleware.Builder) http.Handler
-
- // BasicAuthenticator generates a runtime.Authenticator from the supplied basic auth function.
- // It has a default implemention in the security package, however you can replace it for your particular usage.
- BasicAuthenticator func(security.UserPassAuthentication) runtime.Authenticator
- // APIKeyAuthenticator generates a runtime.Authenticator from the supplied token auth function.
- // It has a default implemention in the security package, however you can replace it for your particular usage.
- APIKeyAuthenticator func(string, string, security.TokenAuthentication) runtime.Authenticator
- // BearerAuthenticator generates a runtime.Authenticator from the supplied bearer token auth function.
- // It has a default implemention in the security package, however you can replace it for your particular usage.
- BearerAuthenticator func(string, security.ScopedTokenAuthentication) runtime.Authenticator
-
- // JSONConsumer registers a consumer for a "application/json" mime type
- JSONConsumer runtime.Consumer
-
- // JSONProducer registers a producer for a "application/json" mime type
- JSONProducer runtime.Producer
-
- // GetCreatorIDHandler sets the operation handler for the get creator ID operation
- GetCreatorIDHandler GetCreatorIDHandler
- // GetCreatorLookupHandler sets the operation handler for the get creator lookup operation
- GetCreatorLookupHandler GetCreatorLookupHandler
- // GetEditgroupIDHandler sets the operation handler for the get editgroup ID operation
- GetEditgroupIDHandler GetEditgroupIDHandler
- // GetEditorUsernameHandler sets the operation handler for the get editor username operation
- GetEditorUsernameHandler GetEditorUsernameHandler
- // GetEditorUsernameChangelogHandler sets the operation handler for the get editor username changelog operation
- GetEditorUsernameChangelogHandler GetEditorUsernameChangelogHandler
- // PostCreatorHandler sets the operation handler for the post creator operation
- PostCreatorHandler PostCreatorHandler
- // PostEditgroupHandler sets the operation handler for the post editgroup operation
- PostEditgroupHandler PostEditgroupHandler
- // PostEditgroupIDAcceptHandler sets the operation handler for the post editgroup ID accept operation
- PostEditgroupIDAcceptHandler PostEditgroupIDAcceptHandler
-
- // ServeError is called when an error is received, there is a default handler
- // but you can set your own with this
- ServeError func(http.ResponseWriter, *http.Request, error)
-
- // ServerShutdown is called when the HTTP(S) server is shut down and done
- // handling all active connections and does not accept connections any more
- ServerShutdown func()
-
- // Custom command line argument groups with their descriptions
- CommandLineOptionsGroups []swag.CommandLineOptionsGroup
-
- // User defined logger function.
- Logger func(string, ...interface{})
-}
-
-// SetDefaultProduces sets the default produces media type
-func (o *FatcatAPI) SetDefaultProduces(mediaType string) {
- o.defaultProduces = mediaType
-}
-
-// SetDefaultConsumes returns the default consumes media type
-func (o *FatcatAPI) SetDefaultConsumes(mediaType string) {
- o.defaultConsumes = mediaType
-}
-
-// SetSpec sets a spec that will be served for the clients.
-func (o *FatcatAPI) SetSpec(spec *loads.Document) {
- o.spec = spec
-}
-
-// DefaultProduces returns the default produces media type
-func (o *FatcatAPI) DefaultProduces() string {
- return o.defaultProduces
-}
-
-// DefaultConsumes returns the default consumes media type
-func (o *FatcatAPI) DefaultConsumes() string {
- return o.defaultConsumes
-}
-
-// Formats returns the registered string formats
-func (o *FatcatAPI) Formats() strfmt.Registry {
- return o.formats
-}
-
-// RegisterFormat registers a custom format validator
-func (o *FatcatAPI) RegisterFormat(name string, format strfmt.Format, validator strfmt.Validator) {
- o.formats.Add(name, format, validator)
-}
-
-// Validate validates the registrations in the FatcatAPI
-func (o *FatcatAPI) Validate() error {
- var unregistered []string
-
- if o.JSONConsumer == nil {
- unregistered = append(unregistered, "JSONConsumer")
- }
-
- if o.JSONProducer == nil {
- unregistered = append(unregistered, "JSONProducer")
- }
-
- if o.GetCreatorIDHandler == nil {
- unregistered = append(unregistered, "GetCreatorIDHandler")
- }
-
- if o.GetCreatorLookupHandler == nil {
- unregistered = append(unregistered, "GetCreatorLookupHandler")
- }
-
- if o.GetEditgroupIDHandler == nil {
- unregistered = append(unregistered, "GetEditgroupIDHandler")
- }
-
- if o.GetEditorUsernameHandler == nil {
- unregistered = append(unregistered, "GetEditorUsernameHandler")
- }
-
- if o.GetEditorUsernameChangelogHandler == nil {
- unregistered = append(unregistered, "GetEditorUsernameChangelogHandler")
- }
-
- if o.PostCreatorHandler == nil {
- unregistered = append(unregistered, "PostCreatorHandler")
- }
-
- if o.PostEditgroupHandler == nil {
- unregistered = append(unregistered, "PostEditgroupHandler")
- }
-
- if o.PostEditgroupIDAcceptHandler == nil {
- unregistered = append(unregistered, "PostEditgroupIDAcceptHandler")
- }
-
- if len(unregistered) > 0 {
- return fmt.Errorf("missing registration: %s", strings.Join(unregistered, ", "))
- }
-
- return nil
-}
-
-// ServeErrorFor gets a error handler for a given operation id
-func (o *FatcatAPI) ServeErrorFor(operationID string) func(http.ResponseWriter, *http.Request, error) {
- return o.ServeError
-}
-
-// AuthenticatorsFor gets the authenticators for the specified security schemes
-func (o *FatcatAPI) AuthenticatorsFor(schemes map[string]spec.SecurityScheme) map[string]runtime.Authenticator {
-
- return nil
-
-}
-
-// Authorizer returns the registered authorizer
-func (o *FatcatAPI) Authorizer() runtime.Authorizer {
-
- return nil
-
-}
-
-// ConsumersFor gets the consumers for the specified media types
-func (o *FatcatAPI) ConsumersFor(mediaTypes []string) map[string]runtime.Consumer {
-
- result := make(map[string]runtime.Consumer)
- for _, mt := range mediaTypes {
- switch mt {
-
- case "application/json":
- result["application/json"] = o.JSONConsumer
-
- }
-
- if c, ok := o.customConsumers[mt]; ok {
- result[mt] = c
- }
- }
- return result
-
-}
-
-// ProducersFor gets the producers for the specified media types
-func (o *FatcatAPI) ProducersFor(mediaTypes []string) map[string]runtime.Producer {
-
- result := make(map[string]runtime.Producer)
- for _, mt := range mediaTypes {
- switch mt {
-
- case "application/json":
- result["application/json"] = o.JSONProducer
-
- }
-
- if p, ok := o.customProducers[mt]; ok {
- result[mt] = p
- }
- }
- return result
-
-}
-
-// HandlerFor gets a http.Handler for the provided operation method and path
-func (o *FatcatAPI) HandlerFor(method, path string) (http.Handler, bool) {
- if o.handlers == nil {
- return nil, false
- }
- um := strings.ToUpper(method)
- if _, ok := o.handlers[um]; !ok {
- return nil, false
- }
- if path == "/" {
- path = ""
- }
- h, ok := o.handlers[um][path]
- return h, ok
-}
-
-// Context returns the middleware context for the fatcat API
-func (o *FatcatAPI) Context() *middleware.Context {
- if o.context == nil {
- o.context = middleware.NewRoutableContext(o.spec, o, nil)
- }
-
- return o.context
-}
-
-func (o *FatcatAPI) initHandlerCache() {
- o.Context() // don't care about the result, just that the initialization happened
-
- if o.handlers == nil {
- o.handlers = make(map[string]map[string]http.Handler)
- }
-
- if o.handlers["GET"] == nil {
- o.handlers["GET"] = make(map[string]http.Handler)
- }
- o.handlers["GET"]["/creator/{id}"] = NewGetCreatorID(o.context, o.GetCreatorIDHandler)
-
- if o.handlers["GET"] == nil {
- o.handlers["GET"] = make(map[string]http.Handler)
- }
- o.handlers["GET"]["/creator/lookup"] = NewGetCreatorLookup(o.context, o.GetCreatorLookupHandler)
-
- if o.handlers["GET"] == nil {
- o.handlers["GET"] = make(map[string]http.Handler)
- }
- o.handlers["GET"]["/editgroup/{id}"] = NewGetEditgroupID(o.context, o.GetEditgroupIDHandler)
-
- if o.handlers["GET"] == nil {
- o.handlers["GET"] = make(map[string]http.Handler)
- }
- o.handlers["GET"]["/editor/{username}"] = NewGetEditorUsername(o.context, o.GetEditorUsernameHandler)
-
- if o.handlers["GET"] == nil {
- o.handlers["GET"] = make(map[string]http.Handler)
- }
- o.handlers["GET"]["/editor/{username}/changelog"] = NewGetEditorUsernameChangelog(o.context, o.GetEditorUsernameChangelogHandler)
-
- if o.handlers["POST"] == nil {
- o.handlers["POST"] = make(map[string]http.Handler)
- }
- o.handlers["POST"]["/creator"] = NewPostCreator(o.context, o.PostCreatorHandler)
-
- if o.handlers["POST"] == nil {
- o.handlers["POST"] = make(map[string]http.Handler)
- }
- o.handlers["POST"]["/editgroup"] = NewPostEditgroup(o.context, o.PostEditgroupHandler)
-
- if o.handlers["POST"] == nil {
- o.handlers["POST"] = make(map[string]http.Handler)
- }
- o.handlers["POST"]["/editgroup/{id}/accept"] = NewPostEditgroupIDAccept(o.context, o.PostEditgroupIDAcceptHandler)
-
-}
-
-// Serve creates a http handler to serve the API over HTTP
-// can be used directly in http.ListenAndServe(":8000", api.Serve(nil))
-func (o *FatcatAPI) Serve(builder middleware.Builder) http.Handler {
- o.Init()
-
- if o.Middleware != nil {
- return o.Middleware(builder)
- }
- return o.context.APIHandler(builder)
-}
-
-// Init allows you to just initialize the handler cache, you can then recompose the middleware as you see fit
-func (o *FatcatAPI) Init() {
- if len(o.handlers) == 0 {
- o.initHandlerCache()
- }
-}
-
-// RegisterConsumer allows you to add (or override) a consumer for a media type.
-func (o *FatcatAPI) RegisterConsumer(mediaType string, consumer runtime.Consumer) {
- o.customConsumers[mediaType] = consumer
-}
-
-// RegisterProducer allows you to add (or override) a producer for a media type.
-func (o *FatcatAPI) RegisterProducer(mediaType string, producer runtime.Producer) {
- o.customProducers[mediaType] = producer
-}
diff --git a/golang/gen/restapi/operations/get_creator_id.go b/golang/gen/restapi/operations/get_creator_id.go
deleted file mode 100644
index 90185374..00000000
--- a/golang/gen/restapi/operations/get_creator_id.go
+++ /dev/null
@@ -1,58 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package operations
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the generate command
-
-import (
- "net/http"
-
- middleware "github.com/go-openapi/runtime/middleware"
-)
-
-// GetCreatorIDHandlerFunc turns a function with the right signature into a get creator ID handler
-type GetCreatorIDHandlerFunc func(GetCreatorIDParams) middleware.Responder
-
-// Handle executing the request and returning a response
-func (fn GetCreatorIDHandlerFunc) Handle(params GetCreatorIDParams) middleware.Responder {
- return fn(params)
-}
-
-// GetCreatorIDHandler interface for that can handle valid get creator ID params
-type GetCreatorIDHandler interface {
- Handle(GetCreatorIDParams) middleware.Responder
-}
-
-// NewGetCreatorID creates a new http.Handler for the get creator ID operation
-func NewGetCreatorID(ctx *middleware.Context, handler GetCreatorIDHandler) *GetCreatorID {
- return &GetCreatorID{Context: ctx, Handler: handler}
-}
-
-/*GetCreatorID swagger:route GET /creator/{id} getCreatorId
-
-GetCreatorID get creator ID API
-
-*/
-type GetCreatorID struct {
- Context *middleware.Context
- Handler GetCreatorIDHandler
-}
-
-func (o *GetCreatorID) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
- route, rCtx, _ := o.Context.RouteInfo(r)
- if rCtx != nil {
- r = rCtx
- }
- var Params = NewGetCreatorIDParams()
-
- if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
- o.Context.Respond(rw, r, route.Produces, route, err)
- return
- }
-
- res := o.Handler.Handle(Params) // actually handle the request
-
- o.Context.Respond(rw, r, route.Produces, route, res)
-
-}
diff --git a/golang/gen/restapi/operations/get_creator_id_parameters.go b/golang/gen/restapi/operations/get_creator_id_parameters.go
deleted file mode 100644
index f1e338b6..00000000
--- a/golang/gen/restapi/operations/get_creator_id_parameters.go
+++ /dev/null
@@ -1,72 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package operations
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the swagger generate command
-
-import (
- "net/http"
-
- "github.com/go-openapi/errors"
- "github.com/go-openapi/runtime/middleware"
-
- strfmt "github.com/go-openapi/strfmt"
-)
-
-// NewGetCreatorIDParams creates a new GetCreatorIDParams object
-// no default values defined in spec.
-func NewGetCreatorIDParams() GetCreatorIDParams {
-
- return GetCreatorIDParams{}
-}
-
-// GetCreatorIDParams contains all the bound params for the get creator ID operation
-// typically these are obtained from a http.Request
-//
-// swagger:parameters GetCreatorID
-type GetCreatorIDParams struct {
-
- // HTTP Request Object
- HTTPRequest *http.Request `json:"-"`
-
- /*
- Required: true
- In: path
- */
- ID string
-}
-
-// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
-// for simple values it will use straight method calls.
-//
-// To ensure default values, the struct must have been initialized with NewGetCreatorIDParams() beforehand.
-func (o *GetCreatorIDParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
- var res []error
-
- o.HTTPRequest = r
-
- rID, rhkID, _ := route.Params.GetOK("id")
- if err := o.bindID(rID, rhkID, route.Formats); err != nil {
- res = append(res, err)
- }
-
- if len(res) > 0 {
- return errors.CompositeValidationError(res...)
- }
- return nil
-}
-
-func (o *GetCreatorIDParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
- var raw string
- if len(rawData) > 0 {
- raw = rawData[len(rawData)-1]
- }
-
- // Required: true
- // Parameter is provided by construction from the route
-
- o.ID = raw
-
- return nil
-}
diff --git a/golang/gen/restapi/operations/get_creator_id_responses.go b/golang/gen/restapi/operations/get_creator_id_responses.go
deleted file mode 100644
index 58dcb687..00000000
--- a/golang/gen/restapi/operations/get_creator_id_responses.go
+++ /dev/null
@@ -1,160 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package operations
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the swagger generate command
-
-import (
- "net/http"
-
- "github.com/go-openapi/runtime"
-
- models "git.archive.org/bnewbold/fatcat/golang/gen/models"
-)
-
-// GetCreatorIDOKCode is the HTTP code returned for type GetCreatorIDOK
-const GetCreatorIDOKCode int = 200
-
-/*GetCreatorIDOK fetch a single creator by id
-
-swagger:response getCreatorIdOK
-*/
-type GetCreatorIDOK struct {
-
- /*
- In: Body
- */
- Payload *models.CreatorEntity `json:"body,omitempty"`
-}
-
-// NewGetCreatorIDOK creates GetCreatorIDOK with default headers values
-func NewGetCreatorIDOK() *GetCreatorIDOK {
-
- return &GetCreatorIDOK{}
-}
-
-// WithPayload adds the payload to the get creator Id o k response
-func (o *GetCreatorIDOK) WithPayload(payload *models.CreatorEntity) *GetCreatorIDOK {
- o.Payload = payload
- return o
-}
-
-// SetPayload sets the payload to the get creator Id o k response
-func (o *GetCreatorIDOK) SetPayload(payload *models.CreatorEntity) {
- o.Payload = payload
-}
-
-// WriteResponse to the client
-func (o *GetCreatorIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
-
- rw.WriteHeader(200)
- if o.Payload != nil {
- payload := o.Payload
- if err := producer.Produce(rw, payload); err != nil {
- panic(err) // let the recovery middleware deal with this
- }
- }
-}
-
-// GetCreatorIDNotFoundCode is the HTTP code returned for type GetCreatorIDNotFound
-const GetCreatorIDNotFoundCode int = 404
-
-/*GetCreatorIDNotFound no such creator
-
-swagger:response getCreatorIdNotFound
-*/
-type GetCreatorIDNotFound struct {
-
- /*
- In: Body
- */
- Payload *models.Error `json:"body,omitempty"`
-}
-
-// NewGetCreatorIDNotFound creates GetCreatorIDNotFound with default headers values
-func NewGetCreatorIDNotFound() *GetCreatorIDNotFound {
-
- return &GetCreatorIDNotFound{}
-}
-
-// WithPayload adds the payload to the get creator Id not found response
-func (o *GetCreatorIDNotFound) WithPayload(payload *models.Error) *GetCreatorIDNotFound {
- o.Payload = payload
- return o
-}
-
-// SetPayload sets the payload to the get creator Id not found response
-func (o *GetCreatorIDNotFound) SetPayload(payload *models.Error) {
- o.Payload = payload
-}
-
-// WriteResponse to the client
-func (o *GetCreatorIDNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
-
- rw.WriteHeader(404)
- if o.Payload != nil {
- payload := o.Payload
- if err := producer.Produce(rw, payload); err != nil {
- panic(err) // let the recovery middleware deal with this
- }
- }
-}
-
-/*GetCreatorIDDefault generic error response
-
-swagger:response getCreatorIdDefault
-*/
-type GetCreatorIDDefault struct {
- _statusCode int
-
- /*
- In: Body
- */
- Payload *models.Error `json:"body,omitempty"`
-}
-
-// NewGetCreatorIDDefault creates GetCreatorIDDefault with default headers values
-func NewGetCreatorIDDefault(code int) *GetCreatorIDDefault {
- if code <= 0 {
- code = 500
- }
-
- return &GetCreatorIDDefault{
- _statusCode: code,
- }
-}
-
-// WithStatusCode adds the status to the get creator ID default response
-func (o *GetCreatorIDDefault) WithStatusCode(code int) *GetCreatorIDDefault {
- o._statusCode = code
- return o
-}
-
-// SetStatusCode sets the status to the get creator ID default response
-func (o *GetCreatorIDDefault) SetStatusCode(code int) {
- o._statusCode = code
-}
-
-// WithPayload adds the payload to the get creator ID default response
-func (o *GetCreatorIDDefault) WithPayload(payload *models.Error) *GetCreatorIDDefault {
- o.Payload = payload
- return o
-}
-
-// SetPayload sets the payload to the get creator ID default response
-func (o *GetCreatorIDDefault) SetPayload(payload *models.Error) {
- o.Payload = payload
-}
-
-// WriteResponse to the client
-func (o *GetCreatorIDDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
-
- rw.WriteHeader(o._statusCode)
- if o.Payload != nil {
- payload := o.Payload
- if err := producer.Produce(rw, payload); err != nil {
- panic(err) // let the recovery middleware deal with this
- }
- }
-}
diff --git a/golang/gen/restapi/operations/get_creator_id_urlbuilder.go b/golang/gen/restapi/operations/get_creator_id_urlbuilder.go
deleted file mode 100644
index 8f23373f..00000000
--- a/golang/gen/restapi/operations/get_creator_id_urlbuilder.go
+++ /dev/null
@@ -1,99 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package operations
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the generate command
-
-import (
- "errors"
- "net/url"
- golangswaggerpaths "path"
- "strings"
-)
-
-// GetCreatorIDURL generates an URL for the get creator ID operation
-type GetCreatorIDURL struct {
- ID string
-
- _basePath string
- // avoid unkeyed usage
- _ struct{}
-}
-
-// WithBasePath sets the base path for this url builder, only required when it's different from the
-// base path specified in the swagger spec.
-// When the value of the base path is an empty string
-func (o *GetCreatorIDURL) WithBasePath(bp string) *GetCreatorIDURL {
- o.SetBasePath(bp)
- return o
-}
-
-// SetBasePath sets the base path for this url builder, only required when it's different from the
-// base path specified in the swagger spec.
-// When the value of the base path is an empty string
-func (o *GetCreatorIDURL) SetBasePath(bp string) {
- o._basePath = bp
-}
-
-// Build a url path and query string
-func (o *GetCreatorIDURL) Build() (*url.URL, error) {
- var result url.URL
-
- var _path = "/creator/{id}"
-
- id := o.ID
- if id != "" {
- _path = strings.Replace(_path, "{id}", id, -1)
- } else {
- return nil, errors.New("ID is required on GetCreatorIDURL")
- }
-
- _basePath := o._basePath
- if _basePath == "" {
- _basePath = "/v0"
- }
- result.Path = golangswaggerpaths.Join(_basePath, _path)
-
- return &result, nil
-}
-
-// Must is a helper function to panic when the url builder returns an error
-func (o *GetCreatorIDURL) Must(u *url.URL, err error) *url.URL {
- if err != nil {
- panic(err)
- }
- if u == nil {
- panic("url can't be nil")
- }
- return u
-}
-
-// String returns the string representation of the path with query string
-func (o *GetCreatorIDURL) String() string {
- return o.Must(o.Build()).String()
-}
-
-// BuildFull builds a full url with scheme, host, path and query string
-func (o *GetCreatorIDURL) BuildFull(scheme, host string) (*url.URL, error) {
- if scheme == "" {
- return nil, errors.New("scheme is required for a full url on GetCreatorIDURL")
- }
- if host == "" {
- return nil, errors.New("host is required for a full url on GetCreatorIDURL")
- }
-
- base, err := o.Build()
- if err != nil {
- return nil, err
- }
-
- base.Scheme = scheme
- base.Host = host
- return base, nil
-}
-
-// StringFull returns the string representation of a complete url
-func (o *GetCreatorIDURL) StringFull(scheme, host string) string {
- return o.Must(o.BuildFull(scheme, host)).String()
-}
diff --git a/golang/gen/restapi/operations/get_creator_lookup.go b/golang/gen/restapi/operations/get_creator_lookup.go
deleted file mode 100644
index 3e371ceb..00000000
--- a/golang/gen/restapi/operations/get_creator_lookup.go
+++ /dev/null
@@ -1,58 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package operations
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the generate command
-
-import (
- "net/http"
-
- middleware "github.com/go-openapi/runtime/middleware"
-)
-
-// GetCreatorLookupHandlerFunc turns a function with the right signature into a get creator lookup handler
-type GetCreatorLookupHandlerFunc func(GetCreatorLookupParams) middleware.Responder
-
-// Handle executing the request and returning a response
-func (fn GetCreatorLookupHandlerFunc) Handle(params GetCreatorLookupParams) middleware.Responder {
- return fn(params)
-}
-
-// GetCreatorLookupHandler interface for that can handle valid get creator lookup params
-type GetCreatorLookupHandler interface {
- Handle(GetCreatorLookupParams) middleware.Responder
-}
-
-// NewGetCreatorLookup creates a new http.Handler for the get creator lookup operation
-func NewGetCreatorLookup(ctx *middleware.Context, handler GetCreatorLookupHandler) *GetCreatorLookup {
- return &GetCreatorLookup{Context: ctx, Handler: handler}
-}
-
-/*GetCreatorLookup swagger:route GET /creator/lookup getCreatorLookup
-
-GetCreatorLookup get creator lookup API
-
-*/
-type GetCreatorLookup struct {
- Context *middleware.Context
- Handler GetCreatorLookupHandler
-}
-
-func (o *GetCreatorLookup) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
- route, rCtx, _ := o.Context.RouteInfo(r)
- if rCtx != nil {
- r = rCtx
- }
- var Params = NewGetCreatorLookupParams()
-
- if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
- o.Context.Respond(rw, r, route.Produces, route, err)
- return
- }
-
- res := o.Handler.Handle(Params) // actually handle the request
-
- o.Context.Respond(rw, r, route.Produces, route, res)
-
-}
diff --git a/golang/gen/restapi/operations/get_creator_lookup_parameters.go b/golang/gen/restapi/operations/get_creator_lookup_parameters.go
deleted file mode 100644
index 3b133cbf..00000000
--- a/golang/gen/restapi/operations/get_creator_lookup_parameters.go
+++ /dev/null
@@ -1,82 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package operations
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the swagger generate command
-
-import (
- "net/http"
-
- "github.com/go-openapi/errors"
- "github.com/go-openapi/runtime"
- "github.com/go-openapi/runtime/middleware"
- "github.com/go-openapi/validate"
-
- strfmt "github.com/go-openapi/strfmt"
-)
-
-// NewGetCreatorLookupParams creates a new GetCreatorLookupParams object
-// no default values defined in spec.
-func NewGetCreatorLookupParams() GetCreatorLookupParams {
-
- return GetCreatorLookupParams{}
-}
-
-// GetCreatorLookupParams contains all the bound params for the get creator lookup operation
-// typically these are obtained from a http.Request
-//
-// swagger:parameters GetCreatorLookup
-type GetCreatorLookupParams struct {
-
- // HTTP Request Object
- HTTPRequest *http.Request `json:"-"`
-
- /*
- Required: true
- In: query
- */
- Orcid string
-}
-
-// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
-// for simple values it will use straight method calls.
-//
-// To ensure default values, the struct must have been initialized with NewGetCreatorLookupParams() beforehand.
-func (o *GetCreatorLookupParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
- var res []error
-
- o.HTTPRequest = r
-
- qs := runtime.Values(r.URL.Query())
-
- qOrcid, qhkOrcid, _ := qs.GetOK("orcid")
- if err := o.bindOrcid(qOrcid, qhkOrcid, route.Formats); err != nil {
- res = append(res, err)
- }
-
- if len(res) > 0 {
- return errors.CompositeValidationError(res...)
- }
- return nil
-}
-
-func (o *GetCreatorLookupParams) bindOrcid(rawData []string, hasKey bool, formats strfmt.Registry) error {
- if !hasKey {
- return errors.Required("orcid", "query")
- }
- var raw string
- if len(rawData) > 0 {
- raw = rawData[len(rawData)-1]
- }
-
- // Required: true
- // AllowEmptyValue: false
- if err := validate.RequiredString("orcid", "query", raw); err != nil {
- return err
- }
-
- o.Orcid = raw
-
- return nil
-}
diff --git a/golang/gen/restapi/operations/get_creator_lookup_responses.go b/golang/gen/restapi/operations/get_creator_lookup_responses.go
deleted file mode 100644
index f4dc7f12..00000000
--- a/golang/gen/restapi/operations/get_creator_lookup_responses.go
+++ /dev/null
@@ -1,160 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package operations
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the swagger generate command
-
-import (
- "net/http"
-
- "github.com/go-openapi/runtime"
-
- models "git.archive.org/bnewbold/fatcat/golang/gen/models"
-)
-
-// GetCreatorLookupOKCode is the HTTP code returned for type GetCreatorLookupOK
-const GetCreatorLookupOKCode int = 200
-
-/*GetCreatorLookupOK find a single creator by external identifer
-
-swagger:response getCreatorLookupOK
-*/
-type GetCreatorLookupOK struct {
-
- /*
- In: Body
- */
- Payload *models.CreatorEntity `json:"body,omitempty"`
-}
-
-// NewGetCreatorLookupOK creates GetCreatorLookupOK with default headers values
-func NewGetCreatorLookupOK() *GetCreatorLookupOK {
-
- return &GetCreatorLookupOK{}
-}
-
-// WithPayload adds the payload to the get creator lookup o k response
-func (o *GetCreatorLookupOK) WithPayload(payload *models.CreatorEntity) *GetCreatorLookupOK {
- o.Payload = payload
- return o
-}
-
-// SetPayload sets the payload to the get creator lookup o k response
-func (o *GetCreatorLookupOK) SetPayload(payload *models.CreatorEntity) {
- o.Payload = payload
-}
-
-// WriteResponse to the client
-func (o *GetCreatorLookupOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
-
- rw.WriteHeader(200)
- if o.Payload != nil {
- payload := o.Payload
- if err := producer.Produce(rw, payload); err != nil {
- panic(err) // let the recovery middleware deal with this
- }
- }
-}
-
-// GetCreatorLookupNotFoundCode is the HTTP code returned for type GetCreatorLookupNotFound
-const GetCreatorLookupNotFoundCode int = 404
-
-/*GetCreatorLookupNotFound no such creator
-
-swagger:response getCreatorLookupNotFound
-*/
-type GetCreatorLookupNotFound struct {
-
- /*
- In: Body
- */
- Payload *models.Error `json:"body,omitempty"`
-}
-
-// NewGetCreatorLookupNotFound creates GetCreatorLookupNotFound with default headers values
-func NewGetCreatorLookupNotFound() *GetCreatorLookupNotFound {
-
- return &GetCreatorLookupNotFound{}
-}
-
-// WithPayload adds the payload to the get creator lookup not found response
-func (o *GetCreatorLookupNotFound) WithPayload(payload *models.Error) *GetCreatorLookupNotFound {
- o.Payload = payload
- return o
-}
-
-// SetPayload sets the payload to the get creator lookup not found response
-func (o *GetCreatorLookupNotFound) SetPayload(payload *models.Error) {
- o.Payload = payload
-}
-
-// WriteResponse to the client
-func (o *GetCreatorLookupNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
-
- rw.WriteHeader(404)
- if o.Payload != nil {
- payload := o.Payload
- if err := producer.Produce(rw, payload); err != nil {
- panic(err) // let the recovery middleware deal with this
- }
- }
-}
-
-/*GetCreatorLookupDefault generic error response
-
-swagger:response getCreatorLookupDefault
-*/
-type GetCreatorLookupDefault struct {
- _statusCode int
-
- /*
- In: Body
- */
- Payload *models.Error `json:"body,omitempty"`
-}
-
-// NewGetCreatorLookupDefault creates GetCreatorLookupDefault with default headers values
-func NewGetCreatorLookupDefault(code int) *GetCreatorLookupDefault {
- if code <= 0 {
- code = 500
- }
-
- return &GetCreatorLookupDefault{
- _statusCode: code,
- }
-}
-
-// WithStatusCode adds the status to the get creator lookup default response
-func (o *GetCreatorLookupDefault) WithStatusCode(code int) *GetCreatorLookupDefault {
- o._statusCode = code
- return o
-}
-
-// SetStatusCode sets the status to the get creator lookup default response
-func (o *GetCreatorLookupDefault) SetStatusCode(code int) {
- o._statusCode = code
-}
-
-// WithPayload adds the payload to the get creator lookup default response
-func (o *GetCreatorLookupDefault) WithPayload(payload *models.Error) *GetCreatorLookupDefault {
- o.Payload = payload
- return o
-}
-
-// SetPayload sets the payload to the get creator lookup default response
-func (o *GetCreatorLookupDefault) SetPayload(payload *models.Error) {
- o.Payload = payload
-}
-
-// WriteResponse to the client
-func (o *GetCreatorLookupDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
-
- rw.WriteHeader(o._statusCode)
- if o.Payload != nil {
- payload := o.Payload
- if err := producer.Produce(rw, payload); err != nil {
- panic(err) // let the recovery middleware deal with this
- }
- }
-}
diff --git a/golang/gen/restapi/operations/get_creator_lookup_urlbuilder.go b/golang/gen/restapi/operations/get_creator_lookup_urlbuilder.go
deleted file mode 100644
index 6f4782d5..00000000
--- a/golang/gen/restapi/operations/get_creator_lookup_urlbuilder.go
+++ /dev/null
@@ -1,100 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package operations
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the generate command
-
-import (
- "errors"
- "net/url"
- golangswaggerpaths "path"
-)
-
-// GetCreatorLookupURL generates an URL for the get creator lookup operation
-type GetCreatorLookupURL struct {
- Orcid string
-
- _basePath string
- // avoid unkeyed usage
- _ struct{}
-}
-
-// WithBasePath sets the base path for this url builder, only required when it's different from the
-// base path specified in the swagger spec.
-// When the value of the base path is an empty string
-func (o *GetCreatorLookupURL) WithBasePath(bp string) *GetCreatorLookupURL {
- o.SetBasePath(bp)
- return o
-}
-
-// SetBasePath sets the base path for this url builder, only required when it's different from the
-// base path specified in the swagger spec.
-// When the value of the base path is an empty string
-func (o *GetCreatorLookupURL) SetBasePath(bp string) {
- o._basePath = bp
-}
-
-// Build a url path and query string
-func (o *GetCreatorLookupURL) Build() (*url.URL, error) {
- var result url.URL
-
- var _path = "/creator/lookup"
-
- _basePath := o._basePath
- if _basePath == "" {
- _basePath = "/v0"
- }
- result.Path = golangswaggerpaths.Join(_basePath, _path)
-
- qs := make(url.Values)
-
- orcid := o.Orcid
- if orcid != "" {
- qs.Set("orcid", orcid)
- }
-
- result.RawQuery = qs.Encode()
-
- return &result, nil
-}
-
-// Must is a helper function to panic when the url builder returns an error
-func (o *GetCreatorLookupURL) Must(u *url.URL, err error) *url.URL {
- if err != nil {
- panic(err)
- }
- if u == nil {
- panic("url can't be nil")
- }
- return u
-}
-
-// String returns the string representation of the path with query string
-func (o *GetCreatorLookupURL) String() string {
- return o.Must(o.Build()).String()
-}
-
-// BuildFull builds a full url with scheme, host, path and query string
-func (o *GetCreatorLookupURL) BuildFull(scheme, host string) (*url.URL, error) {
- if scheme == "" {
- return nil, errors.New("scheme is required for a full url on GetCreatorLookupURL")
- }
- if host == "" {
- return nil, errors.New("host is required for a full url on GetCreatorLookupURL")
- }
-
- base, err := o.Build()
- if err != nil {
- return nil, err
- }
-
- base.Scheme = scheme
- base.Host = host
- return base, nil
-}
-
-// StringFull returns the string representation of a complete url
-func (o *GetCreatorLookupURL) StringFull(scheme, host string) string {
- return o.Must(o.BuildFull(scheme, host)).String()
-}
diff --git a/golang/gen/restapi/operations/get_editgroup_id.go b/golang/gen/restapi/operations/get_editgroup_id.go
deleted file mode 100644
index 451193ec..00000000
--- a/golang/gen/restapi/operations/get_editgroup_id.go
+++ /dev/null
@@ -1,58 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package operations
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the generate command
-
-import (
- "net/http"
-
- middleware "github.com/go-openapi/runtime/middleware"
-)
-
-// GetEditgroupIDHandlerFunc turns a function with the right signature into a get editgroup ID handler
-type GetEditgroupIDHandlerFunc func(GetEditgroupIDParams) middleware.Responder
-
-// Handle executing the request and returning a response
-func (fn GetEditgroupIDHandlerFunc) Handle(params GetEditgroupIDParams) middleware.Responder {
- return fn(params)
-}
-
-// GetEditgroupIDHandler interface for that can handle valid get editgroup ID params
-type GetEditgroupIDHandler interface {
- Handle(GetEditgroupIDParams) middleware.Responder
-}
-
-// NewGetEditgroupID creates a new http.Handler for the get editgroup ID operation
-func NewGetEditgroupID(ctx *middleware.Context, handler GetEditgroupIDHandler) *GetEditgroupID {
- return &GetEditgroupID{Context: ctx, Handler: handler}
-}
-
-/*GetEditgroupID swagger:route GET /editgroup/{id} getEditgroupId
-
-GetEditgroupID get editgroup ID API
-
-*/
-type GetEditgroupID struct {
- Context *middleware.Context
- Handler GetEditgroupIDHandler
-}
-
-func (o *GetEditgroupID) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
- route, rCtx, _ := o.Context.RouteInfo(r)
- if rCtx != nil {
- r = rCtx
- }
- var Params = NewGetEditgroupIDParams()
-
- if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
- o.Context.Respond(rw, r, route.Produces, route, err)
- return
- }
-
- res := o.Handler.Handle(Params) // actually handle the request
-
- o.Context.Respond(rw, r, route.Produces, route, res)
-
-}
diff --git a/golang/gen/restapi/operations/get_editgroup_id_parameters.go b/golang/gen/restapi/operations/get_editgroup_id_parameters.go
deleted file mode 100644
index 41903ebc..00000000
--- a/golang/gen/restapi/operations/get_editgroup_id_parameters.go
+++ /dev/null
@@ -1,77 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package operations
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the swagger generate command
-
-import (
- "net/http"
-
- "github.com/go-openapi/errors"
- "github.com/go-openapi/runtime/middleware"
- "github.com/go-openapi/swag"
-
- strfmt "github.com/go-openapi/strfmt"
-)
-
-// NewGetEditgroupIDParams creates a new GetEditgroupIDParams object
-// no default values defined in spec.
-func NewGetEditgroupIDParams() GetEditgroupIDParams {
-
- return GetEditgroupIDParams{}
-}
-
-// GetEditgroupIDParams contains all the bound params for the get editgroup ID operation
-// typically these are obtained from a http.Request
-//
-// swagger:parameters GetEditgroupID
-type GetEditgroupIDParams struct {
-
- // HTTP Request Object
- HTTPRequest *http.Request `json:"-"`
-
- /*
- Required: true
- In: path
- */
- ID int64
-}
-
-// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
-// for simple values it will use straight method calls.
-//
-// To ensure default values, the struct must have been initialized with NewGetEditgroupIDParams() beforehand.
-func (o *GetEditgroupIDParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
- var res []error
-
- o.HTTPRequest = r
-
- rID, rhkID, _ := route.Params.GetOK("id")
- if err := o.bindID(rID, rhkID, route.Formats); err != nil {
- res = append(res, err)
- }
-
- if len(res) > 0 {
- return errors.CompositeValidationError(res...)
- }
- return nil
-}
-
-func (o *GetEditgroupIDParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
- var raw string
- if len(rawData) > 0 {
- raw = rawData[len(rawData)-1]
- }
-
- // Required: true
- // Parameter is provided by construction from the route
-
- value, err := swag.ConvertInt64(raw)
- if err != nil {
- return errors.InvalidType("id", "path", "int64", raw)
- }
- o.ID = value
-
- return nil
-}
diff --git a/golang/gen/restapi/operations/get_editgroup_id_responses.go b/golang/gen/restapi/operations/get_editgroup_id_responses.go
deleted file mode 100644
index 313be0ca..00000000
--- a/golang/gen/restapi/operations/get_editgroup_id_responses.go
+++ /dev/null
@@ -1,160 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package operations
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the swagger generate command
-
-import (
- "net/http"
-
- "github.com/go-openapi/runtime"
-
- models "git.archive.org/bnewbold/fatcat/golang/gen/models"
-)
-
-// GetEditgroupIDOKCode is the HTTP code returned for type GetEditgroupIDOK
-const GetEditgroupIDOKCode int = 200
-
-/*GetEditgroupIDOK fetch editgroup by identifier
-
-swagger:response getEditgroupIdOK
-*/
-type GetEditgroupIDOK struct {
-
- /*
- In: Body
- */
- Payload *models.Editgroup `json:"body,omitempty"`
-}
-
-// NewGetEditgroupIDOK creates GetEditgroupIDOK with default headers values
-func NewGetEditgroupIDOK() *GetEditgroupIDOK {
-
- return &GetEditgroupIDOK{}
-}
-
-// WithPayload adds the payload to the get editgroup Id o k response
-func (o *GetEditgroupIDOK) WithPayload(payload *models.Editgroup) *GetEditgroupIDOK {
- o.Payload = payload
- return o
-}
-
-// SetPayload sets the payload to the get editgroup Id o k response
-func (o *GetEditgroupIDOK) SetPayload(payload *models.Editgroup) {
- o.Payload = payload
-}
-
-// WriteResponse to the client
-func (o *GetEditgroupIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
-
- rw.WriteHeader(200)
- if o.Payload != nil {
- payload := o.Payload
- if err := producer.Produce(rw, payload); err != nil {
- panic(err) // let the recovery middleware deal with this
- }
- }
-}
-
-// GetEditgroupIDNotFoundCode is the HTTP code returned for type GetEditgroupIDNotFound
-const GetEditgroupIDNotFoundCode int = 404
-
-/*GetEditgroupIDNotFound no such editgroup
-
-swagger:response getEditgroupIdNotFound
-*/
-type GetEditgroupIDNotFound struct {
-
- /*
- In: Body
- */
- Payload *models.Error `json:"body,omitempty"`
-}
-
-// NewGetEditgroupIDNotFound creates GetEditgroupIDNotFound with default headers values
-func NewGetEditgroupIDNotFound() *GetEditgroupIDNotFound {
-
- return &GetEditgroupIDNotFound{}
-}
-
-// WithPayload adds the payload to the get editgroup Id not found response
-func (o *GetEditgroupIDNotFound) WithPayload(payload *models.Error) *GetEditgroupIDNotFound {
- o.Payload = payload
- return o
-}
-
-// SetPayload sets the payload to the get editgroup Id not found response
-func (o *GetEditgroupIDNotFound) SetPayload(payload *models.Error) {
- o.Payload = payload
-}
-
-// WriteResponse to the client
-func (o *GetEditgroupIDNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
-
- rw.WriteHeader(404)
- if o.Payload != nil {
- payload := o.Payload
- if err := producer.Produce(rw, payload); err != nil {
- panic(err) // let the recovery middleware deal with this
- }
- }
-}
-
-/*GetEditgroupIDDefault generic error response
-
-swagger:response getEditgroupIdDefault
-*/
-type GetEditgroupIDDefault struct {
- _statusCode int
-
- /*
- In: Body
- */
- Payload *models.Error `json:"body,omitempty"`
-}
-
-// NewGetEditgroupIDDefault creates GetEditgroupIDDefault with default headers values
-func NewGetEditgroupIDDefault(code int) *GetEditgroupIDDefault {
- if code <= 0 {
- code = 500
- }
-
- return &GetEditgroupIDDefault{
- _statusCode: code,
- }
-}
-
-// WithStatusCode adds the status to the get editgroup ID default response
-func (o *GetEditgroupIDDefault) WithStatusCode(code int) *GetEditgroupIDDefault {
- o._statusCode = code
- return o
-}
-
-// SetStatusCode sets the status to the get editgroup ID default response
-func (o *GetEditgroupIDDefault) SetStatusCode(code int) {
- o._statusCode = code
-}
-
-// WithPayload adds the payload to the get editgroup ID default response
-func (o *GetEditgroupIDDefault) WithPayload(payload *models.Error) *GetEditgroupIDDefault {
- o.Payload = payload
- return o
-}
-
-// SetPayload sets the payload to the get editgroup ID default response
-func (o *GetEditgroupIDDefault) SetPayload(payload *models.Error) {
- o.Payload = payload
-}
-
-// WriteResponse to the client
-func (o *GetEditgroupIDDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
-
- rw.WriteHeader(o._statusCode)
- if o.Payload != nil {
- payload := o.Payload
- if err := producer.Produce(rw, payload); err != nil {
- panic(err) // let the recovery middleware deal with this
- }
- }
-}
diff --git a/golang/gen/restapi/operations/get_editgroup_id_urlbuilder.go b/golang/gen/restapi/operations/get_editgroup_id_urlbuilder.go
deleted file mode 100644
index 70484a35..00000000
--- a/golang/gen/restapi/operations/get_editgroup_id_urlbuilder.go
+++ /dev/null
@@ -1,101 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package operations
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the generate command
-
-import (
- "errors"
- "net/url"
- golangswaggerpaths "path"
- "strings"
-
- "github.com/go-openapi/swag"
-)
-
-// GetEditgroupIDURL generates an URL for the get editgroup ID operation
-type GetEditgroupIDURL struct {
- ID int64
-
- _basePath string
- // avoid unkeyed usage
- _ struct{}
-}
-
-// WithBasePath sets the base path for this url builder, only required when it's different from the
-// base path specified in the swagger spec.
-// When the value of the base path is an empty string
-func (o *GetEditgroupIDURL) WithBasePath(bp string) *GetEditgroupIDURL {
- o.SetBasePath(bp)
- return o
-}
-
-// SetBasePath sets the base path for this url builder, only required when it's different from the
-// base path specified in the swagger spec.
-// When the value of the base path is an empty string
-func (o *GetEditgroupIDURL) SetBasePath(bp string) {
- o._basePath = bp
-}
-
-// Build a url path and query string
-func (o *GetEditgroupIDURL) Build() (*url.URL, error) {
- var result url.URL
-
- var _path = "/editgroup/{id}"
-
- id := swag.FormatInt64(o.ID)
- if id != "" {
- _path = strings.Replace(_path, "{id}", id, -1)
- } else {
- return nil, errors.New("ID is required on GetEditgroupIDURL")
- }
-
- _basePath := o._basePath
- if _basePath == "" {
- _basePath = "/v0"
- }
- result.Path = golangswaggerpaths.Join(_basePath, _path)
-
- return &result, nil
-}
-
-// Must is a helper function to panic when the url builder returns an error
-func (o *GetEditgroupIDURL) Must(u *url.URL, err error) *url.URL {
- if err != nil {
- panic(err)
- }
- if u == nil {
- panic("url can't be nil")
- }
- return u
-}
-
-// String returns the string representation of the path with query string
-func (o *GetEditgroupIDURL) String() string {
- return o.Must(o.Build()).String()
-}
-
-// BuildFull builds a full url with scheme, host, path and query string
-func (o *GetEditgroupIDURL) BuildFull(scheme, host string) (*url.URL, error) {
- if scheme == "" {
- return nil, errors.New("scheme is required for a full url on GetEditgroupIDURL")
- }
- if host == "" {
- return nil, errors.New("host is required for a full url on GetEditgroupIDURL")
- }
-
- base, err := o.Build()
- if err != nil {
- return nil, err
- }
-
- base.Scheme = scheme
- base.Host = host
- return base, nil
-}
-
-// StringFull returns the string representation of a complete url
-func (o *GetEditgroupIDURL) StringFull(scheme, host string) string {
- return o.Must(o.BuildFull(scheme, host)).String()
-}
diff --git a/golang/gen/restapi/operations/get_editor_username.go b/golang/gen/restapi/operations/get_editor_username.go
deleted file mode 100644
index 3fd18839..00000000
--- a/golang/gen/restapi/operations/get_editor_username.go
+++ /dev/null
@@ -1,58 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package operations
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the generate command
-
-import (
- "net/http"
-
- middleware "github.com/go-openapi/runtime/middleware"
-)
-
-// GetEditorUsernameHandlerFunc turns a function with the right signature into a get editor username handler
-type GetEditorUsernameHandlerFunc func(GetEditorUsernameParams) middleware.Responder
-
-// Handle executing the request and returning a response
-func (fn GetEditorUsernameHandlerFunc) Handle(params GetEditorUsernameParams) middleware.Responder {
- return fn(params)
-}
-
-// GetEditorUsernameHandler interface for that can handle valid get editor username params
-type GetEditorUsernameHandler interface {
- Handle(GetEditorUsernameParams) middleware.Responder
-}
-
-// NewGetEditorUsername creates a new http.Handler for the get editor username operation
-func NewGetEditorUsername(ctx *middleware.Context, handler GetEditorUsernameHandler) *GetEditorUsername {
- return &GetEditorUsername{Context: ctx, Handler: handler}
-}
-
-/*GetEditorUsername swagger:route GET /editor/{username} getEditorUsername
-
-GetEditorUsername get editor username API
-
-*/
-type GetEditorUsername struct {
- Context *middleware.Context
- Handler GetEditorUsernameHandler
-}
-
-func (o *GetEditorUsername) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
- route, rCtx, _ := o.Context.RouteInfo(r)
- if rCtx != nil {
- r = rCtx
- }
- var Params = NewGetEditorUsernameParams()
-
- if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
- o.Context.Respond(rw, r, route.Produces, route, err)
- return
- }
-
- res := o.Handler.Handle(Params) // actually handle the request
-
- o.Context.Respond(rw, r, route.Produces, route, res)
-
-}
diff --git a/golang/gen/restapi/operations/get_editor_username_changelog.go b/golang/gen/restapi/operations/get_editor_username_changelog.go
deleted file mode 100644
index dbb8ddfc..00000000
--- a/golang/gen/restapi/operations/get_editor_username_changelog.go
+++ /dev/null
@@ -1,58 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package operations
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the generate command
-
-import (
- "net/http"
-
- middleware "github.com/go-openapi/runtime/middleware"
-)
-
-// GetEditorUsernameChangelogHandlerFunc turns a function with the right signature into a get editor username changelog handler
-type GetEditorUsernameChangelogHandlerFunc func(GetEditorUsernameChangelogParams) middleware.Responder
-
-// Handle executing the request and returning a response
-func (fn GetEditorUsernameChangelogHandlerFunc) Handle(params GetEditorUsernameChangelogParams) middleware.Responder {
- return fn(params)
-}
-
-// GetEditorUsernameChangelogHandler interface for that can handle valid get editor username changelog params
-type GetEditorUsernameChangelogHandler interface {
- Handle(GetEditorUsernameChangelogParams) middleware.Responder
-}
-
-// NewGetEditorUsernameChangelog creates a new http.Handler for the get editor username changelog operation
-func NewGetEditorUsernameChangelog(ctx *middleware.Context, handler GetEditorUsernameChangelogHandler) *GetEditorUsernameChangelog {
- return &GetEditorUsernameChangelog{Context: ctx, Handler: handler}
-}
-
-/*GetEditorUsernameChangelog swagger:route GET /editor/{username}/changelog getEditorUsernameChangelog
-
-GetEditorUsernameChangelog get editor username changelog API
-
-*/
-type GetEditorUsernameChangelog struct {
- Context *middleware.Context
- Handler GetEditorUsernameChangelogHandler
-}
-
-func (o *GetEditorUsernameChangelog) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
- route, rCtx, _ := o.Context.RouteInfo(r)
- if rCtx != nil {
- r = rCtx
- }
- var Params = NewGetEditorUsernameChangelogParams()
-
- if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
- o.Context.Respond(rw, r, route.Produces, route, err)
- return
- }
-
- res := o.Handler.Handle(Params) // actually handle the request
-
- o.Context.Respond(rw, r, route.Produces, route, res)
-
-}
diff --git a/golang/gen/restapi/operations/get_editor_username_changelog_parameters.go b/golang/gen/restapi/operations/get_editor_username_changelog_parameters.go
deleted file mode 100644
index d9958921..00000000
--- a/golang/gen/restapi/operations/get_editor_username_changelog_parameters.go
+++ /dev/null
@@ -1,72 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package operations
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the swagger generate command
-
-import (
- "net/http"
-
- "github.com/go-openapi/errors"
- "github.com/go-openapi/runtime/middleware"
-
- strfmt "github.com/go-openapi/strfmt"
-)
-
-// NewGetEditorUsernameChangelogParams creates a new GetEditorUsernameChangelogParams object
-// no default values defined in spec.
-func NewGetEditorUsernameChangelogParams() GetEditorUsernameChangelogParams {
-
- return GetEditorUsernameChangelogParams{}
-}
-
-// GetEditorUsernameChangelogParams contains all the bound params for the get editor username changelog operation
-// typically these are obtained from a http.Request
-//
-// swagger:parameters GetEditorUsernameChangelog
-type GetEditorUsernameChangelogParams struct {
-
- // HTTP Request Object
- HTTPRequest *http.Request `json:"-"`
-
- /*
- Required: true
- In: path
- */
- Username string
-}
-
-// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
-// for simple values it will use straight method calls.
-//
-// To ensure default values, the struct must have been initialized with NewGetEditorUsernameChangelogParams() beforehand.
-func (o *GetEditorUsernameChangelogParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
- var res []error
-
- o.HTTPRequest = r
-
- rUsername, rhkUsername, _ := route.Params.GetOK("username")
- if err := o.bindUsername(rUsername, rhkUsername, route.Formats); err != nil {
- res = append(res, err)
- }
-
- if len(res) > 0 {
- return errors.CompositeValidationError(res...)
- }
- return nil
-}
-
-func (o *GetEditorUsernameChangelogParams) bindUsername(rawData []string, hasKey bool, formats strfmt.Registry) error {
- var raw string
- if len(rawData) > 0 {
- raw = rawData[len(rawData)-1]
- }
-
- // Required: true
- // Parameter is provided by construction from the route
-
- o.Username = raw
-
- return nil
-}
diff --git a/golang/gen/restapi/operations/get_editor_username_changelog_responses.go b/golang/gen/restapi/operations/get_editor_username_changelog_responses.go
deleted file mode 100644
index 6e0fb3e1..00000000
--- a/golang/gen/restapi/operations/get_editor_username_changelog_responses.go
+++ /dev/null
@@ -1,160 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package operations
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the swagger generate command
-
-import (
- "net/http"
-
- "github.com/go-openapi/runtime"
-
- models "git.archive.org/bnewbold/fatcat/golang/gen/models"
-)
-
-// GetEditorUsernameChangelogOKCode is the HTTP code returned for type GetEditorUsernameChangelogOK
-const GetEditorUsernameChangelogOKCode int = 200
-
-/*GetEditorUsernameChangelogOK find changes (editgroups) by this editor which have been merged
-
-swagger:response getEditorUsernameChangelogOK
-*/
-type GetEditorUsernameChangelogOK struct {
-
- /*
- In: Body
- */
- Payload *models.Changelogentry `json:"body,omitempty"`
-}
-
-// NewGetEditorUsernameChangelogOK creates GetEditorUsernameChangelogOK with default headers values
-func NewGetEditorUsernameChangelogOK() *GetEditorUsernameChangelogOK {
-
- return &GetEditorUsernameChangelogOK{}
-}
-
-// WithPayload adds the payload to the get editor username changelog o k response
-func (o *GetEditorUsernameChangelogOK) WithPayload(payload *models.Changelogentry) *GetEditorUsernameChangelogOK {
- o.Payload = payload
- return o
-}
-
-// SetPayload sets the payload to the get editor username changelog o k response
-func (o *GetEditorUsernameChangelogOK) SetPayload(payload *models.Changelogentry) {
- o.Payload = payload
-}
-
-// WriteResponse to the client
-func (o *GetEditorUsernameChangelogOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
-
- rw.WriteHeader(200)
- if o.Payload != nil {
- payload := o.Payload
- if err := producer.Produce(rw, payload); err != nil {
- panic(err) // let the recovery middleware deal with this
- }
- }
-}
-
-// GetEditorUsernameChangelogNotFoundCode is the HTTP code returned for type GetEditorUsernameChangelogNotFound
-const GetEditorUsernameChangelogNotFoundCode int = 404
-
-/*GetEditorUsernameChangelogNotFound username not found
-
-swagger:response getEditorUsernameChangelogNotFound
-*/
-type GetEditorUsernameChangelogNotFound struct {
-
- /*
- In: Body
- */
- Payload *models.Error `json:"body,omitempty"`
-}
-
-// NewGetEditorUsernameChangelogNotFound creates GetEditorUsernameChangelogNotFound with default headers values
-func NewGetEditorUsernameChangelogNotFound() *GetEditorUsernameChangelogNotFound {
-
- return &GetEditorUsernameChangelogNotFound{}
-}
-
-// WithPayload adds the payload to the get editor username changelog not found response
-func (o *GetEditorUsernameChangelogNotFound) WithPayload(payload *models.Error) *GetEditorUsernameChangelogNotFound {
- o.Payload = payload
- return o
-}
-
-// SetPayload sets the payload to the get editor username changelog not found response
-func (o *GetEditorUsernameChangelogNotFound) SetPayload(payload *models.Error) {
- o.Payload = payload
-}
-
-// WriteResponse to the client
-func (o *GetEditorUsernameChangelogNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
-
- rw.WriteHeader(404)
- if o.Payload != nil {
- payload := o.Payload
- if err := producer.Produce(rw, payload); err != nil {
- panic(err) // let the recovery middleware deal with this
- }
- }
-}
-
-/*GetEditorUsernameChangelogDefault generic error response
-
-swagger:response getEditorUsernameChangelogDefault
-*/
-type GetEditorUsernameChangelogDefault struct {
- _statusCode int
-
- /*
- In: Body
- */
- Payload *models.Error `json:"body,omitempty"`
-}
-
-// NewGetEditorUsernameChangelogDefault creates GetEditorUsernameChangelogDefault with default headers values
-func NewGetEditorUsernameChangelogDefault(code int) *GetEditorUsernameChangelogDefault {
- if code <= 0 {
- code = 500
- }
-
- return &GetEditorUsernameChangelogDefault{
- _statusCode: code,
- }
-}
-
-// WithStatusCode adds the status to the get editor username changelog default response
-func (o *GetEditorUsernameChangelogDefault) WithStatusCode(code int) *GetEditorUsernameChangelogDefault {
- o._statusCode = code
- return o
-}
-
-// SetStatusCode sets the status to the get editor username changelog default response
-func (o *GetEditorUsernameChangelogDefault) SetStatusCode(code int) {
- o._statusCode = code
-}
-
-// WithPayload adds the payload to the get editor username changelog default response
-func (o *GetEditorUsernameChangelogDefault) WithPayload(payload *models.Error) *GetEditorUsernameChangelogDefault {
- o.Payload = payload
- return o
-}
-
-// SetPayload sets the payload to the get editor username changelog default response
-func (o *GetEditorUsernameChangelogDefault) SetPayload(payload *models.Error) {
- o.Payload = payload
-}
-
-// WriteResponse to the client
-func (o *GetEditorUsernameChangelogDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
-
- rw.WriteHeader(o._statusCode)
- if o.Payload != nil {
- payload := o.Payload
- if err := producer.Produce(rw, payload); err != nil {
- panic(err) // let the recovery middleware deal with this
- }
- }
-}
diff --git a/golang/gen/restapi/operations/get_editor_username_changelog_urlbuilder.go b/golang/gen/restapi/operations/get_editor_username_changelog_urlbuilder.go
deleted file mode 100644
index d77e7fdc..00000000
--- a/golang/gen/restapi/operations/get_editor_username_changelog_urlbuilder.go
+++ /dev/null
@@ -1,99 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package operations
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the generate command
-
-import (
- "errors"
- "net/url"
- golangswaggerpaths "path"
- "strings"
-)
-
-// GetEditorUsernameChangelogURL generates an URL for the get editor username changelog operation
-type GetEditorUsernameChangelogURL struct {
- Username string
-
- _basePath string
- // avoid unkeyed usage
- _ struct{}
-}
-
-// WithBasePath sets the base path for this url builder, only required when it's different from the
-// base path specified in the swagger spec.
-// When the value of the base path is an empty string
-func (o *GetEditorUsernameChangelogURL) WithBasePath(bp string) *GetEditorUsernameChangelogURL {
- o.SetBasePath(bp)
- return o
-}
-
-// SetBasePath sets the base path for this url builder, only required when it's different from the
-// base path specified in the swagger spec.
-// When the value of the base path is an empty string
-func (o *GetEditorUsernameChangelogURL) SetBasePath(bp string) {
- o._basePath = bp
-}
-
-// Build a url path and query string
-func (o *GetEditorUsernameChangelogURL) Build() (*url.URL, error) {
- var result url.URL
-
- var _path = "/editor/{username}/changelog"
-
- username := o.Username
- if username != "" {
- _path = strings.Replace(_path, "{username}", username, -1)
- } else {
- return nil, errors.New("Username is required on GetEditorUsernameChangelogURL")
- }
-
- _basePath := o._basePath
- if _basePath == "" {
- _basePath = "/v0"
- }
- result.Path = golangswaggerpaths.Join(_basePath, _path)
-
- return &result, nil
-}
-
-// Must is a helper function to panic when the url builder returns an error
-func (o *GetEditorUsernameChangelogURL) Must(u *url.URL, err error) *url.URL {
- if err != nil {
- panic(err)
- }
- if u == nil {
- panic("url can't be nil")
- }
- return u
-}
-
-// String returns the string representation of the path with query string
-func (o *GetEditorUsernameChangelogURL) String() string {
- return o.Must(o.Build()).String()
-}
-
-// BuildFull builds a full url with scheme, host, path and query string
-func (o *GetEditorUsernameChangelogURL) BuildFull(scheme, host string) (*url.URL, error) {
- if scheme == "" {
- return nil, errors.New("scheme is required for a full url on GetEditorUsernameChangelogURL")
- }
- if host == "" {
- return nil, errors.New("host is required for a full url on GetEditorUsernameChangelogURL")
- }
-
- base, err := o.Build()
- if err != nil {
- return nil, err
- }
-
- base.Scheme = scheme
- base.Host = host
- return base, nil
-}
-
-// StringFull returns the string representation of a complete url
-func (o *GetEditorUsernameChangelogURL) StringFull(scheme, host string) string {
- return o.Must(o.BuildFull(scheme, host)).String()
-}
diff --git a/golang/gen/restapi/operations/get_editor_username_parameters.go b/golang/gen/restapi/operations/get_editor_username_parameters.go
deleted file mode 100644
index c8f57ff7..00000000
--- a/golang/gen/restapi/operations/get_editor_username_parameters.go
+++ /dev/null
@@ -1,72 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package operations
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the swagger generate command
-
-import (
- "net/http"
-
- "github.com/go-openapi/errors"
- "github.com/go-openapi/runtime/middleware"
-
- strfmt "github.com/go-openapi/strfmt"
-)
-
-// NewGetEditorUsernameParams creates a new GetEditorUsernameParams object
-// no default values defined in spec.
-func NewGetEditorUsernameParams() GetEditorUsernameParams {
-
- return GetEditorUsernameParams{}
-}
-
-// GetEditorUsernameParams contains all the bound params for the get editor username operation
-// typically these are obtained from a http.Request
-//
-// swagger:parameters GetEditorUsername
-type GetEditorUsernameParams struct {
-
- // HTTP Request Object
- HTTPRequest *http.Request `json:"-"`
-
- /*
- Required: true
- In: path
- */
- Username string
-}
-
-// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
-// for simple values it will use straight method calls.
-//
-// To ensure default values, the struct must have been initialized with NewGetEditorUsernameParams() beforehand.
-func (o *GetEditorUsernameParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
- var res []error
-
- o.HTTPRequest = r
-
- rUsername, rhkUsername, _ := route.Params.GetOK("username")
- if err := o.bindUsername(rUsername, rhkUsername, route.Formats); err != nil {
- res = append(res, err)
- }
-
- if len(res) > 0 {
- return errors.CompositeValidationError(res...)
- }
- return nil
-}
-
-func (o *GetEditorUsernameParams) bindUsername(rawData []string, hasKey bool, formats strfmt.Registry) error {
- var raw string
- if len(rawData) > 0 {
- raw = rawData[len(rawData)-1]
- }
-
- // Required: true
- // Parameter is provided by construction from the route
-
- o.Username = raw
-
- return nil
-}
diff --git a/golang/gen/restapi/operations/get_editor_username_responses.go b/golang/gen/restapi/operations/get_editor_username_responses.go
deleted file mode 100644
index 44b06340..00000000
--- a/golang/gen/restapi/operations/get_editor_username_responses.go
+++ /dev/null
@@ -1,160 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package operations
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the swagger generate command
-
-import (
- "net/http"
-
- "github.com/go-openapi/runtime"
-
- models "git.archive.org/bnewbold/fatcat/golang/gen/models"
-)
-
-// GetEditorUsernameOKCode is the HTTP code returned for type GetEditorUsernameOK
-const GetEditorUsernameOKCode int = 200
-
-/*GetEditorUsernameOK fetch generic information about an editor
-
-swagger:response getEditorUsernameOK
-*/
-type GetEditorUsernameOK struct {
-
- /*
- In: Body
- */
- Payload *models.Editor `json:"body,omitempty"`
-}
-
-// NewGetEditorUsernameOK creates GetEditorUsernameOK with default headers values
-func NewGetEditorUsernameOK() *GetEditorUsernameOK {
-
- return &GetEditorUsernameOK{}
-}
-
-// WithPayload adds the payload to the get editor username o k response
-func (o *GetEditorUsernameOK) WithPayload(payload *models.Editor) *GetEditorUsernameOK {
- o.Payload = payload
- return o
-}
-
-// SetPayload sets the payload to the get editor username o k response
-func (o *GetEditorUsernameOK) SetPayload(payload *models.Editor) {
- o.Payload = payload
-}
-
-// WriteResponse to the client
-func (o *GetEditorUsernameOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
-
- rw.WriteHeader(200)
- if o.Payload != nil {
- payload := o.Payload
- if err := producer.Produce(rw, payload); err != nil {
- panic(err) // let the recovery middleware deal with this
- }
- }
-}
-
-// GetEditorUsernameNotFoundCode is the HTTP code returned for type GetEditorUsernameNotFound
-const GetEditorUsernameNotFoundCode int = 404
-
-/*GetEditorUsernameNotFound username not found
-
-swagger:response getEditorUsernameNotFound
-*/
-type GetEditorUsernameNotFound struct {
-
- /*
- In: Body
- */
- Payload *models.Error `json:"body,omitempty"`
-}
-
-// NewGetEditorUsernameNotFound creates GetEditorUsernameNotFound with default headers values
-func NewGetEditorUsernameNotFound() *GetEditorUsernameNotFound {
-
- return &GetEditorUsernameNotFound{}
-}
-
-// WithPayload adds the payload to the get editor username not found response
-func (o *GetEditorUsernameNotFound) WithPayload(payload *models.Error) *GetEditorUsernameNotFound {
- o.Payload = payload
- return o
-}
-
-// SetPayload sets the payload to the get editor username not found response
-func (o *GetEditorUsernameNotFound) SetPayload(payload *models.Error) {
- o.Payload = payload
-}
-
-// WriteResponse to the client
-func (o *GetEditorUsernameNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
-
- rw.WriteHeader(404)
- if o.Payload != nil {
- payload := o.Payload
- if err := producer.Produce(rw, payload); err != nil {
- panic(err) // let the recovery middleware deal with this
- }
- }
-}
-
-/*GetEditorUsernameDefault generic error response
-
-swagger:response getEditorUsernameDefault
-*/
-type GetEditorUsernameDefault struct {
- _statusCode int
-
- /*
- In: Body
- */
- Payload *models.Error `json:"body,omitempty"`
-}
-
-// NewGetEditorUsernameDefault creates GetEditorUsernameDefault with default headers values
-func NewGetEditorUsernameDefault(code int) *GetEditorUsernameDefault {
- if code <= 0 {
- code = 500
- }
-
- return &GetEditorUsernameDefault{
- _statusCode: code,
- }
-}
-
-// WithStatusCode adds the status to the get editor username default response
-func (o *GetEditorUsernameDefault) WithStatusCode(code int) *GetEditorUsernameDefault {
- o._statusCode = code
- return o
-}
-
-// SetStatusCode sets the status to the get editor username default response
-func (o *GetEditorUsernameDefault) SetStatusCode(code int) {
- o._statusCode = code
-}
-
-// WithPayload adds the payload to the get editor username default response
-func (o *GetEditorUsernameDefault) WithPayload(payload *models.Error) *GetEditorUsernameDefault {
- o.Payload = payload
- return o
-}
-
-// SetPayload sets the payload to the get editor username default response
-func (o *GetEditorUsernameDefault) SetPayload(payload *models.Error) {
- o.Payload = payload
-}
-
-// WriteResponse to the client
-func (o *GetEditorUsernameDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
-
- rw.WriteHeader(o._statusCode)
- if o.Payload != nil {
- payload := o.Payload
- if err := producer.Produce(rw, payload); err != nil {
- panic(err) // let the recovery middleware deal with this
- }
- }
-}
diff --git a/golang/gen/restapi/operations/get_editor_username_urlbuilder.go b/golang/gen/restapi/operations/get_editor_username_urlbuilder.go
deleted file mode 100644
index fa8597fb..00000000
--- a/golang/gen/restapi/operations/get_editor_username_urlbuilder.go
+++ /dev/null
@@ -1,99 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package operations
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the generate command
-
-import (
- "errors"
- "net/url"
- golangswaggerpaths "path"
- "strings"
-)
-
-// GetEditorUsernameURL generates an URL for the get editor username operation
-type GetEditorUsernameURL struct {
- Username string
-
- _basePath string
- // avoid unkeyed usage
- _ struct{}
-}
-
-// WithBasePath sets the base path for this url builder, only required when it's different from the
-// base path specified in the swagger spec.
-// When the value of the base path is an empty string
-func (o *GetEditorUsernameURL) WithBasePath(bp string) *GetEditorUsernameURL {
- o.SetBasePath(bp)
- return o
-}
-
-// SetBasePath sets the base path for this url builder, only required when it's different from the
-// base path specified in the swagger spec.
-// When the value of the base path is an empty string
-func (o *GetEditorUsernameURL) SetBasePath(bp string) {
- o._basePath = bp
-}
-
-// Build a url path and query string
-func (o *GetEditorUsernameURL) Build() (*url.URL, error) {
- var result url.URL
-
- var _path = "/editor/{username}"
-
- username := o.Username
- if username != "" {
- _path = strings.Replace(_path, "{username}", username, -1)
- } else {
- return nil, errors.New("Username is required on GetEditorUsernameURL")
- }
-
- _basePath := o._basePath
- if _basePath == "" {
- _basePath = "/v0"
- }
- result.Path = golangswaggerpaths.Join(_basePath, _path)
-
- return &result, nil
-}
-
-// Must is a helper function to panic when the url builder returns an error
-func (o *GetEditorUsernameURL) Must(u *url.URL, err error) *url.URL {
- if err != nil {
- panic(err)
- }
- if u == nil {
- panic("url can't be nil")
- }
- return u
-}
-
-// String returns the string representation of the path with query string
-func (o *GetEditorUsernameURL) String() string {
- return o.Must(o.Build()).String()
-}
-
-// BuildFull builds a full url with scheme, host, path and query string
-func (o *GetEditorUsernameURL) BuildFull(scheme, host string) (*url.URL, error) {
- if scheme == "" {
- return nil, errors.New("scheme is required for a full url on GetEditorUsernameURL")
- }
- if host == "" {
- return nil, errors.New("host is required for a full url on GetEditorUsernameURL")
- }
-
- base, err := o.Build()
- if err != nil {
- return nil, err
- }
-
- base.Scheme = scheme
- base.Host = host
- return base, nil
-}
-
-// StringFull returns the string representation of a complete url
-func (o *GetEditorUsernameURL) StringFull(scheme, host string) string {
- return o.Must(o.BuildFull(scheme, host)).String()
-}
diff --git a/golang/gen/restapi/operations/post_creator.go b/golang/gen/restapi/operations/post_creator.go
deleted file mode 100644
index b33694f1..00000000
--- a/golang/gen/restapi/operations/post_creator.go
+++ /dev/null
@@ -1,58 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package operations
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the generate command
-
-import (
- "net/http"
-
- middleware "github.com/go-openapi/runtime/middleware"
-)
-
-// PostCreatorHandlerFunc turns a function with the right signature into a post creator handler
-type PostCreatorHandlerFunc func(PostCreatorParams) middleware.Responder
-
-// Handle executing the request and returning a response
-func (fn PostCreatorHandlerFunc) Handle(params PostCreatorParams) middleware.Responder {
- return fn(params)
-}
-
-// PostCreatorHandler interface for that can handle valid post creator params
-type PostCreatorHandler interface {
- Handle(PostCreatorParams) middleware.Responder
-}
-
-// NewPostCreator creates a new http.Handler for the post creator operation
-func NewPostCreator(ctx *middleware.Context, handler PostCreatorHandler) *PostCreator {
- return &PostCreator{Context: ctx, Handler: handler}
-}
-
-/*PostCreator swagger:route POST /creator postCreator
-
-PostCreator post creator API
-
-*/
-type PostCreator struct {
- Context *middleware.Context
- Handler PostCreatorHandler
-}
-
-func (o *PostCreator) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
- route, rCtx, _ := o.Context.RouteInfo(r)
- if rCtx != nil {
- r = rCtx
- }
- var Params = NewPostCreatorParams()
-
- if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
- o.Context.Respond(rw, r, route.Produces, route, err)
- return
- }
-
- res := o.Handler.Handle(Params) // actually handle the request
-
- o.Context.Respond(rw, r, route.Produces, route, res)
-
-}
diff --git a/golang/gen/restapi/operations/post_creator_parameters.go b/golang/gen/restapi/operations/post_creator_parameters.go
deleted file mode 100644
index f35cf2d5..00000000
--- a/golang/gen/restapi/operations/post_creator_parameters.go
+++ /dev/null
@@ -1,70 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package operations
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the swagger generate command
-
-import (
- "net/http"
-
- "github.com/go-openapi/errors"
- "github.com/go-openapi/runtime"
- "github.com/go-openapi/runtime/middleware"
-
- models "git.archive.org/bnewbold/fatcat/golang/gen/models"
-)
-
-// NewPostCreatorParams creates a new PostCreatorParams object
-// no default values defined in spec.
-func NewPostCreatorParams() PostCreatorParams {
-
- return PostCreatorParams{}
-}
-
-// PostCreatorParams contains all the bound params for the post creator operation
-// typically these are obtained from a http.Request
-//
-// swagger:parameters PostCreator
-type PostCreatorParams struct {
-
- // HTTP Request Object
- HTTPRequest *http.Request `json:"-"`
-
- /*
- In: body
- */
- Body *models.CreatorEntity
-}
-
-// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
-// for simple values it will use straight method calls.
-//
-// To ensure default values, the struct must have been initialized with NewPostCreatorParams() beforehand.
-func (o *PostCreatorParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
- var res []error
-
- o.HTTPRequest = r
-
- if runtime.HasBody(r) {
- defer r.Body.Close()
- var body models.CreatorEntity
- if err := route.Consumer.Consume(r.Body, &body); err != nil {
- res = append(res, errors.NewParseError("body", "body", "", err))
- } else {
-
- // validate body object
- if err := body.Validate(route.Formats); err != nil {
- res = append(res, err)
- }
-
- if len(res) == 0 {
- o.Body = &body
- }
- }
- }
- if len(res) > 0 {
- return errors.CompositeValidationError(res...)
- }
- return nil
-}
diff --git a/golang/gen/restapi/operations/post_creator_responses.go b/golang/gen/restapi/operations/post_creator_responses.go
deleted file mode 100644
index ee95d2e4..00000000
--- a/golang/gen/restapi/operations/post_creator_responses.go
+++ /dev/null
@@ -1,160 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package operations
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the swagger generate command
-
-import (
- "net/http"
-
- "github.com/go-openapi/runtime"
-
- models "git.archive.org/bnewbold/fatcat/golang/gen/models"
-)
-
-// PostCreatorCreatedCode is the HTTP code returned for type PostCreatorCreated
-const PostCreatorCreatedCode int = 201
-
-/*PostCreatorCreated created
-
-swagger:response postCreatorCreated
-*/
-type PostCreatorCreated struct {
-
- /*
- In: Body
- */
- Payload *models.EntityEdit `json:"body,omitempty"`
-}
-
-// NewPostCreatorCreated creates PostCreatorCreated with default headers values
-func NewPostCreatorCreated() *PostCreatorCreated {
-
- return &PostCreatorCreated{}
-}
-
-// WithPayload adds the payload to the post creator created response
-func (o *PostCreatorCreated) WithPayload(payload *models.EntityEdit) *PostCreatorCreated {
- o.Payload = payload
- return o
-}
-
-// SetPayload sets the payload to the post creator created response
-func (o *PostCreatorCreated) SetPayload(payload *models.EntityEdit) {
- o.Payload = payload
-}
-
-// WriteResponse to the client
-func (o *PostCreatorCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
-
- rw.WriteHeader(201)
- if o.Payload != nil {
- payload := o.Payload
- if err := producer.Produce(rw, payload); err != nil {
- panic(err) // let the recovery middleware deal with this
- }
- }
-}
-
-// PostCreatorBadRequestCode is the HTTP code returned for type PostCreatorBadRequest
-const PostCreatorBadRequestCode int = 400
-
-/*PostCreatorBadRequest bad request
-
-swagger:response postCreatorBadRequest
-*/
-type PostCreatorBadRequest struct {
-
- /*
- In: Body
- */
- Payload *models.Error `json:"body,omitempty"`
-}
-
-// NewPostCreatorBadRequest creates PostCreatorBadRequest with default headers values
-func NewPostCreatorBadRequest() *PostCreatorBadRequest {
-
- return &PostCreatorBadRequest{}
-}
-
-// WithPayload adds the payload to the post creator bad request response
-func (o *PostCreatorBadRequest) WithPayload(payload *models.Error) *PostCreatorBadRequest {
- o.Payload = payload
- return o
-}
-
-// SetPayload sets the payload to the post creator bad request response
-func (o *PostCreatorBadRequest) SetPayload(payload *models.Error) {
- o.Payload = payload
-}
-
-// WriteResponse to the client
-func (o *PostCreatorBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
-
- rw.WriteHeader(400)
- if o.Payload != nil {
- payload := o.Payload
- if err := producer.Produce(rw, payload); err != nil {
- panic(err) // let the recovery middleware deal with this
- }
- }
-}
-
-/*PostCreatorDefault generic error response
-
-swagger:response postCreatorDefault
-*/
-type PostCreatorDefault struct {
- _statusCode int
-
- /*
- In: Body
- */
- Payload *models.Error `json:"body,omitempty"`
-}
-
-// NewPostCreatorDefault creates PostCreatorDefault with default headers values
-func NewPostCreatorDefault(code int) *PostCreatorDefault {
- if code <= 0 {
- code = 500
- }
-
- return &PostCreatorDefault{
- _statusCode: code,
- }
-}
-
-// WithStatusCode adds the status to the post creator default response
-func (o *PostCreatorDefault) WithStatusCode(code int) *PostCreatorDefault {
- o._statusCode = code
- return o
-}
-
-// SetStatusCode sets the status to the post creator default response
-func (o *PostCreatorDefault) SetStatusCode(code int) {
- o._statusCode = code
-}
-
-// WithPayload adds the payload to the post creator default response
-func (o *PostCreatorDefault) WithPayload(payload *models.Error) *PostCreatorDefault {
- o.Payload = payload
- return o
-}
-
-// SetPayload sets the payload to the post creator default response
-func (o *PostCreatorDefault) SetPayload(payload *models.Error) {
- o.Payload = payload
-}
-
-// WriteResponse to the client
-func (o *PostCreatorDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
-
- rw.WriteHeader(o._statusCode)
- if o.Payload != nil {
- payload := o.Payload
- if err := producer.Produce(rw, payload); err != nil {
- panic(err) // let the recovery middleware deal with this
- }
- }
-}
diff --git a/golang/gen/restapi/operations/post_creator_urlbuilder.go b/golang/gen/restapi/operations/post_creator_urlbuilder.go
deleted file mode 100644
index 901edeb6..00000000
--- a/golang/gen/restapi/operations/post_creator_urlbuilder.go
+++ /dev/null
@@ -1,87 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package operations
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the generate command
-
-import (
- "errors"
- "net/url"
- golangswaggerpaths "path"
-)
-
-// PostCreatorURL generates an URL for the post creator operation
-type PostCreatorURL struct {
- _basePath string
-}
-
-// WithBasePath sets the base path for this url builder, only required when it's different from the
-// base path specified in the swagger spec.
-// When the value of the base path is an empty string
-func (o *PostCreatorURL) WithBasePath(bp string) *PostCreatorURL {
- o.SetBasePath(bp)
- return o
-}
-
-// SetBasePath sets the base path for this url builder, only required when it's different from the
-// base path specified in the swagger spec.
-// When the value of the base path is an empty string
-func (o *PostCreatorURL) SetBasePath(bp string) {
- o._basePath = bp
-}
-
-// Build a url path and query string
-func (o *PostCreatorURL) Build() (*url.URL, error) {
- var result url.URL
-
- var _path = "/creator"
-
- _basePath := o._basePath
- if _basePath == "" {
- _basePath = "/v0"
- }
- result.Path = golangswaggerpaths.Join(_basePath, _path)
-
- return &result, nil
-}
-
-// Must is a helper function to panic when the url builder returns an error
-func (o *PostCreatorURL) Must(u *url.URL, err error) *url.URL {
- if err != nil {
- panic(err)
- }
- if u == nil {
- panic("url can't be nil")
- }
- return u
-}
-
-// String returns the string representation of the path with query string
-func (o *PostCreatorURL) String() string {
- return o.Must(o.Build()).String()
-}
-
-// BuildFull builds a full url with scheme, host, path and query string
-func (o *PostCreatorURL) BuildFull(scheme, host string) (*url.URL, error) {
- if scheme == "" {
- return nil, errors.New("scheme is required for a full url on PostCreatorURL")
- }
- if host == "" {
- return nil, errors.New("host is required for a full url on PostCreatorURL")
- }
-
- base, err := o.Build()
- if err != nil {
- return nil, err
- }
-
- base.Scheme = scheme
- base.Host = host
- return base, nil
-}
-
-// StringFull returns the string representation of a complete url
-func (o *PostCreatorURL) StringFull(scheme, host string) string {
- return o.Must(o.BuildFull(scheme, host)).String()
-}
diff --git a/golang/gen/restapi/operations/post_editgroup.go b/golang/gen/restapi/operations/post_editgroup.go
deleted file mode 100644
index 1b938ba1..00000000
--- a/golang/gen/restapi/operations/post_editgroup.go
+++ /dev/null
@@ -1,58 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package operations
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the generate command
-
-import (
- "net/http"
-
- middleware "github.com/go-openapi/runtime/middleware"
-)
-
-// PostEditgroupHandlerFunc turns a function with the right signature into a post editgroup handler
-type PostEditgroupHandlerFunc func(PostEditgroupParams) middleware.Responder
-
-// Handle executing the request and returning a response
-func (fn PostEditgroupHandlerFunc) Handle(params PostEditgroupParams) middleware.Responder {
- return fn(params)
-}
-
-// PostEditgroupHandler interface for that can handle valid post editgroup params
-type PostEditgroupHandler interface {
- Handle(PostEditgroupParams) middleware.Responder
-}
-
-// NewPostEditgroup creates a new http.Handler for the post editgroup operation
-func NewPostEditgroup(ctx *middleware.Context, handler PostEditgroupHandler) *PostEditgroup {
- return &PostEditgroup{Context: ctx, Handler: handler}
-}
-
-/*PostEditgroup swagger:route POST /editgroup postEditgroup
-
-PostEditgroup post editgroup API
-
-*/
-type PostEditgroup struct {
- Context *middleware.Context
- Handler PostEditgroupHandler
-}
-
-func (o *PostEditgroup) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
- route, rCtx, _ := o.Context.RouteInfo(r)
- if rCtx != nil {
- r = rCtx
- }
- var Params = NewPostEditgroupParams()
-
- if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
- o.Context.Respond(rw, r, route.Produces, route, err)
- return
- }
-
- res := o.Handler.Handle(Params) // actually handle the request
-
- o.Context.Respond(rw, r, route.Produces, route, res)
-
-}
diff --git a/golang/gen/restapi/operations/post_editgroup_id_accept.go b/golang/gen/restapi/operations/post_editgroup_id_accept.go
deleted file mode 100644
index 121e58cc..00000000
--- a/golang/gen/restapi/operations/post_editgroup_id_accept.go
+++ /dev/null
@@ -1,58 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package operations
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the generate command
-
-import (
- "net/http"
-
- middleware "github.com/go-openapi/runtime/middleware"
-)
-
-// PostEditgroupIDAcceptHandlerFunc turns a function with the right signature into a post editgroup ID accept handler
-type PostEditgroupIDAcceptHandlerFunc func(PostEditgroupIDAcceptParams) middleware.Responder
-
-// Handle executing the request and returning a response
-func (fn PostEditgroupIDAcceptHandlerFunc) Handle(params PostEditgroupIDAcceptParams) middleware.Responder {
- return fn(params)
-}
-
-// PostEditgroupIDAcceptHandler interface for that can handle valid post editgroup ID accept params
-type PostEditgroupIDAcceptHandler interface {
- Handle(PostEditgroupIDAcceptParams) middleware.Responder
-}
-
-// NewPostEditgroupIDAccept creates a new http.Handler for the post editgroup ID accept operation
-func NewPostEditgroupIDAccept(ctx *middleware.Context, handler PostEditgroupIDAcceptHandler) *PostEditgroupIDAccept {
- return &PostEditgroupIDAccept{Context: ctx, Handler: handler}
-}
-
-/*PostEditgroupIDAccept swagger:route POST /editgroup/{id}/accept postEditgroupIdAccept
-
-PostEditgroupIDAccept post editgroup ID accept API
-
-*/
-type PostEditgroupIDAccept struct {
- Context *middleware.Context
- Handler PostEditgroupIDAcceptHandler
-}
-
-func (o *PostEditgroupIDAccept) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
- route, rCtx, _ := o.Context.RouteInfo(r)
- if rCtx != nil {
- r = rCtx
- }
- var Params = NewPostEditgroupIDAcceptParams()
-
- if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
- o.Context.Respond(rw, r, route.Produces, route, err)
- return
- }
-
- res := o.Handler.Handle(Params) // actually handle the request
-
- o.Context.Respond(rw, r, route.Produces, route, res)
-
-}
diff --git a/golang/gen/restapi/operations/post_editgroup_id_accept_parameters.go b/golang/gen/restapi/operations/post_editgroup_id_accept_parameters.go
deleted file mode 100644
index 967c35e7..00000000
--- a/golang/gen/restapi/operations/post_editgroup_id_accept_parameters.go
+++ /dev/null
@@ -1,77 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package operations
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the swagger generate command
-
-import (
- "net/http"
-
- "github.com/go-openapi/errors"
- "github.com/go-openapi/runtime/middleware"
- "github.com/go-openapi/swag"
-
- strfmt "github.com/go-openapi/strfmt"
-)
-
-// NewPostEditgroupIDAcceptParams creates a new PostEditgroupIDAcceptParams object
-// no default values defined in spec.
-func NewPostEditgroupIDAcceptParams() PostEditgroupIDAcceptParams {
-
- return PostEditgroupIDAcceptParams{}
-}
-
-// PostEditgroupIDAcceptParams contains all the bound params for the post editgroup ID accept operation
-// typically these are obtained from a http.Request
-//
-// swagger:parameters PostEditgroupIDAccept
-type PostEditgroupIDAcceptParams struct {
-
- // HTTP Request Object
- HTTPRequest *http.Request `json:"-"`
-
- /*
- Required: true
- In: path
- */
- ID int64
-}
-
-// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
-// for simple values it will use straight method calls.
-//
-// To ensure default values, the struct must have been initialized with NewPostEditgroupIDAcceptParams() beforehand.
-func (o *PostEditgroupIDAcceptParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
- var res []error
-
- o.HTTPRequest = r
-
- rID, rhkID, _ := route.Params.GetOK("id")
- if err := o.bindID(rID, rhkID, route.Formats); err != nil {
- res = append(res, err)
- }
-
- if len(res) > 0 {
- return errors.CompositeValidationError(res...)
- }
- return nil
-}
-
-func (o *PostEditgroupIDAcceptParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
- var raw string
- if len(rawData) > 0 {
- raw = rawData[len(rawData)-1]
- }
-
- // Required: true
- // Parameter is provided by construction from the route
-
- value, err := swag.ConvertInt64(raw)
- if err != nil {
- return errors.InvalidType("id", "path", "int64", raw)
- }
- o.ID = value
-
- return nil
-}
diff --git a/golang/gen/restapi/operations/post_editgroup_id_accept_responses.go b/golang/gen/restapi/operations/post_editgroup_id_accept_responses.go
deleted file mode 100644
index a414fc1b..00000000
--- a/golang/gen/restapi/operations/post_editgroup_id_accept_responses.go
+++ /dev/null
@@ -1,204 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package operations
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the swagger generate command
-
-import (
- "net/http"
-
- "github.com/go-openapi/runtime"
-
- models "git.archive.org/bnewbold/fatcat/golang/gen/models"
-)
-
-// PostEditgroupIDAcceptOKCode is the HTTP code returned for type PostEditgroupIDAcceptOK
-const PostEditgroupIDAcceptOKCode int = 200
-
-/*PostEditgroupIDAcceptOK merged editgroup successfully ("live")
-
-swagger:response postEditgroupIdAcceptOK
-*/
-type PostEditgroupIDAcceptOK struct {
-
- /*
- In: Body
- */
- Payload *models.Success `json:"body,omitempty"`
-}
-
-// NewPostEditgroupIDAcceptOK creates PostEditgroupIDAcceptOK with default headers values
-func NewPostEditgroupIDAcceptOK() *PostEditgroupIDAcceptOK {
-
- return &PostEditgroupIDAcceptOK{}
-}
-
-// WithPayload adds the payload to the post editgroup Id accept o k response
-func (o *PostEditgroupIDAcceptOK) WithPayload(payload *models.Success) *PostEditgroupIDAcceptOK {
- o.Payload = payload
- return o
-}
-
-// SetPayload sets the payload to the post editgroup Id accept o k response
-func (o *PostEditgroupIDAcceptOK) SetPayload(payload *models.Success) {
- o.Payload = payload
-}
-
-// WriteResponse to the client
-func (o *PostEditgroupIDAcceptOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
-
- rw.WriteHeader(200)
- if o.Payload != nil {
- payload := o.Payload
- if err := producer.Produce(rw, payload); err != nil {
- panic(err) // let the recovery middleware deal with this
- }
- }
-}
-
-// PostEditgroupIDAcceptBadRequestCode is the HTTP code returned for type PostEditgroupIDAcceptBadRequest
-const PostEditgroupIDAcceptBadRequestCode int = 400
-
-/*PostEditgroupIDAcceptBadRequest editgroup is in an unmergable state
-
-swagger:response postEditgroupIdAcceptBadRequest
-*/
-type PostEditgroupIDAcceptBadRequest struct {
-
- /*
- In: Body
- */
- Payload *models.Error `json:"body,omitempty"`
-}
-
-// NewPostEditgroupIDAcceptBadRequest creates PostEditgroupIDAcceptBadRequest with default headers values
-func NewPostEditgroupIDAcceptBadRequest() *PostEditgroupIDAcceptBadRequest {
-
- return &PostEditgroupIDAcceptBadRequest{}
-}
-
-// WithPayload adds the payload to the post editgroup Id accept bad request response
-func (o *PostEditgroupIDAcceptBadRequest) WithPayload(payload *models.Error) *PostEditgroupIDAcceptBadRequest {
- o.Payload = payload
- return o
-}
-
-// SetPayload sets the payload to the post editgroup Id accept bad request response
-func (o *PostEditgroupIDAcceptBadRequest) SetPayload(payload *models.Error) {
- o.Payload = payload
-}
-
-// WriteResponse to the client
-func (o *PostEditgroupIDAcceptBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
-
- rw.WriteHeader(400)
- if o.Payload != nil {
- payload := o.Payload
- if err := producer.Produce(rw, payload); err != nil {
- panic(err) // let the recovery middleware deal with this
- }
- }
-}
-
-// PostEditgroupIDAcceptNotFoundCode is the HTTP code returned for type PostEditgroupIDAcceptNotFound
-const PostEditgroupIDAcceptNotFoundCode int = 404
-
-/*PostEditgroupIDAcceptNotFound no such editgroup
-
-swagger:response postEditgroupIdAcceptNotFound
-*/
-type PostEditgroupIDAcceptNotFound struct {
-
- /*
- In: Body
- */
- Payload *models.Error `json:"body,omitempty"`
-}
-
-// NewPostEditgroupIDAcceptNotFound creates PostEditgroupIDAcceptNotFound with default headers values
-func NewPostEditgroupIDAcceptNotFound() *PostEditgroupIDAcceptNotFound {
-
- return &PostEditgroupIDAcceptNotFound{}
-}
-
-// WithPayload adds the payload to the post editgroup Id accept not found response
-func (o *PostEditgroupIDAcceptNotFound) WithPayload(payload *models.Error) *PostEditgroupIDAcceptNotFound {
- o.Payload = payload
- return o
-}
-
-// SetPayload sets the payload to the post editgroup Id accept not found response
-func (o *PostEditgroupIDAcceptNotFound) SetPayload(payload *models.Error) {
- o.Payload = payload
-}
-
-// WriteResponse to the client
-func (o *PostEditgroupIDAcceptNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
-
- rw.WriteHeader(404)
- if o.Payload != nil {
- payload := o.Payload
- if err := producer.Produce(rw, payload); err != nil {
- panic(err) // let the recovery middleware deal with this
- }
- }
-}
-
-/*PostEditgroupIDAcceptDefault generic error response
-
-swagger:response postEditgroupIdAcceptDefault
-*/
-type PostEditgroupIDAcceptDefault struct {
- _statusCode int
-
- /*
- In: Body
- */
- Payload *models.Error `json:"body,omitempty"`
-}
-
-// NewPostEditgroupIDAcceptDefault creates PostEditgroupIDAcceptDefault with default headers values
-func NewPostEditgroupIDAcceptDefault(code int) *PostEditgroupIDAcceptDefault {
- if code <= 0 {
- code = 500
- }
-
- return &PostEditgroupIDAcceptDefault{
- _statusCode: code,
- }
-}
-
-// WithStatusCode adds the status to the post editgroup ID accept default response
-func (o *PostEditgroupIDAcceptDefault) WithStatusCode(code int) *PostEditgroupIDAcceptDefault {
- o._statusCode = code
- return o
-}
-
-// SetStatusCode sets the status to the post editgroup ID accept default response
-func (o *PostEditgroupIDAcceptDefault) SetStatusCode(code int) {
- o._statusCode = code
-}
-
-// WithPayload adds the payload to the post editgroup ID accept default response
-func (o *PostEditgroupIDAcceptDefault) WithPayload(payload *models.Error) *PostEditgroupIDAcceptDefault {
- o.Payload = payload
- return o
-}
-
-// SetPayload sets the payload to the post editgroup ID accept default response
-func (o *PostEditgroupIDAcceptDefault) SetPayload(payload *models.Error) {
- o.Payload = payload
-}
-
-// WriteResponse to the client
-func (o *PostEditgroupIDAcceptDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
-
- rw.WriteHeader(o._statusCode)
- if o.Payload != nil {
- payload := o.Payload
- if err := producer.Produce(rw, payload); err != nil {
- panic(err) // let the recovery middleware deal with this
- }
- }
-}
diff --git a/golang/gen/restapi/operations/post_editgroup_id_accept_urlbuilder.go b/golang/gen/restapi/operations/post_editgroup_id_accept_urlbuilder.go
deleted file mode 100644
index 1c7362f6..00000000
--- a/golang/gen/restapi/operations/post_editgroup_id_accept_urlbuilder.go
+++ /dev/null
@@ -1,101 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package operations
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the generate command
-
-import (
- "errors"
- "net/url"
- golangswaggerpaths "path"
- "strings"
-
- "github.com/go-openapi/swag"
-)
-
-// PostEditgroupIDAcceptURL generates an URL for the post editgroup ID accept operation
-type PostEditgroupIDAcceptURL struct {
- ID int64
-
- _basePath string
- // avoid unkeyed usage
- _ struct{}
-}
-
-// WithBasePath sets the base path for this url builder, only required when it's different from the
-// base path specified in the swagger spec.
-// When the value of the base path is an empty string
-func (o *PostEditgroupIDAcceptURL) WithBasePath(bp string) *PostEditgroupIDAcceptURL {
- o.SetBasePath(bp)
- return o
-}
-
-// SetBasePath sets the base path for this url builder, only required when it's different from the
-// base path specified in the swagger spec.
-// When the value of the base path is an empty string
-func (o *PostEditgroupIDAcceptURL) SetBasePath(bp string) {
- o._basePath = bp
-}
-
-// Build a url path and query string
-func (o *PostEditgroupIDAcceptURL) Build() (*url.URL, error) {
- var result url.URL
-
- var _path = "/editgroup/{id}/accept"
-
- id := swag.FormatInt64(o.ID)
- if id != "" {
- _path = strings.Replace(_path, "{id}", id, -1)
- } else {
- return nil, errors.New("ID is required on PostEditgroupIDAcceptURL")
- }
-
- _basePath := o._basePath
- if _basePath == "" {
- _basePath = "/v0"
- }
- result.Path = golangswaggerpaths.Join(_basePath, _path)
-
- return &result, nil
-}
-
-// Must is a helper function to panic when the url builder returns an error
-func (o *PostEditgroupIDAcceptURL) Must(u *url.URL, err error) *url.URL {
- if err != nil {
- panic(err)
- }
- if u == nil {
- panic("url can't be nil")
- }
- return u
-}
-
-// String returns the string representation of the path with query string
-func (o *PostEditgroupIDAcceptURL) String() string {
- return o.Must(o.Build()).String()
-}
-
-// BuildFull builds a full url with scheme, host, path and query string
-func (o *PostEditgroupIDAcceptURL) BuildFull(scheme, host string) (*url.URL, error) {
- if scheme == "" {
- return nil, errors.New("scheme is required for a full url on PostEditgroupIDAcceptURL")
- }
- if host == "" {
- return nil, errors.New("host is required for a full url on PostEditgroupIDAcceptURL")
- }
-
- base, err := o.Build()
- if err != nil {
- return nil, err
- }
-
- base.Scheme = scheme
- base.Host = host
- return base, nil
-}
-
-// StringFull returns the string representation of a complete url
-func (o *PostEditgroupIDAcceptURL) StringFull(scheme, host string) string {
- return o.Must(o.BuildFull(scheme, host)).String()
-}
diff --git a/golang/gen/restapi/operations/post_editgroup_parameters.go b/golang/gen/restapi/operations/post_editgroup_parameters.go
deleted file mode 100644
index 261e3209..00000000
--- a/golang/gen/restapi/operations/post_editgroup_parameters.go
+++ /dev/null
@@ -1,45 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package operations
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the swagger generate command
-
-import (
- "net/http"
-
- "github.com/go-openapi/errors"
- "github.com/go-openapi/runtime/middleware"
-)
-
-// NewPostEditgroupParams creates a new PostEditgroupParams object
-// no default values defined in spec.
-func NewPostEditgroupParams() PostEditgroupParams {
-
- return PostEditgroupParams{}
-}
-
-// PostEditgroupParams contains all the bound params for the post editgroup operation
-// typically these are obtained from a http.Request
-//
-// swagger:parameters PostEditgroup
-type PostEditgroupParams struct {
-
- // HTTP Request Object
- HTTPRequest *http.Request `json:"-"`
-}
-
-// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
-// for simple values it will use straight method calls.
-//
-// To ensure default values, the struct must have been initialized with NewPostEditgroupParams() beforehand.
-func (o *PostEditgroupParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
- var res []error
-
- o.HTTPRequest = r
-
- if len(res) > 0 {
- return errors.CompositeValidationError(res...)
- }
- return nil
-}
diff --git a/golang/gen/restapi/operations/post_editgroup_responses.go b/golang/gen/restapi/operations/post_editgroup_responses.go
deleted file mode 100644
index ae563d88..00000000
--- a/golang/gen/restapi/operations/post_editgroup_responses.go
+++ /dev/null
@@ -1,160 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package operations
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the swagger generate command
-
-import (
- "net/http"
-
- "github.com/go-openapi/runtime"
-
- models "git.archive.org/bnewbold/fatcat/golang/gen/models"
-)
-
-// PostEditgroupCreatedCode is the HTTP code returned for type PostEditgroupCreated
-const PostEditgroupCreatedCode int = 201
-
-/*PostEditgroupCreated successfully created
-
-swagger:response postEditgroupCreated
-*/
-type PostEditgroupCreated struct {
-
- /*
- In: Body
- */
- Payload *models.Editgroup `json:"body,omitempty"`
-}
-
-// NewPostEditgroupCreated creates PostEditgroupCreated with default headers values
-func NewPostEditgroupCreated() *PostEditgroupCreated {
-
- return &PostEditgroupCreated{}
-}
-
-// WithPayload adds the payload to the post editgroup created response
-func (o *PostEditgroupCreated) WithPayload(payload *models.Editgroup) *PostEditgroupCreated {
- o.Payload = payload
- return o
-}
-
-// SetPayload sets the payload to the post editgroup created response
-func (o *PostEditgroupCreated) SetPayload(payload *models.Editgroup) {
- o.Payload = payload
-}
-
-// WriteResponse to the client
-func (o *PostEditgroupCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
-
- rw.WriteHeader(201)
- if o.Payload != nil {
- payload := o.Payload
- if err := producer.Produce(rw, payload); err != nil {
- panic(err) // let the recovery middleware deal with this
- }
- }
-}
-
-// PostEditgroupBadRequestCode is the HTTP code returned for type PostEditgroupBadRequest
-const PostEditgroupBadRequestCode int = 400
-
-/*PostEditgroupBadRequest invalid request parameters
-
-swagger:response postEditgroupBadRequest
-*/
-type PostEditgroupBadRequest struct {
-
- /*
- In: Body
- */
- Payload *models.Error `json:"body,omitempty"`
-}
-
-// NewPostEditgroupBadRequest creates PostEditgroupBadRequest with default headers values
-func NewPostEditgroupBadRequest() *PostEditgroupBadRequest {
-
- return &PostEditgroupBadRequest{}
-}
-
-// WithPayload adds the payload to the post editgroup bad request response
-func (o *PostEditgroupBadRequest) WithPayload(payload *models.Error) *PostEditgroupBadRequest {
- o.Payload = payload
- return o
-}
-
-// SetPayload sets the payload to the post editgroup bad request response
-func (o *PostEditgroupBadRequest) SetPayload(payload *models.Error) {
- o.Payload = payload
-}
-
-// WriteResponse to the client
-func (o *PostEditgroupBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
-
- rw.WriteHeader(400)
- if o.Payload != nil {
- payload := o.Payload
- if err := producer.Produce(rw, payload); err != nil {
- panic(err) // let the recovery middleware deal with this
- }
- }
-}
-
-/*PostEditgroupDefault generic error response
-
-swagger:response postEditgroupDefault
-*/
-type PostEditgroupDefault struct {
- _statusCode int
-
- /*
- In: Body
- */
- Payload *models.Error `json:"body,omitempty"`
-}
-
-// NewPostEditgroupDefault creates PostEditgroupDefault with default headers values
-func NewPostEditgroupDefault(code int) *PostEditgroupDefault {
- if code <= 0 {
- code = 500
- }
-
- return &PostEditgroupDefault{
- _statusCode: code,
- }
-}
-
-// WithStatusCode adds the status to the post editgroup default response
-func (o *PostEditgroupDefault) WithStatusCode(code int) *PostEditgroupDefault {
- o._statusCode = code
- return o
-}
-
-// SetStatusCode sets the status to the post editgroup default response
-func (o *PostEditgroupDefault) SetStatusCode(code int) {
- o._statusCode = code
-}
-
-// WithPayload adds the payload to the post editgroup default response
-func (o *PostEditgroupDefault) WithPayload(payload *models.Error) *PostEditgroupDefault {
- o.Payload = payload
- return o
-}
-
-// SetPayload sets the payload to the post editgroup default response
-func (o *PostEditgroupDefault) SetPayload(payload *models.Error) {
- o.Payload = payload
-}
-
-// WriteResponse to the client
-func (o *PostEditgroupDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
-
- rw.WriteHeader(o._statusCode)
- if o.Payload != nil {
- payload := o.Payload
- if err := producer.Produce(rw, payload); err != nil {
- panic(err) // let the recovery middleware deal with this
- }
- }
-}
diff --git a/golang/gen/restapi/operations/post_editgroup_urlbuilder.go b/golang/gen/restapi/operations/post_editgroup_urlbuilder.go
deleted file mode 100644
index 9a636968..00000000
--- a/golang/gen/restapi/operations/post_editgroup_urlbuilder.go
+++ /dev/null
@@ -1,87 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package operations
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the generate command
-
-import (
- "errors"
- "net/url"
- golangswaggerpaths "path"
-)
-
-// PostEditgroupURL generates an URL for the post editgroup operation
-type PostEditgroupURL struct {
- _basePath string
-}
-
-// WithBasePath sets the base path for this url builder, only required when it's different from the
-// base path specified in the swagger spec.
-// When the value of the base path is an empty string
-func (o *PostEditgroupURL) WithBasePath(bp string) *PostEditgroupURL {
- o.SetBasePath(bp)
- return o
-}
-
-// SetBasePath sets the base path for this url builder, only required when it's different from the
-// base path specified in the swagger spec.
-// When the value of the base path is an empty string
-func (o *PostEditgroupURL) SetBasePath(bp string) {
- o._basePath = bp
-}
-
-// Build a url path and query string
-func (o *PostEditgroupURL) Build() (*url.URL, error) {
- var result url.URL
-
- var _path = "/editgroup"
-
- _basePath := o._basePath
- if _basePath == "" {
- _basePath = "/v0"
- }
- result.Path = golangswaggerpaths.Join(_basePath, _path)
-
- return &result, nil
-}
-
-// Must is a helper function to panic when the url builder returns an error
-func (o *PostEditgroupURL) Must(u *url.URL, err error) *url.URL {
- if err != nil {
- panic(err)
- }
- if u == nil {
- panic("url can't be nil")
- }
- return u
-}
-
-// String returns the string representation of the path with query string
-func (o *PostEditgroupURL) String() string {
- return o.Must(o.Build()).String()
-}
-
-// BuildFull builds a full url with scheme, host, path and query string
-func (o *PostEditgroupURL) BuildFull(scheme, host string) (*url.URL, error) {
- if scheme == "" {
- return nil, errors.New("scheme is required for a full url on PostEditgroupURL")
- }
- if host == "" {
- return nil, errors.New("host is required for a full url on PostEditgroupURL")
- }
-
- base, err := o.Build()
- if err != nil {
- return nil, err
- }
-
- base.Scheme = scheme
- base.Host = host
- return base, nil
-}
-
-// StringFull returns the string representation of a complete url
-func (o *PostEditgroupURL) StringFull(scheme, host string) string {
- return o.Must(o.BuildFull(scheme, host)).String()
-}
diff --git a/golang/gen/restapi/server.go b/golang/gen/restapi/server.go
deleted file mode 100644
index 2147f3f6..00000000
--- a/golang/gen/restapi/server.go
+++ /dev/null
@@ -1,447 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-package restapi
-
-import (
- "crypto/tls"
- "crypto/x509"
- "errors"
- "io/ioutil"
- "log"
- "net"
- "net/http"
- "os"
- "strconv"
- "sync"
- "sync/atomic"
- "time"
-
- "github.com/go-openapi/runtime/flagext"
- "github.com/go-openapi/swag"
- flags "github.com/jessevdk/go-flags"
- graceful "github.com/tylerb/graceful"
-
- "git.archive.org/bnewbold/fatcat/golang/gen/restapi/operations"
-)
-
-const (
- schemeHTTP = "http"
- schemeHTTPS = "https"
- schemeUnix = "unix"
-)
-
-var defaultSchemes []string
-
-func init() {
- defaultSchemes = []string{
- schemeHTTP,
- }
-}
-
-// NewServer creates a new api fatcat server but does not configure it
-func NewServer(api *operations.FatcatAPI) *Server {
- s := new(Server)
-
- s.shutdown = make(chan struct{})
- s.api = api
- return s
-}
-
-// ConfigureAPI configures the API and handlers.
-func (s *Server) ConfigureAPI() {
- if s.api != nil {
- s.handler = configureAPI(s.api)
- }
-}
-
-// ConfigureFlags configures the additional flags defined by the handlers. Needs to be called before the parser.Parse
-func (s *Server) ConfigureFlags() {
- if s.api != nil {
- configureFlags(s.api)
- }
-}
-
-// Server for the fatcat API
-type Server struct {
- EnabledListeners []string `long:"scheme" description:"the listeners to enable, this can be repeated and defaults to the schemes in the swagger spec"`
- CleanupTimeout time.Duration `long:"cleanup-timeout" description:"grace period for which to wait before shutting down the server" default:"10s"`
- MaxHeaderSize flagext.ByteSize `long:"max-header-size" description:"controls the maximum number of bytes the server will read parsing the request header's keys and values, including the request line. It does not limit the size of the request body." default:"1MiB"`
-
- SocketPath flags.Filename `long:"socket-path" description:"the unix socket to listen on" default:"/var/run/fatcat.sock"`
- domainSocketL net.Listener
-
- Host string `long:"host" description:"the IP to listen on" default:"localhost" env:"HOST"`
- Port int `long:"port" description:"the port to listen on for insecure connections, defaults to a random value" env:"PORT"`
- ListenLimit int `long:"listen-limit" description:"limit the number of outstanding requests"`
- KeepAlive time.Duration `long:"keep-alive" description:"sets the TCP keep-alive timeouts on accepted connections. It prunes dead TCP connections ( e.g. closing laptop mid-download)" default:"3m"`
- ReadTimeout time.Duration `long:"read-timeout" description:"maximum duration before timing out read of the request" default:"30s"`
- WriteTimeout time.Duration `long:"write-timeout" description:"maximum duration before timing out write of the response" default:"60s"`
- httpServerL net.Listener
-
- TLSHost string `long:"tls-host" description:"the IP to listen on for tls, when not specified it's the same as --host" env:"TLS_HOST"`
- TLSPort int `long:"tls-port" description:"the port to listen on for secure connections, defaults to a random value" env:"TLS_PORT"`
- TLSCertificate flags.Filename `long:"tls-certificate" description:"the certificate to use for secure connections" env:"TLS_CERTIFICATE"`
- TLSCertificateKey flags.Filename `long:"tls-key" description:"the private key to use for secure conections" env:"TLS_PRIVATE_KEY"`
- TLSCACertificate flags.Filename `long:"tls-ca" description:"the certificate authority file to be used with mutual tls auth" env:"TLS_CA_CERTIFICATE"`
- TLSListenLimit int `long:"tls-listen-limit" description:"limit the number of outstanding requests"`
- TLSKeepAlive time.Duration `long:"tls-keep-alive" description:"sets the TCP keep-alive timeouts on accepted connections. It prunes dead TCP connections ( e.g. closing laptop mid-download)"`
- TLSReadTimeout time.Duration `long:"tls-read-timeout" description:"maximum duration before timing out read of the request"`
- TLSWriteTimeout time.Duration `long:"tls-write-timeout" description:"maximum duration before timing out write of the response"`
- httpsServerL net.Listener
-
- api *operations.FatcatAPI
- handler http.Handler
- hasListeners bool
- shutdown chan struct{}
- shuttingDown int32
-}
-
-// Logf logs message either via defined user logger or via system one if no user logger is defined.
-func (s *Server) Logf(f string, args ...interface{}) {
- if s.api != nil && s.api.Logger != nil {
- s.api.Logger(f, args...)
- } else {
- log.Printf(f, args...)
- }
-}
-
-// Fatalf logs message either via defined user logger or via system one if no user logger is defined.
-// Exits with non-zero status after printing
-func (s *Server) Fatalf(f string, args ...interface{}) {
- if s.api != nil && s.api.Logger != nil {
- s.api.Logger(f, args...)
- os.Exit(1)
- } else {
- log.Fatalf(f, args...)
- }
-}
-
-// SetAPI configures the server with the specified API. Needs to be called before Serve
-func (s *Server) SetAPI(api *operations.FatcatAPI) {
- if api == nil {
- s.api = nil
- s.handler = nil
- return
- }
-
- s.api = api
- s.api.Logger = log.Printf
- s.handler = configureAPI(api)
-}
-
-func (s *Server) hasScheme(scheme string) bool {
- schemes := s.EnabledListeners
- if len(schemes) == 0 {
- schemes = defaultSchemes
- }
-
- for _, v := range schemes {
- if v == scheme {
- return true
- }
- }
- return false
-}
-
-// Serve the api
-func (s *Server) Serve() (err error) {
- if !s.hasListeners {
- if err = s.Listen(); err != nil {
- return err
- }
- }
-
- // set default handler, if none is set
- if s.handler == nil {
- if s.api == nil {
- return errors.New("can't create the default handler, as no api is set")
- }
-
- s.SetHandler(s.api.Serve(nil))
- }
-
- var wg sync.WaitGroup
-
- if s.hasScheme(schemeUnix) {
- domainSocket := &graceful.Server{Server: new(http.Server)}
- domainSocket.MaxHeaderBytes = int(s.MaxHeaderSize)
- domainSocket.Handler = s.handler
- domainSocket.LogFunc = s.Logf
- if int64(s.CleanupTimeout) > 0 {
- domainSocket.Timeout = s.CleanupTimeout
- }
-
- configureServer(domainSocket, "unix", string(s.SocketPath))
-
- wg.Add(2)
- s.Logf("Serving fatcat at unix://%s", s.SocketPath)
- go func(l net.Listener) {
- defer wg.Done()
- if err := domainSocket.Serve(l); err != nil {
- s.Fatalf("%v", err)
- }
- s.Logf("Stopped serving fatcat at unix://%s", s.SocketPath)
- }(s.domainSocketL)
- go s.handleShutdown(&wg, domainSocket)
- }
-
- if s.hasScheme(schemeHTTP) {
- httpServer := &graceful.Server{Server: new(http.Server)}
- httpServer.MaxHeaderBytes = int(s.MaxHeaderSize)
- httpServer.ReadTimeout = s.ReadTimeout
- httpServer.WriteTimeout = s.WriteTimeout
- httpServer.SetKeepAlivesEnabled(int64(s.KeepAlive) > 0)
- httpServer.TCPKeepAlive = s.KeepAlive
- if s.ListenLimit > 0 {
- httpServer.ListenLimit = s.ListenLimit
- }
-
- if int64(s.CleanupTimeout) > 0 {
- httpServer.Timeout = s.CleanupTimeout
- }
-
- httpServer.Handler = s.handler
- httpServer.LogFunc = s.Logf
-
- configureServer(httpServer, "http", s.httpServerL.Addr().String())
-
- wg.Add(2)
- s.Logf("Serving fatcat at http://%s", s.httpServerL.Addr())
- go func(l net.Listener) {
- defer wg.Done()
- if err := httpServer.Serve(l); err != nil {
- s.Fatalf("%v", err)
- }
- s.Logf("Stopped serving fatcat at http://%s", l.Addr())
- }(s.httpServerL)
- go s.handleShutdown(&wg, httpServer)
- }
-
- if s.hasScheme(schemeHTTPS) {
- httpsServer := &graceful.Server{Server: new(http.Server)}
- httpsServer.MaxHeaderBytes = int(s.MaxHeaderSize)
- httpsServer.ReadTimeout = s.TLSReadTimeout
- httpsServer.WriteTimeout = s.TLSWriteTimeout
- httpsServer.SetKeepAlivesEnabled(int64(s.TLSKeepAlive) > 0)
- httpsServer.TCPKeepAlive = s.TLSKeepAlive
- if s.TLSListenLimit > 0 {
- httpsServer.ListenLimit = s.TLSListenLimit
- }
- if int64(s.CleanupTimeout) > 0 {
- httpsServer.Timeout = s.CleanupTimeout
- }
- httpsServer.Handler = s.handler
- httpsServer.LogFunc = s.Logf
-
- // Inspired by https://blog.bracebin.com/achieving-perfect-ssl-labs-score-with-go
- httpsServer.TLSConfig = &tls.Config{
- // Causes servers to use Go's default ciphersuite preferences,
- // which are tuned to avoid attacks. Does nothing on clients.
- PreferServerCipherSuites: true,
- // Only use curves which have assembly implementations
- // https://github.com/golang/go/tree/master/src/crypto/elliptic
- CurvePreferences: []tls.CurveID{tls.CurveP256},
- // Use modern tls mode https://wiki.mozilla.org/Security/Server_Side_TLS#Modern_compatibility
- NextProtos: []string{"http/1.1", "h2"},
- // https://www.owasp.org/index.php/Transport_Layer_Protection_Cheat_Sheet#Rule_-_Only_Support_Strong_Protocols
- MinVersion: tls.VersionTLS12,
- // These ciphersuites support Forward Secrecy: https://en.wikipedia.org/wiki/Forward_secrecy
- CipherSuites: []uint16{
- tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
- tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
- tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
- tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
- },
- }
-
- if s.TLSCertificate != "" && s.TLSCertificateKey != "" {
- httpsServer.TLSConfig.Certificates = make([]tls.Certificate, 1)
- httpsServer.TLSConfig.Certificates[0], err = tls.LoadX509KeyPair(string(s.TLSCertificate), string(s.TLSCertificateKey))
- }
-
- if s.TLSCACertificate != "" {
- caCert, caCertErr := ioutil.ReadFile(string(s.TLSCACertificate))
- if caCertErr != nil {
- log.Fatal(caCertErr)
- }
- caCertPool := x509.NewCertPool()
- caCertPool.AppendCertsFromPEM(caCert)
- httpsServer.TLSConfig.ClientCAs = caCertPool
- httpsServer.TLSConfig.ClientAuth = tls.RequireAndVerifyClientCert
- }
-
- configureTLS(httpsServer.TLSConfig)
- httpsServer.TLSConfig.BuildNameToCertificate()
-
- if err != nil {
- return err
- }
-
- if len(httpsServer.TLSConfig.Certificates) == 0 {
- if s.TLSCertificate == "" {
- if s.TLSCertificateKey == "" {
- s.Fatalf("the required flags `--tls-certificate` and `--tls-key` were not specified")
- }
- s.Fatalf("the required flag `--tls-certificate` was not specified")
- }
- if s.TLSCertificateKey == "" {
- s.Fatalf("the required flag `--tls-key` was not specified")
- }
- }
-
- configureServer(httpsServer, "https", s.httpsServerL.Addr().String())
-
- wg.Add(2)
- s.Logf("Serving fatcat at https://%s", s.httpsServerL.Addr())
- go func(l net.Listener) {
- defer wg.Done()
- if err := httpsServer.Serve(l); err != nil {
- s.Fatalf("%v", err)
- }
- s.Logf("Stopped serving fatcat at https://%s", l.Addr())
- }(tls.NewListener(s.httpsServerL, httpsServer.TLSConfig))
- go s.handleShutdown(&wg, httpsServer)
- }
-
- wg.Wait()
- return nil
-}
-
-// Listen creates the listeners for the server
-func (s *Server) Listen() error {
- if s.hasListeners { // already done this
- return nil
- }
-
- if s.hasScheme(schemeHTTPS) {
- // Use http host if https host wasn't defined
- if s.TLSHost == "" {
- s.TLSHost = s.Host
- }
- // Use http listen limit if https listen limit wasn't defined
- if s.TLSListenLimit == 0 {
- s.TLSListenLimit = s.ListenLimit
- }
- // Use http tcp keep alive if https tcp keep alive wasn't defined
- if int64(s.TLSKeepAlive) == 0 {
- s.TLSKeepAlive = s.KeepAlive
- }
- // Use http read timeout if https read timeout wasn't defined
- if int64(s.TLSReadTimeout) == 0 {
- s.TLSReadTimeout = s.ReadTimeout
- }
- // Use http write timeout if https write timeout wasn't defined
- if int64(s.TLSWriteTimeout) == 0 {
- s.TLSWriteTimeout = s.WriteTimeout
- }
- }
-
- if s.hasScheme(schemeUnix) {
- domSockListener, err := net.Listen("unix", string(s.SocketPath))
- if err != nil {
- return err
- }
- s.domainSocketL = domSockListener
- }
-
- if s.hasScheme(schemeHTTP) {
- listener, err := net.Listen("tcp", net.JoinHostPort(s.Host, strconv.Itoa(s.Port)))
- if err != nil {
- return err
- }
-
- h, p, err := swag.SplitHostPort(listener.Addr().String())
- if err != nil {
- return err
- }
- s.Host = h
- s.Port = p
- s.httpServerL = listener
- }
-
- if s.hasScheme(schemeHTTPS) {
- tlsListener, err := net.Listen("tcp", net.JoinHostPort(s.TLSHost, strconv.Itoa(s.TLSPort)))
- if err != nil {
- return err
- }
-
- sh, sp, err := swag.SplitHostPort(tlsListener.Addr().String())
- if err != nil {
- return err
- }
- s.TLSHost = sh
- s.TLSPort = sp
- s.httpsServerL = tlsListener
- }
-
- s.hasListeners = true
- return nil
-}
-
-// Shutdown server and clean up resources
-func (s *Server) Shutdown() error {
- if atomic.LoadInt32(&s.shuttingDown) != 0 {
- s.Logf("already shutting down")
- return nil
- }
- s.shutdown <- struct{}{}
- return nil
-}
-
-func (s *Server) handleShutdown(wg *sync.WaitGroup, server *graceful.Server) {
- defer wg.Done()
- for {
- select {
- case <-s.shutdown:
- atomic.AddInt32(&s.shuttingDown, 1)
- server.Stop(s.CleanupTimeout)
- <-server.StopChan()
- s.api.ServerShutdown()
- return
- case <-server.StopChan():
- atomic.AddInt32(&s.shuttingDown, 1)
- s.api.ServerShutdown()
- return
- }
- }
-}
-
-// GetHandler returns a handler useful for testing
-func (s *Server) GetHandler() http.Handler {
- return s.handler
-}
-
-// SetHandler allows for setting a http handler on this server
-func (s *Server) SetHandler(handler http.Handler) {
- s.handler = handler
-}
-
-// UnixListener returns the domain socket listener
-func (s *Server) UnixListener() (net.Listener, error) {
- if !s.hasListeners {
- if err := s.Listen(); err != nil {
- return nil, err
- }
- }
- return s.domainSocketL, nil
-}
-
-// HTTPListener returns the http listener
-func (s *Server) HTTPListener() (net.Listener, error) {
- if !s.hasListeners {
- if err := s.Listen(); err != nil {
- return nil, err
- }
- }
- return s.httpServerL, nil
-}
-
-// TLSListener returns the https listener
-func (s *Server) TLSListener() (net.Listener, error) {
- if !s.hasListeners {
- if err := s.Listen(); err != nil {
- return nil, err
- }
- }
- return s.httpsServerL, nil
-}
diff --git a/golang/gen/restapi/test.go b/golang/gen/restapi/test.go
deleted file mode 100644
index f45b33c5..00000000
--- a/golang/gen/restapi/test.go
+++ /dev/null
@@ -1,13 +0,0 @@
-
-package restapi
-
-import (
- "testing"
- "github.com/stretchr/testify/assert"
-)
-
-func TestSomething(t *testing.T) {
-
- assert.True(t, true, "True is true!")
-
-}
diff --git a/golang/regen.sh b/golang/regen.sh
deleted file mode 100755
index 366314a0..00000000
--- a/golang/regen.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/bash
-
-set -xeo pipefail
-
-cat fatcat-openapi2.yml | python3 -c 'import sys, yaml, json; json.dump(yaml.load(sys.stdin), sys.stdout, indent=4)' > fatcat-openapi2.json
-swagger generate server -A fatcat -f ./fatcat-openapi2.json --exclude-main -t gen
-rm fatcat-openapi2.json
diff --git a/golang/sql/dummy-data.sql b/golang/sql/dummy-data.sql
deleted file mode 100644
index d553b9f1..00000000
--- a/golang/sql/dummy-data.sql
+++ /dev/null
@@ -1,42 +0,0 @@
-
--- Fake data at the raw SQL level, for early development and testing
-
-BEGIN;
-
-INSERT INTO editor (username, is_admin) VALUES
- ('admin', true),
- ('claire', true),
- ('doug', false);
-
-INSERT INTO editgroup (editor_id, description) VALUES
- (1, 'first edit ever!'),
- (1, 'another one!'),
- (3, 'user edit'),
- (2, 'uncommited edit');
-
-INSERT INTO editor (username, is_admin, active_editgroup_id) VALUES
- ('bnewbold', true, 4);
-
-INSERT INTO changelog (editgroup_id) VALUES
- (1),
- (2),
- (3);
-
-INSERT INTO creator_rev (name, orcid) VALUES
- ('Grace Hopper', null),
- ('Emily Noethe', null),
- ('Christine Moran', '0000-0003-2088-7465');
-
-INSERT INTO creator_ident (id, is_live, rev_id, redirect_id) VALUES
- ('f1f046a3-45c9-4b99-adce-000000000001', true, 1, null),
- ('f1f046a3-45c9-4b99-adce-000000000002', true, 2, null),
- ('f1f046a3-45c9-4b99-adce-000000000003', true, 3, null),
- ('f1f046a3-45c9-4b99-adce-000000000004', false, 2, null);
-
-INSERT INTO creator_edit (ident_id, rev_id, redirect_id, editgroup_id) VALUES
- ('f1f046a3-45c9-4b99-adce-000000000001', 1, null, 1),
- ('f1f046a3-45c9-4b99-adce-000000000002', 2, null, 2),
- ('f1f046a3-45c9-4b99-adce-000000000003', 3, null, 3),
- ('f1f046a3-45c9-4b99-adce-000000000004', 2, null, 4);
-
-COMMIT;
diff --git a/golang/sql/fatcat-schema.sql b/golang/sql/fatcat-schema.sql
deleted file mode 100644
index fe07390f..00000000
--- a/golang/sql/fatcat-schema.sql
+++ /dev/null
@@ -1,68 +0,0 @@
-
--- written for Postgres 9.6 with OSSP extension for UUIDs
-
-CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
-
-DROP TABLE IF EXISTS editor CASCADE;
-DROP TABLE IF EXISTS editgroup CASCADE;
-DROP TABLE IF EXISTS changelog CASCADE;
-DROP TABLE IF EXISTS creator_rev CASCADE;
-DROP TABLE IF EXISTS creator_ident CASCADE;
-DROP TABLE IF EXISTS creator_edit CASCADE;
-
--- uuid_generate_v1mc: timestamp ordered, random MAC address
--- uuid_generate_v4: totally random
-
--- NB: could use LIKE clause, or "composite types"
-
-CREATE TABLE editor (
- id BIGSERIAL PRIMARY KEY,
- username TEXT NOT NULL,
- is_admin BOOLEAN NOT NULL DEFAULT false,
- active_editgroup_id BIGINT -- REFERENCES( editgroup(id) via ALTER below
-);
-
-CREATE TABLE editgroup (
- id BIGSERIAL PRIMARY KEY,
- extra_json JSON,
- editor_id BIGSERIAL REFERENCES editor(id) NOT NULL,
- description TEXT
-);
-
-ALTER TABLE editor
- ADD CONSTRAINT editor_editgroupid_fkey FOREIGN KEY (active_editgroup_id)
- REFERENCES editgroup(id);
-
-CREATE TABLE changelog (
- id BIGSERIAL PRIMARY KEY,
- editgroup_id BIGINT REFERENCES editgroup(id) NOT NULL,
- timestamp TIMESTAMP WITHOUT TIME ZONE DEFAULT now()
-);
-
-CREATE TABLE creator_rev (
- id BIGSERIAL PRIMARY KEY,
- extra_json JSON,
-
- name TEXT,
- orcid TEXT
-);
-
--- Could denormalize a "is_live" flag into revision tables, to make indices
--- more efficient
-CREATE INDEX creator_rev_orcid_idx ON creator_rev(orcid) WHERE orcid IS NOT NULL;
-
-CREATE TABLE creator_ident (
- id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
- is_live BOOL NOT NULL DEFAULT false,
- rev_id BIGINT REFERENCES creator_rev(id),
- redirect_id UUID REFERENCES creator_ident(id)
-);
-
-CREATE TABLE creator_edit (
- id BIGSERIAL PRIMARY KEY,
- extra_json JSON,
- ident_id UUID REFERENCES creator_ident(id) NOT NULL,
- rev_id BIGINT REFERENCES creator_rev(id),
- redirect_id UUID REFERENCES creator_ident(id),
- editgroup_id BIGINT REFERENCES editgroup(id) NOT NULL
-);
diff --git a/golang/test.sh b/golang/test.sh
deleted file mode 100755
index 8e0159e3..00000000
--- a/golang/test.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/usr/bin/env bash
-
-set -e
-echo "" > coverage.txt
-
-for d in $(go list ./... | grep -v -e internal/mock -e cmd/api/server -e vendor); do
- go test -race -coverprofile=profile.out -covermode=atomic "$d"
- if [ -f profile.out ]; then
- cat profile.out >> coverage.txt
- rm profile.out
- fi
-done