-
Notifications
You must be signed in to change notification settings - Fork 0
/
ApiProgress.cs
58 lines (50 loc) · 1.45 KB
/
ApiProgress.cs
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
namespace XPlaneDotNetCoreWebAPI
{
public class ApiProgress
{
public bool ShowUser { get; set; } = true;
public bool HasError { get; set; }
public string Message { get; set; }
public object ReturnObject { get; set; }
public static ApiProgress Error(string message, bool ShowUser)
{
return new ApiProgress
{
ShowUser = ShowUser,
HasError = true,
Message = message
};
}
public static ApiProgress Error(CovisartException ex)
{
return Error(ex.Message, ex.responseObject?.ShowUser ?? true);
}
public static ApiProgress Error(Exception ex, bool ShowUser)
{
return Error(ex.Message, ShowUser);
}
public static ApiProgress Success(object returnObject, string message = null)
{
return new ApiProgress
{
ReturnObject = returnObject,
Message = message
};
}
public static ApiProgress TokenError()
{
return new ApiProgress
{
HasError = true,
Message = "AccessToken bulanamadı. Tekrar giriş yapınız."
};
}
public static ApiProgress Success()
{
return new ApiProgress
{
Message = "Success",
};
}
}
}