Created
June 13, 2018 23:38
-
-
Save SeloSlav/0b8e4be6a8d11f6f235f2820220933e7 to your computer and use it in GitHub Desktop.
ParseObject
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#region Assembly Parse, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null | |
// C:\Users\marti\.nuget\packages\parse\2.0.0\lib\netstandard2.0\Parse.dll | |
#endregion | |
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Reflection; | |
using System.Runtime.CompilerServices; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace Parse | |
{ | |
// | |
// Summary: | |
// The ParseObject is a local representation of data that can be saved and retrieved | |
// from the Parse cloud. | |
// | |
// Remarks: | |
// The basic workflow for creating new data is to construct a new ParseObject, use | |
// the indexer to fill it with data, and then use SaveAsync() to persist to the | |
// database. | |
// The basic workflow for accessing existing data is to use a ParseQuery to specify | |
// which existing data to retrieve. | |
[DefaultMember("Item")] | |
public class ParseObject : IEnumerable<KeyValuePair<string, object>>, IEnumerable, INotifyPropertyChanged | |
{ | |
// | |
// Summary: | |
// Constructs a new ParseObject with no data in it. A ParseObject constructed in | |
// this way will not have an ObjectId and will not persist to the database until | |
// Parse.ParseObject.SaveAsync is called. | |
// | |
// Parameters: | |
// className: | |
// The className for this ParseObject. | |
// | |
// Remarks: | |
// Class names must be alphanumerical plus underscore, and start with a letter. | |
// It is recommended to name classes in CamelCaseLikeThis. | |
public ParseObject(string className); | |
// | |
// Summary: | |
// Constructor for use in ParseObject subclasses. Subclasses must specify a ParseClassName | |
// attribute. | |
protected ParseObject(); | |
// | |
// Summary: | |
// Gets or sets a value on the object. It is recommended to name keys in partialCamelCaseLikeThis. | |
// | |
// Parameters: | |
// key: | |
// The key for the object. Keys must be alphanumeric plus underscore and start with | |
// a letter. | |
// | |
// Returns: | |
// The value for the key. | |
// | |
// Exceptions: | |
// T:System.Collections.Generic.KeyNotFoundException: | |
// The property is retrieved and key is not found. | |
public virtual object this[string key] { get; set; } | |
// | |
// Summary: | |
// Gets or sets the object id. An object id is assigned as soon as an object is | |
// saved to the server. The combination of a Parse.ParseObject.ClassName and an | |
// Parse.ParseObject.ObjectId uniquely identifies an object in your application. | |
[ParseFieldName("objectId")] | |
public string ObjectId { get; set; } | |
// | |
// Summary: | |
// Indicates whether this ParseObject has unsaved changes. | |
public bool IsDirty { get; } | |
// | |
// Summary: | |
// Gets the first time this object was saved as the server sees it, so that if you | |
// create a ParseObject, then wait a while, and then call Parse.ParseObject.SaveAsync, | |
// the creation time will be the time of the first Parse.ParseObject.SaveAsync call | |
// rather than the time the object was created locally. | |
[ParseFieldName("createdAt")] | |
public DateTime? CreatedAt { get; } | |
// | |
// Summary: | |
// Gets the last time this object was updated as the server sees it, so that if | |
// you make changes to a ParseObject, then wait a while, and then call Parse.ParseObject.SaveAsync, | |
// the updated time will be the time of the Parse.ParseObject.SaveAsync call rather | |
// than the time the object was changed locally. | |
[ParseFieldName("updatedAt")] | |
public DateTime? UpdatedAt { get; } | |
// | |
// Summary: | |
// Returns true if this object was created by the Parse server when the object might | |
// have already been there (e.g. in the case of a Facebook login) | |
public bool IsNew { get; } | |
// | |
// Summary: | |
// Gets or sets the ParseACL governing this object. | |
[ParseFieldName("ACL")] | |
public ParseACL ACL { get; set; } | |
// | |
// Summary: | |
// Gets a set view of the keys contained in this object. This does not include createdAt, | |
// updatedAt, or objectId. It does include things like username and ACL. | |
public ICollection<string> Keys { get; } | |
// | |
// Summary: | |
// Gets whether the ParseObject has been fetched. | |
public bool IsDataAvailable { get; } | |
// | |
// Summary: | |
// Gets the class name for the ParseObject. | |
public string ClassName { get; } | |
// | |
// Summary: | |
// Occurs when a property value changes. | |
public event PropertyChangedEventHandler PropertyChanged; | |
// | |
// Summary: | |
// Creates a new ParseObject based upon a class name. If the class name is a special | |
// type (e.g. for Parse.ParseUser), then the appropriate type of ParseObject is | |
// returned. | |
// | |
// Parameters: | |
// className: | |
// The class of object to create. | |
// | |
// Returns: | |
// A new ParseObject for the given class name. | |
public static ParseObject Create(string className); | |
// | |
// Summary: | |
// Creates a new ParseObject based upon a given subclass type. | |
// | |
// Returns: | |
// A new ParseObject for the given class name. | |
public static T Create<T>() where T : ParseObject; | |
// | |
// Summary: | |
// Creates a reference to an existing ParseObject for use in creating associations | |
// between ParseObjects. Calling Parse.ParseObject.IsDataAvailable on this object | |
// will return false until Parse.ParseExtensions.FetchIfNeededAsync``1(``0) has | |
// been called. No network request will be made. | |
// | |
// Parameters: | |
// className: | |
// The object's class. | |
// | |
// objectId: | |
// The object id for the referenced object. | |
// | |
// Returns: | |
// A ParseObject without data. | |
public static ParseObject CreateWithoutData(string className, string objectId); | |
// | |
// Summary: | |
// Creates a reference to an existing ParseObject for use in creating associations | |
// between ParseObjects. Calling Parse.ParseObject.IsDataAvailable on this object | |
// will return false until Parse.ParseExtensions.FetchIfNeededAsync``1(``0) has | |
// been called. No network request will be made. | |
// | |
// Parameters: | |
// objectId: | |
// The object id for the referenced object. | |
// | |
// Returns: | |
// A ParseObject without data. | |
public static T CreateWithoutData<T>(string objectId) where T : ParseObject; | |
// | |
// Summary: | |
// Deletes each object in the provided list. | |
// | |
// Parameters: | |
// objects: | |
// The objects to delete. | |
// | |
// cancellationToken: | |
// The cancellation token. | |
public static Task DeleteAllAsync<T>(IEnumerable<T> objects, CancellationToken cancellationToken) where T : ParseObject; | |
// | |
// Summary: | |
// Deletes each object in the provided list. | |
// | |
// Parameters: | |
// objects: | |
// The objects to delete. | |
public static Task DeleteAllAsync<T>(IEnumerable<T> objects) where T : ParseObject; | |
// | |
// Summary: | |
// Fetches all of the objects in the provided list. | |
// | |
// Parameters: | |
// objects: | |
// The objects to fetch. | |
// | |
// Returns: | |
// The list passed in for convenience. | |
public static Task<IEnumerable<T>> FetchAllAsync<T>(IEnumerable<T> objects) where T : ParseObject; | |
// | |
// Summary: | |
// Fetches all of the objects in the provided list. | |
// | |
// Parameters: | |
// objects: | |
// The objects to fetch. | |
// | |
// cancellationToken: | |
// The cancellation token. | |
// | |
// Returns: | |
// The list passed in for convenience. | |
public static Task<IEnumerable<T>> FetchAllAsync<T>(IEnumerable<T> objects, CancellationToken cancellationToken) where T : ParseObject; | |
// | |
// Summary: | |
// Fetches all of the objects that don't have data in the provided list. | |
// | |
// Returns: | |
// The list passed in for convenience. | |
public static Task<IEnumerable<T>> FetchAllIfNeededAsync<T>(IEnumerable<T> objects) where T : ParseObject; | |
// | |
// Summary: | |
// Fetches all of the objects that don't have data in the provided list. | |
// | |
// Parameters: | |
// objects: | |
// The objects to fetch. | |
// | |
// cancellationToken: | |
// The cancellation token. | |
// | |
// Returns: | |
// The list passed in for convenience. | |
public static Task<IEnumerable<T>> FetchAllIfNeededAsync<T>(IEnumerable<T> objects, CancellationToken cancellationToken) where T : ParseObject; | |
// | |
// Summary: | |
// Gets a Parse.ParseQuery`1 for the type of object specified by className | |
// | |
// Parameters: | |
// className: | |
// The class name of the object. | |
// | |
// Returns: | |
// A new Parse.ParseQuery`1. | |
public static ParseQuery<ParseObject> GetQuery(string className); | |
// | |
// Summary: | |
// Registers a custom subclass type with the Parse SDK, enabling strong-typing of | |
// those ParseObjects whenever they appear. Subclasses must specify the ParseClassName | |
// attribute, have a default constructor, and properties backed by ParseObject fields | |
// should have ParseFieldName attributes supplied. | |
// | |
// Type parameters: | |
// T: | |
// The ParseObject subclass type to register. | |
public static void RegisterSubclass<T>() where T : ParseObject, new(); | |
// | |
// Summary: | |
// Saves each object in the provided list. | |
// | |
// Parameters: | |
// objects: | |
// The objects to save. | |
// | |
// cancellationToken: | |
// The cancellation token. | |
public static Task SaveAllAsync<T>(IEnumerable<T> objects, CancellationToken cancellationToken) where T : ParseObject; | |
// | |
// Summary: | |
// Saves each object in the provided list. | |
// | |
// Parameters: | |
// objects: | |
// The objects to save. | |
public static Task SaveAllAsync<T>(IEnumerable<T> objects) where T : ParseObject; | |
// | |
// Summary: | |
// Adds a value for the given key, throwing an Exception if the key already has | |
// a value. | |
// | |
// Parameters: | |
// key: | |
// The key for which a value should be set. | |
// | |
// value: | |
// The value for the key. | |
// | |
// Remarks: | |
// This allows you to use collection initialization syntax when creating ParseObjects, | |
// such as: var obj = new ParseObject("MyType") { {"name", "foo"}, {"count", 10}, | |
// {"found", false} }; | |
public void Add(string key, object value); | |
// | |
// Summary: | |
// Atomically adds objects to the end of the list associated with the given key. | |
// | |
// Parameters: | |
// key: | |
// The key. | |
// | |
// values: | |
// The objects to add. | |
public void AddRangeToList<T>(string key, IEnumerable<T> values); | |
// | |
// Summary: | |
// Atomically adds objects to the end of the list associated with the given key, | |
// only if they are not already present in the list. The position of the inserts | |
// are not guaranteed. | |
// | |
// Parameters: | |
// key: | |
// The key. | |
// | |
// values: | |
// The objects to add. | |
public void AddRangeUniqueToList<T>(string key, IEnumerable<T> values); | |
// | |
// Summary: | |
// Atomically adds an object to the end of the list associated with the given key. | |
// | |
// Parameters: | |
// key: | |
// The key. | |
// | |
// value: | |
// The object to add. | |
public void AddToList(string key, object value); | |
// | |
// Summary: | |
// Atomically adds an object to the end of the list associated with the given key, | |
// only if it is not already present in the list. The position of the insert is | |
// not guaranteed. | |
// | |
// Parameters: | |
// key: | |
// The key. | |
// | |
// value: | |
// The object to add. | |
public void AddUniqueToList(string key, object value); | |
// | |
// Summary: | |
// Returns whether this object has a particular key. | |
// | |
// Parameters: | |
// key: | |
// The key to check for | |
public bool ContainsKey(string key); | |
// | |
// Summary: | |
// Deletes this object on the server. | |
// | |
// Parameters: | |
// cancellationToken: | |
// The cancellation token. | |
public Task DeleteAsync(CancellationToken cancellationToken); | |
// | |
// Summary: | |
// Deletes this object on the server. | |
public Task DeleteAsync(); | |
// | |
// Summary: | |
// Gets a value for the key of a particular type. The type to convert the value | |
// to. Supported types are ParseObject and its descendents, Parse types such as | |
// ParseRelation and ParseGeopoint, primitive types,IList<T>, IDictionary<string, | |
// T>, and strings. The key of the element to get. The property is retrieved and | |
// key is not found. | |
public T Get<T>(string key); | |
// | |
// Summary: | |
// Access or create a Relation value for a key. | |
// | |
// Parameters: | |
// key: | |
// The key for the relation field. | |
// | |
// Type parameters: | |
// T: | |
// The type of object to create a relation for. | |
// | |
// Returns: | |
// A ParseRelation for the key. | |
public ParseRelation<T> GetRelation<T>(string key) where T : ParseObject; | |
// | |
// Summary: | |
// A helper function for checking whether two ParseObjects point to the same object | |
// in the cloud. | |
public bool HasSameId(ParseObject other); | |
// | |
// Summary: | |
// Atomically increments the given key by the given number. | |
// | |
// Parameters: | |
// key: | |
// The key to increment. | |
// | |
// amount: | |
// The amount to increment by. | |
public void Increment(string key, long amount); | |
// | |
// Summary: | |
// Atomically increments the given key by 1. | |
// | |
// Parameters: | |
// key: | |
// The key to increment. | |
public void Increment(string key); | |
// | |
// Summary: | |
// Atomically increments the given key by the given number. | |
// | |
// Parameters: | |
// key: | |
// The key to increment. | |
// | |
// amount: | |
// The amount to increment by. | |
public void Increment(string key, double amount); | |
// | |
// Summary: | |
// Indicates whether key is unsaved for this ParseObject. | |
// | |
// Parameters: | |
// key: | |
// The key to check for. | |
// | |
// Returns: | |
// true if the key has been altered and not saved yet, otherwise false. | |
public bool IsKeyDirty(string key); | |
// | |
// Summary: | |
// Removes a key from the object's data if it exists. | |
// | |
// Parameters: | |
// key: | |
// The key to remove. | |
public virtual void Remove(string key); | |
// | |
// Summary: | |
// Atomically removes all instances of the objects in values from the list associated | |
// with the given key. | |
// | |
// Parameters: | |
// key: | |
// The key. | |
// | |
// values: | |
// The objects to remove. | |
public void RemoveAllFromList<T>(string key, IEnumerable<T> values); | |
// | |
// Summary: | |
// Clears any changes to this object made since the last call to Parse.ParseObject.SaveAsync. | |
public void Revert(); | |
// | |
// Summary: | |
// Saves this object to the server. | |
public Task SaveAsync(); | |
// | |
// Summary: | |
// Saves this object to the server. | |
// | |
// Parameters: | |
// cancellationToken: | |
// The cancellation token. | |
public Task SaveAsync(CancellationToken cancellationToken); | |
// | |
// Summary: | |
// Populates result with the value for the key, if possible. | |
// | |
// Parameters: | |
// key: | |
// The key to retrieve a value for. | |
// | |
// result: | |
// The value for the given key, converted to the requested type, or null if unsuccessful. | |
// | |
// Type parameters: | |
// T: | |
// The desired type for the value. | |
// | |
// Returns: | |
// true if the lookup and conversion succeeded, otherwise false. | |
public bool TryGetValue<T>(string key, out T result); | |
// | |
// Summary: | |
// Gets the value of a property based upon its associated ParseFieldName attribute. | |
// | |
// Parameters: | |
// defaultValue: | |
// The value to return if the property is not present on the ParseObject. | |
// | |
// propertyName: | |
// The name of the property. | |
// | |
// Type parameters: | |
// T: | |
// The return type of the property. | |
// | |
// Returns: | |
// The value of the property. | |
protected T GetProperty<T>(T defaultValue, [CallerMemberName] string propertyName = null); | |
// | |
// Summary: | |
// Gets the value of a property based upon its associated ParseFieldName attribute. | |
// | |
// Parameters: | |
// propertyName: | |
// The name of the property. | |
// | |
// Type parameters: | |
// T: | |
// The return type of the property. | |
// | |
// Returns: | |
// The value of the property. | |
protected T GetProperty<T>([CallerMemberName] string propertyName = null); | |
// | |
// Summary: | |
// Gets a relation for a property based upon its associated ParseFieldName attribute. | |
// | |
// Parameters: | |
// propertyName: | |
// The name of the property. | |
// | |
// Type parameters: | |
// T: | |
// The ParseObject subclass type of the ParseRelation. | |
// | |
// Returns: | |
// The ParseRelation for the property. | |
protected ParseRelation<T> GetRelationProperty<T>([CallerMemberName] string propertyName = null) where T : ParseObject; | |
protected virtual bool IsKeyMutable(string key); | |
// | |
// Summary: | |
// Raises change notifications for all properties associated with the given field | |
// names. If fieldNames is null, this will notify for all known field-linked properties | |
// (e.g. this happens when we recalculate all estimated data from scratch) | |
protected void OnFieldsChanged(IEnumerable<string> fieldNames); | |
// | |
// Summary: | |
// Raises change notifications for a property. Passing null or the empty string | |
// notifies the binding framework that all properties/indexes have changed. Passing | |
// "Item[]" tells the binding framework that all indexed values have changed (but | |
// not all properties) | |
protected void OnPropertyChanged([CallerMemberName] string propertyName = null); | |
protected virtual Task SaveAsync(Task toAwait, CancellationToken cancellationToken); | |
// | |
// Summary: | |
// Sets the value of a property based upon its associated ParseFieldName attribute. | |
// | |
// Parameters: | |
// value: | |
// The new value. | |
// | |
// propertyName: | |
// The name of the property. | |
// | |
// Type parameters: | |
// T: | |
// The type for the property. | |
protected void SetProperty<T>(T value, [CallerMemberName] string propertyName = null); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment