summaryrefslogtreecommitdiffstats
path: root/golang/gen
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-05-26 16:42:17 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-05-26 16:42:19 -0700
commit82f8b4d838de3fb8eda5db9b23c5bc48ab281f9e (patch)
tree2b684049829c72fbdd4289535b18a19b884f377b /golang/gen
parent9b3e52e813bbd9dc9b1771ca2c63e33d93048e97 (diff)
downloadfatcat-82f8b4d838de3fb8eda5db9b23c5bc48ab281f9e.tar.gz
fatcat-82f8b4d838de3fb8eda5db9b23c5bc48ab281f9e.zip
remove golang API server
Not following that path; this is to prevent future confusion. All code is still in version control.
Diffstat (limited to 'golang/gen')
-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
47 files changed, 0 insertions, 5727 deletions
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!")
-
-}