diff --git a/sources/CallrApi/CallrApi/Services/Client/DIDStoreService.cs b/sources/CallrApi/CallrApi/Services/Client/DIDStoreService.cs new file mode 100644 index 0000000..0b449d7 --- /dev/null +++ b/sources/CallrApi/CallrApi/Services/Client/DIDStoreService.cs @@ -0,0 +1,113 @@ +using System.Collections.Generic; + +namespace CallrApi.Services.Client +{ + class DIDStoreService : AppsBaseService + { + + #region Constructors + /// + /// Constructor. + /// + /// API url. + /// Login. + /// Password. + public DIDStoreService(string url, string login, string password) : base(url, login, password) + { + } + + /// + /// Constructor with default API url. + /// + /// Login. + /// Password. + public DIDStoreService(string login, string password) + : this(null, login, password) + { + } + #endregion + + #region Public methods + /// + /// This method reserve DID + /// + /// + /// + /// + /// + /// + public string ReserveDid(int AreaCodeID,string DidClassType, int Quantity, string Sequence) + { + List parameters = new List() { AreaCodeID, DidClassType, Quantity, Sequence }; + dynamic response = this.client.MakeRequest("did/store.reserve", parameters); + return response.result["token"].ToString(); + } + + /// + /// This method allow to buy DID + /// + /// + public void Buy(string token) + { + List parameters = new List() { token }; + dynamic response = this.client.MakeRequest("did/store.buy_order", parameters); + } + + /// + /// This method allow to cancel an order + /// + /// + public void Cancel(string token) + { + List parameters = new List() { token }; + dynamic response = this.client.MakeRequest("did/store.cancel_order", parameters); + } + + /// + /// This method allow to cancel a DID subscription + /// + /// + public void CancelSubscription(string hash){ + List parameters = new List() { hash }; + dynamic response = this.client.MakeRequest("did/store.cancel_subscription", parameters); + } + + /// + /// This method allow to get quota status + /// + /// + /// + public List GetQuotaStatus(){ + List parameters = new List() {}; + dynamic response = this.client.MakeRequest("did/store.get_quota_status", parameters); + return reponse.result; + } + + /// + /// This method allow to get a quote without reserving DIDs + /// + /// + /// + /// + /// + public List GetQuote(int AreaCodeID,string DidClassType, int Quantity){ + List parameters = new List() {AreaCodeID, DidClassType, Quantity}; + dynamic response = this.client.MakeRequest("did/store.get_quote", parameters); + return reponse.result; + } + + + /// + /// This method allow to view your order + /// + /// + /// + public List ViewOrder(string token){ + List parameters = new List() { token }; + dynamic response = this.client.MakeRequest("did/store.view_order", parameters); + return reponse.result; + } + + #endregion + } +}