Initial cloud-services repo - gateway service + pkg modules
This commit is contained in:
108
pkg/ota_api/client/e_c_u/ecu_client.go
Normal file
108
pkg/ota_api/client/e_c_u/ecu_client.go
Normal file
@@ -0,0 +1,108 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package e_c_u
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
httptransport "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// New creates a new e c u API client.
|
||||
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
|
||||
return &Client{transport: transport, formats: formats}
|
||||
}
|
||||
|
||||
// New creates a new e c u API client with basic auth credentials.
|
||||
// It takes the following parameters:
|
||||
// - host: http host (github.com).
|
||||
// - basePath: any base path for the API client ("/v1", "/v3").
|
||||
// - scheme: http scheme ("http", "https").
|
||||
// - user: user for basic authentication header.
|
||||
// - password: password for basic authentication header.
|
||||
func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService {
|
||||
transport := httptransport.New(host, basePath, []string{scheme})
|
||||
transport.DefaultAuthentication = httptransport.BasicAuth(user, password)
|
||||
return &Client{transport: transport, formats: strfmt.Default}
|
||||
}
|
||||
|
||||
// New creates a new e c u API client with a bearer token for authentication.
|
||||
// It takes the following parameters:
|
||||
// - host: http host (github.com).
|
||||
// - basePath: any base path for the API client ("/v1", "/v3").
|
||||
// - scheme: http scheme ("http", "https").
|
||||
// - bearerToken: bearer token for Bearer authentication header.
|
||||
func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService {
|
||||
transport := httptransport.New(host, basePath, []string{scheme})
|
||||
transport.DefaultAuthentication = httptransport.BearerToken(bearerToken)
|
||||
return &Client{transport: transport, formats: strfmt.Default}
|
||||
}
|
||||
|
||||
/*
|
||||
Client for e c u API
|
||||
*/
|
||||
type Client struct {
|
||||
transport runtime.ClientTransport
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ClientOption may be used to customize the behavior of Client methods.
|
||||
type ClientOption func(*runtime.ClientOperation)
|
||||
|
||||
// ClientService is the interface for Client methods
|
||||
type ClientService interface {
|
||||
GetDtcsVin(params *GetDtcsVinParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetDtcsVinOK, error)
|
||||
|
||||
SetTransport(transport runtime.ClientTransport)
|
||||
}
|
||||
|
||||
/*
|
||||
GetDtcsVin gets e c u d t cs for a specific vehicle
|
||||
|
||||
Get ECU diagnostic trouble codes (DTCs) for a specific vehicle within a given time range
|
||||
*/
|
||||
func (a *Client) GetDtcsVin(params *GetDtcsVinParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetDtcsVinOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewGetDtcsVinParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "GetDtcsVin",
|
||||
Method: "GET",
|
||||
PathPattern: "/dtcs/{vin}",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"https"},
|
||||
Params: params,
|
||||
Reader: &GetDtcsVinReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*GetDtcsVinOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
|
||||
msg := fmt.Sprintf("unexpected success response for GetDtcsVin: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
// SetTransport changes the transport on the client
|
||||
func (a *Client) SetTransport(transport runtime.ClientTransport) {
|
||||
a.transport = transport
|
||||
}
|
||||
424
pkg/ota_api/client/e_c_u/get_dtcs_vin_parameters.go
Normal file
424
pkg/ota_api/client/e_c_u/get_dtcs_vin_parameters.go
Normal file
@@ -0,0 +1,424 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package e_c_u
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// NewGetDtcsVinParams creates a new GetDtcsVinParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewGetDtcsVinParams() *GetDtcsVinParams {
|
||||
return &GetDtcsVinParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetDtcsVinParamsWithTimeout creates a new GetDtcsVinParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewGetDtcsVinParamsWithTimeout(timeout time.Duration) *GetDtcsVinParams {
|
||||
return &GetDtcsVinParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetDtcsVinParamsWithContext creates a new GetDtcsVinParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewGetDtcsVinParamsWithContext(ctx context.Context) *GetDtcsVinParams {
|
||||
return &GetDtcsVinParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetDtcsVinParamsWithHTTPClient creates a new GetDtcsVinParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewGetDtcsVinParamsWithHTTPClient(client *http.Client) *GetDtcsVinParams {
|
||||
return &GetDtcsVinParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
GetDtcsVinParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the get dtcs vin operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type GetDtcsVinParams struct {
|
||||
|
||||
/* Decode.
|
||||
|
||||
Return decoded dtc information
|
||||
*/
|
||||
Decode *bool
|
||||
|
||||
/* Ecu.
|
||||
|
||||
ECU
|
||||
*/
|
||||
Ecu *string
|
||||
|
||||
/* EndTime.
|
||||
|
||||
End time (RFC3339 format)
|
||||
*/
|
||||
EndTime *string
|
||||
|
||||
/* Limit.
|
||||
|
||||
Max number of records
|
||||
*/
|
||||
Limit *int64
|
||||
|
||||
/* Offset.
|
||||
|
||||
Records offset
|
||||
*/
|
||||
Offset *int64
|
||||
|
||||
/* Order.
|
||||
|
||||
Sort on column with asc or desc
|
||||
*/
|
||||
Order *string
|
||||
|
||||
/* StartTime.
|
||||
|
||||
Start time (RFC3339 format)
|
||||
*/
|
||||
StartTime *string
|
||||
|
||||
/* TroubleCode.
|
||||
|
||||
Trouble Code
|
||||
*/
|
||||
TroubleCode *string
|
||||
|
||||
/* Vin.
|
||||
|
||||
VIN
|
||||
*/
|
||||
Vin string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the get dtcs vin params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *GetDtcsVinParams) WithDefaults() *GetDtcsVinParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the get dtcs vin params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *GetDtcsVinParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the get dtcs vin params
|
||||
func (o *GetDtcsVinParams) WithTimeout(timeout time.Duration) *GetDtcsVinParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the get dtcs vin params
|
||||
func (o *GetDtcsVinParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the get dtcs vin params
|
||||
func (o *GetDtcsVinParams) WithContext(ctx context.Context) *GetDtcsVinParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the get dtcs vin params
|
||||
func (o *GetDtcsVinParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the get dtcs vin params
|
||||
func (o *GetDtcsVinParams) WithHTTPClient(client *http.Client) *GetDtcsVinParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the get dtcs vin params
|
||||
func (o *GetDtcsVinParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithDecode adds the decode to the get dtcs vin params
|
||||
func (o *GetDtcsVinParams) WithDecode(decode *bool) *GetDtcsVinParams {
|
||||
o.SetDecode(decode)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDecode adds the decode to the get dtcs vin params
|
||||
func (o *GetDtcsVinParams) SetDecode(decode *bool) {
|
||||
o.Decode = decode
|
||||
}
|
||||
|
||||
// WithEcu adds the ecu to the get dtcs vin params
|
||||
func (o *GetDtcsVinParams) WithEcu(ecu *string) *GetDtcsVinParams {
|
||||
o.SetEcu(ecu)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetEcu adds the ecu to the get dtcs vin params
|
||||
func (o *GetDtcsVinParams) SetEcu(ecu *string) {
|
||||
o.Ecu = ecu
|
||||
}
|
||||
|
||||
// WithEndTime adds the endTime to the get dtcs vin params
|
||||
func (o *GetDtcsVinParams) WithEndTime(endTime *string) *GetDtcsVinParams {
|
||||
o.SetEndTime(endTime)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetEndTime adds the endTime to the get dtcs vin params
|
||||
func (o *GetDtcsVinParams) SetEndTime(endTime *string) {
|
||||
o.EndTime = endTime
|
||||
}
|
||||
|
||||
// WithLimit adds the limit to the get dtcs vin params
|
||||
func (o *GetDtcsVinParams) WithLimit(limit *int64) *GetDtcsVinParams {
|
||||
o.SetLimit(limit)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetLimit adds the limit to the get dtcs vin params
|
||||
func (o *GetDtcsVinParams) SetLimit(limit *int64) {
|
||||
o.Limit = limit
|
||||
}
|
||||
|
||||
// WithOffset adds the offset to the get dtcs vin params
|
||||
func (o *GetDtcsVinParams) WithOffset(offset *int64) *GetDtcsVinParams {
|
||||
o.SetOffset(offset)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOffset adds the offset to the get dtcs vin params
|
||||
func (o *GetDtcsVinParams) SetOffset(offset *int64) {
|
||||
o.Offset = offset
|
||||
}
|
||||
|
||||
// WithOrder adds the order to the get dtcs vin params
|
||||
func (o *GetDtcsVinParams) WithOrder(order *string) *GetDtcsVinParams {
|
||||
o.SetOrder(order)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOrder adds the order to the get dtcs vin params
|
||||
func (o *GetDtcsVinParams) SetOrder(order *string) {
|
||||
o.Order = order
|
||||
}
|
||||
|
||||
// WithStartTime adds the startTime to the get dtcs vin params
|
||||
func (o *GetDtcsVinParams) WithStartTime(startTime *string) *GetDtcsVinParams {
|
||||
o.SetStartTime(startTime)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStartTime adds the startTime to the get dtcs vin params
|
||||
func (o *GetDtcsVinParams) SetStartTime(startTime *string) {
|
||||
o.StartTime = startTime
|
||||
}
|
||||
|
||||
// WithTroubleCode adds the troubleCode to the get dtcs vin params
|
||||
func (o *GetDtcsVinParams) WithTroubleCode(troubleCode *string) *GetDtcsVinParams {
|
||||
o.SetTroubleCode(troubleCode)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTroubleCode adds the troubleCode to the get dtcs vin params
|
||||
func (o *GetDtcsVinParams) SetTroubleCode(troubleCode *string) {
|
||||
o.TroubleCode = troubleCode
|
||||
}
|
||||
|
||||
// WithVin adds the vin to the get dtcs vin params
|
||||
func (o *GetDtcsVinParams) WithVin(vin string) *GetDtcsVinParams {
|
||||
o.SetVin(vin)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetVin adds the vin to the get dtcs vin params
|
||||
func (o *GetDtcsVinParams) SetVin(vin string) {
|
||||
o.Vin = vin
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *GetDtcsVinParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
if o.Decode != nil {
|
||||
|
||||
// query param decode
|
||||
var qrDecode bool
|
||||
|
||||
if o.Decode != nil {
|
||||
qrDecode = *o.Decode
|
||||
}
|
||||
qDecode := swag.FormatBool(qrDecode)
|
||||
if qDecode != "" {
|
||||
|
||||
if err := r.SetQueryParam("decode", qDecode); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if o.Ecu != nil {
|
||||
|
||||
// query param ecu
|
||||
var qrEcu string
|
||||
|
||||
if o.Ecu != nil {
|
||||
qrEcu = *o.Ecu
|
||||
}
|
||||
qEcu := qrEcu
|
||||
if qEcu != "" {
|
||||
|
||||
if err := r.SetQueryParam("ecu", qEcu); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if o.EndTime != nil {
|
||||
|
||||
// query param end_time
|
||||
var qrEndTime string
|
||||
|
||||
if o.EndTime != nil {
|
||||
qrEndTime = *o.EndTime
|
||||
}
|
||||
qEndTime := qrEndTime
|
||||
if qEndTime != "" {
|
||||
|
||||
if err := r.SetQueryParam("end_time", qEndTime); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if o.Limit != nil {
|
||||
|
||||
// query param limit
|
||||
var qrLimit int64
|
||||
|
||||
if o.Limit != nil {
|
||||
qrLimit = *o.Limit
|
||||
}
|
||||
qLimit := swag.FormatInt64(qrLimit)
|
||||
if qLimit != "" {
|
||||
|
||||
if err := r.SetQueryParam("limit", qLimit); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if o.Offset != nil {
|
||||
|
||||
// query param offset
|
||||
var qrOffset int64
|
||||
|
||||
if o.Offset != nil {
|
||||
qrOffset = *o.Offset
|
||||
}
|
||||
qOffset := swag.FormatInt64(qrOffset)
|
||||
if qOffset != "" {
|
||||
|
||||
if err := r.SetQueryParam("offset", qOffset); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if o.Order != nil {
|
||||
|
||||
// query param order
|
||||
var qrOrder string
|
||||
|
||||
if o.Order != nil {
|
||||
qrOrder = *o.Order
|
||||
}
|
||||
qOrder := qrOrder
|
||||
if qOrder != "" {
|
||||
|
||||
if err := r.SetQueryParam("order", qOrder); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if o.StartTime != nil {
|
||||
|
||||
// query param start_time
|
||||
var qrStartTime string
|
||||
|
||||
if o.StartTime != nil {
|
||||
qrStartTime = *o.StartTime
|
||||
}
|
||||
qStartTime := qrStartTime
|
||||
if qStartTime != "" {
|
||||
|
||||
if err := r.SetQueryParam("start_time", qStartTime); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if o.TroubleCode != nil {
|
||||
|
||||
// query param trouble_code
|
||||
var qrTroubleCode string
|
||||
|
||||
if o.TroubleCode != nil {
|
||||
qrTroubleCode = *o.TroubleCode
|
||||
}
|
||||
qTroubleCode := qrTroubleCode
|
||||
if qTroubleCode != "" {
|
||||
|
||||
if err := r.SetQueryParam("trouble_code", qTroubleCode); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// path param vin
|
||||
if err := r.SetPathParam("vin", o.Vin); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
578
pkg/ota_api/client/e_c_u/get_dtcs_vin_responses.go
Normal file
578
pkg/ota_api/client/e_c_u/get_dtcs_vin_responses.go
Normal file
@@ -0,0 +1,578 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package e_c_u
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"strconv"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
"fiskerinc.com/modules/ota_api/models"
|
||||
)
|
||||
|
||||
// GetDtcsVinReader is a Reader for the GetDtcsVin structure.
|
||||
type GetDtcsVinReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *GetDtcsVinReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewGetDtcsVinOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
case 400:
|
||||
result := NewGetDtcsVinBadRequest()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
case 401:
|
||||
result := NewGetDtcsVinUnauthorized()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
case 404:
|
||||
result := NewGetDtcsVinNotFound()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
case 503:
|
||||
result := NewGetDtcsVinServiceUnavailable()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
default:
|
||||
return nil, runtime.NewAPIError("[GET /dtcs/{vin}] GetDtcsVin", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetDtcsVinOK creates a GetDtcsVinOK with default headers values
|
||||
func NewGetDtcsVinOK() *GetDtcsVinOK {
|
||||
return &GetDtcsVinOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
GetDtcsVinOK describes a response with status code 200, with default header values.
|
||||
|
||||
List of DTC ECU data
|
||||
*/
|
||||
type GetDtcsVinOK struct {
|
||||
Payload *GetDtcsVinOKBody
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get dtcs vin o k response has a 2xx status code
|
||||
func (o *GetDtcsVinOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get dtcs vin o k response has a 3xx status code
|
||||
func (o *GetDtcsVinOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get dtcs vin o k response has a 4xx status code
|
||||
func (o *GetDtcsVinOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get dtcs vin o k response has a 5xx status code
|
||||
func (o *GetDtcsVinOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this get dtcs vin o k response a status code equal to that given
|
||||
func (o *GetDtcsVinOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the get dtcs vin o k response
|
||||
func (o *GetDtcsVinOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *GetDtcsVinOK) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /dtcs/{vin}][%d] getDtcsVinOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *GetDtcsVinOK) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /dtcs/{vin}][%d] getDtcsVinOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *GetDtcsVinOK) GetPayload() *GetDtcsVinOKBody {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *GetDtcsVinOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(GetDtcsVinOKBody)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewGetDtcsVinBadRequest creates a GetDtcsVinBadRequest with default headers values
|
||||
func NewGetDtcsVinBadRequest() *GetDtcsVinBadRequest {
|
||||
return &GetDtcsVinBadRequest{}
|
||||
}
|
||||
|
||||
/*
|
||||
GetDtcsVinBadRequest describes a response with status code 400, with default header values.
|
||||
|
||||
Bad request
|
||||
*/
|
||||
type GetDtcsVinBadRequest struct {
|
||||
Payload *models.CommonJSONError
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get dtcs vin bad request response has a 2xx status code
|
||||
func (o *GetDtcsVinBadRequest) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get dtcs vin bad request response has a 3xx status code
|
||||
func (o *GetDtcsVinBadRequest) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get dtcs vin bad request response has a 4xx status code
|
||||
func (o *GetDtcsVinBadRequest) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get dtcs vin bad request response has a 5xx status code
|
||||
func (o *GetDtcsVinBadRequest) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this get dtcs vin bad request response a status code equal to that given
|
||||
func (o *GetDtcsVinBadRequest) IsCode(code int) bool {
|
||||
return code == 400
|
||||
}
|
||||
|
||||
// Code gets the status code for the get dtcs vin bad request response
|
||||
func (o *GetDtcsVinBadRequest) Code() int {
|
||||
return 400
|
||||
}
|
||||
|
||||
func (o *GetDtcsVinBadRequest) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /dtcs/{vin}][%d] getDtcsVinBadRequest %s", 400, payload)
|
||||
}
|
||||
|
||||
func (o *GetDtcsVinBadRequest) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /dtcs/{vin}][%d] getDtcsVinBadRequest %s", 400, payload)
|
||||
}
|
||||
|
||||
func (o *GetDtcsVinBadRequest) GetPayload() *models.CommonJSONError {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *GetDtcsVinBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.CommonJSONError)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewGetDtcsVinUnauthorized creates a GetDtcsVinUnauthorized with default headers values
|
||||
func NewGetDtcsVinUnauthorized() *GetDtcsVinUnauthorized {
|
||||
return &GetDtcsVinUnauthorized{}
|
||||
}
|
||||
|
||||
/*
|
||||
GetDtcsVinUnauthorized describes a response with status code 401, with default header values.
|
||||
|
||||
Unauthorized
|
||||
*/
|
||||
type GetDtcsVinUnauthorized struct {
|
||||
Payload *models.CommonJSONError
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get dtcs vin unauthorized response has a 2xx status code
|
||||
func (o *GetDtcsVinUnauthorized) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get dtcs vin unauthorized response has a 3xx status code
|
||||
func (o *GetDtcsVinUnauthorized) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get dtcs vin unauthorized response has a 4xx status code
|
||||
func (o *GetDtcsVinUnauthorized) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get dtcs vin unauthorized response has a 5xx status code
|
||||
func (o *GetDtcsVinUnauthorized) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this get dtcs vin unauthorized response a status code equal to that given
|
||||
func (o *GetDtcsVinUnauthorized) IsCode(code int) bool {
|
||||
return code == 401
|
||||
}
|
||||
|
||||
// Code gets the status code for the get dtcs vin unauthorized response
|
||||
func (o *GetDtcsVinUnauthorized) Code() int {
|
||||
return 401
|
||||
}
|
||||
|
||||
func (o *GetDtcsVinUnauthorized) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /dtcs/{vin}][%d] getDtcsVinUnauthorized %s", 401, payload)
|
||||
}
|
||||
|
||||
func (o *GetDtcsVinUnauthorized) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /dtcs/{vin}][%d] getDtcsVinUnauthorized %s", 401, payload)
|
||||
}
|
||||
|
||||
func (o *GetDtcsVinUnauthorized) GetPayload() *models.CommonJSONError {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *GetDtcsVinUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.CommonJSONError)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewGetDtcsVinNotFound creates a GetDtcsVinNotFound with default headers values
|
||||
func NewGetDtcsVinNotFound() *GetDtcsVinNotFound {
|
||||
return &GetDtcsVinNotFound{}
|
||||
}
|
||||
|
||||
/*
|
||||
GetDtcsVinNotFound describes a response with status code 404, with default header values.
|
||||
|
||||
Not found
|
||||
*/
|
||||
type GetDtcsVinNotFound struct {
|
||||
Payload *models.CommonJSONError
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get dtcs vin not found response has a 2xx status code
|
||||
func (o *GetDtcsVinNotFound) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get dtcs vin not found response has a 3xx status code
|
||||
func (o *GetDtcsVinNotFound) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get dtcs vin not found response has a 4xx status code
|
||||
func (o *GetDtcsVinNotFound) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get dtcs vin not found response has a 5xx status code
|
||||
func (o *GetDtcsVinNotFound) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this get dtcs vin not found response a status code equal to that given
|
||||
func (o *GetDtcsVinNotFound) IsCode(code int) bool {
|
||||
return code == 404
|
||||
}
|
||||
|
||||
// Code gets the status code for the get dtcs vin not found response
|
||||
func (o *GetDtcsVinNotFound) Code() int {
|
||||
return 404
|
||||
}
|
||||
|
||||
func (o *GetDtcsVinNotFound) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /dtcs/{vin}][%d] getDtcsVinNotFound %s", 404, payload)
|
||||
}
|
||||
|
||||
func (o *GetDtcsVinNotFound) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /dtcs/{vin}][%d] getDtcsVinNotFound %s", 404, payload)
|
||||
}
|
||||
|
||||
func (o *GetDtcsVinNotFound) GetPayload() *models.CommonJSONError {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *GetDtcsVinNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.CommonJSONError)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewGetDtcsVinServiceUnavailable creates a GetDtcsVinServiceUnavailable with default headers values
|
||||
func NewGetDtcsVinServiceUnavailable() *GetDtcsVinServiceUnavailable {
|
||||
return &GetDtcsVinServiceUnavailable{}
|
||||
}
|
||||
|
||||
/*
|
||||
GetDtcsVinServiceUnavailable describes a response with status code 503, with default header values.
|
||||
|
||||
Service unavailable
|
||||
*/
|
||||
type GetDtcsVinServiceUnavailable struct {
|
||||
Payload *models.CommonJSONError
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get dtcs vin service unavailable response has a 2xx status code
|
||||
func (o *GetDtcsVinServiceUnavailable) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get dtcs vin service unavailable response has a 3xx status code
|
||||
func (o *GetDtcsVinServiceUnavailable) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get dtcs vin service unavailable response has a 4xx status code
|
||||
func (o *GetDtcsVinServiceUnavailable) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get dtcs vin service unavailable response has a 5xx status code
|
||||
func (o *GetDtcsVinServiceUnavailable) IsServerError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsCode returns true when this get dtcs vin service unavailable response a status code equal to that given
|
||||
func (o *GetDtcsVinServiceUnavailable) IsCode(code int) bool {
|
||||
return code == 503
|
||||
}
|
||||
|
||||
// Code gets the status code for the get dtcs vin service unavailable response
|
||||
func (o *GetDtcsVinServiceUnavailable) Code() int {
|
||||
return 503
|
||||
}
|
||||
|
||||
func (o *GetDtcsVinServiceUnavailable) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /dtcs/{vin}][%d] getDtcsVinServiceUnavailable %s", 503, payload)
|
||||
}
|
||||
|
||||
func (o *GetDtcsVinServiceUnavailable) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /dtcs/{vin}][%d] getDtcsVinServiceUnavailable %s", 503, payload)
|
||||
}
|
||||
|
||||
func (o *GetDtcsVinServiceUnavailable) GetPayload() *models.CommonJSONError {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *GetDtcsVinServiceUnavailable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.CommonJSONError)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
/*
|
||||
GetDtcsVinOKBody get dtcs vin o k body
|
||||
swagger:model GetDtcsVinOKBody
|
||||
*/
|
||||
type GetDtcsVinOKBody struct {
|
||||
models.CommonJSONDBQueryResult
|
||||
|
||||
// data
|
||||
Data []*models.CommonDTCECU `json:"data"`
|
||||
}
|
||||
|
||||
// UnmarshalJSON unmarshals this object from a JSON structure
|
||||
func (o *GetDtcsVinOKBody) UnmarshalJSON(raw []byte) error {
|
||||
// GetDtcsVinOKBodyAO0
|
||||
var getDtcsVinOKBodyAO0 models.CommonJSONDBQueryResult
|
||||
if err := swag.ReadJSON(raw, &getDtcsVinOKBodyAO0); err != nil {
|
||||
return err
|
||||
}
|
||||
o.CommonJSONDBQueryResult = getDtcsVinOKBodyAO0
|
||||
|
||||
// GetDtcsVinOKBodyAO1
|
||||
var dataGetDtcsVinOKBodyAO1 struct {
|
||||
Data []*models.CommonDTCECU `json:"data"`
|
||||
}
|
||||
if err := swag.ReadJSON(raw, &dataGetDtcsVinOKBodyAO1); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
o.Data = dataGetDtcsVinOKBodyAO1.Data
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalJSON marshals this object to a JSON structure
|
||||
func (o GetDtcsVinOKBody) MarshalJSON() ([]byte, error) {
|
||||
_parts := make([][]byte, 0, 2)
|
||||
|
||||
getDtcsVinOKBodyAO0, err := swag.WriteJSON(o.CommonJSONDBQueryResult)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_parts = append(_parts, getDtcsVinOKBodyAO0)
|
||||
var dataGetDtcsVinOKBodyAO1 struct {
|
||||
Data []*models.CommonDTCECU `json:"data"`
|
||||
}
|
||||
|
||||
dataGetDtcsVinOKBodyAO1.Data = o.Data
|
||||
|
||||
jsonDataGetDtcsVinOKBodyAO1, errGetDtcsVinOKBodyAO1 := swag.WriteJSON(dataGetDtcsVinOKBodyAO1)
|
||||
if errGetDtcsVinOKBodyAO1 != nil {
|
||||
return nil, errGetDtcsVinOKBodyAO1
|
||||
}
|
||||
_parts = append(_parts, jsonDataGetDtcsVinOKBodyAO1)
|
||||
return swag.ConcatJSON(_parts...), nil
|
||||
}
|
||||
|
||||
// Validate validates this get dtcs vin o k body
|
||||
func (o *GetDtcsVinOKBody) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
// validation for a type composition with models.CommonJSONDBQueryResult
|
||||
if err := o.CommonJSONDBQueryResult.Validate(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := o.validateData(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *GetDtcsVinOKBody) validateData(formats strfmt.Registry) error {
|
||||
|
||||
if swag.IsZero(o.Data) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < len(o.Data); i++ {
|
||||
if swag.IsZero(o.Data[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if o.Data[i] != nil {
|
||||
if err := o.Data[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("getDtcsVinOK" + "." + "data" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("getDtcsVinOK" + "." + "data" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this get dtcs vin o k body based on the context it is used
|
||||
func (o *GetDtcsVinOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
// validation for a type composition with models.CommonJSONDBQueryResult
|
||||
if err := o.CommonJSONDBQueryResult.ContextValidate(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := o.contextValidateData(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *GetDtcsVinOKBody) contextValidateData(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
for i := 0; i < len(o.Data); i++ {
|
||||
|
||||
if o.Data[i] != nil {
|
||||
|
||||
if swag.IsZero(o.Data[i]) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := o.Data[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("getDtcsVinOK" + "." + "data" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("getDtcsVinOK" + "." + "data" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (o *GetDtcsVinOKBody) MarshalBinary() ([]byte, error) {
|
||||
if o == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(o)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (o *GetDtcsVinOKBody) UnmarshalBinary(b []byte) error {
|
||||
var res GetDtcsVinOKBody
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*o = res
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user