Java Code Examples for io.reactivex.rxjava3.core.Single#fromObservable()
The following examples show how to use
io.reactivex.rxjava3.core.Single#fromObservable() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RestGuild.java From catnip with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Nonnull public Single<String> modifyCurrentUsersNick(@Nonnull final String guildId, @Nullable final String nick, @Nullable final String reason) { return Single.fromObservable(catnip().requester() .queue(new OutboundRequest(Routes.MODIFY_CURRENT_USERS_NICK.withQueryString(guildId), Map.of(), JsonObject.builder().value("nick", nick).done(), reason)) .map(ResponsePayload::string)); }
Example 2
Source File: RestWebhook.java From catnip with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Nonnull @CheckReturnValue @SuppressWarnings("WeakerAccess") public Single<Message> executeWebhook(@Nonnull final String webhookId, @Nonnull final String webhookToken, @Nullable final String username, @Nullable final String avatarUrl, @Nonnull final MessageOptions options) { return Single.fromObservable(executeWebhookRaw(webhookId, webhookToken, username, avatarUrl, options) .map(entityBuilder()::createMessage)); }
Example 3
Source File: RestGuild.java From catnip with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Nonnull @CheckReturnValue public Single<Role> modifyGuildRole(@Nonnull final String guildId, @Nonnull final String roleId, @Nonnull final RoleData roleData, @Nullable final String reason) { return Single.fromObservable(modifyGuildRoleRaw(guildId, roleId, roleData, reason) .map(obj -> entityBuilder().createRole(guildId, obj))); }
Example 4
Source File: RestGuild.java From catnip with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Nonnull @CheckReturnValue public Single<Role> createGuildRole(@Nonnull final String guildId, @Nonnull final RoleData roleData, @Nullable final String reason) { return Single.fromObservable(createGuildRoleRaw(guildId, roleData, reason) .map(obj -> entityBuilder().createRole(guildId, obj))); }
Example 5
Source File: RestChannel.java From catnip with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Nonnull @CheckReturnValue public Single<CreatedInvite> createInvite(@Nonnull final String channelId, @Nullable final InviteCreateOptions options, @Nullable final String reason) { return Single.fromObservable(createInviteRaw(channelId, options, reason).map(entityBuilder()::createCreatedInvite)); }
Example 6
Source File: RestEmoji.java From catnip with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Nonnull public Single<CustomEmoji> modifyGuildEmoji(@Nonnull final String guildId, @Nonnull final String emojiId, @Nonnull final String name, @Nonnull final Collection<String> roles, @Nullable final String reason) { return Single.fromObservable(modifyGuildEmojiRaw(guildId, emojiId, name, roles, reason) .map(e -> entityBuilder().createEmoji(guildId, e)) .map(CustomEmoji.class::cast)); }
Example 7
Source File: RestGuild.java From catnip with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Nonnull @CheckReturnValue public Single<GuildEmbed> modifyGuildEmbed(@Nonnull final String guildId, @Nullable final String channelId, final boolean enabled, @Nullable final String reason) { return Single.fromObservable(modifyGuildEmbedRaw(guildId, channelId, enabled, reason) .map(entityBuilder()::createGuildEmbed)); }
Example 8
Source File: RestEmoji.java From catnip with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Nonnull public Single<CustomEmoji> createGuildEmoji(@Nonnull final String guildId, @Nonnull final String name, @Nonnull final URI imageData, @Nonnull final Collection<String> roles, @Nullable final String reason) { return Single.fromObservable(createGuildEmojiRaw(guildId, name, imageData, roles, reason) .map(e -> entityBuilder().createEmoji(guildId, e)) .map(CustomEmoji.class::cast)); }
Example 9
Source File: RestGuild.java From catnip with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Nonnull @CheckReturnValue public Single<Integer> beginGuildPrune(@Nonnull final String guildId, @Nonnegative final int days) { return Single.fromObservable(beginGuildPruneRaw(guildId, days).map(e -> e.getInt("pruned"))); }
Example 10
Source File: RestGuild.java From catnip with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Nonnull @CheckReturnValue public Single<GuildEmbed> getGuildEmbed(@Nonnull final String guildId) { return Single.fromObservable(getGuildEmbedRaw(guildId).map(entityBuilder()::createGuildEmbed)); }
Example 11
Source File: RestUser.java From catnip with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Nonnull @CheckReturnValue public Single<User> getUser(@Nonnull final String userId) { return Single.fromObservable(getUserRaw(userId).map(entityBuilder()::createUser)); }
Example 12
Source File: RestWebhook.java From catnip with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Nonnull @CheckReturnValue public Single<Webhook> getWebhook(@Nonnull final String webhookId) { return Single.fromObservable(getWebhookRaw(webhookId).map(entityBuilder()::createWebhook)); }
Example 13
Source File: RestEmoji.java From catnip with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Nonnull public Single<CustomEmoji> getGuildEmoji(@Nonnull final String guildId, @Nonnull final String emojiId) { return Single.fromObservable(getGuildEmojiRaw(guildId, emojiId) .map(e -> entityBuilder().createCustomEmoji(guildId, e))); }
Example 14
Source File: RestInvite.java From catnip with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Nonnull @CheckReturnValue public Single<Invite> deleteInvite(@Nonnull final String code, @Nullable final String reason) { return Single.fromObservable(deleteInviteRaw(code, reason).map(entityBuilder()::createInvite)); }
Example 15
Source File: RestUser.java From catnip with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Nonnull @CheckReturnValue public Single<ApplicationInfo> getCurrentApplicationInformation() { return Single.fromObservable(getCurrentApplicationInformationRaw().map(entityBuilder()::createApplicationInfo)); }
Example 16
Source File: RestUser.java From catnip with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Nonnull @CheckReturnValue public Single<DMChannel> createDM(@Nonnull final String recipientId) { return Single.fromObservable(createDMRaw(recipientId) .map(entityBuilder()::createUserDM)); }
Example 17
Source File: RestUser.java From catnip with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Nonnull @CheckReturnValue public Single<User> getCurrentUser() { return Single.fromObservable(getCurrentUserRaw().map(entityBuilder()::createUser)); }
Example 18
Source File: RestGuild.java From catnip with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Nonnull @CheckReturnValue public Single<Member> getGuildMember(@Nonnull final String guildId, @Nonnull final String userId) { return Single.fromObservable(getGuildMemberRaw(guildId, userId) .map(e -> entityBuilder().createMember(guildId, e))); }
Example 19
Source File: RestUser.java From catnip with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Nonnull @CheckReturnValue public Single<GatewayInfo> getGatewayBot() { return Single.fromObservable(getGatewayBotRaw().map(e -> entityBuilder().createGatewayInfo(e))); }
Example 20
Source File: RestChannel.java From catnip with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Nonnull public Single<Message> sendMessage(@Nonnull final String channelId, @Nonnull final MessageOptions options) { return Single.fromObservable(sendMessageRaw(channelId, options).map(entityBuilder()::createMessage)); }