コード例 #1
0
 /// <summary>
 /// Runs an action for the specified device
 /// </summary>
 /// <param name="accessToken">The OAuth2 access token</param>
 /// <param name="actionToRun">The Action Data</param>
 /// <returns></returns>
 public static async Task <bool> RunActionsAsync(string accessToken, Containers.ActionToRun actionToRun)
 {
     using (var restApi = new SmartMeApiClient(accessToken))
     {
         return(await restApi.PostAsync <Containers.ActionToRun>("Actions", actionToRun));
     }
 }
コード例 #2
0
 /// <summary>
 /// Runs an action for the specified device
 /// </summary>
 /// <param name="accessToken">The OAuth2 access token</param>
 /// <param name="actionToRun">The Action Data</param>
 /// <param name="resultHandler">The result handler</param>
 /// <returns></returns>
 public static async Task <IActionResult> RunActionsAsync(
     string accessToken,
     Containers.ActionToRun actionToRun,
     ResultHandler <ActionToRun> resultHandler)
 {
     using (var restApi = new SmartMeApiClient(accessToken))
     {
         return(await restApi.PostAsync <Containers.ActionToRun>("Actions", actionToRun, resultHandler));
     }
 }
コード例 #3
0
 /// <summary>
 /// Runs an action for the specified device
 /// </summary>
 /// <param name="usernamePassword">The Username and Password for Basic Authentication</param>
 /// <param name="actionToRun">The Action Data</param>
 /// <returns></returns>
 public static async Task <bool> RunActionsAsync(UserPassword usernamePassword, Containers.ActionToRun actionToRun)
 {
     using (var restApi = new SmartMeApiClient(usernamePassword))
     {
         return(await restApi.PostAsync <Containers.ActionToRun>("Actions", actionToRun));
     }
 }