Skip to content

Instantly share code, notes, and snippets.

View henzard's full-sized avatar

Henzard Kruger henzard

View GitHub Profile
var xeroToken = client.RequestAccessTokenAsync(code).GetAwaiter().GetResult();
public XeroClient GetClient()
{
var xeroConfig = new XeroConfiguration()
{
ClientId = _xeroConfig.Value.XeroConnect.ClientId,
CallbackUri = new Uri(_xeroConfig.Value.XeroConnect.RedirectUri),
Scope =
"openid profile email offline_access files accounting.transactions accounting.contacts accounting.settings",
State = "WinFormsApp"
};
var api = new IdentityApi();
var companies = await api.GetConnectionsAsync(AccessToken); //Access Token from Json
var http = new HttpListener();
http.Prefixes.Add(RedirectUri);
http.Start();
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
@henzard
henzard / SetupLamp.sh
Last active June 6, 2019 09:27
Setup Linux Apache PHP 7.2 MySql on a PI
sudo apt install -y git mysql-server
sudo apt install -y -t buster apache2 php7.2 php7.2-curl php7.2-gd php7.2-imap php7.2-json mcrypt php7.2-mysql php7.2-opcache php7.2-xmlrpc libapache2-mod-php7.2 php7.2-xml php7.2-mbstring
sudo apt install -y composer nodejs npm
sudo apt-get update -y
sudo apt-get dist-upgrade -y
sudo apt-get upgrade -y
"Mimetype==\"application/pdf\""
PrivateApplication = Connect();
List<Contact> CompanyContacts = new List<Contact>();
Thread.Sleep(1200);
XeroLogging.Info("GetContacts Page #" + Request.ToString());
try
{
CompanyContacts = PrivateApplication.Contacts.Page(Request).Find().ToList();
XeroLogging.Info("GetContacts Page Success #" + Request.ToString());
}
Invoice inv = new Invoice();
inv.LineItems = new List<LineItem>();
//Inside a loop
inv.LineItems.Add(new LineItem() {
Description = "Testing"
});