Skip to content

Add getDeploy endpoint. #15

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
Dec 31, 2016
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
28 changes: 28 additions & 0 deletions go/models/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,26 @@ swagger:model deploy
*/
type Deploy struct {

/* admin url
*/
AdminURL string `json:"admin_url,omitempty"`

/* branch
*/
Branch string `json:"branch,omitempty"`

/* build id
*/
BuildID string `json:"build_id,omitempty"`

/* commit ref
*/
CommitRef string `json:"commit_ref,omitempty"`

/* commit url
*/
CommitURL string `json:"commit_url,omitempty"`

/* created at
*/
CreatedAt string `json:"created_at,omitempty"`
Expand All @@ -36,10 +52,18 @@ type Deploy struct {
*/
Draft bool `json:"draft,omitempty"`

/* error message
*/
ErrorMessage string `json:"error_message,omitempty"`

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

/* name
*/
Name string `json:"name,omitempty"`

/* required
*/
Required []string `json:"required,omitempty"`
Expand All @@ -56,6 +80,10 @@ type Deploy struct {
*/
SiteID string `json:"site_id,omitempty"`

/* skipped
*/
Skipped bool `json:"skipped,omitempty"`

/* state
*/
State string `json:"state,omitempty"`
Expand Down
49 changes: 49 additions & 0 deletions go/plumbing/operations/get_deploy_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"
)

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

/*GetDeployParams contains all the parameters to send to the API endpoint
for the get deploy operation typically these are written to a http.Request
*/
type GetDeployParams struct {

/*DeployID*/
DeployID string
}

// WithDeployID adds the deployId to the get deploy params
func (o *GetDeployParams) WithDeployID(DeployID string) *GetDeployParams {
o.DeployID = DeployID
return o
}

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

var res []error

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

if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
107 changes: 107 additions & 0 deletions go/plumbing/operations/get_deploy_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"
)

// GetDeployReader is a Reader for the GetDeploy structure.
type GetDeployReader struct {
formats strfmt.Registry
}

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

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

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

// NewGetDeployOK creates a GetDeployOK with default headers values
func NewGetDeployOK() *GetDeployOK {
return &GetDeployOK{}
}

/*GetDeployOK handles this case with default header values.

OK
*/
type GetDeployOK struct {
Payload *models.Deploy
}

func (o *GetDeployOK) Error() string {
return fmt.Sprintf("[GET /deploys/{deploy_id}][%d] getDeployOK %+v", 200, o.Payload)
}

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

o.Payload = new(models.Deploy)

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

return nil
}

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

/*GetDeployDefault handles this case with default header values.

error
*/
type GetDeployDefault struct {
_statusCode int

Payload *models.Error
}

// Code gets the status code for the get deploy default response
func (o *GetDeployDefault) Code() int {
return o._statusCode
}

func (o *GetDeployDefault) Error() string {
return fmt.Sprintf("[GET /deploys/{deploy_id}][%d] getDeploy default %+v", o._statusCode, o.Payload)
}

func (o *GetDeployDefault) 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
}
26 changes: 26 additions & 0 deletions go/plumbing/operations/operations_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,32 @@ func (a *Client) GetDNSForSite(params *GetDNSForSiteParams, authInfo runtime.Cli
return result.(*GetDNSForSiteOK), nil
}

/*
GetDeploy get deploy API
*/
func (a *Client) GetDeploy(params *GetDeployParams, authInfo runtime.ClientAuthInfoWriter) (*GetDeployOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetDeployParams()
}

result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "getDeploy",
Method: "GET",
PathPattern: "/deploys/{deploy_id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &GetDeployReader{formats: a.formats},
AuthInfo: authInfo,
})
if err != nil {
return nil, err
}
return result.(*GetDeployOK), nil
}

/*
GetSite get site API
*/
Expand Down
41 changes: 37 additions & 4 deletions swagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,23 @@ paths:
description: error
schema:
$ref: "#/definitions/error"
/deploys/{deploy_id}:
get:
operationId: getDeploy
parameters:
- name: deploy_id
type: string
in: path
required: true
responses:
'200':
description: OK
schema:
$ref: "#/definitions/deploy"
default:
description: error
schema:
$ref: "#/definitions/error"
/deploys/{deploy_id}/files/{path}:
put:
operationId: uploadDeployFile
Expand Down Expand Up @@ -728,18 +745,22 @@ definitions:
type: string
user_id:
type: string
build_id:
type: string
state:
type: string
name:
type: string
url:
type: string
admin_url:
type: string
deploy_url:
type: string
deploy_ssl_url:
type: string
url:
type: string
screenshot_url:
type: string
commit_ref:
type: string
review_id:
type: string
draft:
Expand All @@ -748,6 +769,18 @@ definitions:
type: array
items:
type: string
error_message:
type: string
review_id:
type: string
branch:
type: string
commit_ref:
type: string
commit_url:
type: string
skipped:
type: boolean
created_at:
type: string
format: dateTime
Expand Down
Loading