GithubHelp home page GithubHelp logo

216giorgiy / hastyapi.freshbooks Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lukesampson/hastyapi.freshbooks

0.0 1.0 0.0 153 KB

FreshBooks API library for .NET, built with HastyAPI

License: Other

C# 100.00%

hastyapi.freshbooks's Introduction

Overview

This is a .NET library for interacting with the FreshBooks API.

It's low-level and dynamic, making it flexible and expressive. The downside is, you'll need to refer to the FreshBooks API in order to use it (no help from intellisense!).

Examples

Example: basic request and response

Getting a list of all your clients

var fb = new FreshBooks("yourusername", "yourapitoken");
var result = fb.Call("client.list");

// note: 'result' is dynamic, converted from the XML returned by FreshBooks
// so you can do, e.g.:
var total = result.response.clients.total;

Example: specifying request parameters

Searching for clients updated in the last week:

var fb = new FreshBooks("yourusername", "yourapitoken");
var result = fb.Call("client.list", x => x.updated_from = DateTime.Now.AddDays(-7));

// e.g. get the first client's email address
var email = result.response.clients.client[0].email;

Example: multiple request parameters

Searching for unpaid invoices from the last month:

var fb = new FreshBooks("yourusername", "yourapitoken");
var unpaid = fb.Call("invoice.list", x => {
	x.date_from = DateTime.Now.AddMonths(-1);
	x.status = "unpaid";
});

Example: complex request parameters

Creating a new invoice item:

var fb = new FreshBooks("yourusername", "yourapitoken");
var res = fb.Call("item.create", x => x.item = new {
    name = "Fuzzy Slippers",
    description = "Extra soft",
    unit_cost = "59.99",
    quantity = 1,
    inventory = 10
});

Example: inspecting data returned from the API

You can view the data by calling ToString() on the dynamic result:

var fb = new FreshBooks("yourusername", "yourapitoken");
var expense = fb.Call("expense.get", x => x.expense_id = 433);

// this will output the contents of the response
Console.WriteLine(expense.ToString());

hastyapi.freshbooks's People

Contributors

lukesampson avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.