public static async Task <IHalClient> GetAsync(
            this IHalClient client,
            IResource resource,
            string rel,
            object parameters,
            string curie)
        {
            var relationship = HalClientExtensions.Relationship(rel, curie);

            if (resource.Embedded.Any(e => e.Rel == relationship))
            {
                var current = resource.Embedded.Where(e => e.Rel == relationship);

                return(new HalClient(client, current));
            }

            var link = resource.Links.FirstOrDefault(l => l.Rel == relationship);

            if (link == null)
            {
                throw new FailedToResolveRelationship(relationship);
            }

            return(await client.ExecuteAsync(
                       HalClientExtensions.Construct(resource.BaseAddress, link, parameters),
                       uri => client.Client.GetAsync(uri)));
        }
        public static bool Has(this IHalClient client, string rel, string curie)
        {
            var relationship = HalClientExtensions.Relationship(rel, curie);

            return
                (client.Current.Any(r => r.Embedded.Any(e => e.Rel == relationship)) ||
                 client.Current.Any(r => r.Links.Any(l => l.Rel == relationship)));
        }
        public static Task <IHalClient> Delete(
            this IHalClient client,
            string rel,
            object parameters,
            string curie,
            IDictionary <string, string[]> headers = null,
            CancellationToken cancellationToken    = default)
        {
            var relationship = HalClientExtensions.Relationship(rel, curie);

            return(client.BuildAndExecuteAsync(
                       relationship,
                       parameters,
                       uri => client.Client.DeleteAsync(uri, headers, cancellationToken)));
        }