xero-node
Advanced tools
Comparing version 4.28.1 to 4.29.0
@@ -5,3 +5,3 @@ /** | ||
* | ||
* The version of the OpenAPI document: 2.30.2 | ||
* The version of the OpenAPI document: 2.31.0 | ||
* Contact: api@xero.com | ||
@@ -15,3 +15,7 @@ * | ||
import http = require('http'); | ||
import { CreateUsageRecord } from '../model/appstore/createUsageRecord'; | ||
import { Subscription } from '../model/appstore/subscription'; | ||
import { UpdateUsageRecord } from '../model/appstore/updateUsageRecord'; | ||
import { UsageRecord } from '../model/appstore/usageRecord'; | ||
import { UsageRecordsList } from '../model/appstore/usageRecordsList'; | ||
import { Authentication } from '../model/appstore/models'; | ||
@@ -50,2 +54,46 @@ import { OAuth } from '../model/appstore/models'; | ||
}>; | ||
/** | ||
* | ||
* @summary Gets all usage records related to the subscription | ||
* @param subscriptionId Unique identifier for Subscription object | ||
*/ | ||
getUsageRecords(subscriptionId: string, options?: { | ||
headers: { | ||
[name: string]: string; | ||
}; | ||
}): Promise<{ | ||
response: http.IncomingMessage; | ||
body: UsageRecordsList; | ||
}>; | ||
/** | ||
* | ||
* @summary Send metered usage belonging to this subscription and subscription item | ||
* @param subscriptionId Unique identifier for Subscription object | ||
* @param subscriptionItemId The unique identifier of the subscriptionItem | ||
* @param createUsageRecord Contains the quantity for the usage record to create | ||
*/ | ||
postUsageRecords(subscriptionId: string, subscriptionItemId: string, createUsageRecord: CreateUsageRecord, options?: { | ||
headers: { | ||
[name: string]: string; | ||
}; | ||
}): Promise<{ | ||
response: http.IncomingMessage; | ||
body: UsageRecord; | ||
}>; | ||
/** | ||
* | ||
* @summary Update and existing metered usage belonging to this subscription and subscription item | ||
* @param subscriptionId Unique identifier for Subscription object | ||
* @param subscriptionItemId The unique identifier of the subscriptionItem | ||
* @param usageRecordId The unique identifier of the usage record | ||
* @param updateUsageRecord Contains the quantity for the usage record to update | ||
*/ | ||
putUsageRecords(subscriptionId: string, subscriptionItemId: string, usageRecordId: string, updateUsageRecord: UpdateUsageRecord, options?: { | ||
headers: { | ||
[name: string]: string; | ||
}; | ||
}): Promise<{ | ||
response: http.IncomingMessage; | ||
body: UsageRecord; | ||
}>; | ||
} |
@@ -6,3 +6,3 @@ "use strict"; | ||
* | ||
* The version of the OpenAPI document: 2.30.2 | ||
* The version of the OpenAPI document: 2.31.0 | ||
* Contact: api@xero.com | ||
@@ -38,3 +38,3 @@ * | ||
this._basePath = defaultBasePath; | ||
this.defaultHeaders = { 'user-agent': 'xero-node-4.28.1' }; | ||
this.defaultHeaders = { 'user-agent': 'xero-node-4.29.0' }; | ||
this._useQuerystring = false; | ||
@@ -132,4 +132,205 @@ this.binaryHeaders = {}; | ||
} | ||
/** | ||
* | ||
* @summary Gets all usage records related to the subscription | ||
* @param subscriptionId Unique identifier for Subscription object | ||
*/ | ||
getUsageRecords(subscriptionId, options = { headers: {} }) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const localVarPath = this.basePath + '/subscriptions/{subscriptionId}/usage-records' | ||
.replace('{' + 'subscriptionId' + '}', encodeURIComponent(String(subscriptionId))); | ||
let localVarQueryParameters = {}; | ||
let localVarHeaderParams = Object.assign({}, this.defaultHeaders); | ||
let localVarFormParams = {}; | ||
// verify required parameter 'subscriptionId' is not null or undefined | ||
if (subscriptionId === null || subscriptionId === undefined) { | ||
throw new Error('Required parameter subscriptionId was null or undefined when calling getUsageRecords.'); | ||
} | ||
Object.assign(localVarHeaderParams, options.headers); | ||
let localVarUseFormData = false; | ||
let localVarRequestOptions = { | ||
method: 'GET', | ||
qs: localVarQueryParameters, | ||
headers: localVarHeaderParams, | ||
uri: localVarPath, | ||
useQuerystring: this._useQuerystring, | ||
json: true, | ||
}; | ||
let authenticationPromise = Promise.resolve(); | ||
authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions)); | ||
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); | ||
return authenticationPromise.then(() => { | ||
if (Object.keys(localVarFormParams).length) { | ||
if (localVarUseFormData) { | ||
localVarRequestOptions.formData = localVarFormParams; | ||
} | ||
else { | ||
localVarRequestOptions.form = localVarFormParams; | ||
} | ||
} | ||
return new Promise((resolve, reject) => { | ||
localVarRequest(localVarRequestOptions, (error, response, body) => { | ||
if (error) { | ||
reject(error); | ||
} | ||
else { | ||
body = models_1.ObjectSerializer.deserialize(body, "UsageRecordsList"); | ||
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { | ||
resolve({ response: response, body: body }); | ||
} | ||
else { | ||
reject({ response: response, body: body }); | ||
} | ||
} | ||
}); | ||
}); | ||
}); | ||
}); | ||
} | ||
/** | ||
* | ||
* @summary Send metered usage belonging to this subscription and subscription item | ||
* @param subscriptionId Unique identifier for Subscription object | ||
* @param subscriptionItemId The unique identifier of the subscriptionItem | ||
* @param createUsageRecord Contains the quantity for the usage record to create | ||
*/ | ||
postUsageRecords(subscriptionId, subscriptionItemId, createUsageRecord, options = { headers: {} }) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const localVarPath = this.basePath + '/subscriptions/{subscriptionId}/items/{subscriptionItemId}/usage-records' | ||
.replace('{' + 'subscriptionId' + '}', encodeURIComponent(String(subscriptionId))) | ||
.replace('{' + 'subscriptionItemId' + '}', encodeURIComponent(String(subscriptionItemId))); | ||
let localVarQueryParameters = {}; | ||
let localVarHeaderParams = Object.assign({}, this.defaultHeaders); | ||
let localVarFormParams = {}; | ||
// verify required parameter 'subscriptionId' is not null or undefined | ||
if (subscriptionId === null || subscriptionId === undefined) { | ||
throw new Error('Required parameter subscriptionId was null or undefined when calling postUsageRecords.'); | ||
} | ||
// verify required parameter 'subscriptionItemId' is not null or undefined | ||
if (subscriptionItemId === null || subscriptionItemId === undefined) { | ||
throw new Error('Required parameter subscriptionItemId was null or undefined when calling postUsageRecords.'); | ||
} | ||
// verify required parameter 'createUsageRecord' is not null or undefined | ||
if (createUsageRecord === null || createUsageRecord === undefined) { | ||
throw new Error('Required parameter createUsageRecord was null or undefined when calling postUsageRecords.'); | ||
} | ||
Object.assign(localVarHeaderParams, options.headers); | ||
let localVarUseFormData = false; | ||
let localVarRequestOptions = { | ||
method: 'POST', | ||
qs: localVarQueryParameters, | ||
headers: localVarHeaderParams, | ||
uri: localVarPath, | ||
useQuerystring: this._useQuerystring, | ||
json: true, | ||
body: models_1.ObjectSerializer.serialize(createUsageRecord, "CreateUsageRecord") | ||
}; | ||
let authenticationPromise = Promise.resolve(); | ||
authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions)); | ||
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); | ||
return authenticationPromise.then(() => { | ||
if (Object.keys(localVarFormParams).length) { | ||
if (localVarUseFormData) { | ||
localVarRequestOptions.formData = localVarFormParams; | ||
} | ||
else { | ||
localVarRequestOptions.form = localVarFormParams; | ||
} | ||
} | ||
return new Promise((resolve, reject) => { | ||
localVarRequest(localVarRequestOptions, (error, response, body) => { | ||
if (error) { | ||
reject(error); | ||
} | ||
else { | ||
body = models_1.ObjectSerializer.deserialize(body, "UsageRecord"); | ||
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { | ||
resolve({ response: response, body: body }); | ||
} | ||
else { | ||
reject({ response: response, body: body }); | ||
} | ||
} | ||
}); | ||
}); | ||
}); | ||
}); | ||
} | ||
/** | ||
* | ||
* @summary Update and existing metered usage belonging to this subscription and subscription item | ||
* @param subscriptionId Unique identifier for Subscription object | ||
* @param subscriptionItemId The unique identifier of the subscriptionItem | ||
* @param usageRecordId The unique identifier of the usage record | ||
* @param updateUsageRecord Contains the quantity for the usage record to update | ||
*/ | ||
putUsageRecords(subscriptionId, subscriptionItemId, usageRecordId, updateUsageRecord, options = { headers: {} }) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const localVarPath = this.basePath + '/subscriptions/{subscriptionId}/items/{subscriptionItemId}/usage-records/{usageRecordId}' | ||
.replace('{' + 'subscriptionId' + '}', encodeURIComponent(String(subscriptionId))) | ||
.replace('{' + 'subscriptionItemId' + '}', encodeURIComponent(String(subscriptionItemId))) | ||
.replace('{' + 'usageRecordId' + '}', encodeURIComponent(String(usageRecordId))); | ||
let localVarQueryParameters = {}; | ||
let localVarHeaderParams = Object.assign({}, this.defaultHeaders); | ||
let localVarFormParams = {}; | ||
// verify required parameter 'subscriptionId' is not null or undefined | ||
if (subscriptionId === null || subscriptionId === undefined) { | ||
throw new Error('Required parameter subscriptionId was null or undefined when calling putUsageRecords.'); | ||
} | ||
// verify required parameter 'subscriptionItemId' is not null or undefined | ||
if (subscriptionItemId === null || subscriptionItemId === undefined) { | ||
throw new Error('Required parameter subscriptionItemId was null or undefined when calling putUsageRecords.'); | ||
} | ||
// verify required parameter 'usageRecordId' is not null or undefined | ||
if (usageRecordId === null || usageRecordId === undefined) { | ||
throw new Error('Required parameter usageRecordId was null or undefined when calling putUsageRecords.'); | ||
} | ||
// verify required parameter 'updateUsageRecord' is not null or undefined | ||
if (updateUsageRecord === null || updateUsageRecord === undefined) { | ||
throw new Error('Required parameter updateUsageRecord was null or undefined when calling putUsageRecords.'); | ||
} | ||
Object.assign(localVarHeaderParams, options.headers); | ||
let localVarUseFormData = false; | ||
let localVarRequestOptions = { | ||
method: 'PUT', | ||
qs: localVarQueryParameters, | ||
headers: localVarHeaderParams, | ||
uri: localVarPath, | ||
useQuerystring: this._useQuerystring, | ||
json: true, | ||
body: models_1.ObjectSerializer.serialize(updateUsageRecord, "UpdateUsageRecord") | ||
}; | ||
let authenticationPromise = Promise.resolve(); | ||
authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions)); | ||
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); | ||
return authenticationPromise.then(() => { | ||
if (Object.keys(localVarFormParams).length) { | ||
if (localVarUseFormData) { | ||
localVarRequestOptions.formData = localVarFormParams; | ||
} | ||
else { | ||
localVarRequestOptions.form = localVarFormParams; | ||
} | ||
} | ||
return new Promise((resolve, reject) => { | ||
localVarRequest(localVarRequestOptions, (error, response, body) => { | ||
if (error) { | ||
reject(error); | ||
} | ||
else { | ||
body = models_1.ObjectSerializer.deserialize(body, "UsageRecord"); | ||
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { | ||
resolve({ response: response, body: body }); | ||
} | ||
else { | ||
reject({ response: response, body: body }); | ||
} | ||
} | ||
}); | ||
}); | ||
}); | ||
}); | ||
} | ||
} | ||
exports.AppStoreApi = AppStoreApi; | ||
//# sourceMappingURL=appStoreApi.js.map |
@@ -5,3 +5,3 @@ /** | ||
* | ||
* The version of the OpenAPI document: 2.30.2 | ||
* The version of the OpenAPI document: 2.31.0 | ||
* Contact: api@xero.com | ||
@@ -8,0 +8,0 @@ * |
@@ -6,3 +6,3 @@ "use strict"; | ||
* | ||
* The version of the OpenAPI document: 2.30.2 | ||
* The version of the OpenAPI document: 2.31.0 | ||
* Contact: api@xero.com | ||
@@ -38,3 +38,3 @@ * | ||
this._basePath = defaultBasePath; | ||
this.defaultHeaders = { 'user-agent': 'xero-node-4.28.1' }; | ||
this.defaultHeaders = { 'user-agent': 'xero-node-4.29.0' }; | ||
this._useQuerystring = false; | ||
@@ -41,0 +41,0 @@ this.binaryHeaders = {}; |
@@ -5,3 +5,3 @@ /** | ||
* | ||
* The version of the OpenAPI document: 2.30.2 | ||
* The version of the OpenAPI document: 2.31.0 | ||
* Contact: api@xero.com | ||
@@ -8,0 +8,0 @@ * |
@@ -6,3 +6,3 @@ "use strict"; | ||
* | ||
* The version of the OpenAPI document: 2.30.2 | ||
* The version of the OpenAPI document: 2.31.0 | ||
* Contact: api@xero.com | ||
@@ -38,3 +38,3 @@ * | ||
this._basePath = defaultBasePath; | ||
this.defaultHeaders = { 'user-agent': 'xero-node-4.28.1' }; | ||
this.defaultHeaders = { 'user-agent': 'xero-node-4.29.0' }; | ||
this._useQuerystring = false; | ||
@@ -41,0 +41,0 @@ this.binaryHeaders = {}; |
@@ -5,3 +5,3 @@ /** | ||
* | ||
* The version of the OpenAPI document: 2.30.2 | ||
* The version of the OpenAPI document: 2.31.0 | ||
* Contact: api@xero.com | ||
@@ -8,0 +8,0 @@ * |
@@ -6,3 +6,3 @@ "use strict"; | ||
* | ||
* The version of the OpenAPI document: 2.30.2 | ||
* The version of the OpenAPI document: 2.31.0 | ||
* Contact: api@xero.com | ||
@@ -38,3 +38,3 @@ * | ||
this._basePath = defaultBasePath; | ||
this.defaultHeaders = { 'user-agent': 'xero-node-4.28.1' }; | ||
this.defaultHeaders = { 'user-agent': 'xero-node-4.29.0' }; | ||
this._useQuerystring = false; | ||
@@ -41,0 +41,0 @@ this.binaryHeaders = {}; |
@@ -5,3 +5,3 @@ /** | ||
* | ||
* The version of the OpenAPI document: 2.30.2 | ||
* The version of the OpenAPI document: 2.31.0 | ||
* Contact: api@xero.com | ||
@@ -8,0 +8,0 @@ * |
@@ -6,3 +6,3 @@ "use strict"; | ||
* | ||
* The version of the OpenAPI document: 2.30.2 | ||
* The version of the OpenAPI document: 2.31.0 | ||
* Contact: api@xero.com | ||
@@ -38,3 +38,3 @@ * | ||
this._basePath = defaultBasePath; | ||
this.defaultHeaders = { 'user-agent': 'xero-node-4.28.1' }; | ||
this.defaultHeaders = { 'user-agent': 'xero-node-4.29.0' }; | ||
this._useQuerystring = false; | ||
@@ -41,0 +41,0 @@ this.binaryHeaders = {}; |
@@ -5,3 +5,3 @@ /** | ||
* | ||
* The version of the OpenAPI document: 2.30.2 | ||
* The version of the OpenAPI document: 2.31.0 | ||
* Contact: api@xero.com | ||
@@ -8,0 +8,0 @@ * |
@@ -5,3 +5,3 @@ /** | ||
* | ||
* The version of the OpenAPI document: 2.30.2 | ||
* The version of the OpenAPI document: 2.31.0 | ||
* Contact: api@xero.com | ||
@@ -8,0 +8,0 @@ * |
@@ -5,3 +5,3 @@ /** | ||
* | ||
* The version of the OpenAPI document: 2.30.2 | ||
* The version of the OpenAPI document: 2.31.0 | ||
* Contact: api@xero.com | ||
@@ -8,0 +8,0 @@ * |
@@ -5,3 +5,3 @@ /** | ||
* | ||
* The version of the OpenAPI document: 2.30.2 | ||
* The version of the OpenAPI document: 2.31.0 | ||
* Contact: api@xero.com | ||
@@ -8,0 +8,0 @@ * |
@@ -42,3 +42,3 @@ import { LineItemItem } from '././lineItemItem'; | ||
/** | ||
* If you wish to omit either of the <Quantity> or <UnitAmount> you can provide a LineAmount and Xero will calculate the missing amount for you. The line amount reflects the discounted price if a DiscountRate has been used . i.e LineAmount = Quantity * Unit Amount * ((100 – DiscountRate)/100) | ||
* If you wish to omit either the Quantity or UnitAmount you can provide a LineAmount and Xero will calculate the missing amount for you. The line amount reflects the discounted price if either a DiscountRate or DiscountAmount has been used i.e. LineAmount = Quantity * Unit Amount * ((100 - DiscountRate)/100) or LineAmount = (Quantity * UnitAmount) - DiscountAmount | ||
*/ | ||
@@ -55,3 +55,3 @@ 'lineAmount'?: number; | ||
/** | ||
* Discount amount being applied to a line item. Only supported on ACCREC invoices - ACCPAY invoices and credit notes in Xero do not support discounts. | ||
* Discount amount being applied to a line item. Only supported on ACCREC invoices and quotes. ACCPAY invoices and credit notes in Xero do not support discounts. | ||
*/ | ||
@@ -58,0 +58,0 @@ 'discountAmount'?: number; |
@@ -0,1 +1,2 @@ | ||
export * from '././createUsageRecord'; | ||
export * from '././plan'; | ||
@@ -7,2 +8,5 @@ export * from '././price'; | ||
export * from '././subscriptionItem'; | ||
export * from '././updateUsageRecord'; | ||
export * from '././usageRecord'; | ||
export * from '././usageRecordsList'; | ||
import localVarRequest = require('request'); | ||
@@ -9,0 +13,0 @@ export declare class ObjectSerializer { |
@@ -14,2 +14,3 @@ "use strict"; | ||
exports.VoidAuth = exports.OAuth = exports.ApiKeyAuth = exports.HttpBasicAuth = exports.ObjectSerializer = void 0; | ||
__exportStar(require("././createUsageRecord"), exports); | ||
__exportStar(require("././plan"), exports); | ||
@@ -21,2 +22,6 @@ __exportStar(require("././price"), exports); | ||
__exportStar(require("././subscriptionItem"), exports); | ||
__exportStar(require("././updateUsageRecord"), exports); | ||
__exportStar(require("././usageRecord"), exports); | ||
__exportStar(require("././usageRecordsList"), exports); | ||
const createUsageRecord_1 = require("././createUsageRecord"); | ||
const plan_1 = require("././plan"); | ||
@@ -28,2 +33,5 @@ const price_1 = require("././price"); | ||
const subscriptionItem_1 = require("././subscriptionItem"); | ||
const updateUsageRecord_1 = require("././updateUsageRecord"); | ||
const usageRecord_1 = require("././usageRecord"); | ||
const usageRecordsList_1 = require("././usageRecordsList"); | ||
/* tslint:disable:no-unused-variable */ | ||
@@ -47,2 +55,3 @@ let primitives = [ | ||
let typeMap = { | ||
"CreateUsageRecord": createUsageRecord_1.CreateUsageRecord, | ||
"Plan": plan_1.Plan, | ||
@@ -54,2 +63,5 @@ "Price": price_1.Price, | ||
"SubscriptionItem": subscriptionItem_1.SubscriptionItem, | ||
"UpdateUsageRecord": updateUsageRecord_1.UpdateUsageRecord, | ||
"UsageRecord": usageRecord_1.UsageRecord, | ||
"UsageRecordsList": usageRecordsList_1.UsageRecordsList, | ||
}; | ||
@@ -56,0 +68,0 @@ class ObjectSerializer { |
{ | ||
"name": "xero-node", | ||
"version": "4.28.1", | ||
"version": "4.29.0", | ||
"description": "Xero NodeJS OAuth 2.0 client for xero-node", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
5032681
1659
85246