public static List <ContactType> ListContactTypes(this RestfulBusinessApiClient api, int?pageIndex = null, int?pageSize = null) { var query = MakePagingQuery(pageIndex, pageSize); return(api.GetJson <List <ContactType> >("ContactTypes/" + query.ToQueryString()) ?? new List <ContactType>()); }
/// <summary> /// Lists All Restuarants that match that match the client side filter. This pages through all records to ensure all /// records are returned. /// </summary> /// <param name="api"></param> /// <param name="filter"></param> /// <returns></returns> public static List <RestaurantSummary> ListAllRestaurants(this RestfulBusinessApiClient api, Predicate <RestaurantSummary> filter = null) { var pageSize = DefaultPageSize; return(ListAll(pageSize, pageIndex => api.ListRestaurants(pageIndex, pageSize), filter ?? DefaultFilter)); }
/// <summary> /// Lists Users using pageIndex & pageSize. pageSize is limited to 200 results. /// </summary> /// <param name="api"></param> /// <param name="pageIndex">current page index</param> /// <param name="pageSize">requested page size, under 200.</param> /// <returns></returns> /// <remarks> /// The server will limit pages to 200 records, using paging to get all records. /// </remarks> public static List <UserSummary> ListUsers(this RestfulBusinessApiClient api, int?pageIndex = null, int?pageSize = null) { var query = MakePagingQuery(pageIndex, pageSize); return(api.GetJson <List <UserSummary> >("Users/" + query.ToQueryString()) ?? new List <UserSummary>()); }
public static void DeleteUser(this RestfulBusinessApiClient api, string id) { if (id == null) { throw new ArgumentNullException(nameof(id)); } api.Delete("Users/" + id.UrlEncode()); }
public static User GetUser(this RestfulBusinessApiClient api, string id) { if (id == null) { throw new ArgumentNullException(nameof(id)); } return(api.GetJson <User>("Users/" + id.UrlEncode())); }
public static Asset GetAsset(this RestfulBusinessApiClient api, string id) { if (id == null) { throw new ArgumentNullException(nameof(id)); } return(api.GetJson <Asset>("Assets/" + id.UrlEncode())); }
public static List <StateInfo> ListStatesByCountry(this RestfulBusinessApiClient api, string countryCode, int?pageIndex = null, int?pageSize = null) { //url? //return api.GetJson<List<StateInfo>>("State/"); return(api.ListStates(pageIndex, pageSize) .Where(s => s.CountryCode == countryCode) .ToList()); }
public static void DeleteRestaurant(this RestfulBusinessApiClient api, string id) { api.Delete("Restaurants/" + id.UrlEncode()); }
public static Restaurant PutRestaurant(this RestfulBusinessApiClient api, Restaurant restaurant) { return(api.PutJson <Restaurant>("Restaurants/" + restaurant.Id.UrlEncode(), restaurant)); }
public static Restaurant PostRestaurant(this RestfulBusinessApiClient api, Restaurant restaurant) { return(api.PostJson <Restaurant>("Restaurants", restaurant)); }
/// <summary> /// Sends a PUT request to the server to UPDATE an existing User, using <see cref="User.UserName" /> as the resource /// Id. /// </summary> /// <param name="api"></param> /// <param name="user"></param> /// <returns></returns> public static User PutUser(this RestfulBusinessApiClient api, User user) { user.VerifyKeysAreValidXmlNames(); return(api.PutJson <User>("Users/" + user.UserName.UrlEncode(), user)); }
public static Restaurant GetRestaurant(this RestfulBusinessApiClient api, string id) { return(api.GetJson <Restaurant>("Restaurants/" + id.UrlEncode())); }
public static RetailLocation PostRetailLocation(this RestfulBusinessApiClient api, RetailLocation retailRetailLocation) { return(api.PostJson <RetailLocation>("RetailLocations", retailRetailLocation)); }
public static void DeleteRetailLocation(this RestfulBusinessApiClient api, string id) { api.Delete("RetailLocations/" + id.UrlEncode()); }
public static RetailLocation GetRetailLocation(this RestfulBusinessApiClient api, string id) { return(api.GetJson <RetailLocation>("RetailLocations/" + id.UrlEncode())); }
public static RetailLocation PutRetailLocation(this RestfulBusinessApiClient api, RetailLocation retailRetailLocation) { return(api.PutJson <RetailLocation>("RetailLocations/" + retailRetailLocation.Id.UrlEncode(), retailRetailLocation)); }
/// <summary> /// Sends a POST request to INSERT a new User. /// </summary> /// <param name="api"></param> /// <param name="user"></param> /// <returns></returns> public static User PostUser(this RestfulBusinessApiClient api, User user) { user.VerifyKeysAreValidXmlNames(); return(api.PostJson <User>("Users", user)); }
/// <summary> /// Lists All Assets that match the client side filter. This pages through all records to ensure all records are /// returned. /// </summary> /// <param name="api"></param> /// <param name="filter">A lambda that can filter results on the client side.</param> /// <returns></returns> public static List <Asset> ListAllAssets(this RestfulBusinessApiClient api, Predicate <Asset> filter = null) { var pageSize = DefaultPageSize; return(ListAll(pageSize, pageIndex => api.ListAssets(pageIndex, pageSize), filter ?? DefaultFilter)); }
/// <summary> /// Lists all Countries from the lookup table, using paging to ensure all records are returned. /// </summary> /// <param name="api"></param> /// <param name="filter"></param> /// <returns></returns> public static List <CountryInfo> ListAllCountries(this RestfulBusinessApiClient api, Predicate <CountryInfo> filter = null) { var pageSize = DefaultPageSize; return(ListAll(pageSize, pageIndex => api.ListCountries(pageIndex, pageSize), filter ?? DefaultFilter)); }
public static Asset PostAsset(this RestfulBusinessApiClient api, Asset asset) { return(api.PostJson <Asset>("Assets", asset)); }
public static Asset PutAsset(this RestfulBusinessApiClient api, Asset asset) { return(api.PutJson <Asset>("Assets/" + asset.Id.UrlEncode(), asset)); }