Search in sources :

Example 1 with SettingsReply

use of me.semx11.autotip.api.reply.impl.SettingsReply in project Hyperium by HyperiumClient.

the class Autotip method reloadGlobalSettings.

public void reloadGlobalSettings() {
    SettingsReply reply = SettingsRequest.of(this).execute();
    if (!reply.isSuccess()) {
        throw new AssertionError("Connection error while fetching global settings");
    }
    globalSettings = reply.getSettings();
}
Also used : SettingsReply(me.semx11.autotip.api.reply.impl.SettingsReply)

Example 2 with SettingsReply

use of me.semx11.autotip.api.reply.impl.SettingsReply in project Hyperium by HyperiumClient.

the class SettingsRequest method execute.

@Override
public SettingsReply execute() {
    HttpUriRequest request = GetBuilder.of(this).addParameter("v", version.get()).build();
    Optional<Reply> optional = RequestHandler.getReply(this, request.getURI());
    return optional.map(reply -> (SettingsReply) reply).orElseGet(() -> new SettingsReply(false));
}
Also used : HttpUriRequest(org.apache.http.client.methods.HttpUriRequest) Autotip(me.semx11.autotip.Autotip) RequestHandler(me.semx11.autotip.api.RequestHandler) SettingsReply(me.semx11.autotip.api.reply.impl.SettingsReply) RequestType(me.semx11.autotip.api.RequestType) GetBuilder(me.semx11.autotip.api.GetBuilder) Reply(me.semx11.autotip.api.reply.Reply) Version(me.semx11.autotip.util.Version) Optional(java.util.Optional) HttpUriRequest(org.apache.http.client.methods.HttpUriRequest) Request(me.semx11.autotip.api.request.Request) SettingsReply(me.semx11.autotip.api.reply.impl.SettingsReply) Reply(me.semx11.autotip.api.reply.Reply) SettingsReply(me.semx11.autotip.api.reply.impl.SettingsReply)

Aggregations

SettingsReply (me.semx11.autotip.api.reply.impl.SettingsReply)2 Optional (java.util.Optional)1 Autotip (me.semx11.autotip.Autotip)1 GetBuilder (me.semx11.autotip.api.GetBuilder)1 RequestHandler (me.semx11.autotip.api.RequestHandler)1 RequestType (me.semx11.autotip.api.RequestType)1 Reply (me.semx11.autotip.api.reply.Reply)1 Request (me.semx11.autotip.api.request.Request)1 Version (me.semx11.autotip.util.Version)1 HttpUriRequest (org.apache.http.client.methods.HttpUriRequest)1