| Line 11... |
Line 11... |
| 11 |
public class DreamhostAPI |
11 |
public class DreamhostAPI |
| 12 |
{ |
12 |
{ |
| 13 |
#region Private Variables |
13 |
#region Private Variables |
| 14 |
|
14 |
|
| 15 |
private string apikey = string.Empty; |
15 |
private string apikey = string.Empty; |
| - |
|
16 |
private string accountNumber = string.Empty; |
| 16 |
private DomainRequests domain = null; |
17 |
private DomainRequests domain = null; |
| 17 |
private DNSRequests dns = null; |
18 |
private DNSRequests dns = null; |
| 18 |
private UserRequests user = null; |
19 |
private UserRequests user = null; |
| 19 |
private MailRequests mail = null; |
20 |
private MailRequests mail = null; |
| 20 |
private MySQLRequests mysql = null; |
21 |
private MySQLRequests mysql = null; |
| 21 |
private AnnouncementListRequests announcementlist = null; |
22 |
private AnnouncementListRequests announcementlist = null; |
| - |
|
23 |
private AccountRequests account = null; |
| - |
|
24 |
private OneClickRequests oneclick = null; |
| 22 |
|
25 |
|
| 23 |
#endregion |
26 |
#endregion |
| 24 |
|
27 |
|
| 25 |
#region Constructor |
28 |
#region Constructor |
| 26 |
|
29 |
|
| 27 |
public DreamhostAPI(string apikey) |
30 |
public DreamhostAPI(string apikey) |
| 28 |
{ |
31 |
{ |
| 29 |
this.apikey = apikey; |
32 |
this.apikey = apikey; |
| 30 |
} |
33 |
} |
| 31 |
|
34 |
|
| - |
|
35 |
public DreamhostAPI(string apikey, string accountNumber) |
| - |
|
36 |
{ |
| - |
|
37 |
this.apikey = apikey; |
| - |
|
38 |
this.accountNumber = accountNumber; |
| - |
|
39 |
} |
| - |
|
40 |
|
| 32 |
#endregion |
41 |
#endregion |
| 33 |
|
42 |
|
| 34 |
#region Accessors |
43 |
#region Accessors |
| 35 |
|
44 |
|
| 36 |
public DomainRequests Domain |
45 |
public DomainRequests Domain |
| Line 110... |
Line 119... |
| 110 |
|
119 |
|
| 111 |
return this.announcementlist; |
120 |
return this.announcementlist; |
| 112 |
} |
121 |
} |
| 113 |
} |
122 |
} |
| 114 |
|
123 |
|
| - |
|
124 |
public AccountRequests Account |
| - |
|
125 |
{ |
| - |
|
126 |
get |
| - |
|
127 |
{ |
| - |
|
128 |
if (this.account == null) |
| - |
|
129 |
{ |
| - |
|
130 |
this.account = new AccountRequests(this); |
| - |
|
131 |
} |
| - |
|
132 |
|
| - |
|
133 |
return this.account; |
| - |
|
134 |
} |
| - |
|
135 |
} |
| - |
|
136 |
|
| - |
|
137 |
public OneClickRequests OneClick |
| - |
|
138 |
{ |
| - |
|
139 |
get |
| - |
|
140 |
{ |
| - |
|
141 |
if (this.oneclick == null) |
| - |
|
142 |
{ |
| - |
|
143 |
this.oneclick = new OneClickRequests(this); |
| - |
|
144 |
} |
| - |
|
145 |
|
| - |
|
146 |
return this.oneclick; |
| - |
|
147 |
} |
| - |
|
148 |
} |
| - |
|
149 |
|
| 115 |
#endregion |
150 |
#endregion |
| 116 |
|
151 |
|
| 117 |
#region Internal Methods |
152 |
#region Internal Methods |
| 118 |
|
153 |
|
| 119 |
internal XDocument SendCommand(string method) |
154 |
internal XDocument SendCommand(string method) |
| Line 153... |
Line 188... |
| 153 |
postdata += "key=" + Uri.EscapeDataString(this.apikey); |
188 |
postdata += "key=" + Uri.EscapeDataString(this.apikey); |
| 154 |
postdata += "&unique_id=" + Uri.EscapeDataString(Guid.NewGuid().ToString()); |
189 |
postdata += "&unique_id=" + Uri.EscapeDataString(Guid.NewGuid().ToString()); |
| 155 |
postdata += "&format=xml"; |
190 |
postdata += "&format=xml"; |
| 156 |
postdata += "&cmd=" + Uri.EscapeDataString(method); |
191 |
postdata += "&cmd=" + Uri.EscapeDataString(method); |
| 157 |
|
192 |
|
| - |
|
193 |
if (this.accountNumber != string.Empty) |
| - |
|
194 |
{ |
| - |
|
195 |
postdata += "&account=" + Uri.EscapeDataString(this.accountNumber); |
| - |
|
196 |
} |
| - |
|
197 |
|
| 158 |
foreach (QueryData parameter in parameters) |
198 |
foreach (QueryData parameter in parameters) |
| 159 |
{ |
199 |
{ |
| 160 |
postdata += "&" + Uri.EscapeDataString(parameter.Key) + "=" + Uri.EscapeDataString(parameter.Value); |
200 |
postdata += "&" + Uri.EscapeDataString(parameter.Key) + "=" + Uri.EscapeDataString(parameter.Value); |
| 161 |
} |
201 |
} |
| 162 |
|
202 |
|