getpartners
This commit is contained in:
@@ -10,6 +10,11 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace CebelcaAPI
|
||||
{
|
||||
public class CebelcaPartner
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
public class CebelcaAPISharp
|
||||
{
|
||||
private string _key = "";
|
||||
@@ -55,6 +60,25 @@ namespace CebelcaAPI
|
||||
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<CebelcaPartner>> GetPartners()
|
||||
{
|
||||
var values = new Dictionary<string, string>();
|
||||
var ret = await APICall("partner", "select-all", values);
|
||||
|
||||
var json = JArray.Parse(ret);
|
||||
var retname = (json[0][0] as JObject).Properties().First().Name;
|
||||
if (retname != "id")
|
||||
throw new Exception("Error from api: " + ret);
|
||||
var id = json[0][0]["id"].Value<string>();
|
||||
//var l = new List<CebelcaPartner>();
|
||||
var l = json[0].Select(x => new CebelcaPartner
|
||||
{
|
||||
Id = x["id"].Value<string>(),
|
||||
Name = x["name"].Value<string>()
|
||||
}).ToList();
|
||||
return l;
|
||||
}
|
||||
|
||||
public async Task SendInvoiceByEmail(string invoiceId, string to, string subject, string content)
|
||||
{
|
||||
Thread.CurrentThread.CurrentCulture = new CultureInfo("sl-SI");
|
||||
|
||||
Reference in New Issue
Block a user