-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPauseShocker.cs
More file actions
44 lines (33 loc) · 1.1 KB
/
PauseShocker.cs
File metadata and controls
44 lines (33 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using OpenShock.SDK.CSharp;
using System;
using System.Linq;
using System.Threading.Tasks;
namespace SDK.CSharp.Example.Http;
public sealed class PauseShocker : IExample
{
private readonly ExampleConfig _config;
public PauseShocker(ExampleConfig config)
{
_config = config;
}
public async Task Start()
{
var apiClient = new OpenShockApiClient(new ApiClientOptions
{
Token = _config.ApiToken
});
var firstShocker = _config.Shockers.First();
var response = await apiClient.PauseShocker(firstShocker, true);
response.Switch(
success => Console.WriteLine("Shocker paused: " + success.Value),
error => Console.WriteLine("Shocker not found")
);
Console.WriteLine("Press enter to unpause again");
Console.ReadLine();
response = await apiClient.PauseShocker(firstShocker, false);
response.Switch(
success => Console.WriteLine("Shocker paused: " + success.Value),
error => Console.WriteLine("Shocker not found")
);
}
}