#pragma once #include "V8Tree/Instance.h" #include "V8Tree/Service.h" namespace RBX { extern const char* const sAssetService; class AssetService :public DescribedNonCreatable ,public Service { ThrottlingHelper createPlaceThrottle, savePlaceThrottle; public: enum AccessType { ME = 0, FRIENDS = 1, EVERYONE = 2, INVITEONLY = 3, }; AssetService(); void setPlaceAccessUrl(std::string url); void setAssetRevertUrl(std::string url); void setAssetVersionsUrl(std::string url); void revertAsset(int assetId, int versionNumber, boost::function resumeFunction, boost::function errorFunction); void getAssetVersions(int assetId, int pageNum, boost::function)> resumeFunction, boost::function errorFunction); void getPlacePermissions(int placeId, boost::function)> resumeFunction, boost::function errorFunction); void setPlacePermissions(int placeId, AccessType type, shared_ptr inviteList, boost::function resumeFunction, boost::function errorFunction); void getCreatorAssetID(int creationID, boost::function resumeFunction, boost::function errorFunction); void createPlaceAsync(std::string placeName, int templatePlaceId, std::string desc, boost::function resumeFunction, boost::function errorFunction); void createPlaceInPlayerInventoryAsync(shared_ptr player, std::string placeName, int templatePlaceId, std::string desc, boost::function resumeFunction, boost::function errorFunction); void savePlaceAsync(boost::function resumeFunction, boost::function errorFunction); void getGamePlacesAsync(boost::function) > resumeFunction, boost::function errorFunction); private: std::string placeAccessUrl; std::string assetRevertUrl; std::string assetVersionsUrl; void httpPostHelper(std::string* response, std::exception* httpException, boost::function resumeFunction, boost::function errorFunction); void processServiceResults(std::string *result, const std::exception* httpException, boost::function)> resumeFunction, boost::function errorFunction); void getCreatorAssetIDSuccessHelper(std::string response, boost::function resumeFunction, boost::function errorFunction); void getCreatorAssetIDErrorHelper(std::string error, boost::function errorFunction); void createPlaceAsyncInternal(bool check, std::string placeName, int templatePlaceId, std::string desc, shared_ptr player, boost::function resumeFunction, boost::function errorFunction); bool checkCreatePlaceAccess(const std::string& placeName, int templatePlaceId, std::string& message); }; }