### Get Accounts Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/assets/index.html Retrieves a list of accounts from Xero. This example fetches all accounts; consider using query parameters for specific filtering. ```csharp var accounts = await client.Account.GetAsync(); ``` -------------------------------- ### Get Leave Applications with Combined Query Parameters Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/assets/index.html Demonstrates fetching leave applications with multiple query parameters: filtering by status, sorting by start date, and pagination. ```csharp var leaveApplications = await client.LeaveApplication.GetAsync(where: "Status=="APPROVED"", order: "StartDate ASC", page: 1); ``` -------------------------------- ### Get Payroll Calendars with Combined Query Parameters Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/assets/index.html Demonstrates fetching payroll calendars with multiple query parameters: sorting by start date and pagination. ```csharp var payrollCalendars = await client.PayrollCalendar.GetAsync(order: "StartDate ASC", page: 1); ``` -------------------------------- ### Get Xero Asset Types (C#) Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/assets/index.html This example shows how to fetch a list of available fixed asset types from your Xero account. Requires the 'assets' or 'assets.read' scope. ```csharp using System; using System.Diagnostics; using Xero.NetStandard.OAuth2.Api; using Xero.NetStandard.OAuth2.Client; using Xero.NetStandard.OAuth2.Model; namespace Example { public class GetAssetTypesExample { public async Task Main() { var accessToken = "YOUR_ACCESS_TOKEN"; var apiInstance = new AssetApi(); var xeroTenantId = "YOUR_XERO_TENANT_ID"; try { var result = await apiInstance.GetAssetTypesAsync(accessToken, xeroTenantId); Console.WriteLine(result); } catch (Exception e) { Console.WriteLine("Exception when calling apiInstance.GetAssetTypes: " + e.Message ); } } } } ``` -------------------------------- ### Get all preceding sibling elements Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/projects/index.html Use the .prevAll() method to get all sibling elements before the current element up through the start of the document. If no elements are found, an empty jQuery object is returned. ```javascript r.each({ prevAll: function(a) { return y(a, "previousSibling") } }, function(a, b) { r.fn[a] = function(c, d) { var e = r.map(this, b, c); return "Until" !== a.slice(-5) && (d = c), d && "string" == typeof d && (e = r.filter(d, e)), this.length > 1 && (I[a] || r.uniqueSort(e), H.test(a) && e.reverse()), this.pushStack(e) } }) ``` -------------------------------- ### Initialize and Create a Project in C# Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/projects/index.html Demonstrates how to initialize the ProjectApi and create a new project using the Xero-NetStandard SDK. Ensure you have your access token and tenant ID. ```csharp using System; using System.Diagnostics; using Xero.NetStandard.OAuth2.Api; using Xero.NetStandard.OAuth2.Client; using Xero.NetStandard.OAuth2.Model; namespace Example { public class CreateProjectExample { public async Task Main() { var accessToken = "YOUR_ACCESS_TOKEN"; var apiInstance = new ProjectApi(); var xeroTenantId = "xeroTenantId_example"; var idempotencyKey = "KEY_VALUE"; try { var result = await apiInstance.CreateProjectAsync(accessToken, xeroTenantId, projectCreateOrUpdate, idempotencyKey); Console.WriteLine(result); } catch (Exception e) { Console.WriteLine("Exception when calling apiInstance.CreateProject: " + e.Message ); } } } } ``` -------------------------------- ### Get Organisation Settings Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/payroll-au/index.html Retrieves organisation settings, such as financial year start date. ```csharp var settings = await client.Organisation.GetSettingsAsync(organisations.First().Id); ``` -------------------------------- ### Initialize Xero Client Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/files/index.html Demonstrates how to initialize the Xero client with API credentials and configuration. Ensure you replace placeholders with your actual credentials. ```csharp var config = new XeroConfiguration() { ApiClientSettings = new ApiClientSettings() { TenantId = "YOUR_TENANT_ID", ClientId = "YOUR_CLIENT_ID", ClientSecret = "YOUR_CLIENT_SECRET", RedirectUri = "YOUR_REDIRECT_URI", Scope = "openid profile email accounting.transactions offline_access" } }; var xeroClient = new XeroClient(config); // You would typically use this client to make API calls. ``` -------------------------------- ### Create Product Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/payroll-au-v2/index.html Creates a new product or service. ```csharp var product = new Product { Code = "WIDGET001", Name = "Standard Widget", SalesDetails = new ProductSalesDetails { UnitPrice = 10.00, AccountCode = "300" // Revenue account } }; await client.CreateProductAsync(product); Console.WriteLine("Product created successfully."); ``` -------------------------------- ### Get Timesheets Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/assets/index.html Retrieves timesheets from Xero. This example fetches all timesheets; use query parameters for filtering. ```csharp var timesheets = await client.Timesheet.GetAsync(); ``` -------------------------------- ### Install Xero .Net SDK Source: https://github.com/xeroapi/xero-netstandard/blob/master/Xero.NetStandard.OAuth2Client/README.md Commands to install the Xero .Net Standard OAuth2 client package via NuGet or Package Manager Console. ```bash dotnet add package Xero.NetStandard.OAuth2Client ``` ```powershell Install-Package Xero.NetStandard.OAuth2Client ``` -------------------------------- ### Get Payslips Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/assets/index.html Retrieves payslips from Xero. This example fetches all payslips; use query parameters for filtering. ```csharp var payslips = await client.Payslip.GetAsync(); ``` -------------------------------- ### Get Employees Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/assets/index.html Retrieves employees from Xero. This example fetches all employees; use query parameters for filtering. ```csharp var employees = await client.Employee.GetAsync(); ``` -------------------------------- ### Initialize Xero Client Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/projects/index.html Demonstrates how to initialize the Xero client with API credentials. Ensure you have your client ID, client secret, and redirect URI configured. ```csharp var config = new XeroConfiguration() { ApiClientId = "YOUR_API_CLIENT_ID", ApiClientSecret = "YOUR_API_CLIENT_SECRET", CallbackUri = new Uri("YOUR_REDIRECT_URI") }; var client = new XeroClient(config); // If you have a refresh token, you can use it to get a new access token // var accessToken = await client.RefreshTokenAsync(); // If you need to get an authorization URL to get the first access token // var url = client.BuildLoginRedirectUrl(); ``` -------------------------------- ### Initialize Marked Library Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/finance/index.html Sets up the Marked library with specified options for rendering Markdown. This is typically done once at the start of an application. ```javascript marked.setOptions({ renderer: new marked.Renderer(), gfm: true, tables: true, breaks: false, pedantic: false, sanitize: false, smartLists: true, smartypants: false }); ``` -------------------------------- ### Get Receipts Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/assets/index.html Retrieves receipts from Xero. This example fetches all receipts; use query parameters for filtering. ```csharp var receipts = await client.Receipt.GetAsync(); ``` -------------------------------- ### Get Quotes Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/assets/index.html Retrieves quotes from Xero. This example fetches all quotes; use query parameters for filtering. ```csharp var quotes = await client.Quote.GetAsync(); ``` -------------------------------- ### Initialize Xero Client Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/payroll-au-v2/index.html Initializes the Xero client with configuration. Ensure you have the necessary configuration loaded. ```csharp using Xero.Api.Core; using Xero.Api.Infrastructure.Applications; using Xero.Api.Infrastructure.RateLimit.Interfaces; using Xero.Api.Infrastructure.RateLimit.Stats; // ... var config = new ApplicationConfig( "YOUR_CONSUMER_KEY", "YOUR_CONSUMER_SECRET", "YOUR_ACCESS_TOKEN", "YOUR_ACCESS_TOKEN_SECRET", "YOUR_TENANT_ID" ); var xeroClient = new XeroClient(config); // Optional: Configure rate limit stats var rateLimitStats = new RateLimitStats(); xeroClient.RateLimitHandler = new RateLimitHandler(rateLimitStats); // Now you can use xeroClient to interact with the Xero API ``` -------------------------------- ### Get Organisation Bank Transfers Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/assets/index.html Retrieves bank transfers recorded in Xero. This example fetches all bank transfers. ```csharp var bankTransfers = await client.BankTransfer.GetAsync(); ``` -------------------------------- ### Initialize SDK and Route Documentation Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/payroll-au-v2/index.html JavaScript logic used to detect the current SDK language based on the URL and update the UI selection accordingly. ```javascript $(document).ready(function() { const location = window.location.href.toLowerCase() let sdkLang let sdkName if( location.includes('ruby') ){ sdkLang = 'ruby' sdkName = 'xero-ruby' } else if (location.includes('node')){ sdkLang = 'node' sdkName = 'xero-node' } else if (location.includes('php')){ sdkLang = 'php' sdkName = 'xero-php-oauth2' } else if (location.includes('xero-netstandard') || location.includes('csharp')){ sdkLang = 'dotnet' sdkName = 'Xero-NetStandard' } else if (location.includes('java')){ sdkLang = 'java' sdkName = 'Xero-Java' } else if (location.includes('python')){ sdkLang = 'python' sdkName = 'xero-python' } $('#language-set-selection option[value="'+ sdkLang +'"]').attr("selected", "selected"); $('#sdk-name').html(sdkName); console.log('PayrollAuV2') $('#api-set-selection option[value="'+ 'PayrollAuV2' + '"]').attr("selected", "selected"); }); ``` -------------------------------- ### Post Usage Records using C# SDK Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/appstore/index.html This C# example shows how to post usage records for a given subscription and item. Ensure you have the correct access token and valid GUIDs for subscription and subscription items. The 'Idempotency-Key' header is crucial for safe retries. ```csharp using System; using System.Diagnostics; using Xero.NetStandard.OAuth2.Api; using Xero.NetStandard.OAuth2.Client; using Xero.NetStandard.OAuth2.Model; namespace Example { public class PostUsageRecordsExample { public async Task Main() { var accessToken = "YOUR_ACCESS_TOKEN"; var apiInstance = new AppStoreApi(); var subscriptionId = Guid.Parse("00000000-0000-0000-0000-000000000000"); var subscriptionItemId = Guid.Parse("00000000-0000-0000-0000-000000000000"); var idempotencyKey = "KEY_VALUE"; try { var result = await apiInstance.PostUsageRecordsAsync(accessToken, subscriptionId, subscriptionItemId, createUsageRecord, idempotencyKey); Console.WriteLine(result); } catch (Exception e) { Console.WriteLine("Exception when calling apiInstance.PostUsageRecords: " + e.Message ); } } } } ``` -------------------------------- ### Get Time Off Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/assets/index.html Retrieves time off requests from Xero. This example fetches all time off requests; use query parameters for filtering. ```csharp var timeOffs = await client.TimeOff.GetAsync(); ``` -------------------------------- ### Initialize Xero Client Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/projects/index.html Initializes the Xero client with necessary configuration. Ensure you have your private key and certificate path correctly set. ```csharp var config = new DefaultApiSettings { ConsumerKey = "YOUR_CONSUMER_KEY", ConsumerSecret = "YOUR_CONSUMER_SECRET", PrivateKeyPath = "/path/to/your/privatekey.pem", PrivateKeyPassword = "YOUR_PRIVATE_KEY_PASSWORD" }; var client = new XeroClient(config); await client.ConnectAsync(); ``` -------------------------------- ### Get Superannuation Members Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/assets/index.html Retrieves superannuation members from Xero. This example fetches all members; use query parameters for filtering. ```csharp var superannuationMembers = await client.SuperannuationMember.GetAsync(); ``` -------------------------------- ### Get Superannuation Funds Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/assets/index.html Retrieves superannuation funds from Xero. This example fetches all funds; use query parameters for filtering. ```csharp var superannuationFunds = await client.SuperannuationFund.GetAsync(); ``` -------------------------------- ### Initialize UI Components Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/appstore/index.html Sets up tab navigation and scrollspy behavior on document ready. ```javascript $(document).ready(function () { $('.nav-tabs-examples').find('a:first').tab('show'); $(this).scrollspy({ target: '#scrollingNav', offset: 18 }); }); ``` -------------------------------- ### ClientRequest Constructor and Setup Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/files/index.html Initializes a ClientRequest object, setting up headers and determining the appropriate request mode based on capabilities. ```javascript var capability=require("./capability"),inherits=require("inherits"),response=require("./response"),stream=require("stream"),toArrayBuffer=require("to-arraybuffer"),IncomingMessage=response.IncomingMessage,rStates=response.readyStates,ClientRequest=module.exports=function(e){var t=this;stream.Writable.call(t),t._opts=e,t._body=[],t._headers={},e.auth&&t.setHeader("Authorization","Basic "+new Buffer(e.auth).toString("base64")),Object.keys(e.headers).forEach(function(r){t.setHeader(r,e.headers[r])});var r;if("prefer-streaming"===e.mode)r=!1;else if("allow-wrong-content-type"===e.mode)r=!capability.overrideMimeType;else{if(e.mode&&"default"!==e.mode&&"prefer-fast"!==e.mode)throw new Error("Invalid value for opts.mode");r=!0}t._mode=decideMode(r),t.on("finish",function(){t._onFinish()})};inherits(ClientRequest,stream.Writable) ``` -------------------------------- ### Get Inventory Items Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/assets/index.html Retrieves inventory items from Xero. This example fetches all items; use query parameters for filtering. ```csharp var inventoryItems = await client.InventoryItem.GetAsync(); ``` -------------------------------- ### Get Bank Transactions Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/assets/index.html Retrieves bank transactions from Xero. This example fetches all transactions; use query parameters for filtering. ```csharp var bankTransactions = await client.BankTransaction.GetAsync(); ``` -------------------------------- ### Configure XeroClient Source: https://github.com/xeroapi/xero-netstandard/blob/master/README.md Initialize the XeroClient with your application credentials, callback URI, and required scopes. ```csharp XeroConfiguration xconfig = new XeroConfiguration(); xconfig.ClientId = "yourClientId"; xconfig.ClientSecret = "yourClientSecret"; xconfig.CallbackUri = new Uri("https://localhost:5001"); //default for standard webapi template xconfig.Scope = "openid profile email offline_access files accounting.transactions accounting.contacts"; var client = new XeroClient(xconfig); ``` -------------------------------- ### Get Timesheets with Sorting Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/assets/index.html Retrieves timesheets sorted by start date in ascending order. Use 'order' parameter for sorting. ```csharp var timesheets = await client.Timesheet.GetAsync(order: "StartDate ASC"); ``` -------------------------------- ### Create an asset using C# SDK Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/assets/index.html Demonstrates how to instantiate the AssetApi and create a new asset record. Requires a valid access token and Xero tenant ID. ```csharp using System; using System.Diagnostics; using Xero.NetStandard.OAuth2.Api; using Xero.NetStandard.OAuth2.Client; using Xero.NetStandard.OAuth2.Model; namespace Example { public class CreateAssetExample { public async Task Main() { var accessToken = "YOUR_ACCESS_TOKEN"; var apiInstance = new AssetApi(); var xeroTenantId = "YOUR_XERO_TENANT_ID"; var idempotencyKey = "KEY_VALUE"; var asset = new Asset(); asset.assetName = "AssetName"; asset.assetNumber = "AssetNumber"; asset.Status = AssetStatus.Draft; try { var result = await apiInstance.CreateAssetAsync(accessToken, xeroTenantId, asset, idempotencyKey); Console.WriteLine(result); } catch (Exception e) { Console.WriteLine("Exception when calling apiInstance.CreateAsset: " + e.Message ); } } } } ``` -------------------------------- ### Get Purchases by Item Report Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/assets/index.html Retrieves the purchases by item report for the organisation. Requires start and end dates for the report. ```csharp var purchasesByItem = await client.Accounting.GetPurchasesByItemAsync(DateTime.Today.AddMonths(-1), DateTime.Today); ``` -------------------------------- ### Install Xero SDK Packages via CLI Source: https://github.com/xeroapi/xero-netstandard/blob/master/README.md Use the .NET CLI to add the required Xero OAuth2 and API packages to your project. ```bash dotnet add package Xero.NetStandard.OAuth2 dotnet add package Xero.NetStandard.OAuth2Client ``` -------------------------------- ### Get Sales by Item Report Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/assets/index.html Retrieves the sales by item report for the organisation. Requires start and end dates for the report. ```csharp var salesByItem = await client.Accounting.GetSalesByItemAsync(DateTime.Today.AddMonths(-1), DateTime.Today); ``` -------------------------------- ### Initialize Xero Client Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/projects/index.html Initializes the Xero client with your application's credentials. Ensure you have your private key and certificate set up correctly. ```csharp var config = new XeroConfiguration() { ApiClientSettings = new ApiClientSettings() { XeroTenantId = "YOUR_TENANT_ID", AuthToken = "YOUR_AUTH_TOKEN" } }; var xeroClient = new XeroClient(config); ``` -------------------------------- ### Get Products Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/payroll-au-v2/index.html Retrieves a list of products and services. ```csharp var products = await client.GetProductsAsync(); foreach (var product in products) { Console.WriteLine($"Product Code: {product.Code}, Name: {product.Name}"); } ``` -------------------------------- ### Get Cash Flow Report Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/assets/index.html Retrieves the cash flow report for the organisation. Requires start and end dates for the report. ```csharp var cashFlow = await client.Accounting.GetCashFlowAsync(DateTime.Today.AddMonths(-1), DateTime.Today); ``` -------------------------------- ### Get Profit and Loss Report Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/assets/index.html Retrieves the profit and loss report for the organisation. Requires start and end dates for the report. ```csharp var profitAndLoss = await client.Accounting.GetProfitAndLossAsync(DateTime.Today.AddMonths(-1), DateTime.Today); ``` -------------------------------- ### Initialize Xero SDK Elements Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/payroll-au-v2/index.html The `r.fn.init` constructor is used to create new SDK elements. It handles initialization from various inputs like HTML strings, DOM elements, or other SDK objects. ```javascript G.prototype=r.fn,E=r(d);var H=/^(?:parents|prev(?:Until|All))/,I={children:!0,contents:!0,next:!0,prev:!0};r.fn.extend({has:function(a){var b=r(a,this),c=b.length;return this.filter(function(){for(var a=0;a-1:1===c.nodeType&&r.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?r.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?i.call(r(a),this[0]):i.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(r.uniqueSort(r.merge(this.get(),r(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function J(a,b){while((a=a[b])&&1!==a.nodeType);return a}r.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return y(a,"parentNode")},parentsUntil:function(a,b,c){return y(a,"parentNode",c)},next:function(a){return J(a,"nextSibling")},prev:function(a){return J(a,"previousSibling")},nextAll:function(a){return y(a,"nextSibling")},prevAll:function(a){return y(a,"previousSibling")},nextUntil:function(a,b,c){return y(a,"nextSibling",c)},prevUntil:function(a,b,c){return y(a,"previousSibling",c)},siblings:function(a){return z((a.parentNode||{}).firstChild,a)},children:function(a){return z(a.firstChild)},contents:function(a){return a.contentDocument||r.merge([],a.childNodes)}},function(a,b){r.fn[a]=function(c,d){var e=r.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=r.filter(d,e)),this.length>1&&(I[a]||r.uniqueSort(e),H.test(a)&&e.reverse()),this.pushStack(e)}});var K=/\S+/g;function L(a){var b={};return r.each(a.match(K)||\[\]\,function(a,c){b[c]=!0}),b}r.Callbacks=function(a){a="string"==typeof a?L(a):r.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h0&&(i=a.setTimeout(function(){y.abort("timeout")},o.timeout));try{k=!1,e.send(v,A)}catch(z){if(k)throw z;A(-1,z)}}else A(-1,"No Transport")} ``` ```javascript function A(b,c,d,h){var j,m,n,v,w,x=c;k||(k=!0,i&&a.clearTimeout(i),e=void 0,g=h||"",y.readyState=b>0?4:0,j=b>=200&&b<300||304===b,d&&(v=Mb(o,y,d)),v=Nb(o,v,y,j),j?(o.ifModified&&(w=y.getResponseHeader("Last-Modified"),w&&(r.lastModified[f]=w),w=y.getResponseHeader("etag"),w&&(r.etag[f]=w)),204===b||"HEAD"===o.type?b=204:"error"===v.state?A(0,x):v.state+" "+v.error):A(0,x);u[y.status]&&u[y.status].apply(p,[y,b]),q.trigger("ajaxComplete",[y,o]),i&&o.timeout>0&&a.clearTimeout(i),i=void 0,o.async&&a.clearTimeout(i),y.readyState=4,j||"abort"===c||"error"===c||"timeout"===c||"parsererror"===c||(y.status=0,y.statusText=c),!o.async&&t.add(A),b&&b!==0||t.fireWith(p,[y,c])} ``` -------------------------------- ### Xero SDK Initialization Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/files/index.html Initializes the Xero SDK, setting up core components and utilities. This is a foundational step for using the SDK. ```javascript return h = ga.compile = function(a,b){ var c, d = [], e = [], f = A[a+" "]; if (!f) { b || (b = g(a)), c = b.length; while (c--) f = ya(b[c]), f["__" ] ? d.push(f) : e.push(f); f = A(a, za(e, d)), f.selector = a } return f }, i = ga.select = function(a, b, e, f) { var i, j, k, l, m, n = "function" == typeof a && a, o = !f && g(a = n.selector || a); if (1 === o.length) { if (j = o[0] = o[0].slice(0), j.length > 2 && "ID" === (k = j[0]).type && c.getById && 9 === b.nodeType && p && d.relative[j[1].type]) { if (b = (d.find.ID(k.matches[0].replace(_, aa), b) || [])[0], !b) return e; n && (b = b.parentNode), a = a.slice(j.shift().value.length) } i = V.needsContext.test(a) ? 0 : j.length } return (n || h(a, o))(f, b, !p, e, !b || $.test(a) && qa(b.parentNode) || b) }, c.sortStable = u.split("").sort(B).join("") === u, c.detectDuplicates = !!l, m(), c.sortDetached = ja(function(a) { return 1 & a.compareDocumentPosition(n.createElement("fieldset")) }), ja(function(a) { return a.innerHTML = "", "#" === a.firstChild.getAttribute("href") }) || ka("type|href|height|width", function(a, b, c) { if (!c) return a.getAttribute(b, "type" === b.toLowerCase() ? 1 : 2) }), c.attributes && ja(function(a) { return a.innerHTML = "", "" === a.firstChild.getAttribute("value") }) || ka("value", function(a, b, c) { if (!c && "input" === a.nodeName.toLowerCase()) return a.defaultValue }), ja(function(a) { return null == a.getAttribute("disabled") }) || ka(J, function(a, b, c) { var d; if (!c) return a[b] === !0 ? b.toLowerCase() : (d = a.getAttributeNode(b)) && d.specified ? d.value : null }), ga(a) ``` -------------------------------- ### Get Quotes with Pagination Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/assets/index.html Retrieves quotes using pagination. This example fetches the first page of results. Use 'page' parameter. ```csharp var quotes = await client.Quote.GetAsync(page: 1); ``` -------------------------------- ### Initialize Client Request Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/payroll-au-v2/index.html Sets up the Writable stream for client requests, including authentication headers and mode selection. ```javascript ClientRequest=module.exports=function(e){var t=this;stream.Writable.call(t),t.\_opts=e,t.\_body=[],t.\_headers={},e.auth&&t.setHeader("Authorization","Basic "+new Buffer(e.auth).toString("base64")),Object.keys(e.headers).forEach(function(r){t.setHeader(r,e.headers[r])});var r;if("prefer-streaming"===e.mode)r=!1;else if("allow-wrong-content-type"===e.mode)r=!capability.overrideMimeType;else{if(e.mode&&"default"!==e.mode&&"prefer-fast"!==e.mode)throw new Error("Invalid value for opts.mode");r=!0}t.\_mode=decideMode(r),t.on("finish",function(){t.\_onFinish()})}; ``` -------------------------------- ### Get Accounts with Pagination Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/assets/index.html Retrieves accounts using pagination. This example fetches the first page of results. Use 'page' parameter. ```csharp var accounts = await client.Account.GetAsync(page: 1); ``` -------------------------------- ### Retrieve Assets with Xero .NET SDK Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/assets/index.html Demonstrates how to initialize the AssetApi and call GetAssetsAsync with filtering and pagination parameters. ```csharp using System; using System.Diagnostics; using Xero.NetStandard.OAuth2.Api; using Xero.NetStandard.OAuth2.Client; using Xero.NetStandard.OAuth2.Model; namespace Example { public class GetAssetsExample { public async Task Main() { var accessToken = "YOUR_ACCESS_TOKEN"; var apiInstance = new AssetApi(); var xeroTenantId = "YOUR_XERO_TENANT_ID"; AssetStatusQueryParam status = ; var page = 1; var pageSize = 5; var orderBy = "AssetName"; var sortDirection = "ASC"; var filterBy = "Company Car"; try { var result = await apiInstance.GetAssetsAsync(accessToken, xeroTenantId, status, page, pageSize, orderBy, sortDirection, filterBy); Console.WriteLine(result); } catch (Exception e) { Console.WriteLine("Exception when calling apiInstance.GetAssets: " + e.Message ); } } } } ``` -------------------------------- ### Get Contacts with Pagination Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/assets/index.html Retrieves contacts using pagination. This example fetches the first page of results. Use 'page' parameter. ```csharp var contacts = await client.Contact.GetAsync(page: 1); ``` -------------------------------- ### Get Invoices with Pagination Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/assets/index.html Retrieves invoices using pagination. This example fetches the first page of results. Use 'page' parameter. ```csharp var invoices = await client.Invoice.GetAsync(page: 1); ``` -------------------------------- ### Initialize Xero Client Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/payroll-au/index.html Initializes the Xero client with API credentials. Ensure you have your private key and certificate set up. ```csharp var config = new DefaultConfiguration(); var client = new XeroClient(config); // If using private key authentication: // var privateKey = "-----BEGIN RSA PRIVATE KEY-----\n...\n-----END RSA PRIVATE KEY-----"; // var certificate = new X509Certificate2(Convert.FromBase64String(privateKey)); // var client = new XeroClient(config, certificate); ``` -------------------------------- ### Initialize Xero Client Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/payroll-au/index.html Initializes the Xero client with API credentials. Ensure you have your private key and certificate path correctly configured. ```csharp var config = new DefaultApiConfig("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET", "YOUR_REDIRECT_URI", "YOUR_SCOPES"); var client = new XeroClient(config); // For private applications, use: // var config = new DefaultApiConfig("YOUR_TENANT_ID", "YOUR_CONSUMER_KEY", "YOUR_PRIVATE_KEY_PATH", "YOUR_CERTIFICATE_PATH"); // var client = new XeroClient(config); ``` -------------------------------- ### Get Payroll Calendars Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/assets/index.html Retrieves payroll calendars from Xero. This example fetches all payroll calendars; use query parameters for filtering. ```csharp var payrollCalendars = await client.PayrollCalendar.GetAsync(); ``` -------------------------------- ### Get Repeating Invoices Source: https://github.com/xeroapi/xero-netstandard/blob/master/docs/assets/index.html Retrieves repeating invoices from Xero. This example fetches all repeating invoices; use query parameters for filtering. ```csharp var repeatingInvoices = await client.RepeatingInvoice.GetAsync(); ```