コード例 #1
0
func (o *DeletePetParams) bindPetID(raw string, formats strfmt.Registry) error {

	value, err := swag.ConvertInt64(raw)
	if err != nil {
		return errors.InvalidType("petId", "path", "int64", raw)
	}
	o.PetID = value

	return nil
}
コード例 #2
0
func (o *GetEventByIDParams) bindID(raw string, formats strfmt.Registry) error {

	value, err := swag.ConvertInt64(raw)
	if err != nil {
		return errors.InvalidType("id", "path", "int64", raw)
	}
	o.ID = value

	return nil
}
コード例 #3
0
func (o *UpdateOneParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
	var raw string
	if len(rawData) > 0 {
		raw = rawData[len(rawData)-1]
	}

	value, err := swag.ConvertInt64(raw)
	if err != nil {
		return errors.InvalidType("id", "path", "int64", raw)
	}
	o.ID = value

	return nil
}
コード例 #4
0
ファイル: list_tasks_responses.go プロジェクト: jak-atx/vic
func (o *ListTasksOK) readResponse(response client.Response, consumer httpkit.Consumer, formats strfmt.Registry) error {

	// response header X-Last-Task-Id
	xLastTaskId, err := swag.ConvertInt64(response.GetHeader("X-Last-Task-Id"))
	if err != nil {
		return errors.InvalidType("X-Last-Task-Id", "header", "int64", response.GetHeader("X-Last-Task-Id"))
	}
	o.XLastTaskID = xLastTaskId

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

	return nil
}
コード例 #5
0
func (o *ListTasksParams) bindSinceID(rawData []string, hasKey bool, formats strfmt.Registry) error {
	var raw string
	if len(rawData) > 0 {
		raw = rawData[len(rawData)-1]
	}
	if raw == "" { // empty values pass all other validations
		return nil
	}

	value, err := swag.ConvertInt64(raw)
	if err != nil {
		return errors.InvalidType("sinceId", "query", "int64", raw)
	}
	o.SinceID = value

	return nil
}
コード例 #6
0
func (o *GetOrderByIDParams) bindOrderID(rawData []string, hasKey bool, formats strfmt.Registry) error {
	var raw string
	if len(rawData) > 0 {
		raw = rawData[len(rawData)-1]
	}

	value, err := swag.ConvertInt64(raw)
	if err != nil {
		return errors.InvalidType("orderId", "path", "int64", raw)
	}
	o.OrderID = value

	if err := o.validateOrderID(formats); err != nil {
		return err
	}

	return nil
}