Skip to content

Commit

Permalink
Merge pull request #22 from husnjak/new-protobuf
Browse files Browse the repository at this point in the history
Update protobuf!
  • Loading branch information
lephyrius authored Nov 17, 2023
2 parents 2dc0539 + 8eb4e60 commit 99c7e52
Show file tree
Hide file tree
Showing 10 changed files with 193 additions and 28 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: macos-latest
environment: apitesting
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Cocoapods
run: gem install cocoapods
- if: github.event.release.tag_name == ''
Expand All @@ -36,4 +36,4 @@ jobs:
pod trunk push --allow-warnings
env:
COCOAPODS_TRUNK_TOKEN: "${{ secrets.TRUNK_TOKEN }}"
LIB_VERSION: "${{ github.event.release.tag_name }}"
LIB_VERSION: "${{ github.event.release.tag_name }}"
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: macos-latest
environment: apitesting
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: swift build
- name: Run tests
Expand All @@ -20,4 +20,4 @@ jobs:
client_secret: "${{ secrets.CLIENT_SECRET }}"
access_token: "${{ secrets.BEARER_TOKEN }}"
proxy_url: "${{ secrets.PROXY_URL }}"
proxy_api_key: "${{ secrets.PROXY_API_KEY }}"
proxy_api_key: "${{ secrets.PROXY_API_KEY }}"
4 changes: 2 additions & 2 deletions IGDB-SWIFT-API.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'IGDB-SWIFT-API'
s.version = ENV['LIB_VERSION'] || '0.4.3'
s.version = ENV['LIB_VERSION'] || '0.4.4'
s.summary = 'Wrapper for IGDBs API written in Swift.'
s.description = "A Swift wrapper for the IGDB.com Free Video Game Database API."
s.documentation_url = "https://api-docs.igdb.com"
Expand All @@ -15,6 +15,6 @@ Pod::Spec.new do |s|
s.swift_version = '5.0'
s.source_files = 'Sources/IGDB-SWIFT-API/**/*.swift'

