xero-node
Advanced tools
Comparing version 3.0.13 to 3.0.14
@@ -186,2 +186,31 @@ "use strict"; | ||
}); | ||
describe('with user agent set', function () { | ||
var xeroConfig = { | ||
appType: 'partner', | ||
userAgent: 'PHILWASHERE', | ||
consumerKey: 'RDGDV41TRLQZDFSDX96TKQ2KRJIW4C', | ||
consumerSecret: 'DJ3CMGDB0DIIA9DNEEJMRLZG0BWE7Y', | ||
privateKeyPath: privateKey_helpers_1.validTestCertPath() | ||
}; | ||
var apiConfig = { | ||
tenantType: 'PRACTICE', | ||
apiBasePath: '/s/s', | ||
}; | ||
it('appends useragent', function () { | ||
var retrievedState = config_helper_1.mapConfig(xeroConfig, apiConfig); | ||
expect(retrievedState).toEqual({ | ||
accept: 'application/json', | ||
userAgent: "NodeJS-XeroAPIClient.PHILWASHERE." + version + ".RDGDV41TRLQZDFSDX96TKQ2KRJIW4C", | ||
consumerKey: 'RDGDV41TRLQZDFSDX96TKQ2KRJIW4C', | ||
consumerSecret: privateKey_helpers_1.testCertString(), | ||
tenantType: 'PRACTICE', | ||
apiBasePath: '/s/s', | ||
signatureMethod: 'RSA-SHA1', | ||
callbackUrl: null, | ||
apiBaseUrl: 'https://api.xero.com', | ||
oauthAccessTokenPath: '/oauth/AccessToken', | ||
oauthRequestTokenPath: '/oauth/RequestToken', | ||
}); | ||
}); | ||
}); | ||
describe('with cert as string', function () { | ||
@@ -188,0 +217,0 @@ var xeroConfig = { |
/// <reference types="node" /> | ||
import { IOAuth1HttpClient, AccessToken } from './OAuth1HttpClient'; | ||
import * as fs from 'fs'; | ||
import { AttachmentsResponse } from '../AccountingAPI-responses'; | ||
import { AccessToken, IOAuth1HttpClient } from './OAuth1HttpClient'; | ||
/** | ||
@@ -17,2 +17,3 @@ * TODO: Add support for the following keys: | ||
callbackUrl?: string; | ||
userAgent?: string; | ||
} | ||
@@ -19,0 +20,0 @@ /** |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var config_helper_1 = require("./config-helper"); | ||
var OAuth1HttpClient_1 = require("./OAuth1HttpClient"); | ||
var config_helper_1 = require("./config-helper"); | ||
/** @private */ | ||
@@ -6,0 +6,0 @@ var BaseAPIClient = /** @class */ (function () { |
/** @internalapi */ | ||
/** This second comment is required for typedoc to recognise the WHOLE FILE as @internalapi */ | ||
import { XeroClientConfiguration, ApiConfiguration } from './BaseAPIClient'; | ||
import { OAuth1Configuration, AccessToken } from './OAuth1HttpClient'; | ||
import { ApiConfiguration, XeroClientConfiguration } from './BaseAPIClient'; | ||
import { AccessToken, OAuth1Configuration } from './OAuth1HttpClient'; | ||
/** @private */ | ||
@@ -6,0 +6,0 @@ export declare function mapState(xeroConfig: XeroClientConfiguration): AccessToken; |
@@ -37,2 +37,7 @@ "use strict"; | ||
var cert = xeroConfig.privateKeyPath ? utils_1.getStringFromFile(xeroConfig.privateKeyPath) : null; | ||
var userAgentString = 'NodeJS-XeroAPIClient'; | ||
if (xeroConfig.userAgent) { | ||
userAgentString = userAgentString + '.' + xeroConfig.userAgent; | ||
} | ||
userAgentString = userAgentString + '.' + version + '.' + xeroConfig.consumerKey; | ||
if (xeroConfig.privateKeyString) { | ||
@@ -47,3 +52,3 @@ cert = xeroConfig.privateKeyString; | ||
accept: 'application/json', | ||
userAgent: 'NodeJS-XeroAPIClient.' + version + '.' + xeroConfig.consumerKey, | ||
userAgent: userAgentString, | ||
consumerKey: xeroConfig.consumerKey, | ||
@@ -50,0 +55,0 @@ consumerSecret: xeroConfig.consumerSecret, |
/// <reference types="node" /> | ||
import { OAuth } from 'oauth'; | ||
import { IHttpClient } from './BaseAPIClient'; | ||
import * as fs from 'fs'; | ||
import * as http from 'http'; | ||
import { OAuth } from 'oauth'; | ||
import { AttachmentsResponse } from '../AccountingAPI-responses'; | ||
import { IHttpClient } from './BaseAPIClient'; | ||
export interface RequestToken { | ||
@@ -8,0 +8,0 @@ oauth_token: string; |
@@ -46,6 +46,6 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var http = require("http"); | ||
var https = require("https"); | ||
var oauth_1 = require("oauth"); | ||
var querystring = require("querystring"); | ||
var http = require("http"); | ||
var https = require("https"); | ||
var URL = require("url"); | ||
@@ -52,0 +52,0 @@ var XeroError_1 = require("../XeroError"); |
{ | ||
"name": "xero-node", | ||
"version": "3.0.13", | ||
"version": "3.0.14", | ||
"description": "NodeJS Client for the Xero API, supporting Public, Private and Partner Apps", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -158,2 +158,7 @@ [![npm version](https://badge.fury.io/js/xero-node.svg)](https://badge.fury.io/js/xero-node) | ||
- [Sample app](https://github.com/XeroAPI/xero-node-sample-app) | ||
### What about endpoints not in the package yet? | ||
Sometimes there may be endpoints in the API which have not been added to this package. Feel free to send a PR. In the mean time we have implemented a way of calling any endpoint. Here is a few examples (replace `.get` with `.post` or `.put`): | ||
- [Generic API calls private](https://github.com/XeroAPI/xero-node/blob/master/src/__integration_tests__/generic-endpoint.integration.tests.ts) | ||
@@ -160,0 +165,0 @@ - [Generic API calls public/partner](https://github.com/XeroAPI/xero-node/blob/master/src/__integration_tests__/partner-example-callbackUrl.tests.ts) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
240
206344
45
4278