Skip to content

Add definitions to create auth tickets and tokens. #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions go/models/access_token.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package models

import "github.com/go-openapi/strfmt"

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

/*AccessToken access token

swagger:model accessToken
*/
type AccessToken struct {

/* access token
*/
AccessToken string `json:"access_token,omitempty"`

/* created at
*/
CreatedAt string `json:"created_at,omitempty"`

/* id
*/
ID string `json:"id,omitempty"`

/* user email
*/
UserEmail string `json:"user_email,omitempty"`

/* user id
*/
UserID string `json:"user_id,omitempty"`
}

// Validate validates this access token
func (m *AccessToken) Validate(formats strfmt.Registry) error {
return nil
}
34 changes: 34 additions & 0 deletions go/models/ticket.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package models

import "github.com/go-openapi/strfmt"

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

/*Ticket ticket

swagger:model ticket
*/
type Ticket struct {

/* authorized
*/
Authorized bool `json:"authorized,omitempty"`

/* client id
*/
ClientID string `json:"client_id,omitempty"`

/* created at
*/
CreatedAt string `json:"created_at,omitempty"`

/* id
*/
ID string `json:"id,omitempty"`
}

// Validate validates this ticket
func (m *Ticket) Validate(formats strfmt.Registry) error {
return nil
}
53 changes: 53 additions & 0 deletions go/plumbing/operations/create_ticket_parameters.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
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 (
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"

strfmt "github.com/go-openapi/strfmt"
)

// NewCreateTicketParams creates a new CreateTicketParams object
// with the default values initialized.
func NewCreateTicketParams() *CreateTicketParams {
var ()
return &CreateTicketParams{}
}

/*CreateTicketParams contains all the parameters to send to the API endpoint
for the create ticket operation typically these are written to a http.Request
*/
type CreateTicketParams struct {

/*ClientID*/
ClientID string
}

// WithClientID adds the clientId to the create ticket params
func (o *CreateTicketParams) WithClientID(ClientID string) *CreateTicketParams {
o.ClientID = ClientID
return o
}

// WriteToRequest writes these params to a swagger request
func (o *CreateTicketParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {

var res []error

// query param client_id
qrClientID := o.ClientID
qClientID := qrClientID
if qClientID != "" {
if err := r.SetQueryParam("client_id", qClientID); err != nil {
return err
}
}

if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
107 changes: 107 additions & 0 deletions go/plumbing/operations/create_ticket_responses.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
package operations

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
"fmt"
"io"

"github.com/go-openapi/runtime"

strfmt "github.com/go-openapi/strfmt"

"github.com/netlify/open-api/go/models"
)

// CreateTicketReader is a Reader for the CreateTicket structure.
type CreateTicketReader struct {
formats strfmt.Registry
}

// ReadResponse reads a server response into the recieved o.
func (o *CreateTicketReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {

case 201:
result := NewCreateTicketCreated()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil

default:
result := NewCreateTicketDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
}
}

// NewCreateTicketCreated creates a CreateTicketCreated with default headers values
func NewCreateTicketCreated() *CreateTicketCreated {
return &CreateTicketCreated{}
}

/*CreateTicketCreated handles this case with default header values.

ok
*/
type CreateTicketCreated struct {
Payload *models.Ticket
}

func (o *CreateTicketCreated) Error() string {
return fmt.Sprintf("[POST /oauth/tickets][%d] createTicketCreated %+v", 201, o.Payload)
}

func (o *CreateTicketCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

o.Payload = new(models.Ticket)

// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}

return nil
}

// NewCreateTicketDefault creates a CreateTicketDefault with default headers values
func NewCreateTicketDefault(code int) *CreateTicketDefault {
return &CreateTicketDefault{
_statusCode: code,
}
}

/*CreateTicketDefault handles this case with default header values.

error
*/
type CreateTicketDefault struct {
_statusCode int

Payload *models.Error
}

// Code gets the status code for the create ticket default response
func (o *CreateTicketDefault) Code() int {
return o._statusCode
}

func (o *CreateTicketDefault) Error() string {
return fmt.Sprintf("[POST /oauth/tickets][%d] createTicket default %+v", o._statusCode, o.Payload)
}

func (o *CreateTicketDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

o.Payload = new(models.Error)

// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}

return nil
}
49 changes: 49 additions & 0 deletions go/plumbing/operations/exchange_ticket_parameters.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
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 (
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"

strfmt "github.com/go-openapi/strfmt"
)

// NewExchangeTicketParams creates a new ExchangeTicketParams object
// with the default values initialized.
func NewExchangeTicketParams() *ExchangeTicketParams {
var ()
return &ExchangeTicketParams{}
}

/*ExchangeTicketParams contains all the parameters to send to the API endpoint
for the exchange ticket operation typically these are written to a http.Request
*/
type ExchangeTicketParams struct {

/*TicketID*/
TicketID string
}

// WithTicketID adds the ticketId to the exchange ticket params
func (o *ExchangeTicketParams) WithTicketID(TicketID string) *ExchangeTicketParams {
o.TicketID = TicketID
return o
}

// WriteToRequest writes these params to a swagger request
func (o *ExchangeTicketParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {

var res []error

// path param ticket_id
if err := r.SetPathParam("ticket_id", o.TicketID); err != nil {
return err
}

if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
107 changes: 107 additions & 0 deletions go/plumbing/operations/exchange_ticket_responses.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
package operations

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
"fmt"
"io"

"github.com/go-openapi/runtime"

strfmt "github.com/go-openapi/strfmt"

"github.com/netlify/open-api/go/models"
)

// ExchangeTicketReader is a Reader for the ExchangeTicket structure.
type ExchangeTicketReader struct {
formats strfmt.Registry
}

// ReadResponse reads a server response into the recieved o.
func (o *ExchangeTicketReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {

case 201:
result := NewExchangeTicketCreated()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil

default:
result := NewExchangeTicketDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
}
}

// NewExchangeTicketCreated creates a ExchangeTicketCreated with default headers values
func NewExchangeTicketCreated() *ExchangeTicketCreated {
return &ExchangeTicketCreated{}
}

/*ExchangeTicketCreated handles this case with default header values.

ok
*/
type ExchangeTicketCreated struct {
Payload *models.AccessToken
}

func (o *ExchangeTicketCreated) Error() string {
return fmt.Sprintf("[POST /oauth/tickets/{ticket_id}/exchange][%d] exchangeTicketCreated %+v", 201, o.Payload)
}

func (o *ExchangeTicketCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

o.Payload = new(models.AccessToken)

// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}

return nil
}

// NewExchangeTicketDefault creates a ExchangeTicketDefault with default headers values
func NewExchangeTicketDefault(code int) *ExchangeTicketDefault {
return &ExchangeTicketDefault{
_statusCode: code,
}
}

/*ExchangeTicketDefault handles this case with default header values.

error
*/
type ExchangeTicketDefault struct {
_statusCode int

Payload *models.Error
}

// Code gets the status code for the exchange ticket default response
func (o *ExchangeTicketDefault) Code() int {
return o._statusCode
}

func (o *ExchangeTicketDefault) Error() string {
return fmt.Sprintf("[POST /oauth/tickets/{ticket_id}/exchange][%d] exchangeTicket default %+v", o._statusCode, o.Payload)
}

func (o *ExchangeTicketDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

o.Payload = new(models.Error)

// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}

return nil
}
Loading