xero-node
Advanced tools
Comparing version 3.0.21 to 3.1.0
@@ -90,2 +90,9 @@ export interface Attachment { | ||
} | ||
export interface PaymentService { | ||
PaymentServiceID?: string; | ||
PaymentServiceName?: string; | ||
PaymentServiceUrl?: string; | ||
PayNowText?: string; | ||
PaymentServiceType?: string; | ||
} | ||
export interface BrandingTheme { | ||
@@ -138,3 +145,3 @@ BrandingThemeID: string; | ||
export interface Allocation { | ||
Amount?: number; | ||
AppliedAmount?: number; | ||
Date?: string; | ||
@@ -176,3 +183,2 @@ Invoice?: Invoice; | ||
CISDeduction?: number; | ||
BrandingThemeID?: string; | ||
AmountDue?: number; | ||
@@ -198,3 +204,2 @@ AmountPaid?: number; | ||
CurrencyCode?: string; | ||
CurrencyRate?: number; | ||
History?: HistoryRecord[]; | ||
@@ -239,3 +244,2 @@ } | ||
ContactID?: string; | ||
ContactNumber?: string; | ||
ContactStatus?: string; | ||
@@ -242,0 +246,0 @@ Name?: string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -1,2 +0,2 @@ | ||
import { ExpenseClaim, User, CreditNote, BrandingTheme, Journal, Item, OnlineInvoice, Organisation, OrgCISSetting, Overpayment, Payment, Prepayment, TaxRate, TrackingCategory, BankTransfer, LinkedTransaction, Employee, Currency, HistoryRecord, Contact, ContactGroup, InvoiceReminder, Invoice, Allocation, BankTransaction, Attachment, Receipt, RepeatingInvoice, ManualJournal, PurchaseOrder } from './AccountingAPI-models'; | ||
import { ExpenseClaim, User, CreditNote, BrandingTheme, Journal, Item, OnlineInvoice, Organisation, OrgCISSetting, Overpayment, Payment, Prepayment, TaxRate, TrackingCategory, BankTransfer, LinkedTransaction, Employee, Currency, HistoryRecord, Contact, ContactGroup, InvoiceReminder, Invoice, Allocation, BankTransaction, Attachment, Receipt, RepeatingInvoice, ManualJournal, PurchaseOrder, PaymentService } from './AccountingAPI-models'; | ||
/** @private */ | ||
@@ -123,2 +123,6 @@ export interface AccountingAPIResponse { | ||
/** @private */ | ||
export interface PaymentServicesResponse extends AccountingAPIResponse { | ||
PaymentServices: PaymentService[]; | ||
} | ||
/** @private */ | ||
export interface PrepaymentsResponse extends AccountingAPIResponse { | ||
@@ -125,0 +129,0 @@ Prepayments: Prepayment[]; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
/// <reference types="node" /> | ||
import * as fs from 'fs'; | ||
import { Allocation, BankTransaction, BankTransfer, Contact, ContactGroup, CreditNote, Currency, Employee, ExpenseClaim, Invoice, Item, LinkedTransaction, ManualJournal, Payment, PurchaseOrder, Receipt, TaxRate, TrackingCategory, TrackingOption } from './AccountingAPI-models'; | ||
import { AccountsResponse, AllocationsResponse, AttachmentsResponse, BankTransactionsResponse, BankTransfersResponse, BrandingThemesResponse, ContactGroupsResponse, ContactsResponse, CreditNotesResponse, CurrenciesResponse, EmployeesResponse, ExpenseClaimsResponse, HistoryResponse, InvoiceRemindersResponse, InvoicesResponse, ItemsResponse, JournalsResponse, LinkedTransactionsResponse, ManualJournalsResponse, OnlineInvoicesResponse, OrganisationResponse, OverpaymentsResponse, PaymentsResponse, PrepaymentsResponse, PurchaseOrdersResponse, ReceiptsResponse, RepeatingInvoicesResponse, ReportsResponse, TaxRatesResponse, TrackingCategoriesResponse, UsersResponse } from './AccountingAPI-responses'; | ||
import { Allocation, BankTransaction, BankTransfer, Contact, ContactGroup, CreditNote, Currency, Employee, ExpenseClaim, HistoryRecord, Invoice, Item, LinkedTransaction, ManualJournal, Payment, PaymentService, PurchaseOrder, Receipt, TaxRate, TrackingCategory, TrackingOption } from './AccountingAPI-models'; | ||
import { AccountsResponse, AllocationsResponse, AttachmentsResponse, BankTransactionsResponse, BankTransfersResponse, BrandingThemesResponse, ContactGroupsResponse, ContactsResponse, CreditNotesResponse, CurrenciesResponse, EmployeesResponse, ExpenseClaimsResponse, HistoryResponse, InvoiceRemindersResponse, InvoicesResponse, ItemsResponse, JournalsResponse, LinkedTransactionsResponse, ManualJournalsResponse, OnlineInvoicesResponse, OrganisationResponse, OverpaymentsResponse, PaymentsResponse, PaymentServicesResponse, PrepaymentsResponse, PurchaseOrdersResponse, ReceiptsResponse, RepeatingInvoicesResponse, ReportsResponse, TaxRatesResponse, TrackingCategoriesResponse, UsersResponse } from './AccountingAPI-responses'; | ||
import { BaseAPIClient, XeroClientConfiguration } from './internals/BaseAPIClient'; | ||
@@ -13,2 +13,3 @@ import { AccessToken, IOAuth1HttpClient } from './internals/OAuth1HttpClient'; | ||
page?: number; | ||
pageSize?: number; | ||
} | ||
@@ -51,2 +52,3 @@ export interface UnitDecimalPlacesArgs { | ||
private generateAttachmentsEndpoint; | ||
private generateHistoryEndpoint; | ||
private generateHeader; | ||
@@ -85,2 +87,7 @@ accounts: { | ||
}) => Promise<HistoryResponse>; | ||
create: (args: { | ||
BankTransactionID: string; | ||
} & { | ||
HistoryNote: HistoryRecord; | ||
}) => Promise<HistoryResponse>; | ||
}; | ||
@@ -102,2 +109,7 @@ }; | ||
}) => Promise<HistoryResponse>; | ||
create: (args: { | ||
BankTransferID: string; | ||
} & { | ||
HistoryNote: HistoryRecord; | ||
}) => Promise<HistoryResponse>; | ||
}; | ||
@@ -144,9 +156,9 @@ }; | ||
}, args?: { | ||
summarizeErrors: boolean; | ||
summarizeErrors?: boolean; | ||
}) => Promise<ContactsResponse>; | ||
update: (body?: Contact | { | ||
update: (body: Contact | { | ||
Contacts: Contact[]; | ||
}, args?: { | ||
ContactID: string; | ||
summarizeErrors: boolean; | ||
ContactID?: string; | ||
summarizeErrors?: boolean; | ||
}) => Promise<ContactsResponse>; | ||
@@ -163,2 +175,7 @@ CISsettings: { | ||
}) => Promise<HistoryResponse>; | ||
create: (args: { | ||
ContactID: string; | ||
} & { | ||
HistoryNote: HistoryRecord; | ||
}) => Promise<HistoryResponse>; | ||
}; | ||
@@ -195,2 +212,7 @@ }; | ||
}) => Promise<HistoryResponse>; | ||
create: (args: { | ||
CreditNoteID: string; | ||
} & { | ||
HistoryNote: HistoryRecord; | ||
}) => Promise<HistoryResponse>; | ||
}; | ||
@@ -232,2 +254,7 @@ }; | ||
}) => Promise<HistoryResponse>; | ||
create: (args: { | ||
ExpenseClaimID: string; | ||
} & { | ||
HistoryNote: HistoryRecord; | ||
}) => Promise<HistoryResponse>; | ||
}; | ||
@@ -273,2 +300,7 @@ }; | ||
}) => Promise<HistoryResponse>; | ||
create: (args: { | ||
InvoiceID: string; | ||
} & { | ||
HistoryNote: HistoryRecord; | ||
}) => Promise<HistoryResponse>; | ||
}; | ||
@@ -290,2 +322,7 @@ email: { | ||
}) => Promise<HistoryResponse>; | ||
create: (args: { | ||
RepeatingInvoiceID: string; | ||
} & { | ||
HistoryNote: HistoryRecord; | ||
}) => Promise<HistoryResponse>; | ||
}; | ||
@@ -316,2 +353,7 @@ }; | ||
}) => Promise<HistoryResponse>; | ||
create: (args: { | ||
ItemID: string; | ||
} & { | ||
HistoryNote: HistoryRecord; | ||
}) => Promise<HistoryResponse>; | ||
}; | ||
@@ -384,2 +426,7 @@ }; | ||
}) => Promise<HistoryResponse>; | ||
create: (args: { | ||
OverpaymentID: string; | ||
} & { | ||
HistoryNote: HistoryRecord; | ||
}) => Promise<HistoryResponse>; | ||
}; | ||
@@ -406,4 +453,15 @@ }; | ||
}) => Promise<HistoryResponse>; | ||
create: (args: { | ||
PaymentID: string; | ||
} & { | ||
HistoryNote: HistoryRecord; | ||
}) => Promise<HistoryResponse>; | ||
}; | ||
}; | ||
paymentServices: { | ||
get: () => Promise<PaymentServicesResponse>; | ||
create: (paymentService?: PaymentService, args?: { | ||
summarizeErrors?: boolean; | ||
}) => Promise<PaymentServicesResponse>; | ||
}; | ||
prepayments: { | ||
@@ -425,2 +483,7 @@ get: (args?: { | ||
}) => Promise<HistoryResponse>; | ||
create: (args: { | ||
PrepaymentID: string; | ||
} & { | ||
HistoryNote: HistoryRecord; | ||
}) => Promise<HistoryResponse>; | ||
}; | ||
@@ -456,2 +519,7 @@ }; | ||
}) => Promise<HistoryResponse>; | ||
create: (args: { | ||
PurchaseOrderID: string; | ||
} & { | ||
HistoryNote: HistoryRecord; | ||
}) => Promise<HistoryResponse>; | ||
}; | ||
@@ -479,2 +547,7 @@ }; | ||
}) => Promise<HistoryResponse>; | ||
create: (args: { | ||
ReceiptID: string; | ||
} & { | ||
HistoryNote: HistoryRecord; | ||
}) => Promise<HistoryResponse>; | ||
}; | ||
@@ -481,0 +554,0 @@ }; |
@@ -129,16 +129,3 @@ "use strict"; | ||
attachments: _this.generateAttachmentsEndpoint('banktransactions'), | ||
history: { | ||
get: function (args) { return __awaiter(_this, void 0, void 0, function () { | ||
var endpoint; | ||
return __generator(this, function (_a) { | ||
endpoint = 'banktransactions'; | ||
if (args && args.BankTransactionID) { | ||
endpoint = endpoint + '/' + args.BankTransactionID; | ||
delete args.BankTransactionID; | ||
} | ||
endpoint += '/history'; | ||
return [2 /*return*/, this.oauth1Client.get(endpoint)]; | ||
}); | ||
}); } | ||
}, | ||
history: _this.generateHistoryEndpoint('banktransactions', 'BankTransactionID') | ||
}; | ||
@@ -167,16 +154,3 @@ _this.bankTransfers = { | ||
attachments: _this.generateAttachmentsEndpoint('banktransfers'), | ||
history: { | ||
get: function (args) { return __awaiter(_this, void 0, void 0, function () { | ||
var endpoint; | ||
return __generator(this, function (_a) { | ||
endpoint = 'banktransfers'; | ||
if (args && args.BankTransferID) { | ||
endpoint = endpoint + '/' + args.BankTransferID; | ||
delete args.BankTransferID; | ||
} | ||
endpoint += '/history'; | ||
return [2 /*return*/, this.oauth1Client.get(endpoint)]; | ||
}); | ||
}); } | ||
}, | ||
history: _this.generateHistoryEndpoint('banktransfers', 'BankTransferID') | ||
}; | ||
@@ -308,16 +282,3 @@ _this.brandingThemes = { | ||
attachments: _this.generateAttachmentsEndpoint('contacts'), | ||
history: { | ||
get: function (args) { return __awaiter(_this, void 0, void 0, function () { | ||
var endpoint; | ||
return __generator(this, function (_a) { | ||
endpoint = 'contacts'; | ||
if (args && args.ContactID) { | ||
endpoint = endpoint + '/' + args.ContactID; | ||
delete args.ContactID; | ||
} | ||
endpoint += '/history'; | ||
return [2 /*return*/, this.oauth1Client.get(endpoint)]; | ||
}); | ||
}); } | ||
}, | ||
history: _this.generateHistoryEndpoint('contacts', 'ContactID') | ||
}; | ||
@@ -385,16 +346,3 @@ _this.creditNotes = { | ||
attachments: _this.generateAttachmentsEndpoint('creditnotes'), | ||
history: { | ||
get: function (args) { return __awaiter(_this, void 0, void 0, function () { | ||
var endpoint; | ||
return __generator(this, function (_a) { | ||
endpoint = 'creditnotes'; | ||
if (args && args.CreditNoteID) { | ||
endpoint = endpoint + '/' + args.CreditNoteID; | ||
delete args.CreditNoteID; | ||
} | ||
endpoint += '/history'; | ||
return [2 /*return*/, this.oauth1Client.get(endpoint)]; | ||
}); | ||
}); } | ||
}, | ||
history: _this.generateHistoryEndpoint('creditnotes', 'CreditNoteID') | ||
}; | ||
@@ -478,16 +426,3 @@ _this.currencies = { | ||
}); }, | ||
history: { | ||
get: function (args) { return __awaiter(_this, void 0, void 0, function () { | ||
var endpoint; | ||
return __generator(this, function (_a) { | ||
endpoint = 'expenseclaims'; | ||
if (args && args.ExpenseClaimID) { | ||
endpoint = endpoint + '/' + args.ExpenseClaimID; | ||
delete args.ExpenseClaimID; | ||
} | ||
endpoint += '/history'; | ||
return [2 /*return*/, this.oauth1Client.get(endpoint)]; | ||
}); | ||
}); } | ||
}, | ||
history: _this.generateHistoryEndpoint('expenseclaims', 'ExpenseClaimID') | ||
}; | ||
@@ -576,16 +511,3 @@ _this.invoiceReminders = { | ||
attachments: _this.generateAttachmentsEndpoint('invoices'), | ||
history: { | ||
get: function (args) { return __awaiter(_this, void 0, void 0, function () { | ||
var endpoint; | ||
return __generator(this, function (_a) { | ||
endpoint = 'invoices'; | ||
if (args && args.InvoiceID) { | ||
endpoint = endpoint + '/' + args.InvoiceID; | ||
delete args.InvoiceID; | ||
} | ||
endpoint += '/history'; | ||
return [2 /*return*/, this.oauth1Client.get(endpoint)]; | ||
}); | ||
}); } | ||
}, | ||
history: _this.generateHistoryEndpoint('invoices', 'InvoiceID'), | ||
email: { | ||
@@ -621,16 +543,3 @@ create: function (args) { return __awaiter(_this, void 0, void 0, function () { | ||
attachments: _this.generateAttachmentsEndpoint('repeatinginvoices'), | ||
history: { | ||
get: function (args) { return __awaiter(_this, void 0, void 0, function () { | ||
var endpoint; | ||
return __generator(this, function (_a) { | ||
endpoint = 'repeatinginvoices'; | ||
if (args && args.RepeatingInvoiceID) { | ||
endpoint = endpoint + '/' + args.RepeatingInvoiceID; | ||
delete args.RepeatingInvoiceID; | ||
} | ||
endpoint += '/history'; | ||
return [2 /*return*/, this.oauth1Client.get(endpoint)]; | ||
}); | ||
}); } | ||
}, | ||
history: _this.generateHistoryEndpoint('repeatinginvoices', 'RepeatingInvoiceID') | ||
}; | ||
@@ -681,16 +590,3 @@ _this.items = { | ||
}); }, | ||
history: { | ||
get: function (args) { return __awaiter(_this, void 0, void 0, function () { | ||
var endpoint; | ||
return __generator(this, function (_a) { | ||
endpoint = 'items'; | ||
if (args && args.ItemID) { | ||
endpoint = endpoint + '/' + args.ItemID; | ||
delete args.ItemID; | ||
} | ||
endpoint += '/history'; | ||
return [2 /*return*/, this.oauth1Client.get(endpoint)]; | ||
}); | ||
}); } | ||
}, | ||
history: _this.generateHistoryEndpoint('items', 'ItemID') | ||
}; | ||
@@ -838,16 +734,3 @@ _this.journals = { | ||
}, | ||
history: { | ||
get: function (args) { return __awaiter(_this, void 0, void 0, function () { | ||
var endpoint; | ||
return __generator(this, function (_a) { | ||
endpoint = 'overpayments'; | ||
if (args && args.OverpaymentID) { | ||
endpoint = endpoint + '/' + args.OverpaymentID; | ||
delete args.OverpaymentID; | ||
} | ||
endpoint += '/history'; | ||
return [2 /*return*/, this.oauth1Client.get(endpoint)]; | ||
}); | ||
}); } | ||
}, | ||
history: _this.generateHistoryEndpoint('overpayments', 'OverpaymentID') | ||
}; | ||
@@ -887,17 +770,18 @@ _this.payments = { | ||
}); }, | ||
history: { | ||
get: function (args) { return __awaiter(_this, void 0, void 0, function () { | ||
var endpoint; | ||
return __generator(this, function (_a) { | ||
endpoint = 'payments'; | ||
if (args && args.PaymentID) { | ||
endpoint = endpoint + '/' + args.PaymentID; | ||
delete args.PaymentID; | ||
} | ||
endpoint += '/history'; | ||
return [2 /*return*/, this.oauth1Client.get(endpoint)]; | ||
}); | ||
}); } | ||
}, | ||
history: _this.generateHistoryEndpoint('payments', 'PaymentID') | ||
}; | ||
_this.paymentServices = { | ||
get: function () { return __awaiter(_this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, this.oauth1Client.get('paymentservices')]; | ||
}); | ||
}); }, | ||
create: function (paymentService, args) { return __awaiter(_this, void 0, void 0, function () { | ||
var endpoint; | ||
return __generator(this, function (_a) { | ||
endpoint = 'paymentservices' + utils_1.generateQueryString(args, true); | ||
return [2 /*return*/, this.oauth1Client.put(endpoint, paymentService)]; | ||
}); | ||
}); } | ||
}; | ||
_this.prepayments = { | ||
@@ -928,16 +812,3 @@ get: function (args) { return __awaiter(_this, void 0, void 0, function () { | ||
attachments: _this.generateAttachmentsEndpoint('prepayments'), | ||
history: { | ||
get: function (args) { return __awaiter(_this, void 0, void 0, function () { | ||
var endpoint; | ||
return __generator(this, function (_a) { | ||
endpoint = 'prepayments'; | ||
if (args && args.PrepaymentID) { | ||
endpoint = endpoint + '/' + args.PrepaymentID; | ||
delete args.PrepaymentID; | ||
} | ||
endpoint += '/history'; | ||
return [2 /*return*/, this.oauth1Client.get(endpoint)]; | ||
}); | ||
}); } | ||
}, | ||
history: _this.generateHistoryEndpoint('prepayments', 'PrepaymentID') | ||
}; | ||
@@ -999,16 +870,3 @@ _this.purchaseOrders = { | ||
}); }, | ||
history: { | ||
get: function (args) { return __awaiter(_this, void 0, void 0, function () { | ||
var endpoint; | ||
return __generator(this, function (_a) { | ||
endpoint = 'purchaseorders'; | ||
if (args && args.PurchaseOrderID) { | ||
endpoint = endpoint + '/' + args.PurchaseOrderID; | ||
delete args.PurchaseOrderID; | ||
} | ||
endpoint += '/history'; | ||
return [2 /*return*/, this.oauth1Client.get(endpoint)]; | ||
}); | ||
}); } | ||
}, | ||
history: _this.generateHistoryEndpoint('purchaseorders', 'PurchaseOrderID') | ||
}; | ||
@@ -1049,16 +907,3 @@ _this.receipts = { | ||
attachments: _this.generateAttachmentsEndpoint('receipts'), | ||
history: { | ||
get: function (args) { return __awaiter(_this, void 0, void 0, function () { | ||
var endpoint; | ||
return __generator(this, function (_a) { | ||
endpoint = 'receipts'; | ||
if (args && args.ReceiptID) { | ||
endpoint = endpoint + '/' + args.ReceiptID; | ||
delete args.ReceiptID; | ||
} | ||
endpoint += '/history'; | ||
return [2 /*return*/, this.oauth1Client.get(endpoint)]; | ||
}); | ||
}); } | ||
}, | ||
history: _this.generateHistoryEndpoint('receipts', 'ReceiptID') | ||
}; | ||
@@ -1237,2 +1082,31 @@ _this.reports = { | ||
}; | ||
AccountingAPIClient.prototype.generateHistoryEndpoint = function (endpointName, argName) { | ||
var _this = this; | ||
return { | ||
get: function (args) { return __awaiter(_this, void 0, void 0, function () { | ||
var endpoint; | ||
return __generator(this, function (_a) { | ||
endpoint = endpointName; | ||
if (args && args[argName]) { | ||
endpoint = endpoint + '/' + args[argName]; | ||
delete args[argName]; | ||
} | ||
endpoint += '/history'; | ||
return [2 /*return*/, this.oauth1Client.get(endpoint)]; | ||
}); | ||
}); }, | ||
create: function (args) { return __awaiter(_this, void 0, void 0, function () { | ||
var endpoint; | ||
return __generator(this, function (_a) { | ||
endpoint = endpointName; | ||
if (args && args[argName]) { | ||
endpoint = endpoint + '/' + args[argName]; | ||
delete args[argName]; | ||
} | ||
endpoint += '/history'; | ||
return [2 /*return*/, this.oauth1Client.put(endpoint, args.HistoryNote)]; | ||
}); | ||
}); } | ||
}; | ||
}; | ||
AccountingAPIClient.prototype.generateHeader = function (args) { | ||
@@ -1239,0 +1113,0 @@ if (args && args['If-Modified-Since']) { |
export { AccountingAPIClient } from './AccountingAPIClient'; | ||
export { ProjectsAPIClient } from './ProjectsAPIClient'; | ||
export * from './XeroError'; |
@@ -8,2 +8,4 @@ "use strict"; | ||
exports.AccountingAPIClient = AccountingAPIClient_1.AccountingAPIClient; | ||
var ProjectsAPIClient_1 = require("./ProjectsAPIClient"); | ||
exports.ProjectsAPIClient = ProjectsAPIClient_1.ProjectsAPIClient; | ||
__export(require("./XeroError")); |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { OAuth1Configuration } from '../../OAuth1HttpClient'; |
@@ -0,0 +0,0 @@ "use strict"; |
export declare const validTestCertPath: () => string; | ||
export declare function testCertString(): string; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { BaseAPIClient, XeroClientConfiguration } from '../../BaseAPIClient'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ "use strict"; |
export {}; |
@@ -61,5 +61,8 @@ "use strict"; | ||
}); | ||
it('preserves value if specified', function () { | ||
it('preserves value if specified true', function () { | ||
expect(utils_1.generateQueryString({ summarizeErrors: true }, true)).toEqual('?summarizeErrors=true'); | ||
}); | ||
it('preserves value if specified false', function () { | ||
expect(utils_1.generateQueryString({ summarizeErrors: false }, true)).toEqual('?summarizeErrors=false'); | ||
}); | ||
it('preserves order if specified with other params', function () { | ||
@@ -66,0 +69,0 @@ expect(utils_1.generateQueryString({ d: 12, summarizeErrors: true, a: 5 }, true)).toEqual('?d=12&summarizeErrors=true&a=5'); |
/// <reference types="node" /> | ||
import { IOAuth1HttpClient, AccessToken } from './OAuth1HttpClient'; | ||
import * as fs from 'fs'; | ||
import { AttachmentsResponse } from '../AccountingAPI-responses'; | ||
import { AccessToken, IOAuth1HttpClient } from './OAuth1HttpClient'; | ||
/** | ||
@@ -38,2 +38,5 @@ * TODO: Add support for the following keys: | ||
}): Promise<T>; | ||
patch<T>(endpoint: string, body: object, headers?: { | ||
[key: string]: string; | ||
}): Promise<T>; | ||
post<T>(endpoint: string, body: object, headers?: { | ||
@@ -40,0 +43,0 @@ [key: string]: string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var OAuth1HttpClient_1 = require("./OAuth1HttpClient"); | ||
var config_helper_1 = require("./config-helper"); | ||
var OAuth1HttpClient_1 = require("./OAuth1HttpClient"); | ||
/** @private */ | ||
@@ -6,0 +6,0 @@ var BaseAPIClient = /** @class */ (function () { |
@@ -0,0 +0,0 @@ /** @internalapi */ |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -67,2 +67,5 @@ /// <reference types="node" /> | ||
}) => Promise<T>; | ||
patch: <T>(endpoint: string, body: object, customHeaders?: { | ||
[key: string]: string; | ||
}) => Promise<T>; | ||
delete: <T>(endpoint: string, customHeaders?: { | ||
@@ -69,0 +72,0 @@ [key: string]: string; |
@@ -173,3 +173,3 @@ "use strict"; | ||
else { | ||
var buffer = new Buffer(data, 'binary'); | ||
var buffer = Buffer.from(data, 'binary'); | ||
writeStream.write(buffer, function () { | ||
@@ -341,2 +341,24 @@ writeStream.close(); | ||
}); }; | ||
this.patch = function (endpoint, body, customHeaders) { return __awaiter(_this, void 0, void 0, function () { | ||
var _this = this; | ||
return __generator(this, function (_a) { | ||
this.resetToDefaultHeaders(); | ||
this.oauthLib._headers = __assign({}, this._defaultHeaders, customHeaders); | ||
this.assertAccessTokenIsSet(); | ||
return [2 /*return*/, new Promise(function (resolve, reject) { | ||
_this.oauthLib.patch(_this.config.apiBaseUrl + _this.config.apiBasePath + endpoint, // url | ||
_this._state.oauth_token, _this._state.oauth_token_secret, JSON.stringify(body), // Had to do this not sure if there is another way | ||
'application/json', function (err, data, httpResponse) { | ||
// data is the body of the response | ||
if (err) { | ||
reject(err.statusCode ? new XeroError_1.XeroError(err.statusCode, err.data, httpResponse ? httpResponse.headers : null) : err); | ||
} | ||
else { | ||
var toReturn = JSON.parse(data); | ||
return resolve(toReturn); | ||
} | ||
}); | ||
})]; | ||
}); | ||
}); }; | ||
this.delete = function (endpoint, customHeaders) { return __awaiter(_this, void 0, void 0, function () { | ||
@@ -343,0 +365,0 @@ var _this = this; |
@@ -0,0 +0,0 @@ /** @internalapi */ |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { XeroClientConfiguration, BaseAPIClient } from './internals/BaseAPIClient'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ export declare class XeroError extends Error { |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ Copyright (c) 2017 Xero Limited |
{ | ||
"name": "xero-node", | ||
"version": "3.0.21", | ||
"version": "3.1.0", | ||
"description": "NodeJS Client for the Xero API, supporting Public, Private and Partner Apps", | ||
@@ -14,3 +14,2 @@ "main": "lib/index.js", | ||
"test": "tsc --noEmit && jest --config ./jestconfig.js", | ||
"test-auth": "tsc --noEmit && jest ./src/__integration_tests__/partner-example.tests.ts --config ./jestconfig.js", | ||
"test-ci": "tsc --noEmit && jest --runInBand --config ./jestconfig.js --ci --testResultsProcessor=jest-junit", | ||
@@ -29,17 +28,18 @@ "scratch": "ts-node ./src/scratch.ts", | ||
"@types/es6-promise": "3.3.0", | ||
"@types/jest": "22.1.1", | ||
"@types/jest": "^24.0.0", | ||
"@types/node": "9.4.0", | ||
"@types/puppeteer": "1.1.0", | ||
"jest": "^24.7.1", | ||
"@types/puppeteer": "^1.19.1", | ||
"jest": "^24.9.0", | ||
"jest-junit": "3.6.0", | ||
"nodemon": "^1.18.7", | ||
"opn": "5.2.0", | ||
"prettier": "^1.18.2", | ||
"prompt": "1.0.0", | ||
"puppeteer": "1.1.1", | ||
"ts-jest": "23.10.5", | ||
"puppeteer": "^1.19.0", | ||
"ts-jest": "^24.0.2", | ||
"ts-node": "4.1.0", | ||
"tslint": "5.16.0", | ||
"typedoc": "^0.14.2", | ||
"typescript": "3.4.3" | ||
"typedoc": "^0.15.0", | ||
"typescript": "3.5.3" | ||
} | ||
} |
@@ -189,5 +189,5 @@ [![npm version](https://badge.fury.io/js/xero-node.svg)](https://badge.fury.io/js/xero-node) | ||
1. Copy `private-config-example.json` to `private-config.json` in the [integration test directory](src/__integration_tests__). | ||
2. Copy it again to `1private-config.json` in the [integration test directory](src/__integration_tests__). | ||
2. Copy it again to `private-config1.json` in the [integration test directory](src/__integration_tests__). | ||
3. Overwrite the example values with your own from the [Developer Portal](https://developer.xero.com/myapps). | ||
4. (Do the same for `partner-config-example.json` if required.) | ||
4. (Do the same for `partner-config-example.json` and `xero-login.json`, if required.) | ||
5. Run `npm test` | ||
@@ -197,3 +197,3 @@ | ||
The Prepayments and Overpayments tests require Pre/Overpayments to be present in your Organisatino, again, don't worry too much if these fail for you - they run in CircleCI. | ||
The Prepayments and Overpayments tests require Pre/Overpayments to be present in your organisation, again, don't worry too much if these fail for you - they run in CircleCI. | ||
@@ -224,3 +224,3 @@ | ||
5. Writing the SDK in Typescript will allow us to provide TS types for the API's contracts, and it's what we use internally at Xero. This will also aid in self-generated docs. | ||
5. Writing the SDK in Typescript allows us to provide TS types for the API's contracts, and it's what we use internally at Xero. This also enables generated docs. | ||
@@ -233,5 +233,5 @@ ## Maintainers | ||
``` | ||
npm verion major|minor|patch | ||
npm version major|minor|patch | ||
npm publish | ||
git push origin master --tags | ||
``` |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
211680
4398
5
16
43
3