Documentation
¶
Overview ¶
Package openapi provides primitives to interact with the openapi HTTP API.
Code generated by github.com/deepmap/oapi-codegen/v2 version v2.1.0 DO NOT EDIT.
Package openapi provides primitives to interact with the openapi HTTP API.
Code generated by github.com/deepmap/oapi-codegen/v2 version v2.1.0 DO NOT EDIT.
Package openapi provides primitives to interact with the openapi HTTP API.
Code generated by github.com/deepmap/oapi-codegen/v2 version v2.1.0 DO NOT EDIT.
Package openapi provides primitives to interact with the openapi HTTP API.
Code generated by github.com/deepmap/oapi-codegen/v2 version v2.1.0 DO NOT EDIT.
Index ¶
- func GetSwagger() (swagger *openapi3.T, err error)
- func NewCreateShipmentRequest(server string, body CreateShipmentJSONRequestBody) (*http.Request, error)
- func NewCreateShipmentRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
- func NewGetDocumentRequest(server string, trackingNo string) (*http.Request, error)
- func NewVoidShipmentRequest(server string, trackingNo string) (*http.Request, error)
- func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)
- func RegisterHandlers(router gin.IRouter, si ServerInterface)
- func RegisterHandlersWithOptions(router gin.IRouter, si ServerInterface, options GinServerOptions)
- type Address
- type Client
- func (c *Client) CreateShipment(ctx context.Context, body CreateShipmentJSONRequestBody, ...) (*http.Response, error)
- func (c *Client) CreateShipmentWithBody(ctx context.Context, contentType string, body io.Reader, ...) (*http.Response, error)
- func (c *Client) GetDocument(ctx context.Context, trackingNo string, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) VoidShipment(ctx context.Context, trackingNo string, reqEditors ...RequestEditorFn) (*http.Response, error)
- type ClientInterface
- type ClientOption
- type ClientWithResponses
- func (c *ClientWithResponses) CreateShipmentWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, ...) (*CreateShipmentResponse, error)
- func (c *ClientWithResponses) CreateShipmentWithResponse(ctx context.Context, body CreateShipmentJSONRequestBody, ...) (*CreateShipmentResponse, error)
- func (c *ClientWithResponses) GetDocumentWithResponse(ctx context.Context, trackingNo string, reqEditors ...RequestEditorFn) (*GetDocumentResponse, error)
- func (c *ClientWithResponses) VoidShipmentWithResponse(ctx context.Context, trackingNo string, reqEditors ...RequestEditorFn) (*VoidShipmentResponse, error)
- type ClientWithResponsesInterface
- type CreateShipmentJSONRequestBody
- type CreateShipmentRequest
- type CreateShipmentRequestPrinterType
- type CreateShipmentRequestShipmentPaymentInformationPaymentType
- type CreateShipmentRequestShipmentPickupInformationPickupType
- type CreateShipmentRes
- type CreateShipmentResponse
- type Dimension
- type DimensionDimensionUnit
- type Error
- type GetDocumentResponse
- type GinServerOptions
- type HttpRequestDoer
- type MiddlewareFunc
- type Piece
- type RequestEditorFn
- type ServerInterface
- type ServerInterfaceWrapper
- type VoidShipmentResponse
- type Weight
- type WeightWeightUnit
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSwagger ¶
GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.
func NewCreateShipmentRequest ¶
func NewCreateShipmentRequest(server string, body CreateShipmentJSONRequestBody) (*http.Request, error)
NewCreateShipmentRequest calls the generic CreateShipment builder with application/json body
func NewCreateShipmentRequestWithBody ¶
func NewCreateShipmentRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
NewCreateShipmentRequestWithBody generates requests for CreateShipment with any type of body
func NewGetDocumentRequest ¶
NewGetDocumentRequest generates requests for GetDocument
func NewVoidShipmentRequest ¶
NewVoidShipmentRequest generates requests for VoidShipment
func PathToRawSpec ¶
Constructs a synthetic filesystem for resolving external references when loading openapi specifications.
func RegisterHandlers ¶
func RegisterHandlers(router gin.IRouter, si ServerInterface)
RegisterHandlers creates http.Handler with routing matching OpenAPI spec.
func RegisterHandlersWithOptions ¶
func RegisterHandlersWithOptions(router gin.IRouter, si ServerInterface, options GinServerOptions)
RegisterHandlersWithOptions creates http.Handler with additional options
Types ¶
type Address ¶
type Address struct { Name string `json:"name" validate:"max=30"` Company *string `json:"company,omitempty" validate:"max=20"` StreetNumber string `json:"streetNumber" validate:"max=6"` StreetName string `json:"streetName" validate:"max=30"` City string `json:"city" validate:"max=30"` Province string `json:"province"` Country string `json:"country"` PostalCode string `json:"postalCode"` PhoneNumber struct { CountryCode *string `json:"countryCode,omitempty"` AreaCode *string `json:"areaCode,omitempty"` Phone *string `json:"phone,omitempty"` } `json:"phoneNumber"` }
Address defines model for Address.
type Client ¶
type Client struct { // The endpoint of the server conforming to this interface, with scheme, // https://api.deepmap.com for example. This can contain a path relative // to the server, such as https://api.deepmap.com/dev-test, and all the // paths in the swagger spec will be appended to the server. Server string // Doer for performing requests, typically a *http.Client with any // customized settings, such as certificate chains. Client HttpRequestDoer // A list of callbacks for modifying requests which are generated before sending over // the network. RequestEditors []RequestEditorFn }
Client which conforms to the OpenAPI3 specification for this service.
func NewClient ¶
func NewClient(server string, opts ...ClientOption) (*Client, error)
Creates a new Client, with reasonable defaults
func (*Client) CreateShipment ¶
func (c *Client) CreateShipment(ctx context.Context, body CreateShipmentJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) CreateShipmentWithBody ¶
func (*Client) GetDocument ¶
func (*Client) VoidShipment ¶
type ClientInterface ¶
type ClientInterface interface { // CreateShipmentWithBody request with any body CreateShipmentWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) CreateShipment(ctx context.Context, body CreateShipmentJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // VoidShipment request VoidShipment(ctx context.Context, trackingNo string, reqEditors ...RequestEditorFn) (*http.Response, error) // GetDocument request GetDocument(ctx context.Context, trackingNo string, reqEditors ...RequestEditorFn) (*http.Response, error) }
The interface specification for the client above.
type ClientOption ¶
ClientOption allows setting custom parameters during construction
func WithHTTPClient ¶
func WithHTTPClient(doer HttpRequestDoer) ClientOption
WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.
func WithRequestEditorFn ¶
func WithRequestEditorFn(fn RequestEditorFn) ClientOption
WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.
type ClientWithResponses ¶
type ClientWithResponses struct {
ClientInterface
}
ClientWithResponses builds on ClientInterface to offer response payloads
func NewClientWithResponses ¶
func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)
NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling
func (*ClientWithResponses) CreateShipmentWithBodyWithResponse ¶
func (c *ClientWithResponses) CreateShipmentWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateShipmentResponse, error)
CreateShipmentWithBodyWithResponse request with arbitrary body returning *CreateShipmentResponse
func (*ClientWithResponses) CreateShipmentWithResponse ¶
func (c *ClientWithResponses) CreateShipmentWithResponse(ctx context.Context, body CreateShipmentJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateShipmentResponse, error)
func (*ClientWithResponses) GetDocumentWithResponse ¶
func (c *ClientWithResponses) GetDocumentWithResponse(ctx context.Context, trackingNo string, reqEditors ...RequestEditorFn) (*GetDocumentResponse, error)
GetDocumentWithResponse request returning *GetDocumentResponse
func (*ClientWithResponses) VoidShipmentWithResponse ¶
func (c *ClientWithResponses) VoidShipmentWithResponse(ctx context.Context, trackingNo string, reqEditors ...RequestEditorFn) (*VoidShipmentResponse, error)
VoidShipmentWithResponse request returning *VoidShipmentResponse
type ClientWithResponsesInterface ¶
type ClientWithResponsesInterface interface { // CreateShipmentWithBodyWithResponse request with any body CreateShipmentWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateShipmentResponse, error) CreateShipmentWithResponse(ctx context.Context, body CreateShipmentJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateShipmentResponse, error) // VoidShipmentWithResponse request VoidShipmentWithResponse(ctx context.Context, trackingNo string, reqEditors ...RequestEditorFn) (*VoidShipmentResponse, error) // GetDocumentWithResponse request GetDocumentWithResponse(ctx context.Context, trackingNo string, reqEditors ...RequestEditorFn) (*GetDocumentResponse, error) }
ClientWithResponsesInterface is the interface specification for the client with responses above.
type CreateShipmentJSONRequestBody ¶
type CreateShipmentJSONRequestBody = CreateShipmentRequest
CreateShipmentJSONRequestBody defines body for CreateShipment for application/json ContentType.
type CreateShipmentRequest ¶
type CreateShipmentRequest struct { Shipment struct { SenderInformation struct { Address Address `json:"address"` TaxNumber *string `json:"taxNumber,omitempty" validate:"max=11"` } `json:"senderInformation"` ReceiverInformation struct { Address Address `json:"address"` TaxNumber *string `json:"taxNumber,omitempty" validate:"max=11"` } `json:"receiverInformation"` ShipmentDate string `json:"shipmentDate"` PackageInformation struct { ServiceID string `json:"serviceID"` Description string `json:"description"` TotalWeight Weight `json:"totalWeight"` TotalPieces int32 `json:"totalPieces"` PiecesInformation *struct { Pieces []Piece `json:"pieces" xml:"Piece"` } `json:"piecesInformation,omitempty"` } `json:"packageInformation"` PaymentInformation struct { PaymentType *CreateShipmentRequestShipmentPaymentInformationPaymentType `json:"paymentType,omitempty"` RegisteredAccountNumber *string `json:"registeredAccountNumber,omitempty"` BillingAccountNumber *string `json:"billingAccountNumber,omitempty"` } `json:"paymentInformation"` PickupInformation struct { PickupType *CreateShipmentRequestShipmentPickupInformationPickupType `json:"pickupType,omitempty"` } `json:"pickupInformation"` TrackingReferenceInformation *struct { Reference1 *string `json:"reference1,omitempty"` Reference2 *string `json:"reference2,omitempty"` Reference3 *string `json:"reference3,omitempty"` Reference4 *string `json:"reference4,omitempty"` } `json:"trackingReferenceInformation,omitempty"` } `json:"shipment"` PrinterType CreateShipmentRequestPrinterType `json:"printerType"` }
CreateShipmentRequest defines model for CreateShipmentRequest.
type CreateShipmentRequestPrinterType ¶
type CreateShipmentRequestPrinterType string
CreateShipmentRequestPrinterType defines model for CreateShipmentRequest.PrinterType.
const ( Regular CreateShipmentRequestPrinterType = "Regular" Thermal CreateShipmentRequestPrinterType = "Thermal" )
Defines values for CreateShipmentRequestPrinterType.
type CreateShipmentRequestShipmentPaymentInformationPaymentType ¶
type CreateShipmentRequestShipmentPaymentInformationPaymentType string
CreateShipmentRequestShipmentPaymentInformationPaymentType defines model for CreateShipmentRequest.Shipment.PaymentInformation.PaymentType.
const ( Receiver CreateShipmentRequestShipmentPaymentInformationPaymentType = "Receiver" Sender CreateShipmentRequestShipmentPaymentInformationPaymentType = "Sender" ThirdParty CreateShipmentRequestShipmentPaymentInformationPaymentType = "ThirdParty" )
Defines values for CreateShipmentRequestShipmentPaymentInformationPaymentType.
type CreateShipmentRequestShipmentPickupInformationPickupType ¶
type CreateShipmentRequestShipmentPickupInformationPickupType string
CreateShipmentRequestShipmentPickupInformationPickupType defines model for CreateShipmentRequest.Shipment.PickupInformation.PickupType.
const ( DropOff CreateShipmentRequestShipmentPickupInformationPickupType = "DropOff" PreScheduled CreateShipmentRequestShipmentPickupInformationPickupType = "PreScheduled" )
Defines values for CreateShipmentRequestShipmentPickupInformationPickupType.
type CreateShipmentRes ¶
type CreateShipmentRes struct { MasterTrackingNo string `json:"masterTrackingNo"` TrackingNOs []string `json:"trackingNOs"` }
CreateShipmentRes defines model for CreateShipmentRes.
type CreateShipmentResponse ¶
type CreateShipmentResponse struct { Body []byte HTTPResponse *http.Response JSON201 *CreateShipmentRes JSONDefault *Error }
func ParseCreateShipmentResponse ¶
func ParseCreateShipmentResponse(rsp *http.Response) (*CreateShipmentResponse, error)
ParseCreateShipmentResponse parses an HTTP response from a CreateShipmentWithResponse call
func (CreateShipmentResponse) Status ¶
func (r CreateShipmentResponse) Status() string
Status returns HTTPResponse.Status
func (CreateShipmentResponse) StatusCode ¶
func (r CreateShipmentResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type Dimension ¶
type Dimension struct { Value int32 `json:"value"` DimensionUnit *DimensionDimensionUnit `json:"dimensionUnit,omitempty"` }
Dimension defines model for Dimension.
type DimensionDimensionUnit ¶
type DimensionDimensionUnit string
DimensionDimensionUnit defines model for Dimension.DimensionUnit.
const ( Cm DimensionDimensionUnit = "cm" In DimensionDimensionUnit = "in" )
Defines values for DimensionDimensionUnit.
type GetDocumentResponse ¶
func ParseGetDocumentResponse ¶
func ParseGetDocumentResponse(rsp *http.Response) (*GetDocumentResponse, error)
ParseGetDocumentResponse parses an HTTP response from a GetDocumentWithResponse call
func (GetDocumentResponse) Status ¶
func (r GetDocumentResponse) Status() string
Status returns HTTPResponse.Status
func (GetDocumentResponse) StatusCode ¶
func (r GetDocumentResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type GinServerOptions ¶
type GinServerOptions struct { BaseURL string Middlewares []MiddlewareFunc ErrorHandler func(*gin.Context, error, int) }
GinServerOptions provides options for the Gin server.
type HttpRequestDoer ¶
Doer performs HTTP requests.
The standard http.Client implements this interface.
type MiddlewareFunc ¶
type Piece ¶
type Piece struct { Weight Weight `json:"weight"` Height Dimension `json:"height"` Length Dimension `json:"length"` Width Dimension `json:"width"` }
Piece defines model for Piece.
type RequestEditorFn ¶
RequestEditorFn is the function signature for the RequestEditor callback function
type ServerInterface ¶
type ServerInterface interface { // (POST /shipments) CreateShipment(c *gin.Context) // (DELETE /shipments/{trackingNo}) VoidShipment(c *gin.Context, trackingNo string) // (GET /shipments/{trackingNo}) GetDocument(c *gin.Context, trackingNo string) }
ServerInterface represents all server handlers.
type ServerInterfaceWrapper ¶
type ServerInterfaceWrapper struct { Handler ServerInterface HandlerMiddlewares []MiddlewareFunc ErrorHandler func(*gin.Context, error, int) }
ServerInterfaceWrapper converts contexts to parameters.
func (*ServerInterfaceWrapper) CreateShipment ¶
func (siw *ServerInterfaceWrapper) CreateShipment(c *gin.Context)
CreateShipment operation middleware
func (*ServerInterfaceWrapper) GetDocument ¶
func (siw *ServerInterfaceWrapper) GetDocument(c *gin.Context)
GetDocument operation middleware
func (*ServerInterfaceWrapper) VoidShipment ¶
func (siw *ServerInterfaceWrapper) VoidShipment(c *gin.Context)
VoidShipment operation middleware
type VoidShipmentResponse ¶
func ParseVoidShipmentResponse ¶
func ParseVoidShipmentResponse(rsp *http.Response) (*VoidShipmentResponse, error)
ParseVoidShipmentResponse parses an HTTP response from a VoidShipmentWithResponse call
func (VoidShipmentResponse) Status ¶
func (r VoidShipmentResponse) Status() string
Status returns HTTPResponse.Status
func (VoidShipmentResponse) StatusCode ¶
func (r VoidShipmentResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type Weight ¶
type Weight struct { Value int32 `json:"value"` WeightUnit WeightWeightUnit `json:"weightUnit"` }
Weight defines model for Weight.
type WeightWeightUnit ¶
type WeightWeightUnit string
WeightWeightUnit defines model for Weight.WeightUnit.
const ( Kg WeightWeightUnit = "kg" Lb WeightWeightUnit = "lb" )
Defines values for WeightWeightUnit.