Skip to content

Enums to Tables migration #32

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

Merged
merged 4 commits into from
Mar 13, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions src/main/kotlin/com/api/igdb/request/JsonRequest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,26 @@ fun IGDBWrapper.jsonAgeRatings(APICalypse: APICalypse): String {
return apiJsonRequest(Endpoints.AGE_RATINGS, APICalypse.buildQuery())
}

@Throws(RequestException::class)
fun IGDBWrapper.jsonAgeRatingCategories(APICalypse: APICalypse): String {
return apiJsonRequest(Endpoints.AGE_RATING_CATEGORIES, APICalypse.buildQuery())
}

@Throws(RequestException::class)
fun IGDBWrapper.jsonAgeRatingContentDescriptions(APICalypse: APICalypse): String {
return apiJsonRequest(Endpoints.AGE_RATING_CONTENT_DESCRIPTIONS, APICalypse.buildQuery())
}

@Throws(RequestException::class)
fun IGDBWrapper.jsonAgeRatingContentDescriptionsV2(APICalypse: APICalypse): String {
return apiJsonRequest(Endpoints.AGE_RATING_CONTENT_DESCRIPTIONS_V2, APICalypse.buildQuery())
}

@Throws(RequestException::class)
fun IGDBWrapper.jsonAgeRatingOrganizations(APICalypse: APICalypse): String {
return apiJsonRequest(Endpoints.AGE_RATING_ORGANIZATIONS, APICalypse.buildQuery())
}

