Esempio n. 1
0
        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>());
        }
Esempio n. 2
0
        /// <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));
        }
Esempio n. 3
0
        /// <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>());
        }
Esempio n. 4
0
 public static void DeleteUser(this RestfulBusinessApiClient api, string id)
 {
     if (id == null)
     {
         throw new ArgumentNullException(nameof(id));
     }
     api.Delete("Users/" + id.UrlEncode());
 }
Esempio n. 5
0
        public static User GetUser(this RestfulBusinessApiClient api, string id)
        {
            if (id == null)
            {
                throw new ArgumentNullException(nameof(id));
            }

            return(api.GetJson <User>("Users/" + id.UrlEncode()));
        }
Esempio n. 6
0
        public static Asset GetAsset(this RestfulBusinessApiClient api, string id)
        {
            if (id == null)
            {
                throw new ArgumentNullException(nameof(id));
            }

            return(api.GetJson <Asset>("Assets/" + id.UrlEncode()));
        }
Esempio n. 7
0
 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());
 }
Esempio n. 8
0
 public static void DeleteRestaurant(this RestfulBusinessApiClient api, string id)
 {
     api.Delete("Restaurants/" + id.UrlEncode());
 }
Esempio n. 9
0
 public static Restaurant PutRestaurant(this RestfulBusinessApiClient api, Restaurant restaurant)
 {
     return(api.PutJson <Restaurant>("Restaurants/" + restaurant.Id.UrlEncode(), restaurant));
 }
Esempio n. 10
0
 public static Restaurant PostRestaurant(this RestfulBusinessApiClient api, Restaurant restaurant)
 {
     return(api.PostJson <Restaurant>("Restaurants", restaurant));
 }
Esempio n. 11
0
        /// <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));
        }
Esempio n. 12
0
 public static Restaurant GetRestaurant(this RestfulBusinessApiClient api, string id)
 {
     return(api.GetJson <Restaurant>("Restaurants/" + id.UrlEncode()));
 }
Esempio n. 13
0
 public static RetailLocation PostRetailLocation(this RestfulBusinessApiClient api,
                                                 RetailLocation retailRetailLocation)
 {
     return(api.PostJson <RetailLocation>("RetailLocations", retailRetailLocation));
 }
Esempio n. 14
0
 public static void DeleteRetailLocation(this RestfulBusinessApiClient api, string id)
 {
     api.Delete("RetailLocations/" + id.UrlEncode());
 }
Esempio n. 15
0
 public static RetailLocation GetRetailLocation(this RestfulBusinessApiClient api, string id)
 {
     return(api.GetJson <RetailLocation>("RetailLocations/" + id.UrlEncode()));
 }
Esempio n. 16
0
 public static RetailLocation PutRetailLocation(this RestfulBusinessApiClient api,
                                                RetailLocation retailRetailLocation)
 {
     return(api.PutJson <RetailLocation>("RetailLocations/" + retailRetailLocation.Id.UrlEncode(),
                                         retailRetailLocation));
 }
Esempio n. 17
0
        /// <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));
        }
Esempio n. 18
0
        /// <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));
        }
Esempio n. 19
0
        /// <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));
        }
Esempio n. 20
0
 public static Asset PostAsset(this RestfulBusinessApiClient api, Asset asset)
 {
     return(api.PostJson <Asset>("Assets", asset));
 }
Esempio n. 21
0
 public static Asset PutAsset(this RestfulBusinessApiClient api, Asset asset)
 {
     return(api.PutJson <Asset>("Assets/" + asset.Id.UrlEncode(), asset));
 }