/sendowl-dotnet

SendOwl .Net API client

Primary LanguageC#MIT LicenseMIT

Build Status

SendOwl-dotnet

SendOwl API client

Usage

Add an API key at sendowl.com under Advanced > API.

Initialize the client with your key and secret

SendOwlAPIClient sendOwl = new SendOwlAPIClient("mykey", "mysecret");

Product

Get product by id

var product = await sendOwl.Product.GetAsync(123456);

Search for product by name

var products = await sendOwl.Product.SearchAsync("product name");

List all products

var products = await sendOwl.Product.GetAllAsync();

Create product

var product = await sendOwl.Product.CreateAsync(
  new SendOwlProduct
  {
    Name = "my product",
    Price = "19.99",
    Product_type = ProductType.Software
  });

Update product

var product = await sendOwl.Product.GetAsync(123456);
product.Price = "89.95";
product.Name = "new name";
await sendOwl.Product.UpdateAsync(product);

Delete product

await sendOwl.Product.DeleteAsync(256);

Bundle

Get bundle by id

 var bundle = await sendOwl.Bundle.GetAsync(256);

List all bundles

 var bundles = await sendOwl.Bundle.GetAllAsync();

Create bundle

var bundle = await sendOwl.Bundle.CreateAsync(
  new SendOwlBundle
  {
    Name = "my new bundle",
    Price = "99.5",
    Components = new Components
    {
      Product_ids = new List<long>{ 256, 1024, 1337 }
    }
  });

Update Bundle

var bundle = await sendOwl.Bundle.GetAsync(256)
bundle.Price = "22.9";
bundle.Component.Product_Ids.Remove(1024);
await sendOwl.Bundle.UpdateAsync(bundle);

Delete bundle

 await sendOwl.Bundle.DeleteAsync(256);