-
Notifications
You must be signed in to change notification settings - Fork 7
81 implement guild template api #90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ea7091e
81 implement guild template api
surajkumar d46a8a4
Fix for Optional values
notyourhabibti 2c31c93
Removed comment, OffsetDateTime is already in ISO-8601
notyourhabibti b1ce2dc
Removed comment, object is complete
notyourhabibti 588549b
Implement X-Audit-Log-Reason
notyourhabibti 978611b
Removed TODO, IllegalArgumentException is sufficient
notyourhabibti 1ae167a
Implemented TODO comment and created WidgetStyle
notyourhabibti 8215dd3
Added Forum Media Thread Message Param object
notyourhabibti File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
.../java/com/javadiscord/jdi/internal/api/guild_template/CreateGuildFromTemplateRequest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.javadiscord.jdi.internal.api.guild_template; | ||
|
||
import com.javadiscord.jdi.internal.api.DiscordRequest; | ||
import com.javadiscord.jdi.internal.api.DiscordRequestBuilder; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
import java.util.Optional; | ||
|
||
public record CreateGuildFromTemplateRequest( | ||
String templateCode, String name, Optional<String> icon) implements DiscordRequest { | ||
|
||
@Override | ||
public DiscordRequestBuilder create() { | ||
Map<String, String> body = new HashMap<>(); | ||
body.put("name", name); | ||
icon.ifPresent(it -> body.put("icon", it)); | ||
|
||
return new DiscordRequestBuilder() | ||
.post() | ||
.path("/guilds/templates/%s".formatted(templateCode)) | ||
.body(body); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...main/java/com/javadiscord/jdi/internal/api/guild_template/CreateGuildTemplateRequest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.javadiscord.jdi.internal.api.guild_template; | ||
|
||
import com.javadiscord.jdi.internal.api.DiscordRequest; | ||
import com.javadiscord.jdi.internal.api.DiscordRequestBuilder; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
import java.util.Optional; | ||
|
||
public record CreateGuildTemplateRequest(long guildId, String name, Optional<String> description) | ||
implements DiscordRequest { | ||
|
||
@Override | ||
public DiscordRequestBuilder create() { | ||
Map<String, String> body = new HashMap<>(); | ||
body.put("name", name); | ||
description.ifPresent(d -> body.put("description", d)); | ||
|
||
return new DiscordRequestBuilder() | ||
.post() | ||
.path("/guilds/%s/templates".formatted(guildId)) | ||
.body(body); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...main/java/com/javadiscord/jdi/internal/api/guild_template/DeleteGuildTemplateRequest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.javadiscord.jdi.internal.api.guild_template; | ||
|
||
import com.javadiscord.jdi.internal.api.DiscordRequest; | ||
import com.javadiscord.jdi.internal.api.DiscordRequestBuilder; | ||
|
||
public record DeleteGuildTemplateRequest(long guildId, String templateCode) | ||
implements DiscordRequest { | ||
|
||
@Override | ||
public DiscordRequestBuilder create() { | ||
return new DiscordRequestBuilder() | ||
.delete() | ||
.path("/guilds/%s/templates/%s".formatted(guildId, templateCode)); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...rc/main/java/com/javadiscord/jdi/internal/api/guild_template/GetGuildTemplateRequest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.javadiscord.jdi.internal.api.guild_template; | ||
|
||
import com.javadiscord.jdi.internal.api.DiscordRequest; | ||
import com.javadiscord.jdi.internal.api.DiscordRequestBuilder; | ||
|
||
public record GetGuildTemplateRequest(String templateCode) implements DiscordRequest { | ||
|
||
@Override | ||
public DiscordRequestBuilder create() { | ||
return new DiscordRequestBuilder() | ||
.get() | ||
.path("/guilds/templates/%s".formatted(templateCode)); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...c/main/java/com/javadiscord/jdi/internal/api/guild_template/GetGuildTemplatesRequest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.javadiscord.jdi.internal.api.guild_template; | ||
|
||
import com.javadiscord.jdi.internal.api.DiscordRequest; | ||
import com.javadiscord.jdi.internal.api.DiscordRequestBuilder; | ||
|
||
public record GetGuildTemplatesRequest(long guildId) implements DiscordRequest { | ||
|
||
@Override | ||
public DiscordRequestBuilder create() { | ||
return new DiscordRequestBuilder().get().path("/guilds/%s/templates".formatted(guildId)); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...main/java/com/javadiscord/jdi/internal/api/guild_template/ModifyGuildTemplateRequest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.javadiscord.jdi.internal.api.guild_template; | ||
|
||
import com.javadiscord.jdi.internal.api.DiscordRequest; | ||
import com.javadiscord.jdi.internal.api.DiscordRequestBuilder; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
import java.util.Optional; | ||
|
||
public record ModifyGuildTemplateRequest( | ||
long guildId, String templateCode, Optional<String> name, Optional<String> description) | ||
implements DiscordRequest { | ||
|
||
@Override | ||
public DiscordRequestBuilder create() { | ||
Map<String, String> body = new HashMap<>(); | ||
name.ifPresent(n -> body.put("name", n)); | ||
description.ifPresent(desc -> body.put("description", desc)); | ||
|
||
return new DiscordRequestBuilder() | ||
.patch() | ||
.path("/guilds/%s/templates/%s".formatted(guildId, templateCode)) | ||
.body(body); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...c/main/java/com/javadiscord/jdi/internal/api/guild_template/SyncGuildTemplateRequest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.javadiscord.jdi.internal.api.guild_template; | ||
|
||
import com.javadiscord.jdi.internal.api.DiscordRequest; | ||
import com.javadiscord.jdi.internal.api.DiscordRequestBuilder; | ||
|
||
public record SyncGuildTemplateRequest(long guildId, String templateCode) | ||
implements DiscordRequest { | ||
|
||
@Override | ||
public DiscordRequestBuilder create() { | ||
return new DiscordRequestBuilder() | ||
.put() | ||
.path("/guilds/%s/templates/%s".formatted(guildId, templateCode)); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,8 +7,6 @@ | |
|
||
import java.time.OffsetDateTime; | ||
|
||
// TODO: finish implementation | ||
// https://discord.com/developers/docs/resources/guild#integration-object | ||
Comment on lines
-10
to
-11
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is not done add it back |
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public record Integration( | ||
@JsonProperty("id") long id, | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dont remove this todo