Learn R Programming

twitteR (version 1.1.9)

directMessage-class: Class "directMessage": A class to represent Twitter Direct Messages

Description

Provides a model representing direct messages (DMs) from Twitter

Arguments

Fields

text:
Text of the DM
recipient:
A user object representing the recipient of the message
recipientSN:
Screen name of the recipient
recipientID:
ID number of the recipient
sender:
A user object representing the sender of the message
senderSN:
Screen name of the sender
senderID:
ID number of the sender
created:
When the messages was created

Methods

destroy:
Deletes this DM from Twitter. A wrapper around dmDestroy
toDataFrame:
Converts this into a one row data.frame, with each field representing a column. This can also be accomplished by the S4 style as.data.frame(objectName).

Details

The directMessage class is implemented as a reference class. As there should be no backwards compatibility issues, there are no S4 methods provided as with the user and status classes. An instance of a generator for this class is provided as a convenience to the user as it is configured to handle most standard cases. To access this generator, use the object dmFactory. Accessor set & get methods are provided for every field using reference class $accessors() methodology (see setRefClass for more details). As an example, the sender field could be accessed using object$getSender() and object$setSender().

The constructor of this object assumes that the user is passing in a JSON encoded Twitter Direct Message. It is also possible to directly pass in the arguments.

See Also

dmGet, dmSend, dmDestroy, setRefClass

Examples

Run this code
  ## Not run: 
#     dm <- dmFactory$new(text='foo', recipientSN='blah')
#     dm$getText()
#   
#     ## assume 'json' is the return from a Twitter call
#     dm <- dmFactory$new(json)
#     dm$getSenderID()
#   ## End(Not run)

Run the code above in your browser using DataLab