diff --git a/pkg/gen/primeapi/configure_mymove.go b/pkg/gen/primeapi/configure_mymove.go index a55f660a21f..33e701d8b2f 100644 --- a/pkg/gen/primeapi/configure_mymove.go +++ b/pkg/gen/primeapi/configure_mymove.go @@ -71,11 +71,6 @@ func configureAPI(api *primeoperations.MymoveAPI) http.Handler { return middleware.NotImplemented("operation mto_shipment.CreateMTOShipment has not yet been implemented") }) } - if api.MtoShipmentCreateNonSITAddressUpdateRequestHandler == nil { - api.MtoShipmentCreateNonSITAddressUpdateRequestHandler = mto_shipment.CreateNonSITAddressUpdateRequestHandlerFunc(func(params mto_shipment.CreateNonSITAddressUpdateRequestParams) middleware.Responder { - return middleware.NotImplemented("operation mto_shipment.CreateNonSITAddressUpdateRequest has not yet been implemented") - }) - } if api.PaymentRequestCreatePaymentRequestHandler == nil { api.PaymentRequestCreatePaymentRequestHandler = payment_request.CreatePaymentRequestHandlerFunc(func(params payment_request.CreatePaymentRequestParams) middleware.Responder { return middleware.NotImplemented("operation payment_request.CreatePaymentRequest has not yet been implemented") @@ -161,6 +156,11 @@ func configureAPI(api *primeoperations.MymoveAPI) http.Handler { return middleware.NotImplemented("operation mto_shipment.UpdateSITDeliveryRequest has not yet been implemented") }) } + if api.MtoShipmentUpdateShipmentDestinationAddressHandler == nil { + api.MtoShipmentUpdateShipmentDestinationAddressHandler = mto_shipment.UpdateShipmentDestinationAddressHandlerFunc(func(params mto_shipment.UpdateShipmentDestinationAddressParams) middleware.Responder { + return middleware.NotImplemented("operation mto_shipment.UpdateShipmentDestinationAddress has not yet been implemented") + }) + } api.PreServerShutdown = func() {} diff --git a/pkg/gen/primeapi/embedded_spec.go b/pkg/gen/primeapi/embedded_spec.go index fcb99c7cc6d..d65746ef7b0 100644 --- a/pkg/gen/primeapi/embedded_spec.go +++ b/pkg/gen/primeapi/embedded_spec.go @@ -1049,7 +1049,7 @@ func init() { }, "/mto-shipments/{mtoShipmentID}/shipment-address-updates": { "post": { - "description": "### Functionality\nThis endpoint is used so the Prime can request an **update** for the destination address on an MTO Shipment,\nafter the destination address has already been approved.\nThis does not change addresses on SIT service items.\nAddress updates will be automatically approved unless they change:\n - the service area\n - Mileage bracket for direct delivery\n - the address and the distance between the old and new address is \u003e 50\n - Domestic Short Haul to Domestic Line Haul or vice versa\n - Shipments that start and end in one ZIP3 use Short Haul pricing\n - Shipments that start and end in different ZIP3s use Line Haul pricing\n\nFor those, changes will require TOO approval.\n", + "description": "### Functionality\nThis endpoint is used so the Prime can request an **update** for the destination address on an MTO Shipment,\nafter the destination address has already been approved.\n\nAddress updates will be automatically approved unless they change:\n - The service area\n - Mileage bracket for direct delivery\n - the address and the distance between the old and new address is \u003e 50\n - Domestic Short Haul to Domestic Line Haul or vice versa\n - Shipments that start and end in one ZIP3 use Short Haul pricing\n - Shipments that start and end in different ZIP3s use Line Haul pricing\n\nFor those, changes will require TOO approval.\n", "consumes": [ "application/json" ], @@ -1059,8 +1059,8 @@ func init() { "tags": [ "mtoShipment" ], - "summary": "createNonSITAddressUpdateRequest", - "operationId": "createNonSITAddressUpdateRequest", + "summary": "updateShipmentDestinationAddress", + "operationId": "updateShipmentDestinationAddress", "parameters": [ { "type": "string", @@ -1075,7 +1075,7 @@ func init() { "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreateNonSITAddressUpdateRequest" + "$ref": "#/definitions/UpdateShipmentDestinationAddress" } }, { @@ -1755,24 +1755,6 @@ func init() { } } }, - "CreateNonSITAddressUpdateRequest": { - "description": "CreateNonSITAddressUpdateRequest contains the fields required for the prime to create a non SIT address update request.", - "type": "object", - "required": [ - "contractorRemarks", - "newAddress" - ], - "properties": { - "contractorRemarks": { - "description": "This is the remark the Prime has entered, which would be the reason there is an address change.", - "type": "string", - "example": "Customer reached out to me this week and let me know they want to move somewhere else." - }, - "newAddress": { - "$ref": "#/definitions/Address" - } - } - }, "CreatePPMShipment": { "description": "Creation object containing the ` + "`" + `PPM` + "`" + ` shipmentType specific data, not used for other shipment types.", "type": "object", @@ -4617,6 +4599,24 @@ func init() { } } }, + "UpdateShipmentDestinationAddress": { + "description": "UpdateShipmentDestinationAddress contains the fields required for the prime to request an update for the destination address on an MTO Shipment.", + "type": "object", + "required": [ + "contractorRemarks", + "newAddress" + ], + "properties": { + "contractorRemarks": { + "description": "This is the remark the Prime has entered, which would be the reason there is an address change.", + "type": "string", + "example": "Customer reached out to me this week and let me know they want to move somewhere else." + }, + "newAddress": { + "$ref": "#/definitions/Address" + } + } + }, "UploadWithOmissions": { "description": "An uploaded file.", "type": "object", @@ -6120,7 +6120,7 @@ func init() { }, "/mto-shipments/{mtoShipmentID}/shipment-address-updates": { "post": { - "description": "### Functionality\nThis endpoint is used so the Prime can request an **update** for the destination address on an MTO Shipment,\nafter the destination address has already been approved.\nThis does not change addresses on SIT service items.\nAddress updates will be automatically approved unless they change:\n - the service area\n - Mileage bracket for direct delivery\n - the address and the distance between the old and new address is \u003e 50\n - Domestic Short Haul to Domestic Line Haul or vice versa\n - Shipments that start and end in one ZIP3 use Short Haul pricing\n - Shipments that start and end in different ZIP3s use Line Haul pricing\n\nFor those, changes will require TOO approval.\n", + "description": "### Functionality\nThis endpoint is used so the Prime can request an **update** for the destination address on an MTO Shipment,\nafter the destination address has already been approved.\n\nAddress updates will be automatically approved unless they change:\n - The service area\n - Mileage bracket for direct delivery\n - the address and the distance between the old and new address is \u003e 50\n - Domestic Short Haul to Domestic Line Haul or vice versa\n - Shipments that start and end in one ZIP3 use Short Haul pricing\n - Shipments that start and end in different ZIP3s use Line Haul pricing\n\nFor those, changes will require TOO approval.\n", "consumes": [ "application/json" ], @@ -6130,8 +6130,8 @@ func init() { "tags": [ "mtoShipment" ], - "summary": "createNonSITAddressUpdateRequest", - "operationId": "createNonSITAddressUpdateRequest", + "summary": "updateShipmentDestinationAddress", + "operationId": "updateShipmentDestinationAddress", "parameters": [ { "type": "string", @@ -6146,7 +6146,7 @@ func init() { "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreateNonSITAddressUpdateRequest" + "$ref": "#/definitions/UpdateShipmentDestinationAddress" } }, { @@ -6975,24 +6975,6 @@ func init() { } } }, - "CreateNonSITAddressUpdateRequest": { - "description": "CreateNonSITAddressUpdateRequest contains the fields required for the prime to create a non SIT address update request.", - "type": "object", - "required": [ - "contractorRemarks", - "newAddress" - ], - "properties": { - "contractorRemarks": { - "description": "This is the remark the Prime has entered, which would be the reason there is an address change.", - "type": "string", - "example": "Customer reached out to me this week and let me know they want to move somewhere else." - }, - "newAddress": { - "$ref": "#/definitions/Address" - } - } - }, "CreatePPMShipment": { "description": "Creation object containing the ` + "`" + `PPM` + "`" + ` shipmentType specific data, not used for other shipment types.", "type": "object", @@ -9883,6 +9865,24 @@ func init() { } } }, + "UpdateShipmentDestinationAddress": { + "description": "UpdateShipmentDestinationAddress contains the fields required for the prime to request an update for the destination address on an MTO Shipment.", + "type": "object", + "required": [ + "contractorRemarks", + "newAddress" + ], + "properties": { + "contractorRemarks": { + "description": "This is the remark the Prime has entered, which would be the reason there is an address change.", + "type": "string", + "example": "Customer reached out to me this week and let me know they want to move somewhere else." + }, + "newAddress": { + "$ref": "#/definitions/Address" + } + } + }, "UploadWithOmissions": { "description": "An uploaded file.", "type": "object", diff --git a/pkg/gen/primeapi/primeoperations/mto_shipment/create_non_s_i_t_address_update_request.go b/pkg/gen/primeapi/primeoperations/mto_shipment/create_non_s_i_t_address_update_request.go deleted file mode 100644 index ba4471768ac..00000000000 --- a/pkg/gen/primeapi/primeoperations/mto_shipment/create_non_s_i_t_address_update_request.go +++ /dev/null @@ -1,70 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package mto_shipment - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateNonSITAddressUpdateRequestHandlerFunc turns a function with the right signature into a create non s i t address update request handler -type CreateNonSITAddressUpdateRequestHandlerFunc func(CreateNonSITAddressUpdateRequestParams) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateNonSITAddressUpdateRequestHandlerFunc) Handle(params CreateNonSITAddressUpdateRequestParams) middleware.Responder { - return fn(params) -} - -// CreateNonSITAddressUpdateRequestHandler interface for that can handle valid create non s i t address update request params -type CreateNonSITAddressUpdateRequestHandler interface { - Handle(CreateNonSITAddressUpdateRequestParams) middleware.Responder -} - -// NewCreateNonSITAddressUpdateRequest creates a new http.Handler for the create non s i t address update request operation -func NewCreateNonSITAddressUpdateRequest(ctx *middleware.Context, handler CreateNonSITAddressUpdateRequestHandler) *CreateNonSITAddressUpdateRequest { - return &CreateNonSITAddressUpdateRequest{Context: ctx, Handler: handler} -} - -/* - CreateNonSITAddressUpdateRequest swagger:route POST /mto-shipments/{mtoShipmentID}/shipment-address-updates mtoShipment createNonSITAddressUpdateRequest - -createNonSITAddressUpdateRequest - -### Functionality -This endpoint is used so the Prime can request an **update** for the destination address on an MTO Shipment, -after the destination address has already been approved. -This does not change addresses on SIT service items. -Address updates will be automatically approved unless they change: - - the service area - - Mileage bracket for direct delivery - - the address and the distance between the old and new address is > 50 - - Domestic Short Haul to Domestic Line Haul or vice versa - - Shipments that start and end in one ZIP3 use Short Haul pricing - - Shipments that start and end in different ZIP3s use Line Haul pricing - -For those, changes will require TOO approval. -*/ -type CreateNonSITAddressUpdateRequest struct { - Context *middleware.Context - Handler CreateNonSITAddressUpdateRequestHandler -} - -func (o *CreateNonSITAddressUpdateRequest) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateNonSITAddressUpdateRequestParams() - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/pkg/gen/primeapi/primeoperations/mto_shipment/create_non_s_i_t_address_update_request_responses.go b/pkg/gen/primeapi/primeoperations/mto_shipment/create_non_s_i_t_address_update_request_responses.go deleted file mode 100644 index 63126a59032..00000000000 --- a/pkg/gen/primeapi/primeoperations/mto_shipment/create_non_s_i_t_address_update_request_responses.go +++ /dev/null @@ -1,419 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package mto_shipment - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/transcom/mymove/pkg/gen/primemessages" -) - -// CreateNonSITAddressUpdateRequestCreatedCode is the HTTP code returned for type CreateNonSITAddressUpdateRequestCreated -const CreateNonSITAddressUpdateRequestCreatedCode int = 201 - -/* -CreateNonSITAddressUpdateRequestCreated Successfully created the address update request. - -swagger:response createNonSITAddressUpdateRequestCreated -*/ -type CreateNonSITAddressUpdateRequestCreated struct { - - /* - In: Body - */ - Payload *primemessages.ShipmentAddressUpdate `json:"body,omitempty"` -} - -// NewCreateNonSITAddressUpdateRequestCreated creates CreateNonSITAddressUpdateRequestCreated with default headers values -func NewCreateNonSITAddressUpdateRequestCreated() *CreateNonSITAddressUpdateRequestCreated { - - return &CreateNonSITAddressUpdateRequestCreated{} -} - -// WithPayload adds the payload to the create non s i t address update request created response -func (o *CreateNonSITAddressUpdateRequestCreated) WithPayload(payload *primemessages.ShipmentAddressUpdate) *CreateNonSITAddressUpdateRequestCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create non s i t address update request created response -func (o *CreateNonSITAddressUpdateRequestCreated) SetPayload(payload *primemessages.ShipmentAddressUpdate) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateNonSITAddressUpdateRequestCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateNonSITAddressUpdateRequestBadRequestCode is the HTTP code returned for type CreateNonSITAddressUpdateRequestBadRequest -const CreateNonSITAddressUpdateRequestBadRequestCode int = 400 - -/* -CreateNonSITAddressUpdateRequestBadRequest The request payload is invalid. - -swagger:response createNonSITAddressUpdateRequestBadRequest -*/ -type CreateNonSITAddressUpdateRequestBadRequest struct { - - /* - In: Body - */ - Payload *primemessages.ClientError `json:"body,omitempty"` -} - -// NewCreateNonSITAddressUpdateRequestBadRequest creates CreateNonSITAddressUpdateRequestBadRequest with default headers values -func NewCreateNonSITAddressUpdateRequestBadRequest() *CreateNonSITAddressUpdateRequestBadRequest { - - return &CreateNonSITAddressUpdateRequestBadRequest{} -} - -// WithPayload adds the payload to the create non s i t address update request bad request response -func (o *CreateNonSITAddressUpdateRequestBadRequest) WithPayload(payload *primemessages.ClientError) *CreateNonSITAddressUpdateRequestBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create non s i t address update request bad request response -func (o *CreateNonSITAddressUpdateRequestBadRequest) SetPayload(payload *primemessages.ClientError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateNonSITAddressUpdateRequestBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateNonSITAddressUpdateRequestUnauthorizedCode is the HTTP code returned for type CreateNonSITAddressUpdateRequestUnauthorized -const CreateNonSITAddressUpdateRequestUnauthorizedCode int = 401 - -/* -CreateNonSITAddressUpdateRequestUnauthorized The request was denied. - -swagger:response createNonSITAddressUpdateRequestUnauthorized -*/ -type CreateNonSITAddressUpdateRequestUnauthorized struct { - - /* - In: Body - */ - Payload *primemessages.ClientError `json:"body,omitempty"` -} - -// NewCreateNonSITAddressUpdateRequestUnauthorized creates CreateNonSITAddressUpdateRequestUnauthorized with default headers values -func NewCreateNonSITAddressUpdateRequestUnauthorized() *CreateNonSITAddressUpdateRequestUnauthorized { - - return &CreateNonSITAddressUpdateRequestUnauthorized{} -} - -// WithPayload adds the payload to the create non s i t address update request unauthorized response -func (o *CreateNonSITAddressUpdateRequestUnauthorized) WithPayload(payload *primemessages.ClientError) *CreateNonSITAddressUpdateRequestUnauthorized { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create non s i t address update request unauthorized response -func (o *CreateNonSITAddressUpdateRequestUnauthorized) SetPayload(payload *primemessages.ClientError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateNonSITAddressUpdateRequestUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(401) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateNonSITAddressUpdateRequestForbiddenCode is the HTTP code returned for type CreateNonSITAddressUpdateRequestForbidden -const CreateNonSITAddressUpdateRequestForbiddenCode int = 403 - -/* -CreateNonSITAddressUpdateRequestForbidden The request was denied. - -swagger:response createNonSITAddressUpdateRequestForbidden -*/ -type CreateNonSITAddressUpdateRequestForbidden struct { - - /* - In: Body - */ - Payload *primemessages.ClientError `json:"body,omitempty"` -} - -// NewCreateNonSITAddressUpdateRequestForbidden creates CreateNonSITAddressUpdateRequestForbidden with default headers values -func NewCreateNonSITAddressUpdateRequestForbidden() *CreateNonSITAddressUpdateRequestForbidden { - - return &CreateNonSITAddressUpdateRequestForbidden{} -} - -// WithPayload adds the payload to the create non s i t address update request forbidden response -func (o *CreateNonSITAddressUpdateRequestForbidden) WithPayload(payload *primemessages.ClientError) *CreateNonSITAddressUpdateRequestForbidden { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create non s i t address update request forbidden response -func (o *CreateNonSITAddressUpdateRequestForbidden) SetPayload(payload *primemessages.ClientError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateNonSITAddressUpdateRequestForbidden) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(403) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateNonSITAddressUpdateRequestNotFoundCode is the HTTP code returned for type CreateNonSITAddressUpdateRequestNotFound -const CreateNonSITAddressUpdateRequestNotFoundCode int = 404 - -/* -CreateNonSITAddressUpdateRequestNotFound The requested resource wasn't found. - -swagger:response createNonSITAddressUpdateRequestNotFound -*/ -type CreateNonSITAddressUpdateRequestNotFound struct { - - /* - In: Body - */ - Payload *primemessages.ClientError `json:"body,omitempty"` -} - -// NewCreateNonSITAddressUpdateRequestNotFound creates CreateNonSITAddressUpdateRequestNotFound with default headers values -func NewCreateNonSITAddressUpdateRequestNotFound() *CreateNonSITAddressUpdateRequestNotFound { - - return &CreateNonSITAddressUpdateRequestNotFound{} -} - -// WithPayload adds the payload to the create non s i t address update request not found response -func (o *CreateNonSITAddressUpdateRequestNotFound) WithPayload(payload *primemessages.ClientError) *CreateNonSITAddressUpdateRequestNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create non s i t address update request not found response -func (o *CreateNonSITAddressUpdateRequestNotFound) SetPayload(payload *primemessages.ClientError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateNonSITAddressUpdateRequestNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateNonSITAddressUpdateRequestConflictCode is the HTTP code returned for type CreateNonSITAddressUpdateRequestConflict -const CreateNonSITAddressUpdateRequestConflictCode int = 409 - -/* -CreateNonSITAddressUpdateRequestConflict The request could not be processed because of conflict in the current state of the resource. - -swagger:response createNonSITAddressUpdateRequestConflict -*/ -type CreateNonSITAddressUpdateRequestConflict struct { - - /* - In: Body - */ - Payload *primemessages.ClientError `json:"body,omitempty"` -} - -// NewCreateNonSITAddressUpdateRequestConflict creates CreateNonSITAddressUpdateRequestConflict with default headers values -func NewCreateNonSITAddressUpdateRequestConflict() *CreateNonSITAddressUpdateRequestConflict { - - return &CreateNonSITAddressUpdateRequestConflict{} -} - -// WithPayload adds the payload to the create non s i t address update request conflict response -func (o *CreateNonSITAddressUpdateRequestConflict) WithPayload(payload *primemessages.ClientError) *CreateNonSITAddressUpdateRequestConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create non s i t address update request conflict response -func (o *CreateNonSITAddressUpdateRequestConflict) SetPayload(payload *primemessages.ClientError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateNonSITAddressUpdateRequestConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateNonSITAddressUpdateRequestPreconditionFailedCode is the HTTP code returned for type CreateNonSITAddressUpdateRequestPreconditionFailed -const CreateNonSITAddressUpdateRequestPreconditionFailedCode int = 412 - -/* -CreateNonSITAddressUpdateRequestPreconditionFailed Precondition failed, likely due to a stale eTag (If-Match). Fetch the request again to get the updated eTag value. - -swagger:response createNonSITAddressUpdateRequestPreconditionFailed -*/ -type CreateNonSITAddressUpdateRequestPreconditionFailed struct { - - /* - In: Body - */ - Payload *primemessages.ClientError `json:"body,omitempty"` -} - -// NewCreateNonSITAddressUpdateRequestPreconditionFailed creates CreateNonSITAddressUpdateRequestPreconditionFailed with default headers values -func NewCreateNonSITAddressUpdateRequestPreconditionFailed() *CreateNonSITAddressUpdateRequestPreconditionFailed { - - return &CreateNonSITAddressUpdateRequestPreconditionFailed{} -} - -// WithPayload adds the payload to the create non s i t address update request precondition failed response -func (o *CreateNonSITAddressUpdateRequestPreconditionFailed) WithPayload(payload *primemessages.ClientError) *CreateNonSITAddressUpdateRequestPreconditionFailed { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create non s i t address update request precondition failed response -func (o *CreateNonSITAddressUpdateRequestPreconditionFailed) SetPayload(payload *primemessages.ClientError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateNonSITAddressUpdateRequestPreconditionFailed) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(412) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateNonSITAddressUpdateRequestUnprocessableEntityCode is the HTTP code returned for type CreateNonSITAddressUpdateRequestUnprocessableEntity -const CreateNonSITAddressUpdateRequestUnprocessableEntityCode int = 422 - -/* -CreateNonSITAddressUpdateRequestUnprocessableEntity The request was unprocessable, likely due to bad input from the requester. - -swagger:response createNonSITAddressUpdateRequestUnprocessableEntity -*/ -type CreateNonSITAddressUpdateRequestUnprocessableEntity struct { - - /* - In: Body - */ - Payload *primemessages.ValidationError `json:"body,omitempty"` -} - -// NewCreateNonSITAddressUpdateRequestUnprocessableEntity creates CreateNonSITAddressUpdateRequestUnprocessableEntity with default headers values -func NewCreateNonSITAddressUpdateRequestUnprocessableEntity() *CreateNonSITAddressUpdateRequestUnprocessableEntity { - - return &CreateNonSITAddressUpdateRequestUnprocessableEntity{} -} - -// WithPayload adds the payload to the create non s i t address update request unprocessable entity response -func (o *CreateNonSITAddressUpdateRequestUnprocessableEntity) WithPayload(payload *primemessages.ValidationError) *CreateNonSITAddressUpdateRequestUnprocessableEntity { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create non s i t address update request unprocessable entity response -func (o *CreateNonSITAddressUpdateRequestUnprocessableEntity) SetPayload(payload *primemessages.ValidationError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateNonSITAddressUpdateRequestUnprocessableEntity) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(422) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateNonSITAddressUpdateRequestInternalServerErrorCode is the HTTP code returned for type CreateNonSITAddressUpdateRequestInternalServerError -const CreateNonSITAddressUpdateRequestInternalServerErrorCode int = 500 - -/* -CreateNonSITAddressUpdateRequestInternalServerError A server error occurred. - -swagger:response createNonSITAddressUpdateRequestInternalServerError -*/ -type CreateNonSITAddressUpdateRequestInternalServerError struct { - - /* - In: Body - */ - Payload *primemessages.Error `json:"body,omitempty"` -} - -// NewCreateNonSITAddressUpdateRequestInternalServerError creates CreateNonSITAddressUpdateRequestInternalServerError with default headers values -func NewCreateNonSITAddressUpdateRequestInternalServerError() *CreateNonSITAddressUpdateRequestInternalServerError { - - return &CreateNonSITAddressUpdateRequestInternalServerError{} -} - -// WithPayload adds the payload to the create non s i t address update request internal server error response -func (o *CreateNonSITAddressUpdateRequestInternalServerError) WithPayload(payload *primemessages.Error) *CreateNonSITAddressUpdateRequestInternalServerError { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create non s i t address update request internal server error response -func (o *CreateNonSITAddressUpdateRequestInternalServerError) SetPayload(payload *primemessages.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateNonSITAddressUpdateRequestInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(500) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/pkg/gen/primeapi/primeoperations/mto_shipment/update_shipment_destination_address.go b/pkg/gen/primeapi/primeoperations/mto_shipment/update_shipment_destination_address.go new file mode 100644 index 00000000000..2387babe9ff --- /dev/null +++ b/pkg/gen/primeapi/primeoperations/mto_shipment/update_shipment_destination_address.go @@ -0,0 +1,70 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package mto_shipment + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime/middleware" +) + +// UpdateShipmentDestinationAddressHandlerFunc turns a function with the right signature into a update shipment destination address handler +type UpdateShipmentDestinationAddressHandlerFunc func(UpdateShipmentDestinationAddressParams) middleware.Responder + +// Handle executing the request and returning a response +func (fn UpdateShipmentDestinationAddressHandlerFunc) Handle(params UpdateShipmentDestinationAddressParams) middleware.Responder { + return fn(params) +} + +// UpdateShipmentDestinationAddressHandler interface for that can handle valid update shipment destination address params +type UpdateShipmentDestinationAddressHandler interface { + Handle(UpdateShipmentDestinationAddressParams) middleware.Responder +} + +// NewUpdateShipmentDestinationAddress creates a new http.Handler for the update shipment destination address operation +func NewUpdateShipmentDestinationAddress(ctx *middleware.Context, handler UpdateShipmentDestinationAddressHandler) *UpdateShipmentDestinationAddress { + return &UpdateShipmentDestinationAddress{Context: ctx, Handler: handler} +} + +/* + UpdateShipmentDestinationAddress swagger:route POST /mto-shipments/{mtoShipmentID}/shipment-address-updates mtoShipment updateShipmentDestinationAddress + +updateShipmentDestinationAddress + +### Functionality +This endpoint is used so the Prime can request an **update** for the destination address on an MTO Shipment, +after the destination address has already been approved. + +Address updates will be automatically approved unless they change: + - The service area + - Mileage bracket for direct delivery + - the address and the distance between the old and new address is > 50 + - Domestic Short Haul to Domestic Line Haul or vice versa + - Shipments that start and end in one ZIP3 use Short Haul pricing + - Shipments that start and end in different ZIP3s use Line Haul pricing + +For those, changes will require TOO approval. +*/ +type UpdateShipmentDestinationAddress struct { + Context *middleware.Context + Handler UpdateShipmentDestinationAddressHandler +} + +func (o *UpdateShipmentDestinationAddress) ServeHTTP(rw http.ResponseWriter, r *http.Request) { + route, rCtx, _ := o.Context.RouteInfo(r) + if rCtx != nil { + *r = *rCtx + } + var Params = NewUpdateShipmentDestinationAddressParams() + if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + + res := o.Handler.Handle(Params) // actually handle the request + o.Context.Respond(rw, r, route.Produces, route, res) + +} diff --git a/pkg/gen/primeapi/primeoperations/mto_shipment/create_non_s_i_t_address_update_request_parameters.go b/pkg/gen/primeapi/primeoperations/mto_shipment/update_shipment_destination_address_parameters.go similarity index 80% rename from pkg/gen/primeapi/primeoperations/mto_shipment/create_non_s_i_t_address_update_request_parameters.go rename to pkg/gen/primeapi/primeoperations/mto_shipment/update_shipment_destination_address_parameters.go index b1b5c78a3e2..5017b9a9912 100644 --- a/pkg/gen/primeapi/primeoperations/mto_shipment/create_non_s_i_t_address_update_request_parameters.go +++ b/pkg/gen/primeapi/primeoperations/mto_shipment/update_shipment_destination_address_parameters.go @@ -18,19 +18,19 @@ import ( "github.com/transcom/mymove/pkg/gen/primemessages" ) -// NewCreateNonSITAddressUpdateRequestParams creates a new CreateNonSITAddressUpdateRequestParams object +// NewUpdateShipmentDestinationAddressParams creates a new UpdateShipmentDestinationAddressParams object // // There are no default values defined in the spec. -func NewCreateNonSITAddressUpdateRequestParams() CreateNonSITAddressUpdateRequestParams { +func NewUpdateShipmentDestinationAddressParams() UpdateShipmentDestinationAddressParams { - return CreateNonSITAddressUpdateRequestParams{} + return UpdateShipmentDestinationAddressParams{} } -// CreateNonSITAddressUpdateRequestParams contains all the bound params for the create non s i t address update request operation +// UpdateShipmentDestinationAddressParams contains all the bound params for the update shipment destination address operation // typically these are obtained from a http.Request // -// swagger:parameters createNonSITAddressUpdateRequest -type CreateNonSITAddressUpdateRequestParams struct { +// swagger:parameters updateShipmentDestinationAddress +type UpdateShipmentDestinationAddressParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` @@ -45,7 +45,7 @@ type CreateNonSITAddressUpdateRequestParams struct { Required: true In: body */ - Body *primemessages.CreateNonSITAddressUpdateRequest + Body *primemessages.UpdateShipmentDestinationAddress /*UUID of the shipment associated with the address Required: true In: path @@ -56,8 +56,8 @@ type CreateNonSITAddressUpdateRequestParams struct { // BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface // for simple values it will use straight method calls. // -// To ensure default values, the struct must have been initialized with NewCreateNonSITAddressUpdateRequestParams() beforehand. -func (o *CreateNonSITAddressUpdateRequestParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { +// To ensure default values, the struct must have been initialized with NewUpdateShipmentDestinationAddressParams() beforehand. +func (o *UpdateShipmentDestinationAddressParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r @@ -68,7 +68,7 @@ func (o *CreateNonSITAddressUpdateRequestParams) BindRequest(r *http.Request, ro if runtime.HasBody(r) { defer r.Body.Close() - var body primemessages.CreateNonSITAddressUpdateRequest + var body primemessages.UpdateShipmentDestinationAddress if err := route.Consumer.Consume(r.Body, &body); err != nil { if err == io.EOF { res = append(res, errors.Required("body", "body", "")) @@ -105,7 +105,7 @@ func (o *CreateNonSITAddressUpdateRequestParams) BindRequest(r *http.Request, ro } // bindIfMatch binds and validates parameter IfMatch from header. -func (o *CreateNonSITAddressUpdateRequestParams) bindIfMatch(rawData []string, hasKey bool, formats strfmt.Registry) error { +func (o *UpdateShipmentDestinationAddressParams) bindIfMatch(rawData []string, hasKey bool, formats strfmt.Registry) error { if !hasKey { return errors.Required("If-Match", "header", rawData) } @@ -125,7 +125,7 @@ func (o *CreateNonSITAddressUpdateRequestParams) bindIfMatch(rawData []string, h } // bindMtoShipmentID binds and validates parameter MtoShipmentID from path. -func (o *CreateNonSITAddressUpdateRequestParams) bindMtoShipmentID(rawData []string, hasKey bool, formats strfmt.Registry) error { +func (o *UpdateShipmentDestinationAddressParams) bindMtoShipmentID(rawData []string, hasKey bool, formats strfmt.Registry) error { var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] @@ -149,7 +149,7 @@ func (o *CreateNonSITAddressUpdateRequestParams) bindMtoShipmentID(rawData []str } // validateMtoShipmentID carries on validations for parameter MtoShipmentID -func (o *CreateNonSITAddressUpdateRequestParams) validateMtoShipmentID(formats strfmt.Registry) error { +func (o *UpdateShipmentDestinationAddressParams) validateMtoShipmentID(formats strfmt.Registry) error { if err := validate.FormatOf("mtoShipmentID", "path", "uuid", o.MtoShipmentID.String(), formats); err != nil { return err diff --git a/pkg/gen/primeapi/primeoperations/mto_shipment/update_shipment_destination_address_responses.go b/pkg/gen/primeapi/primeoperations/mto_shipment/update_shipment_destination_address_responses.go new file mode 100644 index 00000000000..409fd04c241 --- /dev/null +++ b/pkg/gen/primeapi/primeoperations/mto_shipment/update_shipment_destination_address_responses.go @@ -0,0 +1,419 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package mto_shipment + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime" + + "github.com/transcom/mymove/pkg/gen/primemessages" +) + +// UpdateShipmentDestinationAddressCreatedCode is the HTTP code returned for type UpdateShipmentDestinationAddressCreated +const UpdateShipmentDestinationAddressCreatedCode int = 201 + +/* +UpdateShipmentDestinationAddressCreated Successfully created the address update request. + +swagger:response updateShipmentDestinationAddressCreated +*/ +type UpdateShipmentDestinationAddressCreated struct { + + /* + In: Body + */ + Payload *primemessages.ShipmentAddressUpdate `json:"body,omitempty"` +} + +// NewUpdateShipmentDestinationAddressCreated creates UpdateShipmentDestinationAddressCreated with default headers values +func NewUpdateShipmentDestinationAddressCreated() *UpdateShipmentDestinationAddressCreated { + + return &UpdateShipmentDestinationAddressCreated{} +} + +// WithPayload adds the payload to the update shipment destination address created response +func (o *UpdateShipmentDestinationAddressCreated) WithPayload(payload *primemessages.ShipmentAddressUpdate) *UpdateShipmentDestinationAddressCreated { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the update shipment destination address created response +func (o *UpdateShipmentDestinationAddressCreated) SetPayload(payload *primemessages.ShipmentAddressUpdate) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *UpdateShipmentDestinationAddressCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(201) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} + +// UpdateShipmentDestinationAddressBadRequestCode is the HTTP code returned for type UpdateShipmentDestinationAddressBadRequest +const UpdateShipmentDestinationAddressBadRequestCode int = 400 + +/* +UpdateShipmentDestinationAddressBadRequest The request payload is invalid. + +swagger:response updateShipmentDestinationAddressBadRequest +*/ +type UpdateShipmentDestinationAddressBadRequest struct { + + /* + In: Body + */ + Payload *primemessages.ClientError `json:"body,omitempty"` +} + +// NewUpdateShipmentDestinationAddressBadRequest creates UpdateShipmentDestinationAddressBadRequest with default headers values +func NewUpdateShipmentDestinationAddressBadRequest() *UpdateShipmentDestinationAddressBadRequest { + + return &UpdateShipmentDestinationAddressBadRequest{} +} + +// WithPayload adds the payload to the update shipment destination address bad request response +func (o *UpdateShipmentDestinationAddressBadRequest) WithPayload(payload *primemessages.ClientError) *UpdateShipmentDestinationAddressBadRequest { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the update shipment destination address bad request response +func (o *UpdateShipmentDestinationAddressBadRequest) SetPayload(payload *primemessages.ClientError) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *UpdateShipmentDestinationAddressBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(400) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} + +// UpdateShipmentDestinationAddressUnauthorizedCode is the HTTP code returned for type UpdateShipmentDestinationAddressUnauthorized +const UpdateShipmentDestinationAddressUnauthorizedCode int = 401 + +/* +UpdateShipmentDestinationAddressUnauthorized The request was denied. + +swagger:response updateShipmentDestinationAddressUnauthorized +*/ +type UpdateShipmentDestinationAddressUnauthorized struct { + + /* + In: Body + */ + Payload *primemessages.ClientError `json:"body,omitempty"` +} + +// NewUpdateShipmentDestinationAddressUnauthorized creates UpdateShipmentDestinationAddressUnauthorized with default headers values +func NewUpdateShipmentDestinationAddressUnauthorized() *UpdateShipmentDestinationAddressUnauthorized { + + return &UpdateShipmentDestinationAddressUnauthorized{} +} + +// WithPayload adds the payload to the update shipment destination address unauthorized response +func (o *UpdateShipmentDestinationAddressUnauthorized) WithPayload(payload *primemessages.ClientError) *UpdateShipmentDestinationAddressUnauthorized { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the update shipment destination address unauthorized response +func (o *UpdateShipmentDestinationAddressUnauthorized) SetPayload(payload *primemessages.ClientError) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *UpdateShipmentDestinationAddressUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(401) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} + +// UpdateShipmentDestinationAddressForbiddenCode is the HTTP code returned for type UpdateShipmentDestinationAddressForbidden +const UpdateShipmentDestinationAddressForbiddenCode int = 403 + +/* +UpdateShipmentDestinationAddressForbidden The request was denied. + +swagger:response updateShipmentDestinationAddressForbidden +*/ +type UpdateShipmentDestinationAddressForbidden struct { + + /* + In: Body + */ + Payload *primemessages.ClientError `json:"body,omitempty"` +} + +// NewUpdateShipmentDestinationAddressForbidden creates UpdateShipmentDestinationAddressForbidden with default headers values +func NewUpdateShipmentDestinationAddressForbidden() *UpdateShipmentDestinationAddressForbidden { + + return &UpdateShipmentDestinationAddressForbidden{} +} + +// WithPayload adds the payload to the update shipment destination address forbidden response +func (o *UpdateShipmentDestinationAddressForbidden) WithPayload(payload *primemessages.ClientError) *UpdateShipmentDestinationAddressForbidden { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the update shipment destination address forbidden response +func (o *UpdateShipmentDestinationAddressForbidden) SetPayload(payload *primemessages.ClientError) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *UpdateShipmentDestinationAddressForbidden) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(403) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} + +// UpdateShipmentDestinationAddressNotFoundCode is the HTTP code returned for type UpdateShipmentDestinationAddressNotFound +const UpdateShipmentDestinationAddressNotFoundCode int = 404 + +/* +UpdateShipmentDestinationAddressNotFound The requested resource wasn't found. + +swagger:response updateShipmentDestinationAddressNotFound +*/ +type UpdateShipmentDestinationAddressNotFound struct { + + /* + In: Body + */ + Payload *primemessages.ClientError `json:"body,omitempty"` +} + +// NewUpdateShipmentDestinationAddressNotFound creates UpdateShipmentDestinationAddressNotFound with default headers values +func NewUpdateShipmentDestinationAddressNotFound() *UpdateShipmentDestinationAddressNotFound { + + return &UpdateShipmentDestinationAddressNotFound{} +} + +// WithPayload adds the payload to the update shipment destination address not found response +func (o *UpdateShipmentDestinationAddressNotFound) WithPayload(payload *primemessages.ClientError) *UpdateShipmentDestinationAddressNotFound { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the update shipment destination address not found response +func (o *UpdateShipmentDestinationAddressNotFound) SetPayload(payload *primemessages.ClientError) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *UpdateShipmentDestinationAddressNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(404) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} + +// UpdateShipmentDestinationAddressConflictCode is the HTTP code returned for type UpdateShipmentDestinationAddressConflict +const UpdateShipmentDestinationAddressConflictCode int = 409 + +/* +UpdateShipmentDestinationAddressConflict The request could not be processed because of conflict in the current state of the resource. + +swagger:response updateShipmentDestinationAddressConflict +*/ +type UpdateShipmentDestinationAddressConflict struct { + + /* + In: Body + */ + Payload *primemessages.ClientError `json:"body,omitempty"` +} + +// NewUpdateShipmentDestinationAddressConflict creates UpdateShipmentDestinationAddressConflict with default headers values +func NewUpdateShipmentDestinationAddressConflict() *UpdateShipmentDestinationAddressConflict { + + return &UpdateShipmentDestinationAddressConflict{} +} + +// WithPayload adds the payload to the update shipment destination address conflict response +func (o *UpdateShipmentDestinationAddressConflict) WithPayload(payload *primemessages.ClientError) *UpdateShipmentDestinationAddressConflict { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the update shipment destination address conflict response +func (o *UpdateShipmentDestinationAddressConflict) SetPayload(payload *primemessages.ClientError) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *UpdateShipmentDestinationAddressConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(409) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} + +// UpdateShipmentDestinationAddressPreconditionFailedCode is the HTTP code returned for type UpdateShipmentDestinationAddressPreconditionFailed +const UpdateShipmentDestinationAddressPreconditionFailedCode int = 412 + +/* +UpdateShipmentDestinationAddressPreconditionFailed Precondition failed, likely due to a stale eTag (If-Match). Fetch the request again to get the updated eTag value. + +swagger:response updateShipmentDestinationAddressPreconditionFailed +*/ +type UpdateShipmentDestinationAddressPreconditionFailed struct { + + /* + In: Body + */ + Payload *primemessages.ClientError `json:"body,omitempty"` +} + +// NewUpdateShipmentDestinationAddressPreconditionFailed creates UpdateShipmentDestinationAddressPreconditionFailed with default headers values +func NewUpdateShipmentDestinationAddressPreconditionFailed() *UpdateShipmentDestinationAddressPreconditionFailed { + + return &UpdateShipmentDestinationAddressPreconditionFailed{} +} + +// WithPayload adds the payload to the update shipment destination address precondition failed response +func (o *UpdateShipmentDestinationAddressPreconditionFailed) WithPayload(payload *primemessages.ClientError) *UpdateShipmentDestinationAddressPreconditionFailed { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the update shipment destination address precondition failed response +func (o *UpdateShipmentDestinationAddressPreconditionFailed) SetPayload(payload *primemessages.ClientError) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *UpdateShipmentDestinationAddressPreconditionFailed) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(412) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} + +// UpdateShipmentDestinationAddressUnprocessableEntityCode is the HTTP code returned for type UpdateShipmentDestinationAddressUnprocessableEntity +const UpdateShipmentDestinationAddressUnprocessableEntityCode int = 422 + +/* +UpdateShipmentDestinationAddressUnprocessableEntity The request was unprocessable, likely due to bad input from the requester. + +swagger:response updateShipmentDestinationAddressUnprocessableEntity +*/ +type UpdateShipmentDestinationAddressUnprocessableEntity struct { + + /* + In: Body + */ + Payload *primemessages.ValidationError `json:"body,omitempty"` +} + +// NewUpdateShipmentDestinationAddressUnprocessableEntity creates UpdateShipmentDestinationAddressUnprocessableEntity with default headers values +func NewUpdateShipmentDestinationAddressUnprocessableEntity() *UpdateShipmentDestinationAddressUnprocessableEntity { + + return &UpdateShipmentDestinationAddressUnprocessableEntity{} +} + +// WithPayload adds the payload to the update shipment destination address unprocessable entity response +func (o *UpdateShipmentDestinationAddressUnprocessableEntity) WithPayload(payload *primemessages.ValidationError) *UpdateShipmentDestinationAddressUnprocessableEntity { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the update shipment destination address unprocessable entity response +func (o *UpdateShipmentDestinationAddressUnprocessableEntity) SetPayload(payload *primemessages.ValidationError) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *UpdateShipmentDestinationAddressUnprocessableEntity) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(422) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} + +// UpdateShipmentDestinationAddressInternalServerErrorCode is the HTTP code returned for type UpdateShipmentDestinationAddressInternalServerError +const UpdateShipmentDestinationAddressInternalServerErrorCode int = 500 + +/* +UpdateShipmentDestinationAddressInternalServerError A server error occurred. + +swagger:response updateShipmentDestinationAddressInternalServerError +*/ +type UpdateShipmentDestinationAddressInternalServerError struct { + + /* + In: Body + */ + Payload *primemessages.Error `json:"body,omitempty"` +} + +// NewUpdateShipmentDestinationAddressInternalServerError creates UpdateShipmentDestinationAddressInternalServerError with default headers values +func NewUpdateShipmentDestinationAddressInternalServerError() *UpdateShipmentDestinationAddressInternalServerError { + + return &UpdateShipmentDestinationAddressInternalServerError{} +} + +// WithPayload adds the payload to the update shipment destination address internal server error response +func (o *UpdateShipmentDestinationAddressInternalServerError) WithPayload(payload *primemessages.Error) *UpdateShipmentDestinationAddressInternalServerError { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the update shipment destination address internal server error response +func (o *UpdateShipmentDestinationAddressInternalServerError) SetPayload(payload *primemessages.Error) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *UpdateShipmentDestinationAddressInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(500) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} diff --git a/pkg/gen/primeapi/primeoperations/mto_shipment/create_non_s_i_t_address_update_request_urlbuilder.go b/pkg/gen/primeapi/primeoperations/mto_shipment/update_shipment_destination_address_urlbuilder.go similarity index 67% rename from pkg/gen/primeapi/primeoperations/mto_shipment/create_non_s_i_t_address_update_request_urlbuilder.go rename to pkg/gen/primeapi/primeoperations/mto_shipment/update_shipment_destination_address_urlbuilder.go index 26f5dbd333c..302bec38b03 100644 --- a/pkg/gen/primeapi/primeoperations/mto_shipment/create_non_s_i_t_address_update_request_urlbuilder.go +++ b/pkg/gen/primeapi/primeoperations/mto_shipment/update_shipment_destination_address_urlbuilder.go @@ -14,8 +14,8 @@ import ( "github.com/go-openapi/strfmt" ) -// CreateNonSITAddressUpdateRequestURL generates an URL for the create non s i t address update request operation -type CreateNonSITAddressUpdateRequestURL struct { +// UpdateShipmentDestinationAddressURL generates an URL for the update shipment destination address operation +type UpdateShipmentDestinationAddressURL struct { MtoShipmentID strfmt.UUID _basePath string @@ -26,7 +26,7 @@ type CreateNonSITAddressUpdateRequestURL struct { // WithBasePath sets the base path for this url builder, only required when it's different from the // base path specified in the swagger spec. // When the value of the base path is an empty string -func (o *CreateNonSITAddressUpdateRequestURL) WithBasePath(bp string) *CreateNonSITAddressUpdateRequestURL { +func (o *UpdateShipmentDestinationAddressURL) WithBasePath(bp string) *UpdateShipmentDestinationAddressURL { o.SetBasePath(bp) return o } @@ -34,12 +34,12 @@ func (o *CreateNonSITAddressUpdateRequestURL) WithBasePath(bp string) *CreateNon // SetBasePath sets the base path for this url builder, only required when it's different from the // base path specified in the swagger spec. // When the value of the base path is an empty string -func (o *CreateNonSITAddressUpdateRequestURL) SetBasePath(bp string) { +func (o *UpdateShipmentDestinationAddressURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string -func (o *CreateNonSITAddressUpdateRequestURL) Build() (*url.URL, error) { +func (o *UpdateShipmentDestinationAddressURL) Build() (*url.URL, error) { var _result url.URL var _path = "/mto-shipments/{mtoShipmentID}/shipment-address-updates" @@ -48,7 +48,7 @@ func (o *CreateNonSITAddressUpdateRequestURL) Build() (*url.URL, error) { if mtoShipmentID != "" { _path = strings.Replace(_path, "{mtoShipmentID}", mtoShipmentID, -1) } else { - return nil, errors.New("mtoShipmentId is required on CreateNonSITAddressUpdateRequestURL") + return nil, errors.New("mtoShipmentId is required on UpdateShipmentDestinationAddressURL") } _basePath := o._basePath @@ -61,7 +61,7 @@ func (o *CreateNonSITAddressUpdateRequestURL) Build() (*url.URL, error) { } // Must is a helper function to panic when the url builder returns an error -func (o *CreateNonSITAddressUpdateRequestURL) Must(u *url.URL, err error) *url.URL { +func (o *UpdateShipmentDestinationAddressURL) Must(u *url.URL, err error) *url.URL { if err != nil { panic(err) } @@ -72,17 +72,17 @@ func (o *CreateNonSITAddressUpdateRequestURL) Must(u *url.URL, err error) *url.U } // String returns the string representation of the path with query string -func (o *CreateNonSITAddressUpdateRequestURL) String() string { +func (o *UpdateShipmentDestinationAddressURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string -func (o *CreateNonSITAddressUpdateRequestURL) BuildFull(scheme, host string) (*url.URL, error) { +func (o *UpdateShipmentDestinationAddressURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateNonSITAddressUpdateRequestURL") + return nil, errors.New("scheme is required for a full url on UpdateShipmentDestinationAddressURL") } if host == "" { - return nil, errors.New("host is required for a full url on CreateNonSITAddressUpdateRequestURL") + return nil, errors.New("host is required for a full url on UpdateShipmentDestinationAddressURL") } base, err := o.Build() @@ -96,6 +96,6 @@ func (o *CreateNonSITAddressUpdateRequestURL) BuildFull(scheme, host string) (*u } // StringFull returns the string representation of a complete url -func (o *CreateNonSITAddressUpdateRequestURL) StringFull(scheme, host string) string { +func (o *UpdateShipmentDestinationAddressURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } diff --git a/pkg/gen/primeapi/primeoperations/mymove_api.go b/pkg/gen/primeapi/primeoperations/mymove_api.go index c7bcb149086..1d557dc5d64 100644 --- a/pkg/gen/primeapi/primeoperations/mymove_api.go +++ b/pkg/gen/primeapi/primeoperations/mymove_api.go @@ -62,9 +62,6 @@ func NewMymoveAPI(spec *loads.Document) *MymoveAPI { MtoShipmentCreateMTOShipmentHandler: mto_shipment.CreateMTOShipmentHandlerFunc(func(params mto_shipment.CreateMTOShipmentParams) middleware.Responder { return middleware.NotImplemented("operation mto_shipment.CreateMTOShipment has not yet been implemented") }), - MtoShipmentCreateNonSITAddressUpdateRequestHandler: mto_shipment.CreateNonSITAddressUpdateRequestHandlerFunc(func(params mto_shipment.CreateNonSITAddressUpdateRequestParams) middleware.Responder { - return middleware.NotImplemented("operation mto_shipment.CreateNonSITAddressUpdateRequest has not yet been implemented") - }), PaymentRequestCreatePaymentRequestHandler: payment_request.CreatePaymentRequestHandlerFunc(func(params payment_request.CreatePaymentRequestParams) middleware.Responder { return middleware.NotImplemented("operation payment_request.CreatePaymentRequest has not yet been implemented") }), @@ -116,6 +113,9 @@ func NewMymoveAPI(spec *loads.Document) *MymoveAPI { MtoShipmentUpdateSITDeliveryRequestHandler: mto_shipment.UpdateSITDeliveryRequestHandlerFunc(func(params mto_shipment.UpdateSITDeliveryRequestParams) middleware.Responder { return middleware.NotImplemented("operation mto_shipment.UpdateSITDeliveryRequest has not yet been implemented") }), + MtoShipmentUpdateShipmentDestinationAddressHandler: mto_shipment.UpdateShipmentDestinationAddressHandlerFunc(func(params mto_shipment.UpdateShipmentDestinationAddressParams) middleware.Responder { + return middleware.NotImplemented("operation mto_shipment.UpdateShipmentDestinationAddress has not yet been implemented") + }), } } @@ -172,8 +172,6 @@ type MymoveAPI struct { MtoServiceItemCreateMTOServiceItemHandler mto_service_item.CreateMTOServiceItemHandler // MtoShipmentCreateMTOShipmentHandler sets the operation handler for the create m t o shipment operation MtoShipmentCreateMTOShipmentHandler mto_shipment.CreateMTOShipmentHandler - // MtoShipmentCreateNonSITAddressUpdateRequestHandler sets the operation handler for the create non s i t address update request operation - MtoShipmentCreateNonSITAddressUpdateRequestHandler mto_shipment.CreateNonSITAddressUpdateRequestHandler // PaymentRequestCreatePaymentRequestHandler sets the operation handler for the create payment request operation PaymentRequestCreatePaymentRequestHandler payment_request.CreatePaymentRequestHandler // SitAddressUpdateCreateSITAddressUpdateRequestHandler sets the operation handler for the create s i t address update request operation @@ -208,6 +206,8 @@ type MymoveAPI struct { MtoShipmentUpdateReweighHandler mto_shipment.UpdateReweighHandler // MtoShipmentUpdateSITDeliveryRequestHandler sets the operation handler for the update s i t delivery request operation MtoShipmentUpdateSITDeliveryRequestHandler mto_shipment.UpdateSITDeliveryRequestHandler + // MtoShipmentUpdateShipmentDestinationAddressHandler sets the operation handler for the update shipment destination address operation + MtoShipmentUpdateShipmentDestinationAddressHandler mto_shipment.UpdateShipmentDestinationAddressHandler // ServeError is called when an error is received, there is a default handler // but you can set your own with this @@ -303,9 +303,6 @@ func (o *MymoveAPI) Validate() error { if o.MtoShipmentCreateMTOShipmentHandler == nil { unregistered = append(unregistered, "mto_shipment.CreateMTOShipmentHandler") } - if o.MtoShipmentCreateNonSITAddressUpdateRequestHandler == nil { - unregistered = append(unregistered, "mto_shipment.CreateNonSITAddressUpdateRequestHandler") - } if o.PaymentRequestCreatePaymentRequestHandler == nil { unregistered = append(unregistered, "payment_request.CreatePaymentRequestHandler") } @@ -357,6 +354,9 @@ func (o *MymoveAPI) Validate() error { if o.MtoShipmentUpdateSITDeliveryRequestHandler == nil { unregistered = append(unregistered, "mto_shipment.UpdateSITDeliveryRequestHandler") } + if o.MtoShipmentUpdateShipmentDestinationAddressHandler == nil { + unregistered = append(unregistered, "mto_shipment.UpdateShipmentDestinationAddressHandler") + } if len(unregistered) > 0 { return fmt.Errorf("missing registration: %s", strings.Join(unregistered, ", ")) @@ -468,10 +468,6 @@ func (o *MymoveAPI) initHandlerCache() { if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } - o.handlers["POST"]["/mto-shipments/{mtoShipmentID}/shipment-address-updates"] = mto_shipment.NewCreateNonSITAddressUpdateRequest(o.context, o.MtoShipmentCreateNonSITAddressUpdateRequestHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } o.handlers["POST"]["/payment-requests"] = payment_request.NewCreatePaymentRequest(o.context, o.PaymentRequestCreatePaymentRequestHandler) if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) @@ -537,6 +533,10 @@ func (o *MymoveAPI) initHandlerCache() { o.handlers["PATCH"] = make(map[string]http.Handler) } o.handlers["PATCH"]["/mto-shipments/{mtoShipmentID}/sit-delivery"] = mto_shipment.NewUpdateSITDeliveryRequest(o.context, o.MtoShipmentUpdateSITDeliveryRequestHandler) + if o.handlers["POST"] == nil { + o.handlers["POST"] = make(map[string]http.Handler) + } + o.handlers["POST"]["/mto-shipments/{mtoShipmentID}/shipment-address-updates"] = mto_shipment.NewUpdateShipmentDestinationAddress(o.context, o.MtoShipmentUpdateShipmentDestinationAddressHandler) } // Serve creates a http handler to serve the API over HTTP diff --git a/pkg/gen/primeclient/mto_shipment/create_non_s_i_t_address_update_request_parameters.go b/pkg/gen/primeclient/mto_shipment/create_non_s_i_t_address_update_request_parameters.go deleted file mode 100644 index 7f4a8fcb5a7..00000000000 --- a/pkg/gen/primeclient/mto_shipment/create_non_s_i_t_address_update_request_parameters.go +++ /dev/null @@ -1,197 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package mto_shipment - -// 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/transcom/mymove/pkg/gen/primemessages" -) - -// NewCreateNonSITAddressUpdateRequestParams creates a new CreateNonSITAddressUpdateRequestParams 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 NewCreateNonSITAddressUpdateRequestParams() *CreateNonSITAddressUpdateRequestParams { - return &CreateNonSITAddressUpdateRequestParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewCreateNonSITAddressUpdateRequestParamsWithTimeout creates a new CreateNonSITAddressUpdateRequestParams object -// with the ability to set a timeout on a request. -func NewCreateNonSITAddressUpdateRequestParamsWithTimeout(timeout time.Duration) *CreateNonSITAddressUpdateRequestParams { - return &CreateNonSITAddressUpdateRequestParams{ - timeout: timeout, - } -} - -// NewCreateNonSITAddressUpdateRequestParamsWithContext creates a new CreateNonSITAddressUpdateRequestParams object -// with the ability to set a context for a request. -func NewCreateNonSITAddressUpdateRequestParamsWithContext(ctx context.Context) *CreateNonSITAddressUpdateRequestParams { - return &CreateNonSITAddressUpdateRequestParams{ - Context: ctx, - } -} - -// NewCreateNonSITAddressUpdateRequestParamsWithHTTPClient creates a new CreateNonSITAddressUpdateRequestParams object -// with the ability to set a custom HTTPClient for a request. -func NewCreateNonSITAddressUpdateRequestParamsWithHTTPClient(client *http.Client) *CreateNonSITAddressUpdateRequestParams { - return &CreateNonSITAddressUpdateRequestParams{ - HTTPClient: client, - } -} - -/* -CreateNonSITAddressUpdateRequestParams contains all the parameters to send to the API endpoint - - for the create non s i t address update request operation. - - Typically these are written to a http.Request. -*/ -type CreateNonSITAddressUpdateRequestParams struct { - - /* IfMatch. - - Needs to be the eTag of the mtoShipment. Optimistic locking is implemented via the `If-Match` header. If the ETag header does not match the value of the resource on the server, the server rejects the change with a `412 Precondition Failed` error. - - */ - IfMatch string - - // Body. - Body *primemessages.CreateNonSITAddressUpdateRequest - - /* MtoShipmentID. - - UUID of the shipment associated with the address - - Format: uuid - */ - MtoShipmentID strfmt.UUID - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the create non s i t address update request params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *CreateNonSITAddressUpdateRequestParams) WithDefaults() *CreateNonSITAddressUpdateRequestParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the create non s i t address update request params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *CreateNonSITAddressUpdateRequestParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the create non s i t address update request params -func (o *CreateNonSITAddressUpdateRequestParams) WithTimeout(timeout time.Duration) *CreateNonSITAddressUpdateRequestParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the create non s i t address update request params -func (o *CreateNonSITAddressUpdateRequestParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the create non s i t address update request params -func (o *CreateNonSITAddressUpdateRequestParams) WithContext(ctx context.Context) *CreateNonSITAddressUpdateRequestParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the create non s i t address update request params -func (o *CreateNonSITAddressUpdateRequestParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the create non s i t address update request params -func (o *CreateNonSITAddressUpdateRequestParams) WithHTTPClient(client *http.Client) *CreateNonSITAddressUpdateRequestParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the create non s i t address update request params -func (o *CreateNonSITAddressUpdateRequestParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithIfMatch adds the ifMatch to the create non s i t address update request params -func (o *CreateNonSITAddressUpdateRequestParams) WithIfMatch(ifMatch string) *CreateNonSITAddressUpdateRequestParams { - o.SetIfMatch(ifMatch) - return o -} - -// SetIfMatch adds the ifMatch to the create non s i t address update request params -func (o *CreateNonSITAddressUpdateRequestParams) SetIfMatch(ifMatch string) { - o.IfMatch = ifMatch -} - -// WithBody adds the body to the create non s i t address update request params -func (o *CreateNonSITAddressUpdateRequestParams) WithBody(body *primemessages.CreateNonSITAddressUpdateRequest) *CreateNonSITAddressUpdateRequestParams { - o.SetBody(body) - return o -} - -// SetBody adds the body to the create non s i t address update request params -func (o *CreateNonSITAddressUpdateRequestParams) SetBody(body *primemessages.CreateNonSITAddressUpdateRequest) { - o.Body = body -} - -// WithMtoShipmentID adds the mtoShipmentID to the create non s i t address update request params -func (o *CreateNonSITAddressUpdateRequestParams) WithMtoShipmentID(mtoShipmentID strfmt.UUID) *CreateNonSITAddressUpdateRequestParams { - o.SetMtoShipmentID(mtoShipmentID) - return o -} - -// SetMtoShipmentID adds the mtoShipmentId to the create non s i t address update request params -func (o *CreateNonSITAddressUpdateRequestParams) SetMtoShipmentID(mtoShipmentID strfmt.UUID) { - o.MtoShipmentID = mtoShipmentID -} - -// WriteToRequest writes these params to a swagger request -func (o *CreateNonSITAddressUpdateRequestParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - // header param If-Match - if err := r.SetHeaderParam("If-Match", o.IfMatch); err != nil { - return err - } - if o.Body != nil { - if err := r.SetBodyParam(o.Body); err != nil { - return err - } - } - - // path param mtoShipmentID - if err := r.SetPathParam("mtoShipmentID", o.MtoShipmentID.String()); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/pkg/gen/primeclient/mto_shipment/create_non_s_i_t_address_update_request_responses.go b/pkg/gen/primeclient/mto_shipment/create_non_s_i_t_address_update_request_responses.go deleted file mode 100644 index 6c58675273e..00000000000 --- a/pkg/gen/primeclient/mto_shipment/create_non_s_i_t_address_update_request_responses.go +++ /dev/null @@ -1,695 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package mto_shipment - -// 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" - "github.com/go-openapi/strfmt" - - "github.com/transcom/mymove/pkg/gen/primemessages" -) - -// CreateNonSITAddressUpdateRequestReader is a Reader for the CreateNonSITAddressUpdateRequest structure. -type CreateNonSITAddressUpdateRequestReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *CreateNonSITAddressUpdateRequestReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 201: - result := NewCreateNonSITAddressUpdateRequestCreated() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 400: - result := NewCreateNonSITAddressUpdateRequestBadRequest() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 401: - result := NewCreateNonSITAddressUpdateRequestUnauthorized() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 403: - result := NewCreateNonSITAddressUpdateRequestForbidden() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 404: - result := NewCreateNonSITAddressUpdateRequestNotFound() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 409: - result := NewCreateNonSITAddressUpdateRequestConflict() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 412: - result := NewCreateNonSITAddressUpdateRequestPreconditionFailed() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 422: - result := NewCreateNonSITAddressUpdateRequestUnprocessableEntity() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 500: - result := NewCreateNonSITAddressUpdateRequestInternalServerError() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[POST /mto-shipments/{mtoShipmentID}/shipment-address-updates] createNonSITAddressUpdateRequest", response, response.Code()) - } -} - -// NewCreateNonSITAddressUpdateRequestCreated creates a CreateNonSITAddressUpdateRequestCreated with default headers values -func NewCreateNonSITAddressUpdateRequestCreated() *CreateNonSITAddressUpdateRequestCreated { - return &CreateNonSITAddressUpdateRequestCreated{} -} - -/* -CreateNonSITAddressUpdateRequestCreated describes a response with status code 201, with default header values. - -Successfully created the address update request. -*/ -type CreateNonSITAddressUpdateRequestCreated struct { - Payload *primemessages.ShipmentAddressUpdate -} - -// IsSuccess returns true when this create non s i t address update request created response has a 2xx status code -func (o *CreateNonSITAddressUpdateRequestCreated) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this create non s i t address update request created response has a 3xx status code -func (o *CreateNonSITAddressUpdateRequestCreated) IsRedirect() bool { - return false -} - -// IsClientError returns true when this create non s i t address update request created response has a 4xx status code -func (o *CreateNonSITAddressUpdateRequestCreated) IsClientError() bool { - return false -} - -// IsServerError returns true when this create non s i t address update request created response has a 5xx status code -func (o *CreateNonSITAddressUpdateRequestCreated) IsServerError() bool { - return false -} - -// IsCode returns true when this create non s i t address update request created response a status code equal to that given -func (o *CreateNonSITAddressUpdateRequestCreated) IsCode(code int) bool { - return code == 201 -} - -// Code gets the status code for the create non s i t address update request created response -func (o *CreateNonSITAddressUpdateRequestCreated) Code() int { - return 201 -} - -func (o *CreateNonSITAddressUpdateRequestCreated) Error() string { - return fmt.Sprintf("[POST /mto-shipments/{mtoShipmentID}/shipment-address-updates][%d] createNonSITAddressUpdateRequestCreated %+v", 201, o.Payload) -} - -func (o *CreateNonSITAddressUpdateRequestCreated) String() string { - return fmt.Sprintf("[POST /mto-shipments/{mtoShipmentID}/shipment-address-updates][%d] createNonSITAddressUpdateRequestCreated %+v", 201, o.Payload) -} - -func (o *CreateNonSITAddressUpdateRequestCreated) GetPayload() *primemessages.ShipmentAddressUpdate { - return o.Payload -} - -func (o *CreateNonSITAddressUpdateRequestCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(primemessages.ShipmentAddressUpdate) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewCreateNonSITAddressUpdateRequestBadRequest creates a CreateNonSITAddressUpdateRequestBadRequest with default headers values -func NewCreateNonSITAddressUpdateRequestBadRequest() *CreateNonSITAddressUpdateRequestBadRequest { - return &CreateNonSITAddressUpdateRequestBadRequest{} -} - -/* -CreateNonSITAddressUpdateRequestBadRequest describes a response with status code 400, with default header values. - -The request payload is invalid. -*/ -type CreateNonSITAddressUpdateRequestBadRequest struct { - Payload *primemessages.ClientError -} - -// IsSuccess returns true when this create non s i t address update request bad request response has a 2xx status code -func (o *CreateNonSITAddressUpdateRequestBadRequest) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this create non s i t address update request bad request response has a 3xx status code -func (o *CreateNonSITAddressUpdateRequestBadRequest) IsRedirect() bool { - return false -} - -// IsClientError returns true when this create non s i t address update request bad request response has a 4xx status code -func (o *CreateNonSITAddressUpdateRequestBadRequest) IsClientError() bool { - return true -} - -// IsServerError returns true when this create non s i t address update request bad request response has a 5xx status code -func (o *CreateNonSITAddressUpdateRequestBadRequest) IsServerError() bool { - return false -} - -// IsCode returns true when this create non s i t address update request bad request response a status code equal to that given -func (o *CreateNonSITAddressUpdateRequestBadRequest) IsCode(code int) bool { - return code == 400 -} - -// Code gets the status code for the create non s i t address update request bad request response -func (o *CreateNonSITAddressUpdateRequestBadRequest) Code() int { - return 400 -} - -func (o *CreateNonSITAddressUpdateRequestBadRequest) Error() string { - return fmt.Sprintf("[POST /mto-shipments/{mtoShipmentID}/shipment-address-updates][%d] createNonSITAddressUpdateRequestBadRequest %+v", 400, o.Payload) -} - -func (o *CreateNonSITAddressUpdateRequestBadRequest) String() string { - return fmt.Sprintf("[POST /mto-shipments/{mtoShipmentID}/shipment-address-updates][%d] createNonSITAddressUpdateRequestBadRequest %+v", 400, o.Payload) -} - -func (o *CreateNonSITAddressUpdateRequestBadRequest) GetPayload() *primemessages.ClientError { - return o.Payload -} - -func (o *CreateNonSITAddressUpdateRequestBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(primemessages.ClientError) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewCreateNonSITAddressUpdateRequestUnauthorized creates a CreateNonSITAddressUpdateRequestUnauthorized with default headers values -func NewCreateNonSITAddressUpdateRequestUnauthorized() *CreateNonSITAddressUpdateRequestUnauthorized { - return &CreateNonSITAddressUpdateRequestUnauthorized{} -} - -/* -CreateNonSITAddressUpdateRequestUnauthorized describes a response with status code 401, with default header values. - -The request was denied. -*/ -type CreateNonSITAddressUpdateRequestUnauthorized struct { - Payload *primemessages.ClientError -} - -// IsSuccess returns true when this create non s i t address update request unauthorized response has a 2xx status code -func (o *CreateNonSITAddressUpdateRequestUnauthorized) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this create non s i t address update request unauthorized response has a 3xx status code -func (o *CreateNonSITAddressUpdateRequestUnauthorized) IsRedirect() bool { - return false -} - -// IsClientError returns true when this create non s i t address update request unauthorized response has a 4xx status code -func (o *CreateNonSITAddressUpdateRequestUnauthorized) IsClientError() bool { - return true -} - -// IsServerError returns true when this create non s i t address update request unauthorized response has a 5xx status code -func (o *CreateNonSITAddressUpdateRequestUnauthorized) IsServerError() bool { - return false -} - -// IsCode returns true when this create non s i t address update request unauthorized response a status code equal to that given -func (o *CreateNonSITAddressUpdateRequestUnauthorized) IsCode(code int) bool { - return code == 401 -} - -// Code gets the status code for the create non s i t address update request unauthorized response -func (o *CreateNonSITAddressUpdateRequestUnauthorized) Code() int { - return 401 -} - -func (o *CreateNonSITAddressUpdateRequestUnauthorized) Error() string { - return fmt.Sprintf("[POST /mto-shipments/{mtoShipmentID}/shipment-address-updates][%d] createNonSITAddressUpdateRequestUnauthorized %+v", 401, o.Payload) -} - -func (o *CreateNonSITAddressUpdateRequestUnauthorized) String() string { - return fmt.Sprintf("[POST /mto-shipments/{mtoShipmentID}/shipment-address-updates][%d] createNonSITAddressUpdateRequestUnauthorized %+v", 401, o.Payload) -} - -func (o *CreateNonSITAddressUpdateRequestUnauthorized) GetPayload() *primemessages.ClientError { - return o.Payload -} - -func (o *CreateNonSITAddressUpdateRequestUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(primemessages.ClientError) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewCreateNonSITAddressUpdateRequestForbidden creates a CreateNonSITAddressUpdateRequestForbidden with default headers values -func NewCreateNonSITAddressUpdateRequestForbidden() *CreateNonSITAddressUpdateRequestForbidden { - return &CreateNonSITAddressUpdateRequestForbidden{} -} - -/* -CreateNonSITAddressUpdateRequestForbidden describes a response with status code 403, with default header values. - -The request was denied. -*/ -type CreateNonSITAddressUpdateRequestForbidden struct { - Payload *primemessages.ClientError -} - -// IsSuccess returns true when this create non s i t address update request forbidden response has a 2xx status code -func (o *CreateNonSITAddressUpdateRequestForbidden) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this create non s i t address update request forbidden response has a 3xx status code -func (o *CreateNonSITAddressUpdateRequestForbidden) IsRedirect() bool { - return false -} - -// IsClientError returns true when this create non s i t address update request forbidden response has a 4xx status code -func (o *CreateNonSITAddressUpdateRequestForbidden) IsClientError() bool { - return true -} - -// IsServerError returns true when this create non s i t address update request forbidden response has a 5xx status code -func (o *CreateNonSITAddressUpdateRequestForbidden) IsServerError() bool { - return false -} - -// IsCode returns true when this create non s i t address update request forbidden response a status code equal to that given -func (o *CreateNonSITAddressUpdateRequestForbidden) IsCode(code int) bool { - return code == 403 -} - -// Code gets the status code for the create non s i t address update request forbidden response -func (o *CreateNonSITAddressUpdateRequestForbidden) Code() int { - return 403 -} - -func (o *CreateNonSITAddressUpdateRequestForbidden) Error() string { - return fmt.Sprintf("[POST /mto-shipments/{mtoShipmentID}/shipment-address-updates][%d] createNonSITAddressUpdateRequestForbidden %+v", 403, o.Payload) -} - -func (o *CreateNonSITAddressUpdateRequestForbidden) String() string { - return fmt.Sprintf("[POST /mto-shipments/{mtoShipmentID}/shipment-address-updates][%d] createNonSITAddressUpdateRequestForbidden %+v", 403, o.Payload) -} - -func (o *CreateNonSITAddressUpdateRequestForbidden) GetPayload() *primemessages.ClientError { - return o.Payload -} - -func (o *CreateNonSITAddressUpdateRequestForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(primemessages.ClientError) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewCreateNonSITAddressUpdateRequestNotFound creates a CreateNonSITAddressUpdateRequestNotFound with default headers values -func NewCreateNonSITAddressUpdateRequestNotFound() *CreateNonSITAddressUpdateRequestNotFound { - return &CreateNonSITAddressUpdateRequestNotFound{} -} - -/* -CreateNonSITAddressUpdateRequestNotFound describes a response with status code 404, with default header values. - -The requested resource wasn't found. -*/ -type CreateNonSITAddressUpdateRequestNotFound struct { - Payload *primemessages.ClientError -} - -// IsSuccess returns true when this create non s i t address update request not found response has a 2xx status code -func (o *CreateNonSITAddressUpdateRequestNotFound) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this create non s i t address update request not found response has a 3xx status code -func (o *CreateNonSITAddressUpdateRequestNotFound) IsRedirect() bool { - return false -} - -// IsClientError returns true when this create non s i t address update request not found response has a 4xx status code -func (o *CreateNonSITAddressUpdateRequestNotFound) IsClientError() bool { - return true -} - -// IsServerError returns true when this create non s i t address update request not found response has a 5xx status code -func (o *CreateNonSITAddressUpdateRequestNotFound) IsServerError() bool { - return false -} - -// IsCode returns true when this create non s i t address update request not found response a status code equal to that given -func (o *CreateNonSITAddressUpdateRequestNotFound) IsCode(code int) bool { - return code == 404 -} - -// Code gets the status code for the create non s i t address update request not found response -func (o *CreateNonSITAddressUpdateRequestNotFound) Code() int { - return 404 -} - -func (o *CreateNonSITAddressUpdateRequestNotFound) Error() string { - return fmt.Sprintf("[POST /mto-shipments/{mtoShipmentID}/shipment-address-updates][%d] createNonSITAddressUpdateRequestNotFound %+v", 404, o.Payload) -} - -func (o *CreateNonSITAddressUpdateRequestNotFound) String() string { - return fmt.Sprintf("[POST /mto-shipments/{mtoShipmentID}/shipment-address-updates][%d] createNonSITAddressUpdateRequestNotFound %+v", 404, o.Payload) -} - -func (o *CreateNonSITAddressUpdateRequestNotFound) GetPayload() *primemessages.ClientError { - return o.Payload -} - -func (o *CreateNonSITAddressUpdateRequestNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(primemessages.ClientError) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewCreateNonSITAddressUpdateRequestConflict creates a CreateNonSITAddressUpdateRequestConflict with default headers values -func NewCreateNonSITAddressUpdateRequestConflict() *CreateNonSITAddressUpdateRequestConflict { - return &CreateNonSITAddressUpdateRequestConflict{} -} - -/* -CreateNonSITAddressUpdateRequestConflict describes a response with status code 409, with default header values. - -The request could not be processed because of conflict in the current state of the resource. -*/ -type CreateNonSITAddressUpdateRequestConflict struct { - Payload *primemessages.ClientError -} - -// IsSuccess returns true when this create non s i t address update request conflict response has a 2xx status code -func (o *CreateNonSITAddressUpdateRequestConflict) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this create non s i t address update request conflict response has a 3xx status code -func (o *CreateNonSITAddressUpdateRequestConflict) IsRedirect() bool { - return false -} - -// IsClientError returns true when this create non s i t address update request conflict response has a 4xx status code -func (o *CreateNonSITAddressUpdateRequestConflict) IsClientError() bool { - return true -} - -// IsServerError returns true when this create non s i t address update request conflict response has a 5xx status code -func (o *CreateNonSITAddressUpdateRequestConflict) IsServerError() bool { - return false -} - -// IsCode returns true when this create non s i t address update request conflict response a status code equal to that given -func (o *CreateNonSITAddressUpdateRequestConflict) IsCode(code int) bool { - return code == 409 -} - -// Code gets the status code for the create non s i t address update request conflict response -func (o *CreateNonSITAddressUpdateRequestConflict) Code() int { - return 409 -} - -func (o *CreateNonSITAddressUpdateRequestConflict) Error() string { - return fmt.Sprintf("[POST /mto-shipments/{mtoShipmentID}/shipment-address-updates][%d] createNonSITAddressUpdateRequestConflict %+v", 409, o.Payload) -} - -func (o *CreateNonSITAddressUpdateRequestConflict) String() string { - return fmt.Sprintf("[POST /mto-shipments/{mtoShipmentID}/shipment-address-updates][%d] createNonSITAddressUpdateRequestConflict %+v", 409, o.Payload) -} - -func (o *CreateNonSITAddressUpdateRequestConflict) GetPayload() *primemessages.ClientError { - return o.Payload -} - -func (o *CreateNonSITAddressUpdateRequestConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(primemessages.ClientError) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewCreateNonSITAddressUpdateRequestPreconditionFailed creates a CreateNonSITAddressUpdateRequestPreconditionFailed with default headers values -func NewCreateNonSITAddressUpdateRequestPreconditionFailed() *CreateNonSITAddressUpdateRequestPreconditionFailed { - return &CreateNonSITAddressUpdateRequestPreconditionFailed{} -} - -/* -CreateNonSITAddressUpdateRequestPreconditionFailed describes a response with status code 412, with default header values. - -Precondition failed, likely due to a stale eTag (If-Match). Fetch the request again to get the updated eTag value. -*/ -type CreateNonSITAddressUpdateRequestPreconditionFailed struct { - Payload *primemessages.ClientError -} - -// IsSuccess returns true when this create non s i t address update request precondition failed response has a 2xx status code -func (o *CreateNonSITAddressUpdateRequestPreconditionFailed) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this create non s i t address update request precondition failed response has a 3xx status code -func (o *CreateNonSITAddressUpdateRequestPreconditionFailed) IsRedirect() bool { - return false -} - -// IsClientError returns true when this create non s i t address update request precondition failed response has a 4xx status code -func (o *CreateNonSITAddressUpdateRequestPreconditionFailed) IsClientError() bool { - return true -} - -// IsServerError returns true when this create non s i t address update request precondition failed response has a 5xx status code -func (o *CreateNonSITAddressUpdateRequestPreconditionFailed) IsServerError() bool { - return false -} - -// IsCode returns true when this create non s i t address update request precondition failed response a status code equal to that given -func (o *CreateNonSITAddressUpdateRequestPreconditionFailed) IsCode(code int) bool { - return code == 412 -} - -// Code gets the status code for the create non s i t address update request precondition failed response -func (o *CreateNonSITAddressUpdateRequestPreconditionFailed) Code() int { - return 412 -} - -func (o *CreateNonSITAddressUpdateRequestPreconditionFailed) Error() string { - return fmt.Sprintf("[POST /mto-shipments/{mtoShipmentID}/shipment-address-updates][%d] createNonSITAddressUpdateRequestPreconditionFailed %+v", 412, o.Payload) -} - -func (o *CreateNonSITAddressUpdateRequestPreconditionFailed) String() string { - return fmt.Sprintf("[POST /mto-shipments/{mtoShipmentID}/shipment-address-updates][%d] createNonSITAddressUpdateRequestPreconditionFailed %+v", 412, o.Payload) -} - -func (o *CreateNonSITAddressUpdateRequestPreconditionFailed) GetPayload() *primemessages.ClientError { - return o.Payload -} - -func (o *CreateNonSITAddressUpdateRequestPreconditionFailed) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(primemessages.ClientError) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewCreateNonSITAddressUpdateRequestUnprocessableEntity creates a CreateNonSITAddressUpdateRequestUnprocessableEntity with default headers values -func NewCreateNonSITAddressUpdateRequestUnprocessableEntity() *CreateNonSITAddressUpdateRequestUnprocessableEntity { - return &CreateNonSITAddressUpdateRequestUnprocessableEntity{} -} - -/* -CreateNonSITAddressUpdateRequestUnprocessableEntity describes a response with status code 422, with default header values. - -The request was unprocessable, likely due to bad input from the requester. -*/ -type CreateNonSITAddressUpdateRequestUnprocessableEntity struct { - Payload *primemessages.ValidationError -} - -// IsSuccess returns true when this create non s i t address update request unprocessable entity response has a 2xx status code -func (o *CreateNonSITAddressUpdateRequestUnprocessableEntity) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this create non s i t address update request unprocessable entity response has a 3xx status code -func (o *CreateNonSITAddressUpdateRequestUnprocessableEntity) IsRedirect() bool { - return false -} - -// IsClientError returns true when this create non s i t address update request unprocessable entity response has a 4xx status code -func (o *CreateNonSITAddressUpdateRequestUnprocessableEntity) IsClientError() bool { - return true -} - -// IsServerError returns true when this create non s i t address update request unprocessable entity response has a 5xx status code -func (o *CreateNonSITAddressUpdateRequestUnprocessableEntity) IsServerError() bool { - return false -} - -// IsCode returns true when this create non s i t address update request unprocessable entity response a status code equal to that given -func (o *CreateNonSITAddressUpdateRequestUnprocessableEntity) IsCode(code int) bool { - return code == 422 -} - -// Code gets the status code for the create non s i t address update request unprocessable entity response -func (o *CreateNonSITAddressUpdateRequestUnprocessableEntity) Code() int { - return 422 -} - -func (o *CreateNonSITAddressUpdateRequestUnprocessableEntity) Error() string { - return fmt.Sprintf("[POST /mto-shipments/{mtoShipmentID}/shipment-address-updates][%d] createNonSITAddressUpdateRequestUnprocessableEntity %+v", 422, o.Payload) -} - -func (o *CreateNonSITAddressUpdateRequestUnprocessableEntity) String() string { - return fmt.Sprintf("[POST /mto-shipments/{mtoShipmentID}/shipment-address-updates][%d] createNonSITAddressUpdateRequestUnprocessableEntity %+v", 422, o.Payload) -} - -func (o *CreateNonSITAddressUpdateRequestUnprocessableEntity) GetPayload() *primemessages.ValidationError { - return o.Payload -} - -func (o *CreateNonSITAddressUpdateRequestUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(primemessages.ValidationError) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewCreateNonSITAddressUpdateRequestInternalServerError creates a CreateNonSITAddressUpdateRequestInternalServerError with default headers values -func NewCreateNonSITAddressUpdateRequestInternalServerError() *CreateNonSITAddressUpdateRequestInternalServerError { - return &CreateNonSITAddressUpdateRequestInternalServerError{} -} - -/* -CreateNonSITAddressUpdateRequestInternalServerError describes a response with status code 500, with default header values. - -A server error occurred. -*/ -type CreateNonSITAddressUpdateRequestInternalServerError struct { - Payload *primemessages.Error -} - -// IsSuccess returns true when this create non s i t address update request internal server error response has a 2xx status code -func (o *CreateNonSITAddressUpdateRequestInternalServerError) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this create non s i t address update request internal server error response has a 3xx status code -func (o *CreateNonSITAddressUpdateRequestInternalServerError) IsRedirect() bool { - return false -} - -// IsClientError returns true when this create non s i t address update request internal server error response has a 4xx status code -func (o *CreateNonSITAddressUpdateRequestInternalServerError) IsClientError() bool { - return false -} - -// IsServerError returns true when this create non s i t address update request internal server error response has a 5xx status code -func (o *CreateNonSITAddressUpdateRequestInternalServerError) IsServerError() bool { - return true -} - -// IsCode returns true when this create non s i t address update request internal server error response a status code equal to that given -func (o *CreateNonSITAddressUpdateRequestInternalServerError) IsCode(code int) bool { - return code == 500 -} - -// Code gets the status code for the create non s i t address update request internal server error response -func (o *CreateNonSITAddressUpdateRequestInternalServerError) Code() int { - return 500 -} - -func (o *CreateNonSITAddressUpdateRequestInternalServerError) Error() string { - return fmt.Sprintf("[POST /mto-shipments/{mtoShipmentID}/shipment-address-updates][%d] createNonSITAddressUpdateRequestInternalServerError %+v", 500, o.Payload) -} - -func (o *CreateNonSITAddressUpdateRequestInternalServerError) String() string { - return fmt.Sprintf("[POST /mto-shipments/{mtoShipmentID}/shipment-address-updates][%d] createNonSITAddressUpdateRequestInternalServerError %+v", 500, o.Payload) -} - -func (o *CreateNonSITAddressUpdateRequestInternalServerError) GetPayload() *primemessages.Error { - return o.Payload -} - -func (o *CreateNonSITAddressUpdateRequestInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(primemessages.Error) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/pkg/gen/primeclient/mto_shipment/mto_shipment_client.go b/pkg/gen/primeclient/mto_shipment/mto_shipment_client.go index 6f76487083c..96f52b751f5 100644 --- a/pkg/gen/primeclient/mto_shipment/mto_shipment_client.go +++ b/pkg/gen/primeclient/mto_shipment/mto_shipment_client.go @@ -34,8 +34,6 @@ type ClientService interface { CreateMTOShipment(params *CreateMTOShipmentParams, opts ...ClientOption) (*CreateMTOShipmentOK, error) - CreateNonSITAddressUpdateRequest(params *CreateNonSITAddressUpdateRequestParams, opts ...ClientOption) (*CreateNonSITAddressUpdateRequestCreated, error) - CreateSITExtension(params *CreateSITExtensionParams, opts ...ClientOption) (*CreateSITExtensionCreated, error) DeleteMTOShipment(params *DeleteMTOShipmentParams, opts ...ClientOption) (*DeleteMTOShipmentNoContent, error) @@ -52,6 +50,8 @@ type ClientService interface { UpdateSITDeliveryRequest(params *UpdateSITDeliveryRequestParams, opts ...ClientOption) (*UpdateSITDeliveryRequestOK, error) + UpdateShipmentDestinationAddress(params *UpdateShipmentDestinationAddressParams, opts ...ClientOption) (*UpdateShipmentDestinationAddressCreated, error) + SetTransport(transport runtime.ClientTransport) } @@ -155,59 +155,6 @@ func (a *Client) CreateMTOShipment(params *CreateMTOShipmentParams, opts ...Clie panic(msg) } -/* - CreateNonSITAddressUpdateRequest creates non s i t address update request - - ### Functionality - -This endpoint is used so the Prime can request an **update** for the destination address on an MTO Shipment, -after the destination address has already been approved. -This does not change addresses on SIT service items. -Address updates will be automatically approved unless they change: - - the service area - - Mileage bracket for direct delivery - - the address and the distance between the old and new address is > 50 - - Domestic Short Haul to Domestic Line Haul or vice versa - - Shipments that start and end in one ZIP3 use Short Haul pricing - - Shipments that start and end in different ZIP3s use Line Haul pricing - -For those, changes will require TOO approval. -*/ -func (a *Client) CreateNonSITAddressUpdateRequest(params *CreateNonSITAddressUpdateRequestParams, opts ...ClientOption) (*CreateNonSITAddressUpdateRequestCreated, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewCreateNonSITAddressUpdateRequestParams() - } - op := &runtime.ClientOperation{ - ID: "createNonSITAddressUpdateRequest", - Method: "POST", - PathPattern: "/mto-shipments/{mtoShipmentID}/shipment-address-updates", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &CreateNonSITAddressUpdateRequestReader{formats: a.formats}, - 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.(*CreateNonSITAddressUpdateRequestCreated) - 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 createNonSITAddressUpdateRequest: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - /* CreateSITExtension creates s i t extension @@ -588,6 +535,59 @@ func (a *Client) UpdateSITDeliveryRequest(params *UpdateSITDeliveryRequestParams panic(msg) } +/* + UpdateShipmentDestinationAddress updates shipment destination address + + ### Functionality + +This endpoint is used so the Prime can request an **update** for the destination address on an MTO Shipment, +after the destination address has already been approved. + +Address updates will be automatically approved unless they change: + - The service area + - Mileage bracket for direct delivery + - the address and the distance between the old and new address is > 50 + - Domestic Short Haul to Domestic Line Haul or vice versa + - Shipments that start and end in one ZIP3 use Short Haul pricing + - Shipments that start and end in different ZIP3s use Line Haul pricing + +For those, changes will require TOO approval. +*/ +func (a *Client) UpdateShipmentDestinationAddress(params *UpdateShipmentDestinationAddressParams, opts ...ClientOption) (*UpdateShipmentDestinationAddressCreated, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewUpdateShipmentDestinationAddressParams() + } + op := &runtime.ClientOperation{ + ID: "updateShipmentDestinationAddress", + Method: "POST", + PathPattern: "/mto-shipments/{mtoShipmentID}/shipment-address-updates", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &UpdateShipmentDestinationAddressReader{formats: a.formats}, + 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.(*UpdateShipmentDestinationAddressCreated) + 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 updateShipmentDestinationAddress: 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 diff --git a/pkg/gen/primeclient/mto_shipment/update_shipment_destination_address_parameters.go b/pkg/gen/primeclient/mto_shipment/update_shipment_destination_address_parameters.go new file mode 100644 index 00000000000..ae9cea49739 --- /dev/null +++ b/pkg/gen/primeclient/mto_shipment/update_shipment_destination_address_parameters.go @@ -0,0 +1,197 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package mto_shipment + +// 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/transcom/mymove/pkg/gen/primemessages" +) + +// NewUpdateShipmentDestinationAddressParams creates a new UpdateShipmentDestinationAddressParams 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 NewUpdateShipmentDestinationAddressParams() *UpdateShipmentDestinationAddressParams { + return &UpdateShipmentDestinationAddressParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewUpdateShipmentDestinationAddressParamsWithTimeout creates a new UpdateShipmentDestinationAddressParams object +// with the ability to set a timeout on a request. +func NewUpdateShipmentDestinationAddressParamsWithTimeout(timeout time.Duration) *UpdateShipmentDestinationAddressParams { + return &UpdateShipmentDestinationAddressParams{ + timeout: timeout, + } +} + +// NewUpdateShipmentDestinationAddressParamsWithContext creates a new UpdateShipmentDestinationAddressParams object +// with the ability to set a context for a request. +func NewUpdateShipmentDestinationAddressParamsWithContext(ctx context.Context) *UpdateShipmentDestinationAddressParams { + return &UpdateShipmentDestinationAddressParams{ + Context: ctx, + } +} + +// NewUpdateShipmentDestinationAddressParamsWithHTTPClient creates a new UpdateShipmentDestinationAddressParams object +// with the ability to set a custom HTTPClient for a request. +func NewUpdateShipmentDestinationAddressParamsWithHTTPClient(client *http.Client) *UpdateShipmentDestinationAddressParams { + return &UpdateShipmentDestinationAddressParams{ + HTTPClient: client, + } +} + +/* +UpdateShipmentDestinationAddressParams contains all the parameters to send to the API endpoint + + for the update shipment destination address operation. + + Typically these are written to a http.Request. +*/ +type UpdateShipmentDestinationAddressParams struct { + + /* IfMatch. + + Needs to be the eTag of the mtoShipment. Optimistic locking is implemented via the `If-Match` header. If the ETag header does not match the value of the resource on the server, the server rejects the change with a `412 Precondition Failed` error. + + */ + IfMatch string + + // Body. + Body *primemessages.UpdateShipmentDestinationAddress + + /* MtoShipmentID. + + UUID of the shipment associated with the address + + Format: uuid + */ + MtoShipmentID strfmt.UUID + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the update shipment destination address params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UpdateShipmentDestinationAddressParams) WithDefaults() *UpdateShipmentDestinationAddressParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the update shipment destination address params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UpdateShipmentDestinationAddressParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the update shipment destination address params +func (o *UpdateShipmentDestinationAddressParams) WithTimeout(timeout time.Duration) *UpdateShipmentDestinationAddressParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the update shipment destination address params +func (o *UpdateShipmentDestinationAddressParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the update shipment destination address params +func (o *UpdateShipmentDestinationAddressParams) WithContext(ctx context.Context) *UpdateShipmentDestinationAddressParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the update shipment destination address params +func (o *UpdateShipmentDestinationAddressParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the update shipment destination address params +func (o *UpdateShipmentDestinationAddressParams) WithHTTPClient(client *http.Client) *UpdateShipmentDestinationAddressParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the update shipment destination address params +func (o *UpdateShipmentDestinationAddressParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithIfMatch adds the ifMatch to the update shipment destination address params +func (o *UpdateShipmentDestinationAddressParams) WithIfMatch(ifMatch string) *UpdateShipmentDestinationAddressParams { + o.SetIfMatch(ifMatch) + return o +} + +// SetIfMatch adds the ifMatch to the update shipment destination address params +func (o *UpdateShipmentDestinationAddressParams) SetIfMatch(ifMatch string) { + o.IfMatch = ifMatch +} + +// WithBody adds the body to the update shipment destination address params +func (o *UpdateShipmentDestinationAddressParams) WithBody(body *primemessages.UpdateShipmentDestinationAddress) *UpdateShipmentDestinationAddressParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the update shipment destination address params +func (o *UpdateShipmentDestinationAddressParams) SetBody(body *primemessages.UpdateShipmentDestinationAddress) { + o.Body = body +} + +// WithMtoShipmentID adds the mtoShipmentID to the update shipment destination address params +func (o *UpdateShipmentDestinationAddressParams) WithMtoShipmentID(mtoShipmentID strfmt.UUID) *UpdateShipmentDestinationAddressParams { + o.SetMtoShipmentID(mtoShipmentID) + return o +} + +// SetMtoShipmentID adds the mtoShipmentId to the update shipment destination address params +func (o *UpdateShipmentDestinationAddressParams) SetMtoShipmentID(mtoShipmentID strfmt.UUID) { + o.MtoShipmentID = mtoShipmentID +} + +// WriteToRequest writes these params to a swagger request +func (o *UpdateShipmentDestinationAddressParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // header param If-Match + if err := r.SetHeaderParam("If-Match", o.IfMatch); err != nil { + return err + } + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param mtoShipmentID + if err := r.SetPathParam("mtoShipmentID", o.MtoShipmentID.String()); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/gen/primeclient/mto_shipment/update_shipment_destination_address_responses.go b/pkg/gen/primeclient/mto_shipment/update_shipment_destination_address_responses.go new file mode 100644 index 00000000000..6d3cb835a36 --- /dev/null +++ b/pkg/gen/primeclient/mto_shipment/update_shipment_destination_address_responses.go @@ -0,0 +1,695 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package mto_shipment + +// 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" + "github.com/go-openapi/strfmt" + + "github.com/transcom/mymove/pkg/gen/primemessages" +) + +// UpdateShipmentDestinationAddressReader is a Reader for the UpdateShipmentDestinationAddress structure. +type UpdateShipmentDestinationAddressReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *UpdateShipmentDestinationAddressReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 201: + result := NewUpdateShipmentDestinationAddressCreated() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewUpdateShipmentDestinationAddressBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewUpdateShipmentDestinationAddressUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewUpdateShipmentDestinationAddressForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewUpdateShipmentDestinationAddressNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewUpdateShipmentDestinationAddressConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 412: + result := NewUpdateShipmentDestinationAddressPreconditionFailed() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewUpdateShipmentDestinationAddressUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewUpdateShipmentDestinationAddressInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /mto-shipments/{mtoShipmentID}/shipment-address-updates] updateShipmentDestinationAddress", response, response.Code()) + } +} + +// NewUpdateShipmentDestinationAddressCreated creates a UpdateShipmentDestinationAddressCreated with default headers values +func NewUpdateShipmentDestinationAddressCreated() *UpdateShipmentDestinationAddressCreated { + return &UpdateShipmentDestinationAddressCreated{} +} + +/* +UpdateShipmentDestinationAddressCreated describes a response with status code 201, with default header values. + +Successfully created the address update request. +*/ +type UpdateShipmentDestinationAddressCreated struct { + Payload *primemessages.ShipmentAddressUpdate +} + +// IsSuccess returns true when this update shipment destination address created response has a 2xx status code +func (o *UpdateShipmentDestinationAddressCreated) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this update shipment destination address created response has a 3xx status code +func (o *UpdateShipmentDestinationAddressCreated) IsRedirect() bool { + return false +} + +// IsClientError returns true when this update shipment destination address created response has a 4xx status code +func (o *UpdateShipmentDestinationAddressCreated) IsClientError() bool { + return false +} + +// IsServerError returns true when this update shipment destination address created response has a 5xx status code +func (o *UpdateShipmentDestinationAddressCreated) IsServerError() bool { + return false +} + +// IsCode returns true when this update shipment destination address created response a status code equal to that given +func (o *UpdateShipmentDestinationAddressCreated) IsCode(code int) bool { + return code == 201 +} + +// Code gets the status code for the update shipment destination address created response +func (o *UpdateShipmentDestinationAddressCreated) Code() int { + return 201 +} + +func (o *UpdateShipmentDestinationAddressCreated) Error() string { + return fmt.Sprintf("[POST /mto-shipments/{mtoShipmentID}/shipment-address-updates][%d] updateShipmentDestinationAddressCreated %+v", 201, o.Payload) +} + +func (o *UpdateShipmentDestinationAddressCreated) String() string { + return fmt.Sprintf("[POST /mto-shipments/{mtoShipmentID}/shipment-address-updates][%d] updateShipmentDestinationAddressCreated %+v", 201, o.Payload) +} + +func (o *UpdateShipmentDestinationAddressCreated) GetPayload() *primemessages.ShipmentAddressUpdate { + return o.Payload +} + +func (o *UpdateShipmentDestinationAddressCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(primemessages.ShipmentAddressUpdate) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewUpdateShipmentDestinationAddressBadRequest creates a UpdateShipmentDestinationAddressBadRequest with default headers values +func NewUpdateShipmentDestinationAddressBadRequest() *UpdateShipmentDestinationAddressBadRequest { + return &UpdateShipmentDestinationAddressBadRequest{} +} + +/* +UpdateShipmentDestinationAddressBadRequest describes a response with status code 400, with default header values. + +The request payload is invalid. +*/ +type UpdateShipmentDestinationAddressBadRequest struct { + Payload *primemessages.ClientError +} + +// IsSuccess returns true when this update shipment destination address bad request response has a 2xx status code +func (o *UpdateShipmentDestinationAddressBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this update shipment destination address bad request response has a 3xx status code +func (o *UpdateShipmentDestinationAddressBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this update shipment destination address bad request response has a 4xx status code +func (o *UpdateShipmentDestinationAddressBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this update shipment destination address bad request response has a 5xx status code +func (o *UpdateShipmentDestinationAddressBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this update shipment destination address bad request response a status code equal to that given +func (o *UpdateShipmentDestinationAddressBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the update shipment destination address bad request response +func (o *UpdateShipmentDestinationAddressBadRequest) Code() int { + return 400 +} + +func (o *UpdateShipmentDestinationAddressBadRequest) Error() string { + return fmt.Sprintf("[POST /mto-shipments/{mtoShipmentID}/shipment-address-updates][%d] updateShipmentDestinationAddressBadRequest %+v", 400, o.Payload) +} + +func (o *UpdateShipmentDestinationAddressBadRequest) String() string { + return fmt.Sprintf("[POST /mto-shipments/{mtoShipmentID}/shipment-address-updates][%d] updateShipmentDestinationAddressBadRequest %+v", 400, o.Payload) +} + +func (o *UpdateShipmentDestinationAddressBadRequest) GetPayload() *primemessages.ClientError { + return o.Payload +} + +func (o *UpdateShipmentDestinationAddressBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(primemessages.ClientError) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewUpdateShipmentDestinationAddressUnauthorized creates a UpdateShipmentDestinationAddressUnauthorized with default headers values +func NewUpdateShipmentDestinationAddressUnauthorized() *UpdateShipmentDestinationAddressUnauthorized { + return &UpdateShipmentDestinationAddressUnauthorized{} +} + +/* +UpdateShipmentDestinationAddressUnauthorized describes a response with status code 401, with default header values. + +The request was denied. +*/ +type UpdateShipmentDestinationAddressUnauthorized struct { + Payload *primemessages.ClientError +} + +// IsSuccess returns true when this update shipment destination address unauthorized response has a 2xx status code +func (o *UpdateShipmentDestinationAddressUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this update shipment destination address unauthorized response has a 3xx status code +func (o *UpdateShipmentDestinationAddressUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this update shipment destination address unauthorized response has a 4xx status code +func (o *UpdateShipmentDestinationAddressUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this update shipment destination address unauthorized response has a 5xx status code +func (o *UpdateShipmentDestinationAddressUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this update shipment destination address unauthorized response a status code equal to that given +func (o *UpdateShipmentDestinationAddressUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the update shipment destination address unauthorized response +func (o *UpdateShipmentDestinationAddressUnauthorized) Code() int { + return 401 +} + +func (o *UpdateShipmentDestinationAddressUnauthorized) Error() string { + return fmt.Sprintf("[POST /mto-shipments/{mtoShipmentID}/shipment-address-updates][%d] updateShipmentDestinationAddressUnauthorized %+v", 401, o.Payload) +} + +func (o *UpdateShipmentDestinationAddressUnauthorized) String() string { + return fmt.Sprintf("[POST /mto-shipments/{mtoShipmentID}/shipment-address-updates][%d] updateShipmentDestinationAddressUnauthorized %+v", 401, o.Payload) +} + +func (o *UpdateShipmentDestinationAddressUnauthorized) GetPayload() *primemessages.ClientError { + return o.Payload +} + +func (o *UpdateShipmentDestinationAddressUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(primemessages.ClientError) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewUpdateShipmentDestinationAddressForbidden creates a UpdateShipmentDestinationAddressForbidden with default headers values +func NewUpdateShipmentDestinationAddressForbidden() *UpdateShipmentDestinationAddressForbidden { + return &UpdateShipmentDestinationAddressForbidden{} +} + +/* +UpdateShipmentDestinationAddressForbidden describes a response with status code 403, with default header values. + +The request was denied. +*/ +type UpdateShipmentDestinationAddressForbidden struct { + Payload *primemessages.ClientError +} + +// IsSuccess returns true when this update shipment destination address forbidden response has a 2xx status code +func (o *UpdateShipmentDestinationAddressForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this update shipment destination address forbidden response has a 3xx status code +func (o *UpdateShipmentDestinationAddressForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this update shipment destination address forbidden response has a 4xx status code +func (o *UpdateShipmentDestinationAddressForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this update shipment destination address forbidden response has a 5xx status code +func (o *UpdateShipmentDestinationAddressForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this update shipment destination address forbidden response a status code equal to that given +func (o *UpdateShipmentDestinationAddressForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the update shipment destination address forbidden response +func (o *UpdateShipmentDestinationAddressForbidden) Code() int { + return 403 +} + +func (o *UpdateShipmentDestinationAddressForbidden) Error() string { + return fmt.Sprintf("[POST /mto-shipments/{mtoShipmentID}/shipment-address-updates][%d] updateShipmentDestinationAddressForbidden %+v", 403, o.Payload) +} + +func (o *UpdateShipmentDestinationAddressForbidden) String() string { + return fmt.Sprintf("[POST /mto-shipments/{mtoShipmentID}/shipment-address-updates][%d] updateShipmentDestinationAddressForbidden %+v", 403, o.Payload) +} + +func (o *UpdateShipmentDestinationAddressForbidden) GetPayload() *primemessages.ClientError { + return o.Payload +} + +func (o *UpdateShipmentDestinationAddressForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(primemessages.ClientError) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewUpdateShipmentDestinationAddressNotFound creates a UpdateShipmentDestinationAddressNotFound with default headers values +func NewUpdateShipmentDestinationAddressNotFound() *UpdateShipmentDestinationAddressNotFound { + return &UpdateShipmentDestinationAddressNotFound{} +} + +/* +UpdateShipmentDestinationAddressNotFound describes a response with status code 404, with default header values. + +The requested resource wasn't found. +*/ +type UpdateShipmentDestinationAddressNotFound struct { + Payload *primemessages.ClientError +} + +// IsSuccess returns true when this update shipment destination address not found response has a 2xx status code +func (o *UpdateShipmentDestinationAddressNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this update shipment destination address not found response has a 3xx status code +func (o *UpdateShipmentDestinationAddressNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this update shipment destination address not found response has a 4xx status code +func (o *UpdateShipmentDestinationAddressNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this update shipment destination address not found response has a 5xx status code +func (o *UpdateShipmentDestinationAddressNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this update shipment destination address not found response a status code equal to that given +func (o *UpdateShipmentDestinationAddressNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the update shipment destination address not found response +func (o *UpdateShipmentDestinationAddressNotFound) Code() int { + return 404 +} + +func (o *UpdateShipmentDestinationAddressNotFound) Error() string { + return fmt.Sprintf("[POST /mto-shipments/{mtoShipmentID}/shipment-address-updates][%d] updateShipmentDestinationAddressNotFound %+v", 404, o.Payload) +} + +func (o *UpdateShipmentDestinationAddressNotFound) String() string { + return fmt.Sprintf("[POST /mto-shipments/{mtoShipmentID}/shipment-address-updates][%d] updateShipmentDestinationAddressNotFound %+v", 404, o.Payload) +} + +func (o *UpdateShipmentDestinationAddressNotFound) GetPayload() *primemessages.ClientError { + return o.Payload +} + +func (o *UpdateShipmentDestinationAddressNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(primemessages.ClientError) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewUpdateShipmentDestinationAddressConflict creates a UpdateShipmentDestinationAddressConflict with default headers values +func NewUpdateShipmentDestinationAddressConflict() *UpdateShipmentDestinationAddressConflict { + return &UpdateShipmentDestinationAddressConflict{} +} + +/* +UpdateShipmentDestinationAddressConflict describes a response with status code 409, with default header values. + +The request could not be processed because of conflict in the current state of the resource. +*/ +type UpdateShipmentDestinationAddressConflict struct { + Payload *primemessages.ClientError +} + +// IsSuccess returns true when this update shipment destination address conflict response has a 2xx status code +func (o *UpdateShipmentDestinationAddressConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this update shipment destination address conflict response has a 3xx status code +func (o *UpdateShipmentDestinationAddressConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this update shipment destination address conflict response has a 4xx status code +func (o *UpdateShipmentDestinationAddressConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this update shipment destination address conflict response has a 5xx status code +func (o *UpdateShipmentDestinationAddressConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this update shipment destination address conflict response a status code equal to that given +func (o *UpdateShipmentDestinationAddressConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the update shipment destination address conflict response +func (o *UpdateShipmentDestinationAddressConflict) Code() int { + return 409 +} + +func (o *UpdateShipmentDestinationAddressConflict) Error() string { + return fmt.Sprintf("[POST /mto-shipments/{mtoShipmentID}/shipment-address-updates][%d] updateShipmentDestinationAddressConflict %+v", 409, o.Payload) +} + +func (o *UpdateShipmentDestinationAddressConflict) String() string { + return fmt.Sprintf("[POST /mto-shipments/{mtoShipmentID}/shipment-address-updates][%d] updateShipmentDestinationAddressConflict %+v", 409, o.Payload) +} + +func (o *UpdateShipmentDestinationAddressConflict) GetPayload() *primemessages.ClientError { + return o.Payload +} + +func (o *UpdateShipmentDestinationAddressConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(primemessages.ClientError) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewUpdateShipmentDestinationAddressPreconditionFailed creates a UpdateShipmentDestinationAddressPreconditionFailed with default headers values +func NewUpdateShipmentDestinationAddressPreconditionFailed() *UpdateShipmentDestinationAddressPreconditionFailed { + return &UpdateShipmentDestinationAddressPreconditionFailed{} +} + +/* +UpdateShipmentDestinationAddressPreconditionFailed describes a response with status code 412, with default header values. + +Precondition failed, likely due to a stale eTag (If-Match). Fetch the request again to get the updated eTag value. +*/ +type UpdateShipmentDestinationAddressPreconditionFailed struct { + Payload *primemessages.ClientError +} + +// IsSuccess returns true when this update shipment destination address precondition failed response has a 2xx status code +func (o *UpdateShipmentDestinationAddressPreconditionFailed) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this update shipment destination address precondition failed response has a 3xx status code +func (o *UpdateShipmentDestinationAddressPreconditionFailed) IsRedirect() bool { + return false +} + +// IsClientError returns true when this update shipment destination address precondition failed response has a 4xx status code +func (o *UpdateShipmentDestinationAddressPreconditionFailed) IsClientError() bool { + return true +} + +// IsServerError returns true when this update shipment destination address precondition failed response has a 5xx status code +func (o *UpdateShipmentDestinationAddressPreconditionFailed) IsServerError() bool { + return false +} + +// IsCode returns true when this update shipment destination address precondition failed response a status code equal to that given +func (o *UpdateShipmentDestinationAddressPreconditionFailed) IsCode(code int) bool { + return code == 412 +} + +// Code gets the status code for the update shipment destination address precondition failed response +func (o *UpdateShipmentDestinationAddressPreconditionFailed) Code() int { + return 412 +} + +func (o *UpdateShipmentDestinationAddressPreconditionFailed) Error() string { + return fmt.Sprintf("[POST /mto-shipments/{mtoShipmentID}/shipment-address-updates][%d] updateShipmentDestinationAddressPreconditionFailed %+v", 412, o.Payload) +} + +func (o *UpdateShipmentDestinationAddressPreconditionFailed) String() string { + return fmt.Sprintf("[POST /mto-shipments/{mtoShipmentID}/shipment-address-updates][%d] updateShipmentDestinationAddressPreconditionFailed %+v", 412, o.Payload) +} + +func (o *UpdateShipmentDestinationAddressPreconditionFailed) GetPayload() *primemessages.ClientError { + return o.Payload +} + +func (o *UpdateShipmentDestinationAddressPreconditionFailed) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(primemessages.ClientError) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewUpdateShipmentDestinationAddressUnprocessableEntity creates a UpdateShipmentDestinationAddressUnprocessableEntity with default headers values +func NewUpdateShipmentDestinationAddressUnprocessableEntity() *UpdateShipmentDestinationAddressUnprocessableEntity { + return &UpdateShipmentDestinationAddressUnprocessableEntity{} +} + +/* +UpdateShipmentDestinationAddressUnprocessableEntity describes a response with status code 422, with default header values. + +The request was unprocessable, likely due to bad input from the requester. +*/ +type UpdateShipmentDestinationAddressUnprocessableEntity struct { + Payload *primemessages.ValidationError +} + +// IsSuccess returns true when this update shipment destination address unprocessable entity response has a 2xx status code +func (o *UpdateShipmentDestinationAddressUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this update shipment destination address unprocessable entity response has a 3xx status code +func (o *UpdateShipmentDestinationAddressUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this update shipment destination address unprocessable entity response has a 4xx status code +func (o *UpdateShipmentDestinationAddressUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this update shipment destination address unprocessable entity response has a 5xx status code +func (o *UpdateShipmentDestinationAddressUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this update shipment destination address unprocessable entity response a status code equal to that given +func (o *UpdateShipmentDestinationAddressUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the update shipment destination address unprocessable entity response +func (o *UpdateShipmentDestinationAddressUnprocessableEntity) Code() int { + return 422 +} + +func (o *UpdateShipmentDestinationAddressUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /mto-shipments/{mtoShipmentID}/shipment-address-updates][%d] updateShipmentDestinationAddressUnprocessableEntity %+v", 422, o.Payload) +} + +func (o *UpdateShipmentDestinationAddressUnprocessableEntity) String() string { + return fmt.Sprintf("[POST /mto-shipments/{mtoShipmentID}/shipment-address-updates][%d] updateShipmentDestinationAddressUnprocessableEntity %+v", 422, o.Payload) +} + +func (o *UpdateShipmentDestinationAddressUnprocessableEntity) GetPayload() *primemessages.ValidationError { + return o.Payload +} + +func (o *UpdateShipmentDestinationAddressUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(primemessages.ValidationError) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewUpdateShipmentDestinationAddressInternalServerError creates a UpdateShipmentDestinationAddressInternalServerError with default headers values +func NewUpdateShipmentDestinationAddressInternalServerError() *UpdateShipmentDestinationAddressInternalServerError { + return &UpdateShipmentDestinationAddressInternalServerError{} +} + +/* +UpdateShipmentDestinationAddressInternalServerError describes a response with status code 500, with default header values. + +A server error occurred. +*/ +type UpdateShipmentDestinationAddressInternalServerError struct { + Payload *primemessages.Error +} + +// IsSuccess returns true when this update shipment destination address internal server error response has a 2xx status code +func (o *UpdateShipmentDestinationAddressInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this update shipment destination address internal server error response has a 3xx status code +func (o *UpdateShipmentDestinationAddressInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this update shipment destination address internal server error response has a 4xx status code +func (o *UpdateShipmentDestinationAddressInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this update shipment destination address internal server error response has a 5xx status code +func (o *UpdateShipmentDestinationAddressInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this update shipment destination address internal server error response a status code equal to that given +func (o *UpdateShipmentDestinationAddressInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the update shipment destination address internal server error response +func (o *UpdateShipmentDestinationAddressInternalServerError) Code() int { + return 500 +} + +func (o *UpdateShipmentDestinationAddressInternalServerError) Error() string { + return fmt.Sprintf("[POST /mto-shipments/{mtoShipmentID}/shipment-address-updates][%d] updateShipmentDestinationAddressInternalServerError %+v", 500, o.Payload) +} + +func (o *UpdateShipmentDestinationAddressInternalServerError) String() string { + return fmt.Sprintf("[POST /mto-shipments/{mtoShipmentID}/shipment-address-updates][%d] updateShipmentDestinationAddressInternalServerError %+v", 500, o.Payload) +} + +func (o *UpdateShipmentDestinationAddressInternalServerError) GetPayload() *primemessages.Error { + return o.Payload +} + +func (o *UpdateShipmentDestinationAddressInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(primemessages.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/gen/primemessages/create_non_s_i_t_address_update_request.go b/pkg/gen/primemessages/update_shipment_destination_address.go similarity index 72% rename from pkg/gen/primemessages/create_non_s_i_t_address_update_request.go rename to pkg/gen/primemessages/update_shipment_destination_address.go index c2d4d338092..c6e82f5275e 100644 --- a/pkg/gen/primemessages/create_non_s_i_t_address_update_request.go +++ b/pkg/gen/primemessages/update_shipment_destination_address.go @@ -14,10 +14,10 @@ import ( "github.com/go-openapi/validate" ) -// CreateNonSITAddressUpdateRequest CreateNonSITAddressUpdateRequest contains the fields required for the prime to create a non SIT address update request. +// UpdateShipmentDestinationAddress UpdateShipmentDestinationAddress contains the fields required for the prime to request an update for the destination address on an MTO Shipment. // -// swagger:model CreateNonSITAddressUpdateRequest -type CreateNonSITAddressUpdateRequest struct { +// swagger:model UpdateShipmentDestinationAddress +type UpdateShipmentDestinationAddress struct { // This is the remark the Prime has entered, which would be the reason there is an address change. // Example: Customer reached out to me this week and let me know they want to move somewhere else. @@ -29,8 +29,8 @@ type CreateNonSITAddressUpdateRequest struct { NewAddress *Address `json:"newAddress"` } -// Validate validates this create non s i t address update request -func (m *CreateNonSITAddressUpdateRequest) Validate(formats strfmt.Registry) error { +// Validate validates this update shipment destination address +func (m *UpdateShipmentDestinationAddress) Validate(formats strfmt.Registry) error { var res []error if err := m.validateContractorRemarks(formats); err != nil { @@ -47,7 +47,7 @@ func (m *CreateNonSITAddressUpdateRequest) Validate(formats strfmt.Registry) err return nil } -func (m *CreateNonSITAddressUpdateRequest) validateContractorRemarks(formats strfmt.Registry) error { +func (m *UpdateShipmentDestinationAddress) validateContractorRemarks(formats strfmt.Registry) error { if err := validate.Required("contractorRemarks", "body", m.ContractorRemarks); err != nil { return err @@ -56,7 +56,7 @@ func (m *CreateNonSITAddressUpdateRequest) validateContractorRemarks(formats str return nil } -func (m *CreateNonSITAddressUpdateRequest) validateNewAddress(formats strfmt.Registry) error { +func (m *UpdateShipmentDestinationAddress) validateNewAddress(formats strfmt.Registry) error { if err := validate.Required("newAddress", "body", m.NewAddress); err != nil { return err @@ -76,8 +76,8 @@ func (m *CreateNonSITAddressUpdateRequest) validateNewAddress(formats strfmt.Reg return nil } -// ContextValidate validate this create non s i t address update request based on the context it is used -func (m *CreateNonSITAddressUpdateRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { +// ContextValidate validate this update shipment destination address based on the context it is used +func (m *UpdateShipmentDestinationAddress) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateNewAddress(ctx, formats); err != nil { @@ -90,7 +90,7 @@ func (m *CreateNonSITAddressUpdateRequest) ContextValidate(ctx context.Context, return nil } -func (m *CreateNonSITAddressUpdateRequest) contextValidateNewAddress(ctx context.Context, formats strfmt.Registry) error { +func (m *UpdateShipmentDestinationAddress) contextValidateNewAddress(ctx context.Context, formats strfmt.Registry) error { if m.NewAddress != nil { @@ -108,7 +108,7 @@ func (m *CreateNonSITAddressUpdateRequest) contextValidateNewAddress(ctx context } // MarshalBinary interface implementation -func (m *CreateNonSITAddressUpdateRequest) MarshalBinary() ([]byte, error) { +func (m *UpdateShipmentDestinationAddress) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } @@ -116,8 +116,8 @@ func (m *CreateNonSITAddressUpdateRequest) MarshalBinary() ([]byte, error) { } // UnmarshalBinary interface implementation -func (m *CreateNonSITAddressUpdateRequest) UnmarshalBinary(b []byte) error { - var res CreateNonSITAddressUpdateRequest +func (m *UpdateShipmentDestinationAddress) UnmarshalBinary(b []byte) error { + var res UpdateShipmentDestinationAddress if err := swag.ReadJSON(b, &res); err != nil { return err } diff --git a/pkg/gen/primev2api/embedded_spec.go b/pkg/gen/primev2api/embedded_spec.go index 4129e9ecc7d..debc2b5ca9b 100644 --- a/pkg/gen/primev2api/embedded_spec.go +++ b/pkg/gen/primev2api/embedded_spec.go @@ -469,24 +469,6 @@ func init() { } } }, - "CreateNonSITAddressUpdateRequest": { - "description": "CreateNonSITAddressUpdateRequest contains the fields required for the prime to create a non SIT address update request.", - "type": "object", - "required": [ - "contractorRemarks", - "newAddress" - ], - "properties": { - "contractorRemarks": { - "description": "This is the remark the Prime has entered, which would be the reason there is an address change.", - "type": "string", - "example": "Customer reached out to me this week and let me know they want to move somewhere else." - }, - "newAddress": { - "$ref": "#/definitions/Address" - } - } - }, "CreatePPMShipment": { "description": "Creation object containing the ` + "`" + `PPM` + "`" + ` shipmentType specific data, not used for other shipment types.", "type": "object", @@ -3127,6 +3109,24 @@ func init() { } } }, + "UpdateShipmentDestinationAddress": { + "description": "UpdateShipmentDestinationAddress contains the fields required for the prime to request an update for the destination address on an MTO Shipment.", + "type": "object", + "required": [ + "contractorRemarks", + "newAddress" + ], + "properties": { + "contractorRemarks": { + "description": "This is the remark the Prime has entered, which would be the reason there is an address change.", + "type": "string", + "example": "Customer reached out to me this week and let me know they want to move somewhere else." + }, + "newAddress": { + "$ref": "#/definitions/Address" + } + } + }, "UploadWithOmissions": { "description": "An uploaded file.", "type": "object", @@ -3732,24 +3732,6 @@ func init() { } } }, - "CreateNonSITAddressUpdateRequest": { - "description": "CreateNonSITAddressUpdateRequest contains the fields required for the prime to create a non SIT address update request.", - "type": "object", - "required": [ - "contractorRemarks", - "newAddress" - ], - "properties": { - "contractorRemarks": { - "description": "This is the remark the Prime has entered, which would be the reason there is an address change.", - "type": "string", - "example": "Customer reached out to me this week and let me know they want to move somewhere else." - }, - "newAddress": { - "$ref": "#/definitions/Address" - } - } - }, "CreatePPMShipment": { "description": "Creation object containing the ` + "`" + `PPM` + "`" + ` shipmentType specific data, not used for other shipment types.", "type": "object", @@ -6390,6 +6372,24 @@ func init() { } } }, + "UpdateShipmentDestinationAddress": { + "description": "UpdateShipmentDestinationAddress contains the fields required for the prime to request an update for the destination address on an MTO Shipment.", + "type": "object", + "required": [ + "contractorRemarks", + "newAddress" + ], + "properties": { + "contractorRemarks": { + "description": "This is the remark the Prime has entered, which would be the reason there is an address change.", + "type": "string", + "example": "Customer reached out to me this week and let me know they want to move somewhere else." + }, + "newAddress": { + "$ref": "#/definitions/Address" + } + } + }, "UploadWithOmissions": { "description": "An uploaded file.", "type": "object", diff --git a/pkg/gen/primev2messages/create_non_s_i_t_address_update_request.go b/pkg/gen/primev2messages/update_shipment_destination_address.go similarity index 72% rename from pkg/gen/primev2messages/create_non_s_i_t_address_update_request.go rename to pkg/gen/primev2messages/update_shipment_destination_address.go index c8debc35234..5c4e9f085d2 100644 --- a/pkg/gen/primev2messages/create_non_s_i_t_address_update_request.go +++ b/pkg/gen/primev2messages/update_shipment_destination_address.go @@ -14,10 +14,10 @@ import ( "github.com/go-openapi/validate" ) -// CreateNonSITAddressUpdateRequest CreateNonSITAddressUpdateRequest contains the fields required for the prime to create a non SIT address update request. +// UpdateShipmentDestinationAddress UpdateShipmentDestinationAddress contains the fields required for the prime to request an update for the destination address on an MTO Shipment. // -// swagger:model CreateNonSITAddressUpdateRequest -type CreateNonSITAddressUpdateRequest struct { +// swagger:model UpdateShipmentDestinationAddress +type UpdateShipmentDestinationAddress struct { // This is the remark the Prime has entered, which would be the reason there is an address change. // Example: Customer reached out to me this week and let me know they want to move somewhere else. @@ -29,8 +29,8 @@ type CreateNonSITAddressUpdateRequest struct { NewAddress *Address `json:"newAddress"` } -// Validate validates this create non s i t address update request -func (m *CreateNonSITAddressUpdateRequest) Validate(formats strfmt.Registry) error { +// Validate validates this update shipment destination address +func (m *UpdateShipmentDestinationAddress) Validate(formats strfmt.Registry) error { var res []error if err := m.validateContractorRemarks(formats); err != nil { @@ -47,7 +47,7 @@ func (m *CreateNonSITAddressUpdateRequest) Validate(formats strfmt.Registry) err return nil } -func (m *CreateNonSITAddressUpdateRequest) validateContractorRemarks(formats strfmt.Registry) error { +func (m *UpdateShipmentDestinationAddress) validateContractorRemarks(formats strfmt.Registry) error { if err := validate.Required("contractorRemarks", "body", m.ContractorRemarks); err != nil { return err @@ -56,7 +56,7 @@ func (m *CreateNonSITAddressUpdateRequest) validateContractorRemarks(formats str return nil } -func (m *CreateNonSITAddressUpdateRequest) validateNewAddress(formats strfmt.Registry) error { +func (m *UpdateShipmentDestinationAddress) validateNewAddress(formats strfmt.Registry) error { if err := validate.Required("newAddress", "body", m.NewAddress); err != nil { return err @@ -76,8 +76,8 @@ func (m *CreateNonSITAddressUpdateRequest) validateNewAddress(formats strfmt.Reg return nil } -// ContextValidate validate this create non s i t address update request based on the context it is used -func (m *CreateNonSITAddressUpdateRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { +// ContextValidate validate this update shipment destination address based on the context it is used +func (m *UpdateShipmentDestinationAddress) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateNewAddress(ctx, formats); err != nil { @@ -90,7 +90,7 @@ func (m *CreateNonSITAddressUpdateRequest) ContextValidate(ctx context.Context, return nil } -func (m *CreateNonSITAddressUpdateRequest) contextValidateNewAddress(ctx context.Context, formats strfmt.Registry) error { +func (m *UpdateShipmentDestinationAddress) contextValidateNewAddress(ctx context.Context, formats strfmt.Registry) error { if m.NewAddress != nil { @@ -108,7 +108,7 @@ func (m *CreateNonSITAddressUpdateRequest) contextValidateNewAddress(ctx context } // MarshalBinary interface implementation -func (m *CreateNonSITAddressUpdateRequest) MarshalBinary() ([]byte, error) { +func (m *UpdateShipmentDestinationAddress) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } @@ -116,8 +116,8 @@ func (m *CreateNonSITAddressUpdateRequest) MarshalBinary() ([]byte, error) { } // UnmarshalBinary interface implementation -func (m *CreateNonSITAddressUpdateRequest) UnmarshalBinary(b []byte) error { - var res CreateNonSITAddressUpdateRequest +func (m *UpdateShipmentDestinationAddress) UnmarshalBinary(b []byte) error { + var res UpdateShipmentDestinationAddress if err := swag.ReadJSON(b, &res); err != nil { return err } diff --git a/pkg/handlers/primeapi/api.go b/pkg/handlers/primeapi/api.go index cf29c9d6cf0..f665cbba0bf 100644 --- a/pkg/handlers/primeapi/api.go +++ b/pkg/handlers/primeapi/api.go @@ -91,7 +91,7 @@ func NewPrimeAPI(handlerConfig handlers.HandlerConfig) *primeoperations.MymoveAP mtoserviceitem.NewServiceRequestDocumentUploadCreator(handlerConfig.FileStorer()), } - primeAPI.MtoShipmentCreateNonSITAddressUpdateRequestHandler = CreateNonSITAddressUpdateRequestHandler{ + primeAPI.MtoShipmentUpdateShipmentDestinationAddressHandler = UpdateShipmentDestinationAddressHandler{ handlerConfig, shipmentaddressupdate.NewShipmentAddressUpdateRequester(handlerConfig.HHGPlanner(), addressCreator, moveRouter), } diff --git a/pkg/handlers/primeapi/mto_shipment.go b/pkg/handlers/primeapi/mto_shipment.go index 14200775ab8..a676e87513b 100644 --- a/pkg/handlers/primeapi/mto_shipment.go +++ b/pkg/handlers/primeapi/mto_shipment.go @@ -105,14 +105,14 @@ func (h CreateMTOShipmentHandler) Handle(params mtoshipmentops.CreateMTOShipment }) } -// CreateNonSITAddressUpdateRequestHandler is the handler to create address update request for non-SIT -type CreateNonSITAddressUpdateRequestHandler struct { +// UpdateShipmentDestinationAddressHandler is the handler to create address update request for non-SIT +type UpdateShipmentDestinationAddressHandler struct { handlers.HandlerConfig services.ShipmentAddressUpdateRequester } // Handle creates the address update request for non-SIT -func (h CreateNonSITAddressUpdateRequestHandler) Handle(params mtoshipmentops.CreateNonSITAddressUpdateRequestParams) middleware.Responder { +func (h UpdateShipmentDestinationAddressHandler) Handle(params mtoshipmentops.UpdateShipmentDestinationAddressParams) middleware.Responder { return h.AuditableAppContextFromRequestWithErrors(params.HTTPRequest, func(appCtx appcontext.AppContext) (middleware.Responder, error) { payload := params.Body @@ -125,36 +125,36 @@ func (h CreateNonSITAddressUpdateRequestHandler) Handle(params mtoshipmentops.Cr response, err := h.ShipmentAddressUpdateRequester.RequestShipmentDeliveryAddressUpdate(appCtx, shipmentID, addressUpdate.NewAddress, addressUpdate.ContractorRemarks, eTag) if err != nil { - appCtx.Logger().Error("primeapi.CreateNonSITAddressUpdateRequestHandler error", zap.Error(err)) + appCtx.Logger().Error("primeapi.UpdateShipmentDestinationAddressHandler error", zap.Error(err)) switch e := err.(type) { // NotFoundError -> Not Found response case apperror.NotFoundError: - return mtoshipmentops.NewCreateNonSITAddressUpdateRequestNotFound().WithPayload(payloads.ClientError(handlers.NotFoundMessage, err.Error(), h.GetTraceIDFromRequest(params.HTTPRequest))), err + return mtoshipmentops.NewUpdateShipmentDestinationAddressNotFound().WithPayload(payloads.ClientError(handlers.NotFoundMessage, err.Error(), h.GetTraceIDFromRequest(params.HTTPRequest))), err // ConflictError -> Request conflict reponse case apperror.ConflictError: - return mtoshipmentops.NewCreateNonSITAddressUpdateRequestConflict().WithPayload(payloads.ClientError(handlers.ConflictErrMessage, err.Error(), h.GetTraceIDFromRequest(params.HTTPRequest))), err + return mtoshipmentops.NewUpdateShipmentDestinationAddressConflict().WithPayload(payloads.ClientError(handlers.ConflictErrMessage, err.Error(), h.GetTraceIDFromRequest(params.HTTPRequest))), err // PreconditionError -> precondition failed reponse case apperror.PreconditionFailedError: - return mtoshipmentops.NewCreateNonSITAddressUpdateRequestPreconditionFailed().WithPayload(payloads.ClientError(handlers.PreconditionErrMessage, err.Error(), h.GetTraceIDFromRequest(params.HTTPRequest))), err + return mtoshipmentops.NewUpdateShipmentDestinationAddressPreconditionFailed().WithPayload(payloads.ClientError(handlers.PreconditionErrMessage, err.Error(), h.GetTraceIDFromRequest(params.HTTPRequest))), err // InvalidInputError -> Unprocessable Entity reponse case apperror.InvalidInputError: - return mtoshipmentops.NewCreateNonSITAddressUpdateRequestUnprocessableEntity().WithPayload(payloads.ValidationError(err.Error(), h.GetTraceIDFromRequest(params.HTTPRequest), e.ValidationErrors)), err + return mtoshipmentops.NewUpdateShipmentDestinationAddressUnprocessableEntity().WithPayload(payloads.ValidationError(err.Error(), h.GetTraceIDFromRequest(params.HTTPRequest), e.ValidationErrors)), err // Unknown -> Internal Server Error default: - return mtoshipmentops.NewCreateNonSITAddressUpdateRequestInternalServerError().WithPayload(payloads.InternalServerError(nil, h.GetTraceIDFromRequest(params.HTTPRequest))), err + return mtoshipmentops.NewUpdateShipmentDestinationAddressInternalServerError().WithPayload(payloads.InternalServerError(nil, h.GetTraceIDFromRequest(params.HTTPRequest))), err } } returnPayload := payloads.ShipmentAddressUpdate(response) - return mtoshipmentops.NewCreateNonSITAddressUpdateRequestCreated().WithPayload(returnPayload), nil + return mtoshipmentops.NewUpdateShipmentDestinationAddressCreated().WithPayload(returnPayload), nil }) } diff --git a/pkg/handlers/primeapi/mto_shipment_test.go b/pkg/handlers/primeapi/mto_shipment_test.go index 70d0ba37585..aaa269480b6 100644 --- a/pkg/handlers/primeapi/mto_shipment_test.go +++ b/pkg/handlers/primeapi/mto_shipment_test.go @@ -560,12 +560,12 @@ func (suite *HandlerSuite) TestCreateMTOShipmentHandler() { }) } -func (suite *HandlerSuite) TestCreateNonSITAddressUpdateRequestHandler() { +func (suite *HandlerSuite) TestUpdateShipmentDestinationAddressHandler() { req := httptest.NewRequest("POST", "/mto-shipments/{mtoShipmentID}/shipment-address-updates", nil) - makeSubtestData := func() mtoshipmentops.CreateNonSITAddressUpdateRequestParams { + makeSubtestData := func() mtoshipmentops.UpdateShipmentDestinationAddressParams { contractorRemark := "This is a contractor remark" - body := primemessages.CreateNonSITAddressUpdateRequest{ + body := primemessages.UpdateShipmentDestinationAddress{ ContractorRemarks: &contractorRemark, NewAddress: &primemessages.Address{ City: swag.String("Beverly Hills"), @@ -575,7 +575,7 @@ func (suite *HandlerSuite) TestCreateNonSITAddressUpdateRequestHandler() { }, } - params := mtoshipmentops.CreateNonSITAddressUpdateRequestParams{ + params := mtoshipmentops.UpdateShipmentDestinationAddressParams{ HTTPRequest: req, Body: &body, } @@ -586,7 +586,7 @@ func (suite *HandlerSuite) TestCreateNonSITAddressUpdateRequestHandler() { suite.Run("POST failure - 422 Unprocessable Entity Error", func() { subtestData := makeSubtestData() mockCreator := mocks.ShipmentAddressUpdateRequester{} - handler := CreateNonSITAddressUpdateRequestHandler{ + handler := UpdateShipmentDestinationAddressHandler{ suite.HandlerConfig(), &mockCreator, } @@ -608,8 +608,8 @@ func (suite *HandlerSuite) TestCreateNonSITAddressUpdateRequestHandler() { suite.NoError(subtestData.Body.Validate(strfmt.Default)) response := handler.Handle(subtestData) - suite.IsType(&mtoshipmentops.CreateNonSITAddressUpdateRequestUnprocessableEntity{}, response) - errResponse := response.(*mtoshipmentops.CreateNonSITAddressUpdateRequestUnprocessableEntity) + suite.IsType(&mtoshipmentops.UpdateShipmentDestinationAddressUnprocessableEntity{}, response) + errResponse := response.(*mtoshipmentops.UpdateShipmentDestinationAddressUnprocessableEntity) // Validate outgoing payload suite.NoError(errResponse.Payload.Validate(strfmt.Default)) @@ -618,7 +618,7 @@ func (suite *HandlerSuite) TestCreateNonSITAddressUpdateRequestHandler() { suite.Run("POST failure - 409 Request conflict reponse Error", func() { subtestData := makeSubtestData() mockCreator := mocks.ShipmentAddressUpdateRequester{} - handler := CreateNonSITAddressUpdateRequestHandler{ + handler := UpdateShipmentDestinationAddressHandler{ suite.HandlerConfig(), &mockCreator, } @@ -637,8 +637,8 @@ func (suite *HandlerSuite) TestCreateNonSITAddressUpdateRequestHandler() { suite.NoError(subtestData.Body.Validate(strfmt.Default)) response := handler.Handle(subtestData) - suite.IsType(&mtoshipmentops.CreateNonSITAddressUpdateRequestConflict{}, response) - errResponse := response.(*mtoshipmentops.CreateNonSITAddressUpdateRequestConflict) + suite.IsType(&mtoshipmentops.UpdateShipmentDestinationAddressConflict{}, response) + errResponse := response.(*mtoshipmentops.UpdateShipmentDestinationAddressConflict) // Validate outgoing payload suite.NoError(errResponse.Payload.Validate(strfmt.Default)) @@ -648,7 +648,7 @@ func (suite *HandlerSuite) TestCreateNonSITAddressUpdateRequestHandler() { subtestData := makeSubtestData() mockCreator := mocks.ShipmentAddressUpdateRequester{} - handler := CreateNonSITAddressUpdateRequestHandler{ + handler := UpdateShipmentDestinationAddressHandler{ suite.HandlerConfig(), &mockCreator, } @@ -667,8 +667,8 @@ func (suite *HandlerSuite) TestCreateNonSITAddressUpdateRequestHandler() { suite.NoError(subtestData.Body.Validate(strfmt.Default)) response := handler.Handle(subtestData) - suite.IsType(&mtoshipmentops.CreateNonSITAddressUpdateRequestNotFound{}, response) - errResponse := response.(*mtoshipmentops.CreateNonSITAddressUpdateRequestNotFound) + suite.IsType(&mtoshipmentops.UpdateShipmentDestinationAddressNotFound{}, response) + errResponse := response.(*mtoshipmentops.UpdateShipmentDestinationAddressNotFound) // Validate outgoing payload suite.NoError(errResponse.Payload.Validate(strfmt.Default)) @@ -678,7 +678,7 @@ func (suite *HandlerSuite) TestCreateNonSITAddressUpdateRequestHandler() { subtestData := makeSubtestData() mockCreator := mocks.ShipmentAddressUpdateRequester{} - handler := CreateNonSITAddressUpdateRequestHandler{ + handler := UpdateShipmentDestinationAddressHandler{ suite.HandlerConfig(), &mockCreator, } @@ -697,8 +697,8 @@ func (suite *HandlerSuite) TestCreateNonSITAddressUpdateRequestHandler() { suite.NoError(subtestData.Body.Validate(strfmt.Default)) response := handler.Handle(subtestData) - suite.IsType(&mtoshipmentops.CreateNonSITAddressUpdateRequestInternalServerError{}, response) - errResponse := response.(*mtoshipmentops.CreateNonSITAddressUpdateRequestInternalServerError) + suite.IsType(&mtoshipmentops.UpdateShipmentDestinationAddressInternalServerError{}, response) + errResponse := response.(*mtoshipmentops.UpdateShipmentDestinationAddressInternalServerError) // Validate outgoing payload suite.NoError(errResponse.Payload.Validate(strfmt.Default)) diff --git a/pkg/handlers/primeapi/payloads/payload_to_model.go b/pkg/handlers/primeapi/payloads/payload_to_model.go index 14a3a1d16ec..d0f9b295205 100644 --- a/pkg/handlers/primeapi/payloads/payload_to_model.go +++ b/pkg/handlers/primeapi/payloads/payload_to_model.go @@ -176,7 +176,7 @@ func MTOShipmentModelFromCreate(mtoShipment *primemessages.CreateMTOShipment) *m } // Non SIT Address update Model -func ShipmentAddressUpdateModel(nonSITAddressUpdate *primemessages.CreateNonSITAddressUpdateRequest, MtoShipmentID uuid.UUID) *models.ShipmentAddressUpdate { +func ShipmentAddressUpdateModel(nonSITAddressUpdate *primemessages.UpdateShipmentDestinationAddress, MtoShipmentID uuid.UUID) *models.ShipmentAddressUpdate { if nonSITAddressUpdate == nil { return nil } diff --git a/pkg/handlers/primeapi/payloads/payload_to_model_test.go b/pkg/handlers/primeapi/payloads/payload_to_model_test.go index 9ed0c4478e4..7691b47b2ea 100644 --- a/pkg/handlers/primeapi/payloads/payload_to_model_test.go +++ b/pkg/handlers/primeapi/payloads/payload_to_model_test.go @@ -460,7 +460,7 @@ func (suite *PayloadsSuite) TestShipmentAddressUpdateModel() { StreetAddress1: handlers.FmtString(""), } - nonSITAddressUpdate := primemessages.CreateNonSITAddressUpdateRequest{ + nonSITAddressUpdate := primemessages.UpdateShipmentDestinationAddress{ ContractorRemarks: &contractorRemarks, NewAddress: &newAddress, } diff --git a/pkg/handlers/primeapiv2/payloads/payload_to_model.go b/pkg/handlers/primeapiv2/payloads/payload_to_model.go index 59896e6a4e4..a531103bff7 100644 --- a/pkg/handlers/primeapiv2/payloads/payload_to_model.go +++ b/pkg/handlers/primeapiv2/payloads/payload_to_model.go @@ -184,7 +184,7 @@ func MTOShipmentModelFromCreate(mtoShipment *primev2messages.CreateMTOShipment) } // Non SIT Address update Model -func ShipmentAddressUpdateModel(nonSITAddressUpdate *primev2messages.CreateNonSITAddressUpdateRequest, MtoShipmentID uuid.UUID) *models.ShipmentAddressUpdate { +func ShipmentAddressUpdateModel(nonSITAddressUpdate *primev2messages.UpdateShipmentDestinationAddress, MtoShipmentID uuid.UUID) *models.ShipmentAddressUpdate { if nonSITAddressUpdate == nil { return nil } diff --git a/pkg/handlers/primeapiv2/payloads/payload_to_model_test.go b/pkg/handlers/primeapiv2/payloads/payload_to_model_test.go index 69f86fed251..b24ff544112 100644 --- a/pkg/handlers/primeapiv2/payloads/payload_to_model_test.go +++ b/pkg/handlers/primeapiv2/payloads/payload_to_model_test.go @@ -460,7 +460,7 @@ func (suite *PayloadsSuite) TestShipmentAddressUpdateModel() { StreetAddress1: handlers.FmtString(""), } - nonSITAddressUpdate := primev2messages.CreateNonSITAddressUpdateRequest{ + nonSITAddressUpdate := primev2messages.UpdateShipmentDestinationAddress{ ContractorRemarks: &contractorRemarks, NewAddress: &newAddress, } diff --git a/swagger-def/prime.yaml b/swagger-def/prime.yaml index bd162fd3ba6..7765b352191 100644 --- a/swagger-def/prime.yaml +++ b/swagger-def/prime.yaml @@ -537,14 +537,14 @@ paths: $ref: '#/responses/ServerError' /mto-shipments/{mtoShipmentID}/shipment-address-updates: post: - summary: createNonSITAddressUpdateRequest + summary: updateShipmentDestinationAddress description: | ### Functionality This endpoint is used so the Prime can request an **update** for the destination address on an MTO Shipment, after the destination address has already been approved. - This does not change addresses on SIT service items. + Address updates will be automatically approved unless they change: - - the service area + - The service area - Mileage bracket for direct delivery - the address and the distance between the old and new address is > 50 - Domestic Short Haul to Domestic Line Haul or vice versa @@ -553,7 +553,7 @@ paths: For those, changes will require TOO approval. - operationId: createNonSITAddressUpdateRequest + operationId: updateShipmentDestinationAddress tags: - mtoShipment consumes: @@ -571,7 +571,7 @@ paths: required: true name: body schema: - $ref: '#/definitions/CreateNonSITAddressUpdateRequest' + $ref: '#/definitions/UpdateShipmentDestinationAddress' - in: header name: If-Match type: string @@ -1764,8 +1764,8 @@ definitions: readOnly: true allOf: - $ref: 'definitions/prime/MTOShipmentWithoutServiceItems.yaml' - CreateNonSITAddressUpdateRequest: - description: CreateNonSITAddressUpdateRequest contains the fields required for the prime to create a non SIT address update request. + UpdateShipmentDestinationAddress: + description: UpdateShipmentDestinationAddress contains the fields required for the prime to request an update for the destination address on an MTO Shipment. type: object properties: newAddress: diff --git a/swagger-def/prime_v2.yaml b/swagger-def/prime_v2.yaml index 07a175e6ba2..493cbe90371 100644 --- a/swagger-def/prime_v2.yaml +++ b/swagger-def/prime_v2.yaml @@ -637,8 +637,8 @@ definitions: type: string x-nullable: true x-omitempty: false - CreateNonSITAddressUpdateRequest: - description: CreateNonSITAddressUpdateRequest contains the fields required for the prime to create a non SIT address update request. + UpdateShipmentDestinationAddress: + description: UpdateShipmentDestinationAddress contains the fields required for the prime to request an update for the destination address on an MTO Shipment. type: object properties: newAddress: diff --git a/swagger/prime.yaml b/swagger/prime.yaml index c3acae5d8da..4243faf822f 100644 --- a/swagger/prime.yaml +++ b/swagger/prime.yaml @@ -641,7 +641,7 @@ paths: $ref: '#/responses/ServerError' /mto-shipments/{mtoShipmentID}/shipment-address-updates: post: - summary: createNonSITAddressUpdateRequest + summary: updateShipmentDestinationAddress description: > ### Functionality @@ -650,10 +650,9 @@ paths: after the destination address has already been approved. - This does not change addresses on SIT service items. Address updates will be automatically approved unless they change: - - the service area + - The service area - Mileage bracket for direct delivery - the address and the distance between the old and new address is > 50 - Domestic Short Haul to Domestic Line Haul or vice versa @@ -661,7 +660,7 @@ paths: - Shipments that start and end in different ZIP3s use Line Haul pricing For those, changes will require TOO approval. - operationId: createNonSITAddressUpdateRequest + operationId: updateShipmentDestinationAddress tags: - mtoShipment consumes: @@ -679,7 +678,7 @@ paths: required: true name: body schema: - $ref: '#/definitions/CreateNonSITAddressUpdateRequest' + $ref: '#/definitions/UpdateShipmentDestinationAddress' - in: header name: If-Match type: string @@ -2397,10 +2396,10 @@ definitions: readOnly: true allOf: - $ref: '#/definitions/MTOShipmentWithoutServiceItems' - CreateNonSITAddressUpdateRequest: + UpdateShipmentDestinationAddress: description: >- - CreateNonSITAddressUpdateRequest contains the fields required for the - prime to create a non SIT address update request. + UpdateShipmentDestinationAddress contains the fields required for the + prime to request an update for the destination address on an MTO Shipment. type: object properties: newAddress: diff --git a/swagger/prime_v2.yaml b/swagger/prime_v2.yaml index 611cf14df01..bc51549b981 100644 --- a/swagger/prime_v2.yaml +++ b/swagger/prime_v2.yaml @@ -985,10 +985,10 @@ definitions: type: string x-nullable: true x-omitempty: false - CreateNonSITAddressUpdateRequest: + UpdateShipmentDestinationAddress: description: >- - CreateNonSITAddressUpdateRequest contains the fields required for the - prime to create a non SIT address update request. + UpdateShipmentDestinationAddress contains the fields required for the + prime to request an update for the destination address on an MTO Shipment. type: object properties: newAddress: