func enrichLinkSingle(ctx *workItemLinkContext, appLinks *app.WorkItemLinkSingle) error {
	// include link type
	modelLinkType, err := ctx.Application.WorkItemLinkTypes().LoadByID(ctx.Context, appLinks.Data.Relationships.LinkType.Data.ID)
	if err != nil {
		return errs.WithStack(err)
	}
	appLinkType := ConvertWorkItemLinkTypeFromModel(ctx.RequestData, *modelLinkType)
	appLinks.Included = append(appLinks.Included, appLinkType.Data)

	// include link category
	modelCategory, err := ctx.Application.WorkItemLinkCategories().Load(ctx.Context, appLinkType.Data.Relationships.LinkCategory.Data.ID)
	if err != nil {
		return errs.WithStack(err)
	}
	appCategory := convertLinkCategoryFromModel(*modelCategory)
	appLinks.Included = append(appLinks.Included, appCategory.Data)

	// TODO(kwk): include source work item type (once #559 is merged)
	// sourceWit, err := appl.WorkItemTypes().Load(ctx, linkType.Data.Relationships.SourceType.Data.ID)
	// if err != nil {
	// 	return errs.WithStack(err)
	// }
	// link.Included = append(link.Included, sourceWit.Data)

	// TODO(kwk): include target work item type (once #559 is merged)
	// targetWit, err := appl.WorkItemTypes().Load(ctx, linkType.Data.Relationships.TargetType.Data.ID)
	// if err != nil {
	// 	return errs.WithStack(err)
	// }
	// link.Included = append(link.Included, targetWit.Data)

	// TODO(kwk): include source work item
	sourceWi, err := ctx.Application.WorkItems().LoadByID(ctx.Context, appLinks.Data.Relationships.Source.Data.ID)
	if err != nil {
		return errs.WithStack(err)
	}
	appLinks.Included = append(appLinks.Included, ConvertWorkItem(ctx.RequestData, *sourceWi))

	// TODO(kwk): include target work item
	targetWi, err := ctx.Application.WorkItems().LoadByID(ctx.Context, appLinks.Data.Relationships.Target.Data.ID)
	if err != nil {
		return errs.WithStack(err)
	}
	appLinks.Included = append(appLinks.Included, ConvertWorkItem(ctx.RequestData, *targetWi))

	// Add links to individual link data element
	selfURL := rest.AbsoluteURL(ctx.RequestData, ctx.LinkFunc(*appLinks.Data.ID))
	appLinks.Data.Links = &app.GenericLinks{
		Self: &selfURL,
	}

	return nil
}
// enrichLinkSingle includes related resources in the link's "included" array
enrichLinkSingle includes related resources in the link's "included" array
// enrichLinkSingle includes related resources in the link ' s " included " array
func enrichLinkSingle(ctx *workItemLinkContext, appLinks *app.WorkItemLinkSingle) error {
	modelLinkType, err := ctx.Application.WorkItemLinkTypes().LoadByID(ctx.Context, appLinks.Data.Relationships.LinkType.Data.ID)
	if err != nil {
		return errs.WithStack(err)
	}
	appLinkType := ConvertWorkItemLinkTypeFromModel(ctx.RequestData, *modelLinkType)
	appLinks.Included = append(appLinks.Included, appLinkType.Data)
	modelCategory, err := ctx.Application.WorkItemLinkCategories().Load(ctx.Context, appLinkType.Data.Relationships.LinkCategory.Data.ID)
	if err != nil {
		return errs.WithStack(err)
	}
	appCategory := convertLinkCategoryFromModel(*modelCategory)
	appLinks.Included = append(appLinks.Included, appCategory.Data)
	sourceWi, err := ctx.Application.WorkItems().LoadByID(ctx.Context, appLinks.Data.Relationships.Source.Data.ID)
	if err != nil {
		return errs.WithStack(err)
	}
	appLinks.Included = append(appLinks.Included, ConvertWorkItem(ctx.RequestData, *sourceWi))
	targetWi, err := ctx.Application.WorkItems().LoadByID(ctx.Context, appLinks.Data.Relationships.Target.Data.ID)
	if err != nil {
		return errs.WithStack(err)
	}
	appLinks.Included = append(appLinks.Included, ConvertWorkItem(ctx.RequestData, *targetWi))
	selfURL := rest.AbsoluteURL(ctx.RequestData, ctx.LinkFunc(*appLinks.Data.ID))
	appLinks.Data.Links = &app.GenericLinks{
		Self: &selfURL,
	}
	return nil
}
func enrichLinkSingle ( ctx * workItemLinkContext , appLinks * app . WorkItemLinkSingle ) error { modelLinkType , err := ctx . Application . WorkItemLinkTypes ( ) . LoadByID ( ctx . Context , appLinks . Data . Relationships . LinkType . Data . ID ) if err != nil { return errs . WithStack ( err ) } appLinkType := ConvertWorkItemLinkTypeFromModel ( ctx . RequestData , * modelLinkType ) appLinks . Included = append ( appLinks . Included , appLinkType . Data ) modelCategory , err := ctx . Application . WorkItemLinkCategories ( ) . Load ( ctx . Context , appLinkType . Data . Relationships . LinkCategory . Data . ID ) if err != nil { return errs . WithStack ( err ) } appCategory := convertLinkCategoryFromModel ( * modelCategory ) appLinks . Included = append ( appLinks . Included , appCategory . Data ) sourceWi , err := ctx . Application . WorkItems ( ) . LoadByID ( ctx . Context , appLinks . Data . Relationships . Source . Data . ID ) if err != nil { return errs . WithStack ( err ) } appLinks . Included = append ( appLinks . Included , ConvertWorkItem ( ctx . RequestData , * sourceWi ) ) targetWi , err := ctx . Application . WorkItems ( ) . LoadByID ( ctx . Context , appLinks . Data . Relationships . Target . Data . ID ) if err != nil { return errs . WithStack ( err ) } appLinks . Included = append ( appLinks . Included , ConvertWorkItem ( ctx . RequestData , * targetWi ) ) selfURL := rest . AbsoluteURL ( ctx . RequestData , ctx . LinkFunc ( * appLinks . Data . ID ) ) appLinks . Data . Links = & app . GenericLinks { Self : & selfURL , } return nil }
enrichLinkSingle includes related resources in the link's "included" array
enrichLinkSingle includes related resources in the link ' s " included " array
// include link type // include link category // TODO(kwk): include source work item type (once #559 is merged) // sourceWit, err := appl.WorkItemTypes().Load(ctx, linkType.Data.Relationships.SourceType.Data.ID) // if err != nil { // 	return errs.WithStack(err) // } // link.Included = append(link.Included, sourceWit.Data) // TODO(kwk): include target work item type (once #559 is merged) // targetWit, err := appl.WorkItemTypes().Load(ctx, linkType.Data.Relationships.TargetType.Data.ID) // if err != nil { // 	return errs.WithStack(err) // } // link.Included = append(link.Included, targetWit.Data) // TODO(kwk): include source work item // TODO(kwk): include target work item // Add links to individual link data element