Constructor
new ConnectionEvents(connection)
Parameters:
Name | Type | Description |
---|---|---|
connection |
Connection |
- Source:
Members
delete
- Source:
Methods
addAttachment(eventId, callback, the) → {Event}
Parameters:
Name | Type | Description |
---|---|---|
eventId |
String | |
callback |
ConnectionEvents~eventCreatedOnTheAPI | |
the |
FormData | formData to post for fileUpload. On node.js refers to pryv.utility.forgeFormData |
- Source:
Returns:
event
- Type
- Event
batchWithData(eventsData, callback, callBackWithEventsBeforeRequestopt) → {Array.<Event>}
//TODO rename to batch //TODO make it NewEventLike compatible //TODO once it support an array of mixed values Event and EventLike, the, no need for callBackWithEventsBeforeRequest at it will. A dev who want Event object just have to create them before This is the prefered method to create events in batch
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
eventsData |
Array.<Object> |
|
|
callback |
ConnectionEvents~eventBatchCreatedOnTheAPI | ||
callBackWithEventsBeforeRequest |
function |
<optional> |
mostly for testing purposes |
- Source:
Returns:
events
- Type
- Array.<Event>
create(event, callback, startopt) → {Event}
This is the preferred method to create an event, or to create it on the API. The function return the newly created object.. It will be updated when posted on the API.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
event |
NewEventLike |
|
||
callback |
ConnectionEvents~eventCreatedOnTheAPI | |||
start |
Boolean |
<optional> |
false | if set to true will POST the event to /events/start |
- Source:
Returns:
event
- Type
- Event
createWithAttachment(event, callback, the) → {Event}
Parameters:
Name | Type | Description |
---|---|---|
event |
NewEventLike |
|
callback |
ConnectionEvents~eventCreatedOnTheAPI | |
the |
FormData | formData to post for fileUpload. On node.js refers to pryv.utility.forgeFormData |
- Source:
Returns:
event
- Type
- Event
get(filter, doneCallback, partialResultCallback)
Parameters:
Name | Type | Description |
---|---|---|
filter |
FilterLike | |
doneCallback |
ConnectionEvents~getCallback | |
partialResultCallback |
ConnectionEvents~partialResultCallback |
- Source:
Example
// get events from the Diary stream
conn.events.get({streamId : 'diary'},
function(events) {
console.log('got ' + events.length + ' events)
}
);
getAttachment(eventId, callback, the) → {Event}
Parameters:
Name | Type | Description |
---|---|---|
eventId |
String | |
callback |
ConnectionEvents~eventCreatedOnTheAPI | |
the |
FormData | formData to post for fileUpload. On node.js refers to pryv.utility.forgeFormData |
- Source:
Returns:
event
- Type
- Event
removeAttachment(eventId, callback, fileName) → {Event}
Parameters:
Name | Type | Description |
---|---|---|
eventId |
String | |
callback |
ConnectionEvents~eventCreatedOnTheAPI | |
fileName |
String |
- Source:
Returns:
event
- Type
- Event
start(event, callback) → {Event}
This is the preferred method to create and start an event, Starts a new period event. This is equivalent to starting an event with a null duration. In singleActivity streams, also stops the previously running period event if any.
Parameters:
Name | Type | Description |
---|---|---|
event |
NewEventLike |
|
callback |
ConnectionEvents~eventCreatedOnTheAPI |
- Source:
Returns:
event
- Type
- Event
stopEvent(event, dateopt, callback) → {Event}
Stop an event by it's Id
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
event |
EventLike |
|
||
date |
Date |
<optional> |
now | the date to set to stop the event |
callback |
ConnectionEvents~eventStoppedOnTheAPI |
- Source:
Returns:
event
- Type
- Event
stopStream(stream, dateopt, typeopt, callback) → {Event}
Stop any event in this stream
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
stream |
StreamLike |
|
||
date |
Date |
<optional> |
now | the date to set to stop the event |
type |
String |
<optional> |
null | stop any matching eventType is this stream. |
callback |
ConnectionEvents~eventStoppedOnTheAPI |
- Source:
Returns:
event
- Type
- Event
trashWithId(eventId, callback)
Parameters:
Name | Type | Description |
---|---|---|
eventId |
String | |
callback |
Connection~requestCallback |
- Source:
update(event, callback)
Parameters:
Name | Type | Description |
---|---|---|
event |
Event | |
callback |
Connection~requestCallback |
- Source:
Type Definitions
eventBatchCreatedOnTheAPI(error, events)
Called when batch create an array of events on the API
Parameters:
Name | Type | Description |
---|---|---|
error |
Object | eventual error |
events |
Array.<Event> |
- Source:
eventCreatedOnTheAPI(error, event)
Called when an event is created on the API
Parameters:
Name | Type | Description |
---|---|---|
error |
Object | eventual error |
event |
Event |
- Source:
eventStoppedOnTheAPI(error, stoppedEventId)
Called when an event is created on the API
Parameters:
Name | Type | Description |
---|---|---|
error |
Object | eventual error |
stoppedEventId |
String | or null if event not found |
- Source:
getCallback(error, result)
Called with the desired Events as result.
Parameters:
Name | Type | Description |
---|---|---|
error |
Object | eventual error |
result |
Array.<Event> |
- Source:
partialResultCallback(result)
Called each time a "part" of the result is received
Parameters:
Name | Type | Description |
---|---|---|
result |
Array.<Event> |
- Source: