From e6fedd421bf7644e969072eff9f375ecb58b25e2 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 10 May 2018 18:55:02 -0700 Subject: bunch more API endpoints --- golang/fatcat-openapi2.yml | 173 ++++++- golang/gen/models/changelogentry.go | 88 ++++ golang/gen/models/creator_entity.go | 18 +- golang/gen/models/editgroup.go | 81 ++++ golang/gen/models/editor.go | 64 +++ golang/gen/models/success.go | 64 +++ golang/gen/restapi/embedded_spec.go | 512 ++++++++++++++++++++- golang/gen/restapi/operations/fatcat_api.go | 84 ++++ .../gen/restapi/operations/get_creator_lookup.go | 58 +++ .../operations/get_creator_lookup_parameters.go | 82 ++++ .../operations/get_creator_lookup_responses.go | 160 +++++++ .../operations/get_creator_lookup_urlbuilder.go | 100 ++++ golang/gen/restapi/operations/get_editgroup_id.go | 58 +++ .../operations/get_editgroup_id_parameters.go | 77 ++++ .../operations/get_editgroup_id_responses.go | 160 +++++++ .../operations/get_editgroup_id_urlbuilder.go | 101 ++++ .../gen/restapi/operations/get_editor_username.go | 58 +++ .../operations/get_editor_username_changelog.go | 58 +++ .../get_editor_username_changelog_parameters.go | 72 +++ .../get_editor_username_changelog_responses.go | 160 +++++++ .../get_editor_username_changelog_urlbuilder.go | 99 ++++ .../operations/get_editor_username_parameters.go | 72 +++ .../operations/get_editor_username_responses.go | 160 +++++++ .../operations/get_editor_username_urlbuilder.go | 99 ++++ .../restapi/operations/post_creator_responses.go | 44 ++ golang/gen/restapi/operations/post_editgroup.go | 58 +++ .../restapi/operations/post_editgroup_id_accept.go | 58 +++ .../post_editgroup_id_accept_parameters.go | 77 ++++ .../post_editgroup_id_accept_responses.go | 204 ++++++++ .../post_editgroup_id_accept_urlbuilder.go | 101 ++++ .../operations/post_editgroup_parameters.go | 45 ++ .../restapi/operations/post_editgroup_responses.go | 160 +++++++ .../operations/post_editgroup_urlbuilder.go | 87 ++++ 33 files changed, 3475 insertions(+), 17 deletions(-) create mode 100644 golang/gen/models/changelogentry.go create mode 100644 golang/gen/models/editgroup.go create mode 100644 golang/gen/models/editor.go create mode 100644 golang/gen/models/success.go create mode 100644 golang/gen/restapi/operations/get_creator_lookup.go create mode 100644 golang/gen/restapi/operations/get_creator_lookup_parameters.go create mode 100644 golang/gen/restapi/operations/get_creator_lookup_responses.go create mode 100644 golang/gen/restapi/operations/get_creator_lookup_urlbuilder.go create mode 100644 golang/gen/restapi/operations/get_editgroup_id.go create mode 100644 golang/gen/restapi/operations/get_editgroup_id_parameters.go create mode 100644 golang/gen/restapi/operations/get_editgroup_id_responses.go create mode 100644 golang/gen/restapi/operations/get_editgroup_id_urlbuilder.go create mode 100644 golang/gen/restapi/operations/get_editor_username.go create mode 100644 golang/gen/restapi/operations/get_editor_username_changelog.go create mode 100644 golang/gen/restapi/operations/get_editor_username_changelog_parameters.go create mode 100644 golang/gen/restapi/operations/get_editor_username_changelog_responses.go create mode 100644 golang/gen/restapi/operations/get_editor_username_changelog_urlbuilder.go create mode 100644 golang/gen/restapi/operations/get_editor_username_parameters.go create mode 100644 golang/gen/restapi/operations/get_editor_username_responses.go create mode 100644 golang/gen/restapi/operations/get_editor_username_urlbuilder.go create mode 100644 golang/gen/restapi/operations/post_editgroup.go create mode 100644 golang/gen/restapi/operations/post_editgroup_id_accept.go create mode 100644 golang/gen/restapi/operations/post_editgroup_id_accept_parameters.go create mode 100644 golang/gen/restapi/operations/post_editgroup_id_accept_responses.go create mode 100644 golang/gen/restapi/operations/post_editgroup_id_accept_urlbuilder.go create mode 100644 golang/gen/restapi/operations/post_editgroup_parameters.go create mode 100644 golang/gen/restapi/operations/post_editgroup_responses.go create mode 100644 golang/gen/restapi/operations/post_editgroup_urlbuilder.go (limited to 'golang') diff --git a/golang/fatcat-openapi2.yml b/golang/fatcat-openapi2.yml index 8f2feec9..a00780f0 100644 --- a/golang/fatcat-openapi2.yml +++ b/golang/fatcat-openapi2.yml @@ -26,21 +26,28 @@ definitions: properties: message: type: string + success: + type: object + required: + - message + properties: + message: + type: string creator_entity: type: object required: - ident - state + - name properties: state: type: string enum: ["wip", "active", "redirect", "deleted"] ident: type: string - # format: uuid + #format: uuid revision: - type: string - # integer + type: integer redirect: type: string # format: uuid @@ -49,6 +56,35 @@ definitions: orcid: type: string # format: custom + editor: + type: object + required: + - username + properties: + username: + type: string + editgroup: + type: object + required: + - id + - editor_id + properties: + id: + type: integer + editor_id: + type: integer + changelogentry: + type: object + required: + - index + properties: + index: + type: integer + editgroup_id: + type: integer + timestamp: + type: string + format: date-time paths: /creator: @@ -63,6 +99,10 @@ paths: description: created schema: $ref: "#/definitions/creator_entity" + 400: + description: bad request + schema: + $ref: "#/definitions/error" default: description: generic error response schema: @@ -87,11 +127,122 @@ paths: description: generic error response schema: $ref: "#/definitions/error" -# /creator/lookup: - -# /editgroup: -# /editgroup/{id}: -# /editgroup/{id}/accept: - -# /editor/{username}: -# /editor/{username}/changelog: + /creator/lookup: + get: + parameters: + - name: orcid + in: query + type: string + required: true + responses: + 200: + description: find a single creator by external identifer + schema: + $ref: "#/definitions/creator_entity" + 404: + description: no such creator + schema: + $ref: "#/definitions/error" + default: + description: generic error response + schema: + $ref: "#/definitions/error" + /editor/{username}: + parameters: + - name: username + in: path + type: string + required: true + get: + responses: + 200: + description: fetch generic information about an editor + schema: + $ref: "#/definitions/editor" + 404: + description: username not found + schema: + $ref: "#/definitions/error" + default: + description: generic error response + schema: + $ref: "#/definitions/error" + /editor/{username}/changelog: + parameters: + - name: username + in: path + type: string + required: true + get: + responses: + 200: + description: find changes (editgroups) by this editor which have been merged + schema: + $ref: "#/definitions/changelogentry" + 404: + description: username not found + schema: + $ref: "#/definitions/error" + default: + description: generic error response + schema: + $ref: "#/definitions/error" + /editgroup: + post: + responses: + 201: + description: successfully created + schema: + $ref: "#/definitions/editgroup" + 400: + description: invalid request parameters + schema: + $ref: "#/definitions/error" + default: + description: generic error response + schema: + $ref: "#/definitions/error" + /editgroup/{id}: + parameters: + - name: id + in: path + type: integer + required: true + get: + responses: + 200: + description: fetch editgroup by identifier + schema: + $ref: "#/definitions/editgroup" + 404: + description: no such editgroup + schema: + $ref: "#/definitions/error" + default: + description: generic error response + schema: + $ref: "#/definitions/error" + /editgroup/{id}/accept: + parameters: + - name: id + in: path + type: integer + required: true + post: + responses: + 200: + description: merged editgroup successfully ("live") + schema: + $ref: "#/definitions/success" + 400: + description: editgroup is in an unmergable state + schema: + $ref: "#/definitions/error" + 404: + description: no such editgroup + schema: + $ref: "#/definitions/error" + default: + description: generic error response + schema: + $ref: "#/definitions/error" diff --git a/golang/gen/models/changelogentry.go b/golang/gen/models/changelogentry.go new file mode 100644 index 00000000..acf93e60 --- /dev/null +++ b/golang/gen/models/changelogentry.go @@ -0,0 +1,88 @@ +// 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_entity.go b/golang/gen/models/creator_entity.go index be3bb6d1..0f1532a8 100644 --- a/golang/gen/models/creator_entity.go +++ b/golang/gen/models/creator_entity.go @@ -24,7 +24,8 @@ type CreatorEntity struct { Ident *string `json:"ident"` // name - Name string `json:"name,omitempty"` + // Required: true + Name *string `json:"name"` // orcid Orcid string `json:"orcid,omitempty"` @@ -33,7 +34,7 @@ type CreatorEntity struct { Redirect string `json:"redirect,omitempty"` // revision - Revision string `json:"revision,omitempty"` + Revision int64 `json:"revision,omitempty"` // state // Required: true @@ -49,6 +50,10 @@ func (m *CreatorEntity) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + if err := m.validateState(formats); err != nil { res = append(res, err) } @@ -68,6 +73,15 @@ func (m *CreatorEntity) validateIdent(formats strfmt.Registry) error { return nil } +func (m *CreatorEntity) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + var creatorEntityTypeStatePropEnum []interface{} func init() { diff --git a/golang/gen/models/editgroup.go b/golang/gen/models/editgroup.go new file mode 100644 index 00000000..67be219c --- /dev/null +++ b/golang/gen/models/editgroup.go @@ -0,0 +1,81 @@ +// 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 new file mode 100644 index 00000000..865de3ff --- /dev/null +++ b/golang/gen/models/editor.go @@ -0,0 +1,64 @@ +// 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/success.go b/golang/gen/models/success.go new file mode 100644 index 00000000..47aac304 --- /dev/null +++ b/golang/gen/models/success.go @@ -0,0 +1,64 @@ +// 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/embedded_spec.go b/golang/gen/restapi/embedded_spec.go index 4e08594f..32753475 100644 --- a/golang/gen/restapi/embedded_spec.go +++ b/golang/gen/restapi/embedded_spec.go @@ -54,6 +54,44 @@ func init() { "$ref": "#/definitions/creator_entity" } }, + "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": { @@ -94,14 +132,191 @@ func init() { "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", "required": [ "ident", - "state" + "state", + "name" ], "properties": { "ident": { @@ -117,7 +332,7 @@ func init() { "type": "string" }, "revision": { - "type": "string" + "type": "integer" }, "state": { "type": "string", @@ -130,6 +345,32 @@ func init() { } } }, + "editgroup": { + "type": "object", + "required": [ + "id", + "editor_id" + ], + "properties": { + "editor_id": { + "type": "integer" + }, + "id": { + "type": "integer" + } + } + }, + "editor": { + "type": "object", + "required": [ + "username" + ], + "properties": { + "username": { + "type": "string" + } + } + }, "error": { "type": "object", "required": [ @@ -140,6 +381,17 @@ func init() { "type": "string" } } + }, + "success": { + "type": "object", + "required": [ + "message" + ], + "properties": { + "message": { + "type": "string" + } + } } } }`)) @@ -180,6 +432,44 @@ func init() { "$ref": "#/definitions/creator_entity" } }, + "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": { @@ -220,14 +510,191 @@ func init() { "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", "required": [ "ident", - "state" + "state", + "name" ], "properties": { "ident": { @@ -243,7 +710,7 @@ func init() { "type": "string" }, "revision": { - "type": "string" + "type": "integer" }, "state": { "type": "string", @@ -256,6 +723,32 @@ func init() { } } }, + "editgroup": { + "type": "object", + "required": [ + "id", + "editor_id" + ], + "properties": { + "editor_id": { + "type": "integer" + }, + "id": { + "type": "integer" + } + } + }, + "editor": { + "type": "object", + "required": [ + "username" + ], + "properties": { + "username": { + "type": "string" + } + } + }, "error": { "type": "object", "required": [ @@ -266,6 +759,17 @@ func init() { "type": "string" } } + }, + "success": { + "type": "object", + "required": [ + "message" + ], + "properties": { + "message": { + "type": "string" + } + } } } }`)) diff --git a/golang/gen/restapi/operations/fatcat_api.go b/golang/gen/restapi/operations/fatcat_api.go index 7b60b34f..1b6b465d 100644 --- a/golang/gen/restapi/operations/fatcat_api.go +++ b/golang/gen/restapi/operations/fatcat_api.go @@ -40,9 +40,27 @@ func NewFatcatAPI(spec *loads.Document) *FatcatAPI { 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") + }), } } @@ -76,8 +94,20 @@ type FatcatAPI struct { // 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 @@ -145,10 +175,34 @@ func (o *FatcatAPI) Validate() error { 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, ", ")) } @@ -252,11 +306,41 @@ func (o *FatcatAPI) initHandlerCache() { } 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 diff --git a/golang/gen/restapi/operations/get_creator_lookup.go b/golang/gen/restapi/operations/get_creator_lookup.go new file mode 100644 index 00000000..3e371ceb --- /dev/null +++ b/golang/gen/restapi/operations/get_creator_lookup.go @@ -0,0 +1,58 @@ +// 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 new file mode 100644 index 00000000..3b133cbf --- /dev/null +++ b/golang/gen/restapi/operations/get_creator_lookup_parameters.go @@ -0,0 +1,82 @@ +// 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 new file mode 100644 index 00000000..f4dc7f12 --- /dev/null +++ b/golang/gen/restapi/operations/get_creator_lookup_responses.go @@ -0,0 +1,160 @@ +// 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 new file mode 100644 index 00000000..6f4782d5 --- /dev/null +++ b/golang/gen/restapi/operations/get_creator_lookup_urlbuilder.go @@ -0,0 +1,100 @@ +// 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 new file mode 100644 index 00000000..451193ec --- /dev/null +++ b/golang/gen/restapi/operations/get_editgroup_id.go @@ -0,0 +1,58 @@ +// 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 new file mode 100644 index 00000000..41903ebc --- /dev/null +++ b/golang/gen/restapi/operations/get_editgroup_id_parameters.go @@ -0,0 +1,77 @@ +// 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 new file mode 100644 index 00000000..313be0ca --- /dev/null +++ b/golang/gen/restapi/operations/get_editgroup_id_responses.go @@ -0,0 +1,160 @@ +// 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 new file mode 100644 index 00000000..70484a35 --- /dev/null +++ b/golang/gen/restapi/operations/get_editgroup_id_urlbuilder.go @@ -0,0 +1,101 @@ +// 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 new file mode 100644 index 00000000..3fd18839 --- /dev/null +++ b/golang/gen/restapi/operations/get_editor_username.go @@ -0,0 +1,58 @@ +// 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 new file mode 100644 index 00000000..dbb8ddfc --- /dev/null +++ b/golang/gen/restapi/operations/get_editor_username_changelog.go @@ -0,0 +1,58 @@ +// 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 new file mode 100644 index 00000000..d9958921 --- /dev/null +++ b/golang/gen/restapi/operations/get_editor_username_changelog_parameters.go @@ -0,0 +1,72 @@ +// 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 new file mode 100644 index 00000000..6e0fb3e1 --- /dev/null +++ b/golang/gen/restapi/operations/get_editor_username_changelog_responses.go @@ -0,0 +1,160 @@ +// 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 new file mode 100644 index 00000000..d77e7fdc --- /dev/null +++ b/golang/gen/restapi/operations/get_editor_username_changelog_urlbuilder.go @@ -0,0 +1,99 @@ +// 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 new file mode 100644 index 00000000..c8f57ff7 --- /dev/null +++ b/golang/gen/restapi/operations/get_editor_username_parameters.go @@ -0,0 +1,72 @@ +// 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 new file mode 100644 index 00000000..44b06340 --- /dev/null +++ b/golang/gen/restapi/operations/get_editor_username_responses.go @@ -0,0 +1,160 @@ +// 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 new file mode 100644 index 00000000..fa8597fb --- /dev/null +++ b/golang/gen/restapi/operations/get_editor_username_urlbuilder.go @@ -0,0 +1,99 @@ +// 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_responses.go b/golang/gen/restapi/operations/post_creator_responses.go index 8f8ea571..dcf661a5 100644 --- a/golang/gen/restapi/operations/post_creator_responses.go +++ b/golang/gen/restapi/operations/post_creator_responses.go @@ -57,6 +57,50 @@ func (o *PostCreatorCreated) WriteResponse(rw http.ResponseWriter, producer runt } } +// 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 diff --git a/golang/gen/restapi/operations/post_editgroup.go b/golang/gen/restapi/operations/post_editgroup.go new file mode 100644 index 00000000..1b938ba1 --- /dev/null +++ b/golang/gen/restapi/operations/post_editgroup.go @@ -0,0 +1,58 @@ +// 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 new file mode 100644 index 00000000..121e58cc --- /dev/null +++ b/golang/gen/restapi/operations/post_editgroup_id_accept.go @@ -0,0 +1,58 @@ +// 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 new file mode 100644 index 00000000..967c35e7 --- /dev/null +++ b/golang/gen/restapi/operations/post_editgroup_id_accept_parameters.go @@ -0,0 +1,77 @@ +// 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 new file mode 100644 index 00000000..a414fc1b --- /dev/null +++ b/golang/gen/restapi/operations/post_editgroup_id_accept_responses.go @@ -0,0 +1,204 @@ +// 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 new file mode 100644 index 00000000..1c7362f6 --- /dev/null +++ b/golang/gen/restapi/operations/post_editgroup_id_accept_urlbuilder.go @@ -0,0 +1,101 @@ +// 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 new file mode 100644 index 00000000..261e3209 --- /dev/null +++ b/golang/gen/restapi/operations/post_editgroup_parameters.go @@ -0,0 +1,45 @@ +// 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 new file mode 100644 index 00000000..ae563d88 --- /dev/null +++ b/golang/gen/restapi/operations/post_editgroup_responses.go @@ -0,0 +1,160 @@ +// 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 new file mode 100644 index 00000000..9a636968 --- /dev/null +++ b/golang/gen/restapi/operations/post_editgroup_urlbuilder.go @@ -0,0 +1,87 @@ +// 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() +} -- cgit v1.2.3