Skip to content
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

Add support for server templates #876

Merged
merged 14 commits into from Mar 28, 2021
Merged

Conversation

quanticc
Copy link
Member

@quanticc quanticc commented Mar 28, 2021

This PR is based off #831, applying requested changes: removing templates from StateHolder and rearranging some methods.

Close #791

Redstoneguy129 and others added 10 commits January 6, 2021 09:12
Added routes to the Discord API
Created the Service for Template and edited a template route
RestTemplate entity and new method to templateservice and restclient
Added all the routes with comments.
Almost finished, need to optimise and provide access to the values.
Mostly sorted just came across an annoying error
Can now call all the values given in the template request and also fixed guild creation through template.
…iscord4J into Redstoneguy129-feature/templates
@quanticc quanticc added area/core Related to core module: events, entities, clients, specs area/rest Related to the rest module: request-stream, routes, rest-api feature-request Request for a new library feature or behavior labels Mar 28, 2021
@quanticc quanticc added this to the 3.1.4 milestone Mar 28, 2021
@quanticc quanticc linked an issue Mar 28, 2021 that may be closed by this pull request
@@ -0,0 +1,214 @@
package discord4j.core.object;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing license header

Copy link
Member

@darichey darichey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing on naming: Template or GuildTemplate? All of the specs use the latter. I think it would be good to rename the class to match.

There are also many unnecessary import and formatting changes that shouldn't be included in this PR.

Many of the classes are missing javadoc and license headers

import java.util.Optional;
import java.util.function.Consumer;

public class Template implements DiscordObject {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing javadoc

*
* @return the template code (unique ID)
*/
public final String getCode() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think these methods need to be final. Most of our entity classes are final, though.

}

/**
* Requests to delete this template while optionally specifying a reason.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to specify the reason? (does that even show up in Audit Log?)

@@ -1368,6 +1383,18 @@ public OptionalInt getMaxMembers() {
.map(data -> new ExtendedInvite(gateway, data));
}

/**
* Requests to retrieve the invites of the guild.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Requests to retrieve the invites of the guild.
* Requests to retrieve the templates of the guild.

/**
* Requests to retrieve the invites of the guild.
*
* @return A {@link Flux} that continually emits the {@link ExtendedInvite invites} of the guild. If an error is
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @return A {@link Flux} that continually emits the {@link ExtendedInvite invites} of the guild. If an error is
* @return A {@link Flux} that continually emits the {@link Template templates} of the guild. If an error is

@quanticc quanticc merged commit b25064e into 3.1.x Mar 28, 2021
@quanticc quanticc deleted the Redstoneguy129-feature/templates branch March 28, 2021 23:13
quanticc added a commit that referenced this pull request Mar 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core Related to core module: events, entities, clients, specs area/rest Related to the rest module: request-stream, routes, rest-api feature-request Request for a new library feature or behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Server Templates
3 participants