// // /*=============================================================================== // // Copyright (C) 2024 PhantomsXR Ltd. All Rights Reserved. // // // // This file is part of the Phantom.XRMOD.CloudSave.Runtime. // // // // The Nin1 cannot be copied, distributed, or made available to // // third-parties for commercial purposes without written permission of PhantomsXR Ltd. // // // // Contact nswell@phantomsxr.com for licensing requests. // // ===============================================================================*/ using System.Collections.Generic; using System.Threading.Tasks; using Unity.Services.CloudSave.Models; namespace Phantom.XRMOD.GameServices.Runtime { public interface ICloudSaveGameData { /// /// Upload one or more key-value pairs to the Cloud Save service without write lock validation, overwriting any values /// that are currently stored under the given keys. /// Key can only contain alphanumeric characters, dashes, and underscores and be up to a length of 255 characters. /// Throws a CloudSaveException with a reason code and explanation of what happened. /// /// Dictionary as a parameter ensures the uniqueness of given keys. /// There is no client validation in place, which means the API can be called regardless if data is incorrect, invalid, and/or missing. /// /// The dictionary of keys and corresponding values to upload /// The dictionary of saved keys and the corresponding updated write lock /// Thrown if request is unsuccessful. /// Thrown if the service returned validation error. /// Thrown if the service returned rate limited error. Task SavePlayerData(Dictionary _saveData); /// /// Downloads data from Cloud Save for the keys provided. /// There is no client validation in place for the provided keys. /// Throws a CloudSaveException with a reason code and explanation of what happened. /// /// The optional set of keys to load data for /// The dictionary of all key-value pairs that represents the current state of data on the server including their write locks /// Thrown if request is unsuccessful. /// Thrown if the service returned validation error. /// Thrown if the service returned rate limited error. Task> LoadPlayerData(HashSet _keys); } public interface ICloudSaveGameDataQuery { /// /// Queries indexed player data from Cloud Save, and returns the requested keys for matching items. /// Throws a CloudSaveException with a reason code and explanation of what happened. /// /// The query conditions to apply, including field filters and sort orders /// Options to modify the behavior of the method, specifying AccessClass /// The dictionary of all key-value pairs that represents the current state of data on the server including their write locks /// Thrown if request is unsuccessful. /// Thrown if the service returned validation error. /// Thrown if the service returned rate limited error. Task> QueryPlayerData(Query _options); } public interface IDeleteData { /// /// Removes one key at a time, with optional write lock validation. If the given key doesn't exist, there is no feedback in place to inform a developer about it. /// If a write lock is provided and it does not match with the existing write lock, will throw a conflict exception. /// There is no client validation on the arguments for this method. /// Throws a CloudSaveException with a reason code and explanation of what happened. /// /// /// The key to be removed from the server /// The optional options object for specifying the write lock to check conflict in the server /// Thrown if request is unsuccessful. /// Thrown if the service returned validation error. /// Thrown if the service returned rate limited error. /// Thrown if the service returned write lock conflict error. void DeletePlayerData(string _key); } }