Exemple #1
0
        public static LinkID withID(string id)
        {
            if (string.IsNullOrWhiteSpace(id))
            {
                throw new ArgumentNullException("Please provide a Link ID");
            }

            var linkId = new LinkID(id);

            linkId._withNoCheks = true;

            return(linkId);
        }
        public ResponseContext WithLink(LinkID linkId, string action = "", bool standardRel = false)
        {
            var rel = string.Empty;

            if (!string.IsNullOrWhiteSpace(linkId.ID))
            {
                rel = linkId.ID;
            }
            else
            {
                throw new ArgumentNullException("Please provide a Link ID");
            }

            return(WithLink(new Link(rel, linkId, action, standardRel)));
        }
Exemple #3
0
        public static LinkID fromResourceLink(ResourceLink resourceLink)
        {
            if (resourceLink == null)
            {
                throw new ArgumentNullException("Please provide a ResourceLink");
            }

            var linkId = new LinkID(resourceLink.ResourceID)
            {
                ResourceSpecs = resourceLink
            };

            foreach (var parameter in resourceLink.Parameters)
            {
                if (parameter.IsRequired && parameter.DefaultValue == null)
                {
                    linkId._missingNonDefaultRequiredFields++;
                }
            }

            return(linkId);
        }
 public ResponseContext WithDeleteItemLink(LinkID linkId, bool standardRel = false)
 {
     return(WithLink(linkId, LinkRelations.Item.Actions.DeleteItem, standardRel));
 }
 public ResponseContext WithRemoveRelatedItemLink(string rel, LinkID linkId, bool standardRel = false)
 {
     return(WithLink(rel, linkId, LinkRelations.Item.Actions.RemoveRelatedItem, standardRel));
 }
 public ResponseContext WithCreateRelatedLink(LinkID linkId, bool standardRel = false)
 {
     return(WithLink(linkId, LinkRelations.Item.Actions.CreateRelatedItem, standardRel));
 }
 public ResponseContext WithCollectionLink(LinkID linkId, bool standardRel = false)
 {
     return(WithLink(linkId, LinkRelations.Item.Actions.GetCollection, standardRel));
 }
 public ResponseContext WithLink(string rel, LinkID linkId, string action = "", bool standardRel = false)
 {
     return(WithLink(new Link(rel, linkId, action, standardRel)));
 }