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)); }
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)); }
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); }
public TResource Get(TId id) { return(Client.Get <TResource>(GetResourceUri(id))); }