Exemplo n.º 1
0
 public static object Get(this IPomonaClient client, string uri, Type type)
 {
     if (client == null)
     {
         throw new ArgumentNullException(nameof(client));
     }
     return(client.Get(uri, type, null));
 }
Exemplo n.º 2
0
 public static T Get <T>(this IPomonaClient client, string uri)
 {
     if (client == null)
     {
         throw new ArgumentNullException(nameof(client));
     }
     return((T)client.Get(uri, typeof(T), null));
 }
Exemplo n.º 3
0
        public static T Get <T>(this IPomonaClient client, string uri, RequestOptions requestOptions)
        {
            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }

            var type     = typeof(T);
            var resource = client.Get(uri, type, requestOptions);

            if (resource == null && type.IsValueType && !type.IsNullable())
            {
                throw new InvalidCastException($"The response from {uri} was null, which can't be cast to {type}.");
            }

            return((T)resource);
        }
Exemplo n.º 4
0
 public TResource Get(TId id)
 {
     return(Client.Get <TResource>(GetResourceUri(id)));
 }