TCHMessageBuilder Class Reference

Inherits from NSObject
Declared in TCHMessageBuilder.h

Overview

The builder of a message to send later in a conversation.

– setBody:

Set the new message body.

- (instancetype)setBody:(nullable NSString *)body

Parameters

body

The body for the new message.

Return Value

Self for chaining.

Discussion

Set the new message body.

Declared In

TCHMessageBuilder.h

– setSubject:

Set the new message subject.

- (instancetype)setSubject:(nullable NSString *)subject

Parameters

subject

The subject of the message.

Return Value

Self for chaining.

Discussion

Set the new message subject.

The subject is a part of the message which will be sent to email participants of the conversation (if any) as subject field of an email.

If there is no email participants in the conversation - other chat participants will receive this field as a part of the message anyway.

Declared In

TCHMessageBuilder.h

– setAttributes:error:

Sets user defined attributes for the new message.

- (instancetype)setAttributes:(nullable TCHJsonAttributes *)attributes error:(TCHError *_Nullable *_Nullable)error

Parameters

attributes

The new developer-defined extensible attributes for this message. (Supported types are NSString, NSNumber, NSArray, NSDictionary and NSNull)

error

An error which will indicate the failure of setting the attributes.

Return Value

A reference to this options object for convenience in chaining or nil in the event the attributes could not be parsed/updated.

Discussion

Sets user defined attributes for the new message.

Declared In

TCHMessageBuilder.h

– setContentTemplateWithSid:

Defines the message as a templated one. This method uses default variables.

- (instancetype)setContentTemplateWithSid:(nullable NSString *)contentTemplateSid

Parameters

contentTemplateSid

The content template sid. For all available sids take a look at [TwilioConversationsClient getContentTemplatesWithCompletion:]

Return Value

Self for chaining.

Discussion

Defines the message as a templated one. This method uses default variables.

Use [setContentTemplateWithSid:contentVariables:] to specify custom values of variables.

The message will ignore all data provided as a body, subject, and/or media.

Declared In

TCHMessageBuilder.h

– setContentTemplateWithSid:contentTemplateVariables:

Defines the message as a templated one. This method uses default variables.

- (instancetype)setContentTemplateWithSid:(nullable NSString *)contentTemplateSid contentTemplateVariables:(NSArray<TCHContentTemplateVariable*> *)contentTemplateVariables

Parameters

contentTemplateSid

The content template sid. For all available sids take a look at [TwilioConversationsClient getContentTemplatesWithCompletion:]

contentTemplateVariables

The array of variables to replace the default values in the template. The content template sid must be set for a non-empty array of variables.

Return Value

Self for chaining.

Discussion

Defines the message as a templated one. This method uses default variables.

The message will ignore all data provided as a body, subject, and/or media.

Declared In

TCHMessageBuilder.h

– addMediaWithInputStream:contentType:

Adds the media attachment for the the new message.

- (instancetype)addMediaWithInputStream:(NSInputStream *)inputStream contentType:(NSString *)contentType

Parameters

inputStream

The content of the attachment.

contentType

The type of the attachment.

Return Value

Self for chaining.

Discussion

Adds the media attachment for the the new message.

Declared In

TCHMessageBuilder.h

– addMediaWithInputStream:contentType:filename:

Adds the media attachment for the the new message.

- (instancetype)addMediaWithInputStream:(NSInputStream *)inputStream contentType:(NSString *)contentType filename:(nullable NSString *)filename

Parameters

inputStream

The content of the attachment.

contentType

The type of the attachment.

filename

The name of the attachment.

Return Value

Self for chaining.

Discussion

Adds the media attachment for the the new message.

Declared In

TCHMessageBuilder.h

– addMediaWithInputStream:contentType:filename:listener:

Adds the media attachment for the the new message.

- (instancetype)addMediaWithInputStream:(NSInputStream *)inputStream contentType:(NSString *)contentType filename:(nullable NSString *)filename listener:(nullable TCHMediaMessageListener *)listener

Parameters

inputStream

The content of the attachment.

contentType

The type of the attachment.

filename

The name of the attachment.

listener

The listener for monitoring the upload process.

Return Value

Self for chaining.

Discussion

Adds the media attachment for the the new message.

Declared In

TCHMessageBuilder.h

– addMediaWithData:contentType:

Adds the media attachment for the the new message.

- (instancetype)addMediaWithData:(NSData *)mediaData contentType:(NSString *)contentType

Parameters

mediaData

The data of attachment.

contentType

The type of the attachment.

Return Value

Self for chaining.

Discussion

Adds the media attachment for the the new message.

Declared In

TCHMessageBuilder.h

– addMediaWithData:contentType:filename:

Adds the media attachment for the the new message.

- (instancetype)addMediaWithData:(NSData *)mediaData contentType:(NSString *)contentType filename:(nullable NSString *)filename

Parameters

mediaData

The data of attachment.

contentType

The type of the attachment.

filename

The name of the attachment.

Return Value

Self for chaining.

Discussion

Adds the media attachment for the the new message.

Declared In

TCHMessageBuilder.h

– addMediaWithData:contentType:filename:listener:

Adds the media attachment for the the new message.

- (instancetype)addMediaWithData:(NSData *)mediaData contentType:(NSString *)contentType filename:(nullable NSString *)filename listener:(nullable TCHMediaMessageListener *)listener

Parameters

mediaData

