-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathSoapLabelClient.cs
More file actions
55 lines (46 loc) · 1.77 KB
/
Copy pathSoapLabelClient.cs
File metadata and controls
55 lines (46 loc) · 1.77 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
45
46
47
48
49
50
51
52
53
54
55
using CallFire_csharp_sdk.Common.Resource;
using CallFire_csharp_sdk.Common.Result;
using CallFire_csharp_sdk.Common.Result.Mappers;
namespace CallFire_csharp_sdk.API.Soap
{
public class SoapLabelClient : BaseSoapClient, ILabelClient
{
internal ILabelServicePortTypeClient LabelService;
public SoapLabelClient(string username, string password)
{
LabelService = new LabelServicePortTypeClient(GetCustomBinding(), GetEndpointAddress<Label>())
{
ClientCredentials = { UserName = { UserName = username, Password = password } }
};
}
internal SoapLabelClient(ILabelServicePortTypeClient client)
{
LabelService = client;
}
public void DeleteLabel(string labelName)
{
LabelService.DeleteLabel(new DeleteLabel(labelName));
}
public CfLabelQueryResult QueryLabels(CfQuery queryLabels)
{
return LabelQueryResultMapper.FromSoapLabelQueryResult(
LabelService.QueryLabels(new Query(queryLabels.MaxResults, queryLabels.FirstResult)));
}
public void LabelBroadcast(long id, string labelName)
{
LabelService.LabelBroadcast(new IdLabelRequest(id, labelName));
}
public void UnlabelBroadcast(long id, string labelName)
{
LabelService.UnlabelBroadcast(new IdLabelRequest(id, labelName));
}
public void LabelNumber(string number, string labelName)
{
LabelService.LabelNumber(new NumberLabelRequest(number, labelName));
}
public void UnlabelNumber(string number, string labelName)
{
LabelService.UnlabelNumber(new NumberLabelRequest(number, labelName));
}
}
}