-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApiClient.cs
61 lines (51 loc) · 1.9 KB
/
ApiClient.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
59
60
61
using System.Net;
using System.Threading.Tasks;
using UniversityApiClient.Requests;
using UniversityApiClient.Responses;
namespace UniversityApiClient
{
public class ApiClient
{
public string Token { get; private set;}
public string EndPoint { get; private set;}
public ApiClient(string token, string endPoint)
{
this.Token = token;
this.EndPoint = endPoint;
}
#region GET
public async Task<FacultiesResponse> GetFaculties()
{
var request = new GetFacultiesRequest();
var result = await request.Execute(EndPoint);
return result;
}
public async Task<SpecialitiesResponse> GetSpecialities(string faculty)
{
var request = new GetSpecialitiesRequest(faculty);
var result = await request.Execute(EndPoint);
return result;
}
public async Task<GroupsResponse> GetGroups(string faculty, int speciality)
{
var request = new GetGroupsRequest(faculty, speciality);
var result = await request.Execute(EndPoint);
return result;
}
public async Task<SubgroupsResponse> GetSubgroups(string faculty, int speciality, string groupName,
int groupCode)
{
var request = new GetSubgroupsRequest(faculty, speciality, groupName, groupCode);
var result = await request.Execute(EndPoint);
return result;
}
public async Task<SchedulerResponse> GetScheduler(string faculty, int speciality, string groupName,
int groupCode, int subgroup)
{
var request = new GetSchedulerRequest(faculty, speciality, groupName, groupCode, subgroup);
var result = await request.Execute(EndPoint);
return result;
}
#endregion
}
}