com.ibasco.agql.protocols.valve.steam.webapi.interfaces.SteamCommunityService Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of agql-steam-webapi Show documentation
Show all versions of agql-steam-webapi Show documentation
An implementation for the Steam Web API Interfaces
package com.ibasco.agql.protocols.valve.steam.webapi.interfaces;
import com.google.gson.JsonObject;
import com.google.gson.reflect.TypeToken;
import com.ibasco.agql.protocols.valve.steam.webapi.SteamWebApiClient;
import com.ibasco.agql.protocols.valve.steam.webapi.SteamWebApiInterface;
import com.ibasco.agql.protocols.valve.steam.webapi.interfaces.communityservice.GetApps;
import com.ibasco.agql.protocols.valve.steam.webapi.pojos.SteamCommunityApp;
import java.lang.reflect.Type;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.CompletableFuture;
public class SteamCommunityService extends SteamWebApiInterface {
/**
* Default Constructor
*
* @param client
* A {@link SteamWebApiClient} instance
*/
public SteamCommunityService(SteamWebApiClient client) {
super(client);
}
public CompletableFuture> getApps(Integer... appIds) {
return getApps(Arrays.asList(appIds));
}
/**
* Returns a list of apps retrieved from the community service interface.
*
* @param appIds
* A collection of steam app ids
*
* @return A {@link CompletableFuture} object
*/
public CompletableFuture> getApps(Collection appIds) {
CompletableFuture result = sendRequest(new GetApps(VERSION_1, appIds));
return result.thenApply(r -> {
JsonObject response = r.getAsJsonObject("response");
Type listType = new TypeToken>() {}.getType();
return builder().fromJson(response.getAsJsonArray("apps"), listType);
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy