...

Source file src/github.com/sigstore/timestamp-authority/pkg/generated/client/timestamp/get_timestamp_response_responses.go

Documentation: github.com/sigstore/timestamp-authority/pkg/generated/client/timestamp

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  // Copyright 2022 The Sigstore Authors.
     4  //
     5  // Licensed under the Apache License, Version 2.0 (the "License");
     6  // you may not use this file except in compliance with the License.
     7  // You may obtain a copy of the License at
     8  //
     9  //     http://www.apache.org/licenses/LICENSE-2.0
    10  //
    11  // Unless required by applicable law or agreed to in writing, software
    12  // distributed under the License is distributed on an "AS IS" BASIS,
    13  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14  // See the License for the specific language governing permissions and
    15  // limitations under the License.
    16  //
    17  
    18  package timestamp
    19  
    20  // This file was generated by the swagger tool.
    21  // Editing this file might prove futile when you re-run the swagger generate command
    22  
    23  import (
    24  	"fmt"
    25  	"io"
    26  
    27  	"github.com/go-openapi/runtime"
    28  	"github.com/go-openapi/strfmt"
    29  
    30  	"github.com/sigstore/timestamp-authority/pkg/generated/models"
    31  )
    32  
    33  // GetTimestampResponseReader is a Reader for the GetTimestampResponse structure.
    34  type GetTimestampResponseReader struct {
    35  	formats strfmt.Registry
    36  	writer  io.Writer
    37  }
    38  
    39  // ReadResponse reads a server response into the received o.
    40  func (o *GetTimestampResponseReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
    41  	switch response.Code() {
    42  	case 201:
    43  		result := NewGetTimestampResponseCreated(o.writer)
    44  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    45  			return nil, err
    46  		}
    47  		return result, nil
    48  	case 400:
    49  		result := NewGetTimestampResponseBadRequest()
    50  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    51  			return nil, err
    52  		}
    53  		return nil, result
    54  	case 501:
    55  		result := NewGetTimestampResponseNotImplemented()
    56  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    57  			return nil, err
    58  		}
    59  		return nil, result
    60  	default:
    61  		result := NewGetTimestampResponseDefault(response.Code())
    62  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    63  			return nil, err
    64  		}
    65  		if response.Code()/100 == 2 {
    66  			return result, nil
    67  		}
    68  		return nil, result
    69  	}
    70  }
    71  
    72  // NewGetTimestampResponseCreated creates a GetTimestampResponseCreated with default headers values
    73  func NewGetTimestampResponseCreated(writer io.Writer) *GetTimestampResponseCreated {
    74  	return &GetTimestampResponseCreated{
    75  
    76  		Payload: writer,
    77  	}
    78  }
    79  
    80  /*
    81  GetTimestampResponseCreated describes a response with status code 201, with default header values.
    82  
    83  Returns a timestamp response and the location of the log entry in the transprency log
    84  */
    85  type GetTimestampResponseCreated struct {
    86  	Payload io.Writer
    87  }
    88  
    89  // IsSuccess returns true when this get timestamp response created response has a 2xx status code
    90  func (o *GetTimestampResponseCreated) IsSuccess() bool {
    91  	return true
    92  }
    93  
    94  // IsRedirect returns true when this get timestamp response created response has a 3xx status code
    95  func (o *GetTimestampResponseCreated) IsRedirect() bool {
    96  	return false
    97  }
    98  
    99  // IsClientError returns true when this get timestamp response created response has a 4xx status code
   100  func (o *GetTimestampResponseCreated) IsClientError() bool {
   101  	return false
   102  }
   103  
   104  // IsServerError returns true when this get timestamp response created response has a 5xx status code
   105  func (o *GetTimestampResponseCreated) IsServerError() bool {
   106  	return false
   107  }
   108  
   109  // IsCode returns true when this get timestamp response created response a status code equal to that given
   110  func (o *GetTimestampResponseCreated) IsCode(code int) bool {
   111  	return code == 201
   112  }
   113  
   114  // Code gets the status code for the get timestamp response created response
   115  func (o *GetTimestampResponseCreated) Code() int {
   116  	return 201
   117  }
   118  
   119  func (o *GetTimestampResponseCreated) Error() string {
   120  	return fmt.Sprintf("[POST /api/v1/timestamp][%d] getTimestampResponseCreated  %+v", 201, o.Payload)
   121  }
   122  
   123  func (o *GetTimestampResponseCreated) String() string {
   124  	return fmt.Sprintf("[POST /api/v1/timestamp][%d] getTimestampResponseCreated  %+v", 201, o.Payload)
   125  }
   126  
   127  func (o *GetTimestampResponseCreated) GetPayload() io.Writer {
   128  	return o.Payload
   129  }
   130  
   131  func (o *GetTimestampResponseCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   132  
   133  	// response payload
   134  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   135  		return err
   136  	}
   137  
   138  	return nil
   139  }
   140  
   141  // NewGetTimestampResponseBadRequest creates a GetTimestampResponseBadRequest with default headers values
   142  func NewGetTimestampResponseBadRequest() *GetTimestampResponseBadRequest {
   143  	return &GetTimestampResponseBadRequest{}
   144  }
   145  
   146  /*
   147  GetTimestampResponseBadRequest describes a response with status code 400, with default header values.
   148  
   149  The content supplied to the server was invalid
   150  */
   151  type GetTimestampResponseBadRequest struct {
   152  	Payload *models.Error
   153  }
   154  
   155  // IsSuccess returns true when this get timestamp response bad request response has a 2xx status code
   156  func (o *GetTimestampResponseBadRequest) IsSuccess() bool {
   157  	return false
   158  }
   159  
   160  // IsRedirect returns true when this get timestamp response bad request response has a 3xx status code
   161  func (o *GetTimestampResponseBadRequest) IsRedirect() bool {
   162  	return false
   163  }
   164  
   165  // IsClientError returns true when this get timestamp response bad request response has a 4xx status code
   166  func (o *GetTimestampResponseBadRequest) IsClientError() bool {
   167  	return true
   168  }
   169  
   170  // IsServerError returns true when this get timestamp response bad request response has a 5xx status code
   171  func (o *GetTimestampResponseBadRequest) IsServerError() bool {
   172  	return false
   173  }
   174  
   175  // IsCode returns true when this get timestamp response bad request response a status code equal to that given
   176  func (o *GetTimestampResponseBadRequest) IsCode(code int) bool {
   177  	return code == 400
   178  }
   179  
   180  // Code gets the status code for the get timestamp response bad request response
   181  func (o *GetTimestampResponseBadRequest) Code() int {
   182  	return 400
   183  }
   184  
   185  func (o *GetTimestampResponseBadRequest) Error() string {
   186  	return fmt.Sprintf("[POST /api/v1/timestamp][%d] getTimestampResponseBadRequest  %+v", 400, o.Payload)
   187  }
   188  
   189  func (o *GetTimestampResponseBadRequest) String() string {
   190  	return fmt.Sprintf("[POST /api/v1/timestamp][%d] getTimestampResponseBadRequest  %+v", 400, o.Payload)
   191  }
   192  
   193  func (o *GetTimestampResponseBadRequest) GetPayload() *models.Error {
   194  	return o.Payload
   195  }
   196  
   197  func (o *GetTimestampResponseBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   198  
   199  	o.Payload = new(models.Error)
   200  
   201  	// response payload
   202  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   203  		return err
   204  	}
   205  
   206  	return nil
   207  }
   208  
   209  // NewGetTimestampResponseNotImplemented creates a GetTimestampResponseNotImplemented with default headers values
   210  func NewGetTimestampResponseNotImplemented() *GetTimestampResponseNotImplemented {
   211  	return &GetTimestampResponseNotImplemented{}
   212  }
   213  
   214  /*
   215  GetTimestampResponseNotImplemented describes a response with status code 501, with default header values.
   216  
   217  The content requested is not implemented
   218  */
   219  type GetTimestampResponseNotImplemented struct {
   220  }
   221  
   222  // IsSuccess returns true when this get timestamp response not implemented response has a 2xx status code
   223  func (o *GetTimestampResponseNotImplemented) IsSuccess() bool {
   224  	return false
   225  }
   226  
   227  // IsRedirect returns true when this get timestamp response not implemented response has a 3xx status code
   228  func (o *GetTimestampResponseNotImplemented) IsRedirect() bool {
   229  	return false
   230  }
   231  
   232  // IsClientError returns true when this get timestamp response not implemented response has a 4xx status code
   233  func (o *GetTimestampResponseNotImplemented) IsClientError() bool {
   234  	return false
   235  }
   236  
   237  // IsServerError returns true when this get timestamp response not implemented response has a 5xx status code
   238  func (o *GetTimestampResponseNotImplemented) IsServerError() bool {
   239  	return true
   240  }
   241  
   242  // IsCode returns true when this get timestamp response not implemented response a status code equal to that given
   243  func (o *GetTimestampResponseNotImplemented) IsCode(code int) bool {
   244  	return code == 501
   245  }
   246  
   247  // Code gets the status code for the get timestamp response not implemented response
   248  func (o *GetTimestampResponseNotImplemented) Code() int {
   249  	return 501
   250  }
   251  
   252  func (o *GetTimestampResponseNotImplemented) Error() string {
   253  	return fmt.Sprintf("[POST /api/v1/timestamp][%d] getTimestampResponseNotImplemented ", 501)
   254  }
   255  
   256  func (o *GetTimestampResponseNotImplemented) String() string {
   257  	return fmt.Sprintf("[POST /api/v1/timestamp][%d] getTimestampResponseNotImplemented ", 501)
   258  }
   259  
   260  func (o *GetTimestampResponseNotImplemented) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   261  
   262  	return nil
   263  }
   264  
   265  // NewGetTimestampResponseDefault creates a GetTimestampResponseDefault with default headers values
   266  func NewGetTimestampResponseDefault(code int) *GetTimestampResponseDefault {
   267  	return &GetTimestampResponseDefault{
   268  		_statusCode: code,
   269  	}
   270  }
   271  
   272  /*
   273  GetTimestampResponseDefault describes a response with status code -1, with default header values.
   274  
   275  There was an internal error in the server while processing the request
   276  */
   277  type GetTimestampResponseDefault struct {
   278  	_statusCode int
   279  
   280  	Payload *models.Error
   281  }
   282  
   283  // IsSuccess returns true when this get timestamp response default response has a 2xx status code
   284  func (o *GetTimestampResponseDefault) IsSuccess() bool {
   285  	return o._statusCode/100 == 2
   286  }
   287  
   288  // IsRedirect returns true when this get timestamp response default response has a 3xx status code
   289  func (o *GetTimestampResponseDefault) IsRedirect() bool {
   290  	return o._statusCode/100 == 3
   291  }
   292  
   293  // IsClientError returns true when this get timestamp response default response has a 4xx status code
   294  func (o *GetTimestampResponseDefault) IsClientError() bool {
   295  	return o._statusCode/100 == 4
   296  }
   297  
   298  // IsServerError returns true when this get timestamp response default response has a 5xx status code
   299  func (o *GetTimestampResponseDefault) IsServerError() bool {
   300  	return o._statusCode/100 == 5
   301  }
   302  
   303  // IsCode returns true when this get timestamp response default response a status code equal to that given
   304  func (o *GetTimestampResponseDefault) IsCode(code int) bool {
   305  	return o._statusCode == code
   306  }
   307  
   308  // Code gets the status code for the get timestamp response default response
   309  func (o *GetTimestampResponseDefault) Code() int {
   310  	return o._statusCode
   311  }
   312  
   313  func (o *GetTimestampResponseDefault) Error() string {
   314  	return fmt.Sprintf("[POST /api/v1/timestamp][%d] getTimestampResponse default  %+v", o._statusCode, o.Payload)
   315  }
   316  
   317  func (o *GetTimestampResponseDefault) String() string {
   318  	return fmt.Sprintf("[POST /api/v1/timestamp][%d] getTimestampResponse default  %+v", o._statusCode, o.Payload)
   319  }
   320  
   321  func (o *GetTimestampResponseDefault) GetPayload() *models.Error {
   322  	return o.Payload
   323  }
   324  
   325  func (o *GetTimestampResponseDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   326  
   327  	o.Payload = new(models.Error)
   328  
   329  	// response payload
   330  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   331  		return err
   332  	}
   333  
   334  	return nil
   335  }
   336  

View as plain text