The data of attachment.

contentType

The type of the attachment.

filename

The name of the attachment.

listener

The listener for monitoring the upload process.

Return Value

Self for chaining.

Discussion

Adds the media attachment for the the new message.

Declared In

TCHMessageBuilder.h

– setEmailBody:contentType:

Set the new email body for the new message.

- (instancetype)setEmailBody:(nullable NSString *)emailBody contentType:(NSString *)contentType

Parameters

emailBody

The content of the email body.

contentType

The type of the email body [TCHConversationLimits emailBodiesAllowedContentTypes].

Return Value

Self for chaining.

Discussion

Set the new email body for the new message.

This email body will be sent to email participants of the conversation.

Declared In

TCHMessageBuilder.h

– setEmailBody:contentType:listener:

Set the new email body for the new message.

- (instancetype)setEmailBody:(nullable NSString *)emailBody contentType:(NSString *)contentType listener:(nullable TCHMediaMessageListener *)listener

Parameters

emailBody

The content of the email body.

contentType

The type of the email body [TCHConversationLimits emailBodiesAllowedContentTypes].

listener

The listener of the uploading status of the email body.

Return Value

Self for chaining.

Discussion

Set the new email body for the new message.

This email body will be sent to email participants of the conversation.

Declared In

TCHMessageBuilder.h

– setEmailBodyWithInputStream:contentType:

Set the new email body for the new message.

- (instancetype)setEmailBodyWithInputStream:(nullable NSInputStream *)inputStream contentType:(NSString *)contentType

Parameters

inputStream

The input stream of a data containing the email body.

contentType

The type of the email body [TCHConversationLimits emailBodiesAllowedContentTypes].

Return Value

Self for chaining.

Discussion

Set the new email body for the new message.

This body will be sent to email participants of the conversation.

Declared In

TCHMessageBuilder.h

– setEmailBodyWithInputStream:contentType:listener:

Set the new email body for the new message.

- (instancetype)setEmailBodyWithInputStream:(nullable NSInputStream *)inputStream contentType:(NSString *)contentType listener:(nullable TCHMediaMessageListener *)listener

Parameters

inputStream

The input stream of a data containing the email body.

contentType

The type of the email body [TCHConversationLimits emailBodiesAllowedContentTypes].

listener

The listener of uploading status of the email body.

Return Value

Self for chaining.

Discussion

Set the new email body for the new message.

This body will be sent to email participants of the conversation.

Declared In

TCHMessageBuilder.h

– setEmailHistory:contentType:

Set the new email history for the new message.

- (instancetype)setEmailHistory:(nullable NSString *)emailHistory contentType:(NSString *)contentType

Parameters

emailHistory

The content of the email history.

contentType

The type of the email history [TCHConversationLimits emailHistoriesAllowedContentTypes].

Return Value

Self for chaining.

Discussion

Set the new email history for the new message.

This email history will be sent to email participants of the conversation.

Declared In

TCHMessageBuilder.h

– setEmailHistory:contentType:listener:

Set the new email history for the new message.

- (instancetype)setEmailHistory:(nullable NSString *)emailHistory contentType:(NSString *)contentType listener:(nullable TCHMediaMessageListener *)listener

Parameters

emailHistory

The content of the email history.

contentType

The type of the email history [TCHConversationLimits emailHistoriesAllowedContentTypes].

listener

The listener of the uploading status of the email history.

Return Value

Self for chaining.

Discussion

Set the new email history for the new message.

This email history will be sent to email participants of the conversation.

Declared In

TCHMessageBuilder.h

– setEmailHistoryWithInputStream:contentType:

Set the new email history for the new message.

- (instancetype)setEmailHistoryWithInputStream:(nullable NSInputStream *)inputStream contentType:(NSString *)contentType

Parameters

inputStream

The input stream of a data containing the email history.

contentType

The type of the email history [TCHConversationLimits emailHistoriesAllowedContentTypes].

Return Value

Self for chaining.

Discussion

Set the new email history for the new message.

This email history will be sent to email participants of the conversation.

Declared In

TCHMessageBuilder.h

– setEmailHistoryWithInputStream:contentType:listener:

Set the new email history for the new message.

- (instancetype)setEmailHistoryWithInputStream:(nullable NSInputStream *)inputStream contentType:(NSString *)contentType listener:(nullable TCHMediaMessageListener *)listener

Parameters

inputStream

The input stream of a data containing the email history.

contentType

The type of the email history [TCHConversationLimits emailHistoriesAllowedContentTypes].

listener

The listener of the uploading status of the email history.

Return Value

Self for chaining.

Discussion

Set the new email history for the new message.

This email history will be sent to email participants of the conversation.

Declared In

TCHMessageBuilder.h

– build

Builds the new TCHUnsentMessage with which you can send the message later.

- (TCHUnsentMessage *)build

Return Value

The message which is ready to send.

Discussion

Builds the new TCHUnsentMessage with which you can send the message later.

Declared In

TCHMessageBuilder.h

– buildAndSendWithCompletion:

Builds new TCHUnsentMessage and sends it immediately.

- (TCHCancellationToken *)buildAndSendWithCompletion:(nullable TCHMessageCompletion)completion

Parameters

completion

The completion to report the result of the operation that receives sent TCHMessage object.

Discussion

Builds new TCHUnsentMessage and sends it immediately.

Declared In

TCHMessageBuilder.h