From 5506eec9367789bedc5dbedf305772e6ae7d2be0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20VIARD?= Date: Tue, 11 Jul 2017 11:30:26 +0200 Subject: [PATCH 1/2] Ajout des methodes permettant la reservation de DID ainsi que leur achat --- .../Services/Client/DIDStoreService.cs | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 sources/CallrApi/CallrApi/Services/Client/DIDStoreService.cs diff --git a/sources/CallrApi/CallrApi/Services/Client/DIDStoreService.cs b/sources/CallrApi/CallrApi/Services/Client/DIDStoreService.cs new file mode 100644 index 0000000..dfe22be --- /dev/null +++ b/sources/CallrApi/CallrApi/Services/Client/DIDStoreService.cs @@ -0,0 +1,54 @@ +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 prefixToOrder) + { + List parameters = new List() { prefixToOrder, "CLASSIC", 1, "RANDOM" }; + 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); + } + #endregion + } +} From 5fed52e8339731e53553347f7b2e31a04e033c30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20VIARD?= Date: Thu, 13 Jul 2017 11:08:53 +0200 Subject: [PATCH 2/2] =?UTF-8?q?Ajout=20des=20methodes=20demand=C3=A9es=20:?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit did/store.cancel_order did/store.cancel_subscription did/store.get_quota_status did/store.get_quote did/store.view_order --- .../Services/Client/DIDStoreService.cs | 65 ++++++++++++++++++- 1 file changed, 62 insertions(+), 3 deletions(-) diff --git a/sources/CallrApi/CallrApi/Services/Client/DIDStoreService.cs b/sources/CallrApi/CallrApi/Services/Client/DIDStoreService.cs index dfe22be..0b449d7 100644 --- a/sources/CallrApi/CallrApi/Services/Client/DIDStoreService.cs +++ b/sources/CallrApi/CallrApi/Services/Client/DIDStoreService.cs @@ -31,11 +31,14 @@ public DIDStoreService(string login, string password) /// /// This method reserve DID /// - /// + /// + /// + /// + /// /// - public string ReserveDid(int prefixToOrder) + public string ReserveDid(int AreaCodeID,string DidClassType, int Quantity, string Sequence) { - List parameters = new List() { prefixToOrder, "CLASSIC", 1, "RANDOM" }; + List parameters = new List() { AreaCodeID, DidClassType, Quantity, Sequence }; dynamic response = this.client.MakeRequest("did/store.reserve", parameters); return response.result["token"].ToString(); } @@ -49,6 +52,62 @@ 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 } }