func ConvertWorkItemLinkTypeToModel(appLinkType app.WorkItemLinkTypeSingle) (*link.WorkItemLinkType, error) {
	modelLinkType := link.WorkItemLinkType{}
	if appLinkType.Data == nil {
		return nil, errors.NewBadParameterError("data", nil).Expected("not <nil>")
	}
	if appLinkType.Data.Attributes == nil {
		return nil, errors.NewBadParameterError("data.attributes", nil).Expected("not <nil>")
	}
	if appLinkType.Data.Relationships == nil {
		return nil, errors.NewBadParameterError("data.relationships", nil).Expected("not <nil>")
	}

	attrs := appLinkType.Data.Attributes
	rel := appLinkType.Data.Relationships

	if appLinkType.Data.ID != nil {
		modelLinkType.ID = *appLinkType.Data.ID
	}

	if attrs != nil {
		// If the name is not nil, it MUST NOT be empty
		if attrs.Name != nil {
			if *attrs.Name == "" {
				return nil, errors.NewBadParameterError("data.attributes.name", *attrs.Name)
			}
			modelLinkType.Name = *attrs.Name
		}

		if attrs.Description != nil {
			modelLinkType.Description = attrs.Description
		}

		if attrs.Version != nil {
			modelLinkType.Version = *attrs.Version
		}

		// If the forwardName is not nil, it MUST NOT be empty
		if attrs.ForwardName != nil {
			if *attrs.ForwardName == "" {
				return nil, errors.NewBadParameterError("data.attributes.forward_name", *attrs.ForwardName)
			}
			modelLinkType.ForwardName = *attrs.ForwardName
		}

		// If the ReverseName is not nil, it MUST NOT be empty
		if attrs.ReverseName != nil {
			if *attrs.ReverseName == "" {
				return nil, errors.NewBadParameterError("data.attributes.reverse_name", *attrs.ReverseName)
			}
			modelLinkType.ReverseName = *attrs.ReverseName
		}

		if attrs.Topology != nil {
			if err := link.CheckValidTopology(*attrs.Topology); err != nil {
				return nil, errs.WithStack(err)
			}
			modelLinkType.Topology = *attrs.Topology
		}
	}

	if rel != nil && rel.LinkCategory != nil && rel.LinkCategory.Data != nil {
		modelLinkType.LinkCategoryID = rel.LinkCategory.Data.ID
	}
	if rel != nil && rel.SourceType != nil && rel.SourceType.Data != nil {
		modelLinkType.SourceTypeID = rel.SourceType.Data.ID
	}
	if rel != nil && rel.TargetType != nil && rel.TargetType.Data != nil {
		modelLinkType.TargetTypeID = rel.TargetType.Data.ID
	}
	if rel != nil && rel.Space != nil && rel.Space.Data != nil {
		modelLinkType.SpaceID = *rel.Space.Data.ID
	}

	return &modelLinkType, nil
}
// ConvertWorkItemLinkTypeToModel converts the incoming app representation of a work item link type to the model layout.
// Values are only overwrriten if they are set in "in", otherwise the values in "out" remain.
ConvertWorkItemLinkTypeToModel converts the incoming app representation of a work item link type to the model layout.
Values are only overwrriten if they are set in "in", otherwise the values in "out" remain.
// ConvertWorkItemLinkTypeToModel converts the incoming app representation of a work item link type to the model layout . // Values are only overwrriten if they are set in " in " otherwise the values in " out " remain .
func ConvertWorkItemLinkTypeToModel(appLinkType app.WorkItemLinkTypeSingle) (*link.WorkItemLinkType, error) {
	modelLinkType := link.WorkItemLinkType{}
	if appLinkType.Data == nil {
		return nil, errors.NewBadParameterError("data", nil).Expected("not <nil>")
	}
	if appLinkType.Data.Attributes == nil {
		return nil, errors.NewBadParameterError("data.attributes", nil).Expected("not <nil>")
	}
	if appLinkType.Data.Relationships == nil {
		return nil, errors.NewBadParameterError("data.relationships", nil).Expected("not <nil>")
	}
	attrs := appLinkType.Data.Attributes
	rel := appLinkType.Data.Relationships
	if appLinkType.Data.ID != nil {
		modelLinkType.ID = *appLinkType.Data.ID
	}
	if attrs != nil {
		if attrs.Name != nil {
			if *attrs.Name == "" {
				return nil, errors.NewBadParameterError("data.attributes.name", *attrs.Name)
			}
			modelLinkType.Name = *attrs.Name
		}
		if attrs.Description != nil {
			modelLinkType.Description = attrs.Description
		}
		if attrs.Version != nil {
			modelLinkType.Version = *attrs.Version
		}
		if attrs.ForwardName != nil {
			if *attrs.ForwardName == "" {
				return nil, errors.NewBadParameterError("data.attributes.forward_name", *attrs.ForwardName)
			}
			modelLinkType.ForwardName = *attrs.ForwardName
		}
		if attrs.ReverseName != nil {
			if *attrs.ReverseName == "" {
				return nil, errors.NewBadParameterError("data.attributes.reverse_name", *attrs.ReverseName)
			}
			modelLinkType.ReverseName = *attrs.ReverseName
		}
		if attrs.Topology != nil {
			if err := link.CheckValidTopology(*attrs.Topology); err != nil {
				return nil, errs.WithStack(err)
			}
			modelLinkType.Topology = *attrs.Topology
		}
	}
	if rel != nil && rel.LinkCategory != nil && rel.LinkCategory.Data != nil {
		modelLinkType.LinkCategoryID = rel.LinkCategory.Data.ID
	}
	if rel != nil && rel.SourceType != nil && rel.SourceType.Data != nil {
		modelLinkType.SourceTypeID = rel.SourceType.Data.ID
	}
	if rel != nil && rel.TargetType != nil && rel.TargetType.Data != nil {
		modelLinkType.TargetTypeID = rel.TargetType.Data.ID
	}
	if rel != nil && rel.Space != nil && rel.Space.Data != nil {
		modelLinkType.SpaceID = *rel.Space.Data.ID
	}
	return &modelLinkType, nil
}
func ConvertWorkItemLinkTypeToModel ( appLinkType app . WorkItemLinkTypeSingle ) ( * link . WorkItemLinkType , error ) { modelLinkType := link . WorkItemLinkType { } if appLinkType . Data == nil { return nil , errors . NewBadParameterError ( " " , nil ) . Expected ( " " ) } if appLinkType . Data . Attributes == nil { return nil , errors . NewBadParameterError ( " " , nil ) . Expected ( " " ) } if appLinkType . Data . Relationships == nil { return nil , errors . NewBadParameterError ( " " , nil ) . Expected ( " " ) } attrs := appLinkType . Data . Attributes rel := appLinkType . Data . Relationships if appLinkType . Data . ID != nil { modelLinkType . ID = * appLinkType . Data . ID } if attrs != nil { if attrs . Name != nil { if * attrs . Name == " " { return nil , errors . NewBadParameterError ( " " , * attrs . Name ) } modelLinkType . Name = * attrs . Name } if attrs . Description != nil { modelLinkType . Description = attrs . Description } if attrs . Version != nil { modelLinkType . Version = * attrs . Version } if attrs . ForwardName != nil { if * attrs . ForwardName == " " { return nil , errors . NewBadParameterError ( " " , * attrs . ForwardName ) } modelLinkType . ForwardName = * attrs . ForwardName } if attrs . ReverseName != nil { if * attrs . ReverseName == " " { return nil , errors . NewBadParameterError ( " " , * attrs . ReverseName ) } modelLinkType . ReverseName = * attrs . ReverseName } if attrs . Topology != nil { if err := link . CheckValidTopology ( * attrs . Topology ) ; err != nil { return nil , errs . WithStack ( err ) } modelLinkType . Topology = * attrs . Topology } } if rel != nil && rel . LinkCategory != nil && rel . LinkCategory . Data != nil { modelLinkType . LinkCategoryID = rel . LinkCategory . Data . ID } if rel != nil && rel . SourceType != nil && rel . SourceType . Data != nil { modelLinkType . SourceTypeID = rel . SourceType . Data . ID } if rel != nil && rel . TargetType != nil && rel . TargetType . Data != nil { modelLinkType . TargetTypeID = rel . TargetType . Data . ID } if rel != nil && rel . Space != nil && rel . Space . Data != nil { modelLinkType . SpaceID = * rel . Space . Data . ID } return & modelLinkType , nil }
ConvertWorkItemLinkTypeToModel converts the incoming app representation of a work item link type to the model layout.
ConvertWorkItemLinkTypeToModel converts the incoming app representation of a work item link type to the model layout .
// If the name is not nil, it MUST NOT be empty // If the forwardName is not nil, it MUST NOT be empty // If the ReverseName is not nil, it MUST NOT be empty