C# Class Particle.ParticleCloud

Represents the connection to the particle cloud.
Inheritance: ParticleBase, IDisposable
显示文件 Open project: ParticleNET/ParticleSDK Class Usage Examples

Public Methods

Method Description
ClaimDeviceAsync ( String deviceId ) : Task

Claims the specified device for the logged in user

Dispose ( ) : void

Releases unmanaged and - optionally - managed resources mainly the underlining HttpClient

GetDevicesAsync ( ) : Task>>

Get the list of devices the user has access to

LoginWithUserAsync ( String username, String password, int expiresIn = 3600 ) : Task

Logs into ParticleCloud with the given username and password

Logout ( ) : void

Logs the user out locally

MakeDeleteRequestAsync ( String method ) : Task

Makes the delete request asynchronous to the particle cloud

MakeDeleteRequestWithAuthTestAsync ( String method ) : Task

Calls MakeDeleteRequestAsync(string) and if it returns a status code of Unauthorized try s to refresh the token and makes the request again

MakeGetRequestAsync ( String method ) : Task

Makes the get request asynchronous to the cloud api

MakeGetRequestWithAuthTestAsync ( String method ) : Task

Calls MakeGetRequestAsync(string) and if it returns a status code of Unauthorized try s to refresh the token and makes the request again

MakePostRequestAsync ( String method ) : Task

Makes the post request asynchronous to the particle cloud

MakePostRequestWithAuthTestAsync ( String method ) : Task

Calls MakePostRequestAsync(string, KeyValuePair{string, string}[]) and if it returns a status code of Unauthorized try s to refresh the token and makes the request again

MakePostRequestWithoutAuthAsync ( String method ) : Task

Makes the post request without authentication asynchronous to the particle cloud.

MakePutRequestAsync ( String method ) : Task

Makes the put request asynchronous to the particle cloud

MakePutRequestWithAuthTestAsync ( String method ) : Task

Calls MakePutRequestAsync(string, KeyValuePair{string, string}[]) and if it returns a status code of Unauthorized try s to refresh the token and makes the request again

ParticleCloud ( ) : Newtonsoft.Json

Initializes a new instance of the ParticleCloud class using the default url https://api.particle.io/v1/

ParticleCloud ( Uri baseUri ) : Newtonsoft.Json

Initializes a new instance of the ParticleCloud class.

RefreshTokenAsync ( ) : Task

Refreshes the access token asynchronous.

RequestPasswordResetAsync ( String email ) : Task

Requests the password be reset.

SignupWithUserAsync ( String username, String password ) : Task

Sign up with new account credentials to Particle cloud

Method Details

ClaimDeviceAsync() public method

Claims the specified device for the logged in user
public ClaimDeviceAsync ( String deviceId ) : Task
deviceId String The id of the new device
return Task

Dispose() public method

Releases unmanaged and - optionally - managed resources mainly the underlining HttpClient
public Dispose ( ) : void
return void

GetDevicesAsync() public method

Get the list of devices the user has access to
public GetDevicesAsync ( ) : Task>>
return Task>>

LoginWithUserAsync() public method

Logs into ParticleCloud with the given username and password
public LoginWithUserAsync ( String username, String password, int expiresIn = 3600 ) : Task
username String The Particle account username
password String The Particle account password
expiresIn int How many seconds the token will be valid for. 0 means forever. Short lived tokens are better for security.
return Task

Logout() public method

Logs the user out locally
public Logout ( ) : void
return void

MakeDeleteRequestAsync() public method

Makes the delete request asynchronous to the particle cloud
public MakeDeleteRequestAsync ( String method ) : Task
method String The method.
return Task

MakeDeleteRequestWithAuthTestAsync() public method

Calls MakeDeleteRequestAsync(string) and if it returns a status code of Unauthorized try s to refresh the token and makes the request again
public MakeDeleteRequestWithAuthTestAsync ( String method ) : Task
method String The method to call
return Task

MakeGetRequestAsync() public method

Makes the get request asynchronous to the cloud api
public MakeGetRequestAsync ( String method ) : Task
method String The method to call i.e. devices
return Task

MakeGetRequestWithAuthTestAsync() public method

Calls MakeGetRequestAsync(string) and if it returns a status code of Unauthorized try s to refresh the token and makes the request again
public MakeGetRequestWithAuthTestAsync ( String method ) : Task
method String The method to call
return Task

MakePostRequestAsync() public method

Makes the post request asynchronous to the particle cloud
public MakePostRequestAsync ( String method ) : Task
method String The method to call
return Task

MakePostRequestWithAuthTestAsync() public method

Calls MakePostRequestAsync(string, KeyValuePair{string, string}[]) and if it returns a status code of Unauthorized try s to refresh the token and makes the request again
public MakePostRequestWithAuthTestAsync ( String method ) : Task
method String The method to call
return Task

MakePostRequestWithoutAuthAsync() public method

Makes the post request without authentication asynchronous to the particle cloud.
public MakePostRequestWithoutAuthAsync ( String method ) : Task
method String The method.
return Task

MakePutRequestAsync() public method

Makes the put request asynchronous to the particle cloud
public MakePutRequestAsync ( String method ) : Task
method String The method to call
return Task

MakePutRequestWithAuthTestAsync() public method

Calls MakePutRequestAsync(string, KeyValuePair{string, string}[]) and if it returns a status code of Unauthorized try s to refresh the token and makes the request again
public MakePutRequestWithAuthTestAsync ( String method ) : Task
method String The method to call
return Task

ParticleCloud() public method

Initializes a new instance of the ParticleCloud class using the default url https://api.particle.io/v1/
public ParticleCloud ( ) : Newtonsoft.Json
return Newtonsoft.Json

ParticleCloud() public method

Initializes a new instance of the ParticleCloud class.
public ParticleCloud ( Uri baseUri ) : Newtonsoft.Json
baseUri System.Uri The url to the particle sdk i.e. https://api.particle.io/v1/
return Newtonsoft.Json

RefreshTokenAsync() public method

Refreshes the access token asynchronous.
public RefreshTokenAsync ( ) : Task
return Task

RequestPasswordResetAsync() public method

Requests the password be reset.
public RequestPasswordResetAsync ( String email ) : Task
email String The email.
return Task

SignupWithUserAsync() public method

Sign up with new account credentials to Particle cloud
public SignupWithUserAsync ( String username, String password ) : Task
username String Required user name, must be a valid email address
password String Required password
return Task