Search in sources :

Example 1 with LocaleReply

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

the class Autotip method reloadLocale.

public void reloadLocale() {
    LocaleReply reply = LocaleRequest.of(this).execute();
    if (!reply.isSuccess()) {
        throw new IllegalStateException("Could not fetch locale");
    }
    localeHolder = reply.getLocaleHolder();
}
Also used : LocaleReply(me.semx11.autotip.api.reply.impl.LocaleReply)

Example 2 with LocaleReply

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

the class LocaleRequest method execute.

@Override
public LocaleReply execute() {
    HttpUriRequest request = GetBuilder.of(this).addParameter("lang", locale.toLanguageTag()).addParameter("v", version.get()).build();
    Optional<Reply> optional = RequestHandler.getReply(this, request.getURI());
    return optional.map(reply -> (LocaleReply) reply).orElseGet(() -> new LocaleReply(false));
}
Also used : HttpUriRequest(org.apache.http.client.methods.HttpUriRequest) Autotip(me.semx11.autotip.Autotip) RequestHandler(me.semx11.autotip.api.RequestHandler) LocaleReply(me.semx11.autotip.api.reply.impl.LocaleReply) Locale(java.util.Locale) 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) LocaleReply(me.semx11.autotip.api.reply.impl.LocaleReply) LocaleReply(me.semx11.autotip.api.reply.impl.LocaleReply) Reply(me.semx11.autotip.api.reply.Reply)

Aggregations

LocaleReply (me.semx11.autotip.api.reply.impl.LocaleReply)2 Locale (java.util.Locale)1 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