s.dependency 'SwiftProtobuf', '~> 1.21.0'
s.dependency 'SwiftProtobuf', '~> 1.25.1'
s.dependency 'Just', '~> 0.8.0'
end
4 changes: 2 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"repositoryURL": "https://github.com/apple/swift-protobuf.git",
"state": {
"branch": null,
"revision": "0af9125c4eae12a4973fb66574c53a54962a9e1e",
"version": "1.21.0"
"revision": "07f7f26ded8df9645c072f220378879c4642e063",
"version": "1.25.1"
}
}
]
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ let package = Package(
],
dependencies: [
.package(url: "https://github.com/dduan/Just.git", from: "0.8.0"),
.package(url: "https://github.com/apple/swift-protobuf.git", from: "1.21.0")
.package(url: "https://github.com/apple/swift-protobuf.git", from: "1.25.1")
],
targets: [
.target(
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/husnjak/IGDB-SWIFT-API#license)
[![CocoaPods](https://img.shields.io/cocoapods/v/IGDB-SWIFT-API.svg)](https://cocoapods.org/pods/IGDB-SWIFT-API)
[![test](https://github.com/husnjak/IGDB-SWIFT-API/workflows/test/badge.svg)](https://github.com/husnjak/IGDB-SWIFT-API/actions)

# IGDB SWIFT-API
A Swift wrapper for the IGDB.com Free Video Game Database API.
Expand Down Expand Up @@ -31,7 +33,7 @@ You can either import this library using Xcode by simply pasting this repository
Or if you have a `Package.swift` file you can add this:
```swift
dependencies: [
.package(url: "https://github.com/husnjak/IGDB-SWIFT-API.git", from: "0.4.3"),
.package(url: "https://github.com/husnjak/IGDB-SWIFT-API.git", from: "0.4.4"),
],
targets: [
.target(name: "MyTarget", dependencies: ["IGDB-SWIFT-API"]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// swift-format-ignore-file
//
// Generated by the Swift generator plugin for the protocol buffer compiler.
// Source: IGDBProtoFile.proto
// Source: igdbapi.proto
//
// For information on using the generated types, please see the documentation:
// https://github.com/apple/swift-protobuf/
Expand Down Expand Up @@ -70,7 +70,7 @@ public enum Proto_AgeRatingCategoryEnum: SwiftProtobuf.Enum {

extension Proto_AgeRatingCategoryEnum: CaseIterable {
// The compiler won't synthesize support with the UNRECOGNIZED case.
public static var allCases: [Proto_AgeRatingCategoryEnum] = [
public static let allCases: [Proto_AgeRatingCategoryEnum] = [
.ageratingCategoryNull,
.esrb,
.pegi,
Expand Down Expand Up @@ -230,7 +230,7 @@ public enum Proto_AgeRatingRatingEnum: SwiftProtobuf.Enum {

extension Proto_AgeRatingRatingEnum: CaseIterable {
// The compiler won't synthesize support with the UNRECOGNIZED case.
public static var allCases: [Proto_AgeRatingRatingEnum] = [
public static let allCases: [Proto_AgeRatingRatingEnum] = [
.ageratingRatingNull,
.three,
.seven,
Expand Down Expand Up @@ -560,7 +560,7 @@ public enum Proto_AgeRatingContentDescriptionCategoryEnum: SwiftProtobuf.Enum {

extension Proto_AgeRatingContentDescriptionCategoryEnum: CaseIterable {
// The compiler won't synthesize support with the UNRECOGNIZED case.
public static var allCases: [Proto_AgeRatingContentDescriptionCategoryEnum] = [
public static let allCases: [Proto_AgeRatingContentDescriptionCategoryEnum] = [
.ageratingcontentdescriptionCategoryNull,
.esrbAlcoholReference,
.esrbAnimatedBlood,
Expand Down Expand Up @@ -687,7 +687,7 @@ public enum Proto_GenderGenderEnum: SwiftProtobuf.Enum {

extension Proto_GenderGenderEnum: CaseIterable {
// The compiler won't synthesize support with the UNRECOGNIZED case.
public static var allCases: [Proto_GenderGenderEnum] = [
public static let allCases: [Proto_GenderGenderEnum] = [
.male,
.female,
.other,
Expand Down Expand Up @@ -740,7 +740,7 @@ public enum Proto_CharacterSpeciesEnum: SwiftProtobuf.Enum {

extension Proto_CharacterSpeciesEnum: CaseIterable {
// The compiler won't synthesize support with the UNRECOGNIZED case.
public static var allCases: [Proto_CharacterSpeciesEnum] = [
public static let allCases: [Proto_CharacterSpeciesEnum] = [
.characterSpeciesNull,
.human,
.alien,
Expand Down Expand Up @@ -802,7 +802,7 @@ public enum Proto_DateFormatChangeDateCategoryEnum: SwiftProtobuf.Enum {

extension Proto_DateFormatChangeDateCategoryEnum: CaseIterable {
// The compiler won't synthesize support with the UNRECOGNIZED case.
public static var allCases: [Proto_DateFormatChangeDateCategoryEnum] = [
public static let allCases: [Proto_DateFormatChangeDateCategoryEnum] = [
.yyyymmmmdd,
.yyyymmmm,
.yyyy,
Expand Down Expand Up @@ -896,7 +896,7 @@ public enum Proto_WebsiteCategoryEnum: SwiftProtobuf.Enum {

extension Proto_WebsiteCategoryEnum: CaseIterable {
// The compiler won't synthesize support with the UNRECOGNIZED case.
public static var allCases: [Proto_WebsiteCategoryEnum] = [
public static let allCases: [Proto_WebsiteCategoryEnum] = [
.websiteCategoryNull,
.websiteOfficial,
.websiteWikia,
Expand Down Expand Up @@ -1009,7 +1009,7 @@ public enum Proto_ExternalGameCategoryEnum: SwiftProtobuf.Enum {

extension Proto_ExternalGameCategoryEnum: CaseIterable {
// The compiler won't synthesize support with the UNRECOGNIZED case.
public static var allCases: [Proto_ExternalGameCategoryEnum] = [
public static let allCases: [Proto_ExternalGameCategoryEnum] = [
.externalgameCategoryNull,
.externalgameSteam,
.externalgameGog,
Expand Down Expand Up @@ -1071,7 +1071,7 @@ public enum Proto_ExternalGameMediaEnum: SwiftProtobuf.Enum {

extension Proto_ExternalGameMediaEnum: CaseIterable {
// The compiler won't synthesize support with the UNRECOGNIZED case.
public static var allCases: [Proto_ExternalGameMediaEnum] = [
public static let allCases: [Proto_ExternalGameMediaEnum] = [
.externalgameMediaNull,
.externalgameDigital,
.externalgamePhysical,
Expand Down Expand Up @@ -1151,7 +1151,7 @@ public enum Proto_GameCategoryEnum: SwiftProtobuf.Enum {

extension Proto_GameCategoryEnum: CaseIterable {
// The compiler won't synthesize support with the UNRECOGNIZED case.
public static var allCases: [Proto_GameCategoryEnum] = [
public static let allCases: [Proto_GameCategoryEnum] = [
.mainGame,
.dlcAddon,
.expansion,
Expand Down Expand Up @@ -1222,7 +1222,7 @@ public enum Proto_GameStatusEnum: SwiftProtobuf.Enum {

extension Proto_GameStatusEnum: CaseIterable {
// The compiler won't synthesize support with the UNRECOGNIZED case.
public static var allCases: [Proto_GameStatusEnum] = [
public static let allCases: [Proto_GameStatusEnum] = [
.released,
.alpha,
.beta,
Expand Down Expand Up @@ -1268,7 +1268,7 @@ public enum Proto_GameVersionFeatureCategoryEnum: SwiftProtobuf.Enum {

extension Proto_GameVersionFeatureCategoryEnum: CaseIterable {
// The compiler won't synthesize support with the UNRECOGNIZED case.
public static var allCases: [Proto_GameVersionFeatureCategoryEnum] = [
public static let allCases: [Proto_GameVersionFeatureCategoryEnum] = [
.boolean,
.description_,
]
Expand Down Expand Up @@ -1311,7 +1311,7 @@ public enum Proto_GameVersionFeatureValueIncludedFeatureEnum: SwiftProtobuf.Enum

extension Proto_GameVersionFeatureValueIncludedFeatureEnum: CaseIterable {
// The compiler won't synthesize support with the UNRECOGNIZED case.
public static var allCases: [Proto_GameVersionFeatureValueIncludedFeatureEnum] = [
public static let allCases: [Proto_GameVersionFeatureValueIncludedFeatureEnum] = [
.notIncluded,
.included,
.preOrderOnly,
Expand Down Expand Up @@ -1367,7 +1367,7 @@ public enum Proto_PlatformCategoryEnum: SwiftProtobuf.Enum {

extension Proto_PlatformCategoryEnum: CaseIterable {
// The compiler won't synthesize support with the UNRECOGNIZED case.
public static var allCases: [Proto_PlatformCategoryEnum] = [
public static let allCases: [Proto_PlatformCategoryEnum] = [
.platformCategoryNull,
.console,
.arcade,
Expand Down Expand Up @@ -1439,7 +1439,7 @@ public enum Proto_RegionRegionEnum: SwiftProtobuf.Enum {

extension Proto_RegionRegionEnum: CaseIterable {
// The compiler won't synthesize support with the UNRECOGNIZED case.
public static var allCases: [Proto_RegionRegionEnum] = [
public static let allCases: [Proto_RegionRegionEnum] = [
.regionRegionNull,
.europe,
.northAmerica,
Expand Down Expand Up @@ -1491,7 +1491,7 @@ public enum Proto_TestDummyEnumTestEnum: SwiftProtobuf.Enum {

extension Proto_TestDummyEnumTestEnum: CaseIterable {
// The compiler won't synthesize support with the UNRECOGNIZED case.
public static var allCases: [Proto_TestDummyEnumTestEnum] = [
public static let allCases: [Proto_TestDummyEnumTestEnum] = [
.testdummyEnumTestNull,
.enum1,
.enum2,
Expand Down
2 changes: 1 addition & 1 deletion Sources/IGDB-SWIFT-API/Wrapper/Endpoints.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ public enum Endpoint: String {
FRANCHISES, GAMES, GAME_ENGINES, GAME_ENGINE_LOGOS, GAME_MODES, GAME_LOCALIZATIONS, 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, RELEASE_DATES, REGIONS, SCREENSHOTS, SEARCH, THEMES, TIME_TO_BEATS, TITLES, WEBSITES
PLATFORM_WEBSITES, PLAYER_PERSPECTIVES, PLATFORM_FAMILIES, RELEASE_DATES, REGIONS, SCREENSHOTS, SEARCH, THEMES, TIME_TO_BEATS, TITLES, WEBSITES, EVENTS, EVENT_LOGOS, EVENT_NETWORKS, NETWORK_TYPES, COLLECTION_RELATION_TYPES, COLLECTION_TYPES, COLLECTION_MEMBERSHIPS, COLLECTION_MEMBERSHIP_TYPES
}
57 changes: 57 additions & 0 deletions Sources/IGDB-SWIFT-API/Wrapper/ProtoRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -312,4 +312,61 @@ public extension IGDBWrapper {
}, errorResponse: errorResponse)
}

func events(apiCalypse: APICalypse, result: @escaping ([Proto_Event]) -> (Void), errorResponse: @escaping (RequestException) -> (Void)) {
apiProtoRequest(endpoint: .EVENTS, apicalypseQuery: apiCalypse.buildQuery(), dataResponse: { bytes -> (Void) in
let objects = try! Proto_EventResult(serializedData: bytes).events
result(objects)
}, errorResponse: errorResponse)
}

func eventLogos(apiCalypse: APICalypse, result: @escaping ([Proto_EventLogo]) -> (Void), errorResponse: @escaping (RequestException) -> (Void)) {
apiProtoRequest(endpoint: .EVENT_LOGOS, apicalypseQuery: apiCalypse.buildQuery(), dataResponse: { bytes -> (Void) in
let objects = try! Proto_EventLogoResult(serializedData: bytes).eventlogos
result(objects)
}, errorResponse: errorResponse)
}

func eventNetworks(apiCalypse: APICalypse, result: @escaping ([Proto_EventNetwork]) -> (Void), errorResponse: @escaping (RequestException) -> (Void)) {
apiProtoRequest(endpoint: .EVENT_NETWORKS, apicalypseQuery: apiCalypse.buildQuery(), dataResponse: { bytes -> (Void) in
let objects = try! Proto_EventNetworkResult(serializedData: bytes).eventnetworks
result(objects)
}, errorResponse: errorResponse)
}

func networkTypes(apiCalypse: APICalypse, result: @escaping ([Proto_NetworkType]) -> (Void), errorResponse: @escaping (RequestException) -> (Void)) {
apiProtoRequest(endpoint: .NETWORK_TYPES, apicalypseQuery: apiCalypse.buildQuery(), dataResponse: { bytes -> (Void) in
let objects = try! Proto_NetworkTypeResult(serializedData: bytes).networktypes
result(objects)
}, errorResponse: errorResponse)
}

func collectionRelationTypes(apiCalypse: APICalypse, result: @escaping ([Proto_CollectionRelationType]) -> (Void), errorResponse: @escaping (RequestException) -> (Void)) {
apiProtoRequest(endpoint: .COLLECTION_RELATION_TYPES, apicalypseQuery: apiCalypse.buildQuery(), dataResponse: { bytes -> (Void) in
let objects = try! Proto_CollectionRelationTypeResult(serializedData: bytes).collectionrelationtypes
result(objects)
}, errorResponse: errorResponse)
}

func collectionTypes(apiCalypse: APICalypse, result: @escaping ([Proto_CollectionType]) -> (Void), errorResponse: @escaping (RequestException) -> (Void)) {
apiProtoRequest(endpoint: .COLLECTION_TYPES, apicalypseQuery: apiCalypse.buildQuery(), dataResponse: { bytes -> (Void) in
let objects = try! Proto_CollectionTypeResult(serializedData: bytes).collectiontypes
result(objects)
}, errorResponse: errorResponse)
}

func collectionMemberships(apiCalypse: APICalypse, result: @escaping ([Proto_CollectionMembership]) -> (Void), errorResponse: @escaping (RequestException) -> (Void)) {
apiProtoRequest(endpoint: .COLLECTION_MEMBERSHIPS, apicalypseQuery: apiCalypse.buildQuery(), dataResponse: { bytes -> (Void) in
let objects = try! Proto_CollectionMembershipResult(serializedData: bytes).collectionmemberships
result(objects)
}, errorResponse: errorResponse)
}

func collectionMembershipTypes(apiCalypse: APICalypse, result: @escaping ([Proto_CollectionMembershipType]) -> (Void), errorResponse: @escaping (RequestException) -> (Void)) {
apiProtoRequest(endpoint: .COLLECTION_MEMBERSHIP_TYPES, apicalypseQuery: apiCalypse.buildQuery(), dataResponse: { bytes -> (Void) in
let objects = try! Proto_CollectionMembershipTypeResult(serializedData: bytes).collectionmembershiptypes
result(objects)
}, errorResponse: errorResponse)
}


}
Loading

0 comments on commit 99c7e52

Please sign in to comment.