protected virtual HttpRequestMessage CreateRequest(GetEntityCommand cmd) { var req = new HttpRequest(HttpMethod.Get, GenerateRequestUrl(cmd.Id, cmd.Rev)); req.SetIfMatch(cmd.Rev); return(req); }
public virtual async Task <EntityResponse <T> > GetAsync <T>(GetEntityCommand cmd) where T : class { Ensure.That(cmd, "cmd").IsNotNull(); var req = CreateRequest(cmd); var res = SendAsync(req); return(ProcessEntityResponse <T>(cmd, await res.ForAwait())); }
public static Task <EntityResponse <T> > ExecuteAsync <T>(this IClient client, GetEntityCommand cmd) where T : class { return(client.Entities.GetAsync <T>(cmd)); }
protected virtual EntityResponse <T> ProcessEntityResponse <T>(GetEntityCommand cmd, HttpResponseMessage response) where T : class { return(EntityResponseFactory.Create <T>(response)); }