Ticket
Extends:
Ingresse Ticket's API
API to get, create, update or remove tickets.
Example:
var Sdk = require('ingresse-sdk');
var ingresse = new Sdk();
// You will have access to this API
// after instantiate the Sdk.
var ticket = ingresse.ticket;
Constructor Summary
Public Constructor | ||
public |
constructor(custom: object) Ticket Api |
Member Summary
Public Members | ||
public |
settings: * |
Method Summary
Public Methods | ||
public |
Associate a passkey to items |
|
public |
batchPasskeys(eventId: number, data: object, query: Object): Promise Create many passkeys and associate it for many tickets. |
|
public |
createPasskey(data: object, query: Object): Promise Create a new passkey |
|
public |
deleteExternal(eventId: number, query: object): Promise Delete External Item |
|
public |
Delete External Item Code |
|
public |
deletePasskey(id: number, data: object, query: Object): Promise Delete a passkey |
|
public |
getExternalCodes(itemId: number, query: object): Promise Get External Item Codes |
|
public |
Get item by ID |
|
public |
Get a list of ticket items
This method will return a |
|
public |
getPasskeyById(id: number, query: Object): Promise Get the ticket passkeys by id. |
|
public |
getPasskeys(query: Object): Promise Get the ticket passkeys list. |
|
public |
Get the tax calculated |
|
public |
getTriggers(id: number, query: object): Promise Get a list of triggers
This method will return a |
|
public |
Get a list of ticket types
This method will return a |
|
public |
newAttribute(id: number, attribute: object, query: object): * Create new ticket attribute |
|
public |
Create new Ticket item |
|
public |
newSalePeriod(id: number, salePeriod: object, query: object): * Create new sale period to ticket |
|
public |
Create new values to ticket |
|
public |
removeItem(id: string | number, query: object): Promise Remove a ticket item |
|
public |
updateAttribute(id: number, attribute: object, query: object): * Updated ticket attribute |
|
public |
Update a ticket item |
|
public |
Update a passkey |
|
public |
updateSalePeriod(id: number, salePeriod: object, query: object): * Updated ticket sale period |
|
public |
updateValues(id: number, values: object, query: object): * Updated ticket values |
|
public |
uploadExternals(eventId: number, formData: object, query: object): Promise Upload External Codes via CSV file |
Inherited Summary
From class RequestHandler | ||
public |
auth: * |
|
public |
settings: * |
|
public |
Delete resource |
|
public |
Get resource |
|
public |
Post resource |
|
public |
Put resource |
|
public |
Create new request promise |
|
public |
Set Environment |
|
public |
Set API url |
|
public |
Upload files |
Public Constructors
public constructor(custom: object) source
Ticket Api
Override:
RequestHandler#constructorParams:
Name | Type | Attribute | Description |
custom | object |
|
Initialize Ticket Api settings. |
Public Members
Public Methods
public associatePasskey(id: string | number, data: object, query: Object): Promise source
Associate a passkey to items
Example:
...
ingresse.ticket.associatePasskey(820, { itemIds: [ 1, 2, 3] })
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
public batchPasskeys(eventId: number, data: object, query: Object): Promise source
Create many passkeys and associate it for many tickets.
Params:
Name | Type | Attribute | Description |
eventId | number | The event id. |
|
data | object | Data with passkeys details. |
|
data.codes | array[string] | Array with passkeys strings. |
|
data.itemIds | array[integer] |
|
Array with tickets id. |
data.start | date |
|
The date that this passkey will works (can not be lower than current day). |
data.finish | date |
|
The data that this passkey will stop works. |
data.limit | integer |
|
The usage limit. |
query | Object |
|
The request parameters. |
Example:
...
ingresse.ticket.batchPasskeys(200, {
"codes" : ["passkey1", "passkey2", "passkey3"],
"itemIds": [1,2,3],
"limit" : 100,
"start" : "2018-10-31 12:00:00",
"finish" : "2019-11-10 20:20:00"
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
public createPasskey(data: object, query: Object): Promise source
Create a new passkey
Params:
Name | Type | Attribute | Description |
data | object | Data to create a new passkey. |
|
data.eventId | number | The event id. |
|
data.passkey | string | The passkey. |
|
data.start | date |
|
The date that this passkey will works. |
data.finish | date |
|
The data that this passkey will stop works. |
query | Object |
|
The request parameters. |
Example:
...
ingresse.ticket.createPasskey({
"eventId": 26899,
"passkey": "passkey",
"start" : "2018-10-31 12:00:00",
"finish" : "2019-11-10 20:20:00"
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
public deleteExternal(eventId: number, query: object): Promise source
Delete External Item
Example:
....
ingresse.ticket.deleteExternal(21232, { name: 'My Ticket Name' })
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
public deleteExternalCode(itemId: number, codeId: number | string, query: object): Promise source
Delete External Item Code
Example:
....
ingresse.ticket.deleteExternalCode(123456, 987654321)
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
public deletePasskey(id: number, data: object, query: Object): Promise source
Delete a passkey
Example:
...
ingresse.ticket.deletePasskey(123)
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
public getExternalCodes(itemId: number, query: object): Promise source
Get External Item Codes
Example:
....
ingresse.ticket.getExternalCodes(456789)
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
public getItem(id: string | number, query: object): Promise source
Get item by ID
Example:
...
ingresse.ticket.getItem(200)
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
public getItems(query: object): Promise source
Get a list of ticket items
This method will return a Promise
so you can use
.then
and .catch
methdos.
Params:
Name | Type | Attribute | Description |
query | object |
|
Optional request parameters. |
Example:
...
ingresse.ticket.getItems()
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
public getPasskeyById(id: number, query: Object): Promise source
Get the ticket passkeys by id.
Example:
...
ingresse.ticket.getPasskeyById(id, query)
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
public getPasskeys(query: Object): Promise source
Get the ticket passkeys list.
Example:
...
var query = {
eventId: 123, // must be informed one eventId.
};
ingresse.ticket.getPasskeys(query)
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
public getTax(query: Object): Promise source
Get the tax calculated
Params:
Name | Type | Attribute | Description |
query | Object | The request parameters. |
|
query.producerId | Number |
|
The producer id. |
query.eventId | Number |
|
The event id. |
query.price | Number |
|
The ticket's price in cents. |
query.taxDistribution | Number |
|
The tax payed by customer (in percent). |
query.tax | Number |
|
The custom tax in cents. |
Example:
...
var query = {
eventId: 123, // must be informed one eventId or producerId.
taxDistribution: 50
};
ingresse.ticket.getTax(query)
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
public getTriggers(id: number, query: object): Promise source
Get a list of triggers
This method will return a Promise
so you can use
.then
and .catch
methods.
Example:
...
ingresse.ticket.getTriggers(10000040)
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
public getTypes(query: object): Promise source
Get a list of ticket types
This method will return a Promise
so you can use
.then
and .catch
methods.
Params:
Name | Type | Attribute | Description |
query | object |
|
Optional request parameters. |
Example:
...
ingresse.ticket.getTypes()
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
public newAttribute(id: number, attribute: object, query: object): * source
Create new ticket attribute
Return:
* | Promise |
Example:
...
ingresse.ticket.newAttribute(200, { key: 'min', value: '1', type: 'integer' })
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
public newItem(data: object, query: object): Promise source
Create new Ticket item
Example:
...
ingresse.ticket.newItem({ name: 'My Ticket Name' })
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
public newSalePeriod(id: number, salePeriod: object, query: object): * source
Create new sale period to ticket
Return:
* | Promise |
Example:
...
ingresse.ticket.newSalePeriod({
appCategoryId: 1,
start: '2016-10-10 20:20:00',
finish: '2016-11-10 20:20:00',
available: 1
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
public newValues(id: number, values: object, query: object): * source
Create new values to ticket
Return:
* | Promise |
Example:
...
ingresse.ticket.newValues({
price: 10000,
feeSale: 500,
feeProducer: 500
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
public removeItem(id: string | number, query: object): Promise source
Remove a ticket item
Example:
...
ingresse.ticket.removeItem(200)
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
public updateAttribute(id: number, attribute: object, query: object): * source
Updated ticket attribute
Return:
* | Promise |
Example:
...
ingresse.ticket.updateAttribute(200, { key: 'minimum', value: 5, type: 'integer' })
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
public updateItem(id: string | number, data: object, query: object): Promise source
Update a ticket item
Example:
...
ingresse.ticket.updateItem(200, { name: 'My Updated Ticket Name' })
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
public updatePasskey(id: string | number, data: object, query: Object): Promise source
Update a passkey
Params:
Name | Type | Attribute | Description |
id | string | number | The passkey id to update. |
|
data | object | Data to update a passkey. |
|
data.eventId | number | The event id. |
|
data.passkey | string | The passkey. |
|
data.start | date |
|
The date that this passkey will works (can not be lower than current day). |
data.finish | date |
|
The data that this passkey will stop works. |
query | Object |
|
The request parameters. |
Example:
...
ingresse.ticket.updatePasskey(200, {
"eventId": 26899,
"passkey": "passkey",
"start" : "2018-10-31 12:00:00",
"finish" : "2019-11-10 20:20:00"
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
public updateSalePeriod(id: number, salePeriod: object, query: object): * source
Updated ticket sale period
Return:
* | Promise |
Example:
...
ingresse.ticket.updateSalePeriod(200, {
appCategoryId: 1,
start: '2016-11-20 10:10:00',
finish: '2016-12-20 10:10:00',
available: 1
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
public updateValues(id: number, values: object, query: object): * source
Updated ticket values
Return:
* | Promise |
Example:
...
ingresse.ticket.updateValues(200, {
price: 20000,
feeSale: 1000,
feeProducer: 1000
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
public uploadExternals(eventId: number, formData: object, query: object): Promise source
Upload External Codes via CSV file
Example:
....
var uploadData = new FormData();
uploadData.append('file', document.getElementById('input-file-id').value);
ingresse.ticket.uploadExternals(21232, uploadData)
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});