@Throws(RequestException::class)
fun IGDBWrapper.jsonAlternativeNames(APICalypse: APICalypse): String {
return apiJsonRequest(Endpoints.ALTERNATIVE_NAMES, APICalypse.buildQuery())
Expand All @@ -29,6 +44,16 @@ fun IGDBWrapper.jsonCharacters(APICalypse: APICalypse): String {
return apiJsonRequest(Endpoints.CHARACTERS, APICalypse.buildQuery())
}

@Throws(RequestException::class)
fun IGDBWrapper.jsonCharacterGenders(APICalypse: APICalypse): String {
return apiJsonRequest(Endpoints.CHARACTER_GENDERS, APICalypse.buildQuery())
}

@Throws(RequestException::class)
fun IGDBWrapper.jsonCharacterSpecies(APICalypse: APICalypse): String {
return apiJsonRequest(Endpoints.CHARACTER_SPECIES, APICalypse.buildQuery())
}

@Throws(RequestException::class)
fun IGDBWrapper.jsonCollections(APICalypse: APICalypse): String {
return apiJsonRequest(Endpoints.COLLECTIONS, APICalypse.buildQuery())
Expand All @@ -44,6 +69,11 @@ fun IGDBWrapper.jsonCompanies(APICalypse: APICalypse): String {
return apiJsonRequest(Endpoints.COMPANIES, APICalypse.buildQuery())
}

@Throws(RequestException::class)
fun IGDBWrapper.jsonCompanyStatuses(APICalypse: APICalypse): String {
return apiJsonRequest(Endpoints.COMPANY_STATUS, APICalypse.buildQuery())
}

@Throws(RequestException::class)
fun IGDBWrapper.jsonCompanyWebsites(APICalypse: APICalypse): String {
return apiJsonRequest(Endpoints.COMPANY_WEBSITES, APICalypse.buildQuery())
Expand All @@ -59,11 +89,21 @@ fun IGDBWrapper.jsonCovers(APICalypse: APICalypse): String {
return apiJsonRequest(Endpoints.COVERS, APICalypse.buildQuery())
}

@Throws(RequestException::class)
fun IGDBWrapper.jsonDateFormats(APICalypse: APICalypse): String {
return apiJsonRequest(Endpoints.DATE_FORMATS, APICalypse.buildQuery())
}

@Throws(RequestException::class)
fun IGDBWrapper.jsonExternalGames(APICalypse: APICalypse): String {
return apiJsonRequest(Endpoints.EXTERNAL_GAMES, APICalypse.buildQuery())
}

@Throws(RequestException::class)
fun IGDBWrapper.jsonExternalGameSources(APICalypse: APICalypse): String {
return apiJsonRequest(Endpoints.EXTERNAL_GAMES_SOURCES, APICalypse.buildQuery())
}

@Throws(RequestException::class)
fun IGDBWrapper.jsonFranchises(APICalypse: APICalypse): String {
return apiJsonRequest(Endpoints.FRANCHISES, APICalypse.buildQuery())
Expand Down Expand Up @@ -94,6 +134,21 @@ fun IGDBWrapper.jsonGameModes(APICalypse: APICalypse): String {
return apiJsonRequest(Endpoints.GAME_MODES, APICalypse.buildQuery())
}

@Throws(RequestException::class)
fun IGDBWrapper.jsonGameReleaseFormats(APICalypse: APICalypse): String {
return apiJsonRequest(Endpoints.GAME_RELEASE_FORMATS, APICalypse.buildQuery())
}

@Throws(RequestException::class)
fun IGDBWrapper.jsonGameStatuses(APICalypse: APICalypse): String {
return apiJsonRequest(Endpoints.GAME_STATUSES, APICalypse.buildQuery())
}

@Throws(RequestException::class)
fun IGDBWrapper.jsonGameTypes(APICalypse: APICalypse): String {
return apiJsonRequest(Endpoints.GAME_TYPES, APICalypse.buildQuery())
}

@Throws(RequestException::class)
fun IGDBWrapper.jsonGameVersion(APICalypse: APICalypse): String {
return apiJsonRequest(Endpoints.GAME_VERSIONS, APICalypse.buildQuery())
Expand Down Expand Up @@ -159,6 +214,11 @@ fun IGDBWrapper.jsonPlatformLogos(APICalypse: APICalypse): String {
return apiJsonRequest(Endpoints.PLATFORM_LOGOS, APICalypse.buildQuery())
}

@Throws(RequestException::class)
fun IGDBWrapper.jsonPlatformTypes(APICalypse: APICalypse): String {
return apiJsonRequest(Endpoints.PLATFORM_TYPES, APICalypse.buildQuery())
}

@Throws(RequestException::class)
fun IGDBWrapper.jsonPlatformVersions(APICalypse: APICalypse): String {
return apiJsonRequest(Endpoints.PLATFORM_VERSIONS, APICalypse.buildQuery())
Expand Down Expand Up @@ -199,6 +259,11 @@ fun IGDBWrapper.jsonReleaseDates(APICalypse: APICalypse): String {
return apiJsonRequest(Endpoints.RELEASE_DATES, APICalypse.buildQuery())
}

@Throws(RequestException::class)
fun IGDBWrapper.jsonReleaseDateRegions(APICalypse: APICalypse): String {
return apiJsonRequest(Endpoints.RELEASE_DATE_REGIONS, APICalypse.buildQuery())
}

@Throws(RequestException::class)
fun IGDBWrapper.jsonScreenshots(APICalypse: APICalypse): String {
return apiJsonRequest(Endpoints.SCREENSHOTS, APICalypse.buildQuery())
Expand All @@ -219,6 +284,11 @@ fun IGDBWrapper.jsonWebsites(APICalypse: APICalypse): String {
return apiJsonRequest(Endpoints.WEBSITES, APICalypse.buildQuery())
}

@Throws(RequestException::class)
fun IGDBWrapper.jsonWebsiteTypes(APICalypse: APICalypse): String {
return apiJsonRequest(Endpoints.WEBSITE_TYPES, APICalypse.buildQuery())
}

@Throws(RequestException::class)
fun IGDBWrapper.jsonEvents(APICalypse: APICalypse): String {
return apiJsonRequest(Endpoints.EVENTS, APICalypse.buildQuery())
Expand Down
87 changes: 85 additions & 2 deletions src/main/kotlin/com/api/igdb/request/ProtoRequest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,30 @@ fun IGDBWrapper.ageRatings(APICalypse: APICalypse): List<AgeRating> {
return AgeRatingResult.parseFrom(bytes).ageratingsList
}

@Throws(RequestException::class)
fun IGDBWrapper.ageRatingCategories(APICalypse: APICalypse): List<AgeRatingCategory> {
val bytes = apiProtoRequest(Endpoints.AGE_RATING_CATEGORIES, APICalypse.buildQuery())
return AgeRatingCategoryResult.parseFrom(bytes).ageratingcategoriesList
}

@Throws(RequestException::class)
fun IGDBWrapper.ageRatingContentDescriptions(APICalypse: APICalypse): List<AgeRatingContentDescription> {
val bytes = apiProtoRequest(Endpoints.AGE_RATING_CONTENT_DESCRIPTIONS, APICalypse.buildQuery())
return AgeRatingContentDescriptionResult.parseFrom(bytes).ageratingcontentdescriptionsList
}

@Throws(RequestException::class)
fun IGDBWrapper.ageRatingContentDescriptionsV2(APICalypse: APICalypse): List<AgeRatingContentDescriptionV2> {
val bytes = apiProtoRequest(Endpoints.AGE_RATING_CONTENT_DESCRIPTIONS_V2, APICalypse.buildQuery())
return AgeRatingContentDescriptionV2Result.parseFrom(bytes).ageratingcontentdescriptionsv2List
}

@Throws(RequestException::class)
fun IGDBWrapper.ageRatingOrganizations(APICalypse: APICalypse): List<AgeRatingOrganization> {
val bytes = apiProtoRequest(Endpoints.AGE_RATING_ORGANIZATIONS, APICalypse.buildQuery())
return AgeRatingOrganizationResult.parseFrom(bytes).ageratingorganizationsList
}

@Throws(RequestException::class)
fun IGDBWrapper.alternativeNames(APICalypse: APICalypse): List<AlternativeName> {
val bytes = apiProtoRequest(Endpoints.ALTERNATIVE_NAMES, APICalypse.buildQuery())
Expand All @@ -37,6 +55,18 @@ fun IGDBWrapper.characters(APICalypse: APICalypse): List<Character> {
return CharacterResult.parseFrom(bytes).charactersList
}

@Throws(RequestException::class)
fun IGDBWrapper.characterGenders(APICalypse: APICalypse): List<CharacterGender> {
val bytes = apiProtoRequest(Endpoints.CHARACTER_GENDERS, APICalypse.buildQuery())
return CharacterGenderResult.parseFrom(bytes).charactergendersList
}

@Throws(RequestException::class)
fun IGDBWrapper.characterSpecies(APICalypse: APICalypse): List<CharacterSpecie> {
val bytes = apiProtoRequest(Endpoints.CHARACTER_SPECIES, APICalypse.buildQuery())
return CharacterSpecieResult.parseFrom(bytes).characterspeciesList
}

@Throws(RequestException::class)
fun IGDBWrapper.collections(APICalypse: APICalypse): List<Collection> {
val bytes = apiProtoRequest(Endpoints.COLLECTIONS, APICalypse.buildQuery())
Expand All @@ -55,6 +85,12 @@ fun IGDBWrapper.companies(APICalypse: APICalypse): List<Company> {
return CompanyResult.parseFrom(bytes).companiesList
}

@Throws(RequestException::class)
fun IGDBWrapper.companyStatuses(APICalypse: APICalypse): List<CompanyStatus> {
val bytes = apiProtoRequest(Endpoints.COMPANIES, APICalypse.buildQuery())
return CompanyStatusResult.parseFrom(bytes).companystatusesList
}

@Throws(RequestException::class)
fun IGDBWrapper.companyWebsites(APICalypse: APICalypse): List<CompanyWebsite> {
val bytes = apiProtoRequest(Endpoints.COMPANY_WEBSITES, APICalypse.buildQuery())
Expand All @@ -73,12 +109,24 @@ fun IGDBWrapper.covers(APICalypse: APICalypse): List<Cover> {
return CoverResult.parseFrom(bytes).coversList
}

@Throws(RequestException::class)
fun IGDBWrapper.dateFormats(APICalypse: APICalypse): List<DateFormat> {
val bytes = apiProtoRequest(Endpoints.COVERS, APICalypse.buildQuery())
return DateFormatResult.parseFrom(bytes).dateformatsList
}

@Throws(RequestException::class)
fun IGDBWrapper.externalGames(APICalypse: APICalypse): List<ExternalGame> {
val bytes = apiProtoRequest(Endpoints.EXTERNAL_GAMES, APICalypse.buildQuery())
return ExternalGameResult.parseFrom(bytes).externalgamesList
}

@Throws(RequestException::class)
fun IGDBWrapper.externalGameSources(APICalypse: APICalypse): List<ExternalGameSource> {
val bytes = apiProtoRequest(Endpoints.EXTERNAL_GAMES, APICalypse.buildQuery())
return ExternalGameSourceResult.parseFrom(bytes).externalgamesourcesList
}

@Throws(RequestException::class)
fun IGDBWrapper.franchises(APICalypse: APICalypse): List<Franchise> {
val bytes = apiProtoRequest(Endpoints.FRANCHISES, APICalypse.buildQuery())
Expand Down Expand Up @@ -115,6 +163,24 @@ fun IGDBWrapper.gameModes(APICalypse: APICalypse): List<GameMode> {
return GameModeResult.parseFrom(bytes).gamemodesList
}

@Throws(RequestException::class)
fun IGDBWrapper.gameReleaseFormats(APICalypse: APICalypse): List<GameReleaseFormat> {
val bytes = apiProtoRequest(Endpoints.GAME_RELEASE_FORMATS, APICalypse.buildQuery())
return GameReleaseFormatResult.parseFrom(bytes).gamereleaseformatsList
}

@Throws(RequestException::class)
fun IGDBWrapper.gameStatuses(APICalypse: APICalypse): List<GameStatus> {
val bytes = apiProtoRequest(Endpoints.GAME_MODES, APICalypse.buildQuery())
return GameStatusResult.parseFrom(bytes).gamestatusesList
}

@Throws(RequestException::class)
fun IGDBWrapper.gameTypes(APICalypse: APICalypse): List<GameType> {
val bytes = apiProtoRequest(Endpoints.GAME_MODES, APICalypse.buildQuery())
return GameTypeResult.parseFrom(bytes).gametypesList
}

@Throws(RequestException::class)
fun IGDBWrapper.gameVersion(APICalypse: APICalypse): List<GameVersion> {
val bytes = apiProtoRequest(Endpoints.GAME_VERSIONS, APICalypse.buildQuery())
Expand Down Expand Up @@ -193,6 +259,12 @@ fun IGDBWrapper.platformLogos(APICalypse: APICalypse): List<PlatformLogo> {
return PlatformLogoResult.parseFrom(bytes).platformlogosList
}

@Throws(RequestException::class)
fun IGDBWrapper.platformTypes(APICalypse: APICalypse): List<PlatformType> {
val bytes = apiProtoRequest(Endpoints.PLATFORM_LOGOS, APICalypse.buildQuery())
return PlatformTypeResult.parseFrom(bytes).platformtypesList
}

@Throws(RequestException::class)
fun IGDBWrapper.platformVersions(APICalypse: APICalypse): List<PlatformVersion> {
val bytes = apiProtoRequest(Endpoints.PLATFORM_VERSIONS, APICalypse.buildQuery())
Expand Down Expand Up @@ -241,6 +313,12 @@ fun IGDBWrapper.releaseDates(APICalypse: APICalypse): List<ReleaseDate> {
return ReleaseDateResult.parseFrom(bytes).releasedatesList
}

@Throws(RequestException::class)
fun IGDBWrapper.releaseDateRegions(APICalypse: APICalypse): List<ReleaseDateRegion> {
val bytes = apiProtoRequest(Endpoints.RELEASE_DATES, APICalypse.buildQuery())
return ReleaseDateRegionResult.parseFrom(bytes).releasedateregionsList
}

@Throws(RequestException::class)
fun IGDBWrapper.screenshots(APICalypse: APICalypse): List<Screenshot> {
val bytes = apiProtoRequest(Endpoints.SCREENSHOTS, APICalypse.buildQuery())
Expand All @@ -265,6 +343,12 @@ fun IGDBWrapper.websites(APICalypse: APICalypse): List<Website> {
return WebsiteResult.parseFrom(bytes).websitesList
}

@Throws(RequestException::class)
fun IGDBWrapper.websiteTypes(APICalypse: APICalypse): List<WebsiteType> {
val bytes = apiProtoRequest(Endpoints.WEBSITES, APICalypse.buildQuery())
return WebsiteTypeResult.parseFrom(bytes).websitetypesList
}

@Throws(RequestException::class)
fun IGDBWrapper.events(APICalypse: APICalypse): List<Event> {
val bytes = apiProtoRequest(Endpoints.EVENTS, APICalypse.buildQuery())
Expand All @@ -277,7 +361,6 @@ fun IGDBWrapper.eventLogos(APICalypse: APICalypse): List<EventLogo> {
return EventLogoResult.parseFrom(bytes).eventlogosList
}


@Throws(RequestException::class)
fun IGDBWrapper.eventNetworks(APICalypse: APICalypse): List<EventNetwork> {
val bytes = apiProtoRequest(Endpoints.EVENT_NETWORKS, APICalypse.buildQuery())
Expand Down Expand Up @@ -328,6 +411,6 @@ fun IGDBWrapper.popularityTypes(APICalypse: APICalypse): List<PopularityType> {

@Throws(RequestException::class)
fun IGDBWrapper.popularityPrimitives(APICalypse: APICalypse): List<PopularityPrimitive> {
val bytes = apiProtoRequest(Endpoints.COLLECTION_MEMBERSHIP_TYPES, APICalypse.buildQuery())
val bytes = apiProtoRequest(Endpoints.POPULARITY_PRIMITIVES, APICalypse.buildQuery())
return PopularityPrimitiveResult.parseFrom(bytes).popularityprimitivesList
}
19 changes: 10 additions & 9 deletions src/main/kotlin/com/api/igdb/utils/Endpoints.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ package com.api.igdb.utils
* The Public Endpoint Enum class holds all of the accessible IGDB API Endpoints
*/
enum class Endpoints : Endpoint {
AGE_RATINGS, AGE_RATING_CONTENT_DESCRIPTIONS, ALTERNATIVE_NAMES, ARTWORKS, CHARACTERS, CHARACTER_MUG_SHOTS,
COLLECTIONS, COMPANIES, COMPANY_WEBSITES, COMPANY_LOGOS, COVERS, EXTERNAL_GAMES, FRANCHISES, GAMES, GAME_ENGINES,
GAME_ENGINE_LOGOS, GAME_LOCALIZATIONS, GAME_MODES, GAME_VERSIONS, GAME_VERSION_FEATURES, GAME_VERSION_FEATURE_VALUES, GAME_VIDEOS,
GENRES, INVOLVED_COMPANIES, KEYWORDS, LANGUAGES, LANGUAGE_SUPPORTS, LANGUAGE_SUPPORT_TYPES, MULTIPLAYER_MODES,
PLATFORMS, PLATFORM_LOGOS, PLATFORM_VERSIONS, PLATFORM_VERSION_COMPANIES, PLATFORM_VERSION_RELEASE_DATES,
PLATFORM_WEBSITES, PLAYER_PERSPECTIVES, PLATFORM_FAMILIES, REGIONS, RELEASE_DATES, SCREENSHOTS, SEARCH, THEMES,
WEBSITES, EVENTS, EVENT_LOGOS, EVENT_NETWORKS, NETWORK_TYPES, COLLECTION_RELATIONS, COLLECTION_RELATION_TYPES,
COLLECTION_TYPES, COLLECTION_MEMBERSHIPS, COLLECTION_MEMBERSHIP_TYPES, POPULARITY_TYPES, POPULARITY_PRIMITIVES;

AGE_RATING_CATEGORIES, AGE_RATING_CONTENT_DESCRIPTIONS, AGE_RATING_CONTENT_DESCRIPTIONS_V2, AGE_RATING_ORGANIZATIONS, AGE_RATINGS,
ALTERNATIVE_NAMES, ARTWORKS, CHARACTERS, CHARACTER_GENDERS, CHARACTER_MUG_SHOTS, CHARACTER_SPECIES, COLLECTION_MEMBERSHIPS,
COLLECTION_MEMBERSHIP_TYPES, COLLECTION_RELATIONS, COLLECTION_RELATION_TYPES, COLLECTION_TYPES, COLLECTIONS, COMPANIES,
COMPANY_LOGOS, COMPANY_STATUS, COMPANY_WEBSITES, COVERS, DATE_FORMATS, EVENTS, EVENT_LOGOS,
EVENT_NETWORKS, EXTERNAL_GAMES, EXTERNAL_GAMES_SOURCES, FRANCHISES, GAMES, GAME_ENGINES, GAME_ENGINE_LOGOS, GAME_LOCALIZATIONS,
GAME_MODES, GAME_RELEASE_FORMATS, GAME_STATUSES, GAME_TYPES, GAME_VERSIONS, GAME_VERSION_FEATURES, GAME_VERSION_FEATURE_VALUES,
GAME_VIDEOS, GENRES, INVOLVED_COMPANIES, KEYWORDS, LANGUAGES, LANGUAGE_SUPPORTS, LANGUAGE_SUPPORT_TYPES, MULTIPLAYER_MODES,
NETWORK_TYPES, PLATFORMS, PLATFORM_FAMILIES, PLATFORM_LOGOS, PLATFORM_TYPES, PLATFORM_VERSIONS, PLATFORM_VERSION_COMPANIES,
PLATFORM_VERSION_RELEASE_DATES, PLATFORM_WEBSITES, PLAYER_PERSPECTIVES, POPULARITY_PRIMITIVES, POPULARITY_TYPES, REGIONS,
RELEASE_DATES, RELEASE_DATE_REGIONS, SCREENSHOTS, SEARCH, THEMES, WEBSITES, WEBSITE_TYPES;

override fun url(): String {
return "/${this.name.lowercase()}"
Expand Down
Loading