本文整理汇总了Java中com.twilio.chat.ErrorInfo类的典型用法代码示例。如果您正苦于以下问题:Java ErrorInfo类的具体用法?Java ErrorInfo怎么用?Java ErrorInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ErrorInfo类属于com.twilio.chat包,在下文中一共展示了ErrorInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLastConsumedMessageIndex
import com.twilio.chat.ErrorInfo; //导入依赖的package包/类
@ReactMethod
public void getLastConsumedMessageIndex(String channelSid, final Promise promise) {
loadMessagesFromChannelSid(channelSid, new CallbackListener<Messages>() {
@Override
public void onError(ErrorInfo errorInfo) {
super.onError(errorInfo);
promise.reject("get-last-consumped-message-index","Error occurred while attempting to getLastConsumedMessageIndex.");
}
@Override
public void onSuccess(Messages messages) {
Long lastConsumedMessageIndex = messages.getLastConsumedMessageIndex();
if (lastConsumedMessageIndex != null) {
promise.resolve(Integer.valueOf(lastConsumedMessageIndex.intValue()));
} else {
promise.resolve(null);
}
}
});
}
示例2: getUserChannels
import com.twilio.chat.ErrorInfo; //导入依赖的package包/类
@ReactMethod
public void getUserChannels(final Promise promise) {
channels().getUserChannels(new CallbackListener<Paginator<Channel>>() {
@Override
public void onError(final ErrorInfo errorInfo) {
super.onError(errorInfo);
promise.reject("get-user-channels-error", "Error occurred while attempting to getUserChannels.");
}
@Override
public void onSuccess(final Paginator<Channel> channelPaginator) {
for (Channel channel: channelPaginator.getItems()) {
createListener(channel);
}
String uuid = RCTTwilioChatPaginator.setPaginator(channelPaginator);
promise.resolve(RCTConvert.Paginator(channelPaginator, uuid, "Channel"));
}
});
}
示例3: getPublicChannels
import com.twilio.chat.ErrorInfo; //导入依赖的package包/类
@ReactMethod
public void getPublicChannels(final Promise promise) {
channels().getPublicChannels(new CallbackListener<Paginator<ChannelDescriptor>>() {
@Override
public void onError(final ErrorInfo errorInfo) {
super.onError(errorInfo);
promise.reject("get-public-channels-error", "Error occurred while attempting to getPublicChannels.");
}
@Override
public void onSuccess(final Paginator<ChannelDescriptor> channelDescriptorPaginator) {
String uuid = RCTTwilioChatPaginator.setPaginator(channelDescriptorPaginator);
promise.resolve(RCTConvert.Paginator(channelDescriptorPaginator, uuid, "ChannelDescriptor"));
}
});
}
示例4: createChannel
import com.twilio.chat.ErrorInfo; //导入依赖的package包/类
@ReactMethod
public void createChannel(ReadableMap options, final Promise promise) {
final JSONObject attributes = RCTConvert.readableMapToJson(options.getMap("attributes"));
final String uniqueName = options.getString("uniqueName");
String friendlyName = options.getString("friendlyName");
Channel.ChannelType type = (options.getString("type").compareTo("CHANNEL_TYPE_PRIVATE") == 0) ? Channel.ChannelType.PRIVATE : Channel.ChannelType.PUBLIC;
channels().channelBuilder()
.withUniqueName(uniqueName)
.withFriendlyName(friendlyName)
.withType(type)
.withAttributes(attributes)
.build(new CallbackListener<Channel>() {
@Override
public void onError(final ErrorInfo errorInfo) {
super.onError(errorInfo);
promise.reject("create-channel-error", "Error occurred while attempting to createChannel.");
}
@Override
public void onSuccess(final Channel newChannel) {
promise.resolve(RCTConvert.Channel(newChannel));
}
});
}
示例5: requestNextPageChannelDescriptors
import com.twilio.chat.ErrorInfo; //导入依赖的package包/类
@ReactMethod
public void requestNextPageChannelDescriptors(String sid, final Promise promise) {
final RCTTwilioChatPaginator tmp = RCTTwilioChatPaginator.getInstance();
Paginator<ChannelDescriptor> _paginator = (Paginator<ChannelDescriptor>)tmp.paginators.get(sid);
_paginator.requestNextPage(new CallbackListener<Paginator<ChannelDescriptor>>() {
@Override
public void onError(ErrorInfo errorInfo) {
super.onError(errorInfo);
promise.reject("request-next-page", "Error occurred while attempting to request the next page. Error Message: " + errorInfo.getErrorText());
}
@Override
public void onSuccess(Paginator<ChannelDescriptor> paginator) {
String uuid = RCTTwilioChatPaginator.setPaginator(paginator);
promise.resolve(RCTConvert.Paginator(paginator, uuid, "ChannelDescriptor"));
}
});
}
示例6: requestNextPageChannels
import com.twilio.chat.ErrorInfo; //导入依赖的package包/类
public void requestNextPageChannels(String sid, final Promise promise) {
final RCTTwilioChatPaginator tmp = RCTTwilioChatPaginator.getInstance();
Paginator<Channel> _paginator = (Paginator<Channel>)tmp.paginators.get(sid);
_paginator.requestNextPage(new CallbackListener<Paginator<Channel>>() {
@Override
public void onError(ErrorInfo errorInfo) {
super.onError(errorInfo);
promise.reject("request-next-page", "Error occurred while attempting to request the next page. Error Message: " + errorInfo.getErrorText());
}
@Override
public void onSuccess(Paginator<Channel> paginator) {
String uuid = RCTTwilioChatPaginator.setPaginator(paginator);
promise.resolve(RCTConvert.Paginator(paginator, uuid, "Channel"));
}
});
}
示例7: requestNextPageMembers
import com.twilio.chat.ErrorInfo; //导入依赖的package包/类
public void requestNextPageMembers(String sid, final Promise promise) {
final RCTTwilioChatPaginator tmp = RCTTwilioChatPaginator.getInstance();
Paginator<Member> _paginator = (Paginator<Member>)tmp.paginators.get(sid);
_paginator.requestNextPage(new CallbackListener<Paginator<Member>>() {
@Override
public void onError(ErrorInfo errorInfo) {
super.onError(errorInfo);
promise.reject("request-next-page", "Error occurred while attempting to request the next page. Error Message: " + errorInfo.getErrorText());
}
@Override
public void onSuccess(Paginator<Member> paginator) {
String uuid = RCTTwilioChatPaginator.setPaginator(paginator);
promise.resolve(RCTConvert.Paginator(paginator, uuid, "Member"));
}
});
}
示例8: register
import com.twilio.chat.ErrorInfo; //导入依赖的package包/类
@ReactMethod
public void register(String token) {
RCTTwilioChatClient tmp = RCTTwilioChatClient.getInstance();
StatusListener listener = new StatusListener() {
@Override
public void onError(ErrorInfo errorInfo) {
super.onError(errorInfo);
}
@Override
public void onSuccess() {
}
};
tmp.client.registerGCMToken(token, listener);
}
示例9: unregister
import com.twilio.chat.ErrorInfo; //导入依赖的package包/类
@ReactMethod
public void unregister(String token) {
RCTTwilioChatClient tmp = RCTTwilioChatClient.getInstance();
StatusListener listener = new StatusListener() {
@Override
public void onError(ErrorInfo errorInfo) {
super.onError(errorInfo);
}
@Override
public void onSuccess() {
}
};
tmp.client.unregisterGCMToken(token, listener);
}
示例10: setFriendlyName
import com.twilio.chat.ErrorInfo; //导入依赖的package包/类
@ReactMethod
public void setFriendlyName(String friendlyName, final Promise promise) {
RCTTwilioChatClient tmp = RCTTwilioChatClient.getInstance();
StatusListener listener = new StatusListener() {
@Override
public void onError(ErrorInfo errorInfo) {
super.onError(errorInfo);
promise.reject("set-friendly-name-error", "Error occurred while attempting to setFriendlyName on user.");
}
@Override
public void onSuccess() {
promise.resolve(true);
}
};
tmp.client.getMyUserInfo().setFriendlyName(friendlyName, listener);
}
示例11: setAttributes
import com.twilio.chat.ErrorInfo; //导入依赖的package包/类
@ReactMethod
public void setAttributes(ReadableMap attributes, final Promise promise) {
RCTTwilioChatClient tmp = RCTTwilioChatClient.getInstance();
JSONObject json = RCTConvert.readableMapToJson(attributes);
StatusListener listener = new StatusListener() {
@Override
public void onError(ErrorInfo errorInfo) {
super.onError(errorInfo);
promise.reject("set-attributes-error", "Error occurred while attempting to setAttributes on user.");
}
@Override
public void onSuccess() {
promise.resolve(true);
}
};
tmp.client.getMyUserInfo().setAttributes(json, listener);
}
示例12: setCurrentChannel
import com.twilio.chat.ErrorInfo; //导入依赖的package包/类
public void setCurrentChannel(Channel currentChannel, final StatusListener handler) {
if (currentChannel == null) {
this.currentChannel = null;
return;
}
if (!currentChannel.equals(this.currentChannel)) {
setMessageInputEnabled(false);
this.currentChannel = currentChannel;
this.currentChannel.addListener(this);
if (this.currentChannel.getStatus() == Channel.ChannelStatus.JOINED) {
loadMessages(handler);
} else {
this.currentChannel.join(new StatusListener() {
@Override
public void onSuccess() {
loadMessages(handler);
}
@Override
public void onError(ErrorInfo errorInfo) {
}
});
}
}
}
示例13: extractFromChannelDescriptor
import com.twilio.chat.ErrorInfo; //导入依赖的package包/类
private void extractFromChannelDescriptor(Paginator<ChannelDescriptor> paginator,
final TaskCompletionListener<List<Channel>, String> listener) {
final List<Channel> channels = new ArrayList<>();
final AtomicInteger channelDescriptorCount = new AtomicInteger(paginator.getItems().size());
for (ChannelDescriptor channelDescriptor : paginator.getItems()) {
channelDescriptor.getChannel(new CallbackListener<Channel>() {
@Override
public void onSuccess(Channel channel) {
channels.add(channel);
int channelDescriptorsLeft = channelDescriptorCount.decrementAndGet();
if(channelDescriptorsLeft == 0) {
listener.onSuccess(channels);
}
}
@Override
public void onError(ErrorInfo errorInfo) {
listener.onError(errorInfo.getErrorText());
}
});
}
}
示例14: createChannelWithName
import com.twilio.chat.ErrorInfo; //导入依赖的package包/类
public void createChannelWithName(String name, final StatusListener handler) {
this.channelsObject
.channelBuilder()
.withFriendlyName(name)
.withType(ChannelType.PUBLIC)
.build(new CallbackListener<Channel>() {
@Override
public void onSuccess(final Channel newChannel) {
handler.onSuccess();
}
@Override
public void onError(ErrorInfo errorInfo) {
handler.onError(errorInfo);
}
});
}
示例15: createGeneralChannelWithCompletion
import com.twilio.chat.ErrorInfo; //导入依赖的package包/类
private void createGeneralChannelWithCompletion(final StatusListener listener) {
this.channelsObject
.channelBuilder()
.withFriendlyName(defaultChannelName)
.withUniqueName(defaultChannelUniqueName)
.withType(ChannelType.PUBLIC)
.build(new CallbackListener<Channel>() {
@Override
public void onSuccess(final Channel channel) {
ChannelManager.this.generalChannel = channel;
ChannelManager.this.channels.add(channel);
joinGeneralChannelWithCompletion(listener);
}
@Override
public void onError(ErrorInfo errorInfo) {
listener.onError(errorInfo);
}
});
}