|
10 | 10 |
|
11 | 11 | import com.google.gson.JsonArray; |
12 | 12 | import com.google.gson.JsonElement; |
| 13 | +import com.google.gson.JsonObject; |
13 | 14 | import net.dec4234.javadestinyapi.material.DestinyAPI; |
14 | 15 | import net.dec4234.javadestinyapi.material.user.BungieUser; |
15 | 16 | import net.dec4234.javadestinyapi.utils.HttpUtils; |
@@ -99,6 +100,37 @@ public void abdicateFoundership(BungieUser bungieUser) { |
99 | 100 | hu.urlRequestPOSTOauth("https://www.bungie.net/Platform/GroupV2/" + clan.getClanID() + "/Admin/AbdicateFoundership/" + bungieUser.getMembershipType() + "/" + bungieUser.getID() + "/", ""); |
100 | 101 | } |
101 | 102 |
|
| 103 | + /** |
| 104 | + * Adds a new optional conversation to the clan |
| 105 | + * |
| 106 | + * @param chatName The name of the chat |
| 107 | + * @param clanChatSecuritySetting The security setting of the chat |
| 108 | + */ |
| 109 | + public void addOptionalConversation(String chatName, ClanChatSecuritySetting clanChatSecuritySetting) { |
| 110 | + JsonObject jsonObject = new JsonObject(); |
| 111 | + jsonObject.addProperty("chatName", chatName); |
| 112 | + jsonObject.addProperty("chatSecurity", clanChatSecuritySetting.getSetting()); |
| 113 | + |
| 114 | + hu.urlRequestPOSTOauth("https://www.bungie.net/Platform/GroupV2/" + clan.getClanID() + "/Admin/OptionalConversations/Add/", jsonObject.toString()); |
| 115 | + } |
| 116 | + |
| 117 | + /** |
| 118 | + * Edits an optional conversation |
| 119 | + * |
| 120 | + * @param conversationID The ID of the conversation |
| 121 | + * @param chatEnabled Whether or not the chat is enabled |
| 122 | + * @param chatName The name of the chat |
| 123 | + * @param clanChatSecuritySetting The security setting of the chat |
| 124 | + */ |
| 125 | + public void editOptionalConversation(String conversationID, boolean chatEnabled, String chatName, ClanChatSecuritySetting clanChatSecuritySetting) { |
| 126 | + JsonObject jsonObject = new JsonObject(); |
| 127 | + jsonObject.addProperty("chatName", chatName); |
| 128 | + jsonObject.addProperty("chatSecurity", clanChatSecuritySetting.getSetting()); |
| 129 | + jsonObject.addProperty("chatEnabled", chatEnabled); |
| 130 | + |
| 131 | + hu.urlRequestPOSTOauth("https://www.bungie.net/Platform/GroupV2/" + clan.getClanID() + "/Admin/OptionalConversations/" + conversationID + "/Edit/", jsonObject.toString()); |
| 132 | + } |
| 133 | + |
102 | 134 | /** |
103 | 135 | * Gets a list of members who have been banned from the clan |
104 | 136 | * |
@@ -130,6 +162,25 @@ public List<BungieUser> getPendingMembers() { |
130 | 162 | return temp; |
131 | 163 | } |
132 | 164 |
|
| 165 | + /** |
| 166 | + * Returns a list of members who have been invited to the clan |
| 167 | + * |
| 168 | + * Has pagination feature that is not implemented because what clan would have more than 50 invited users? |
| 169 | + * |
| 170 | + * @return The list of invited users |
| 171 | + */ |
| 172 | + public List<BungieUser> getInvitedMembers() { |
| 173 | + List<BungieUser> temp = new ArrayList<>(); |
| 174 | + |
| 175 | + JsonArray ja = hu.urlRequestGETOauth("https://www.bungie.net/Platform/GroupV2/" + clan.getClanID() + "/Members/Invited/?components=200").getAsJsonObject("Response").getAsJsonArray("results"); |
| 176 | + |
| 177 | + for(JsonElement je : ja) { |
| 178 | + temp.add(new BungieUser(je.getAsJsonObject().getAsJsonObject("destinyUserInfo").get("membershipId").getAsString())); |
| 179 | + } |
| 180 | + |
| 181 | + return temp; |
| 182 | + } |
| 183 | + |
133 | 184 | /** |
134 | 185 | * Check if a BungieUser is a pending applicant without the performance overhead of creating multiple BungieUsers |
135 | 186 | */ |
|
0 commit comments