lolAPIWrapper 1.1.8

lolAPIWrapper 1.1.8

测试已测试
语言语言 SwiftSwift
许可证 MIT
发布最新发布2016年11月
SPM支持 SPM

mobinzk 维护。



  • Moov2

lolAPIWrapper

lolAPIWrapper 是围绕《英雄联盟》(LOL)API 的轻量级封装。在 Swift 中开发,以使 iOS 开发者更容易使用 LOL API 开发应用程序。

安装

lolAPIWrapper 通过 CocoaPods 提供。要安装,只需将以下行添加到您的 Podfile 中

pod "lolAPIWrapper"

用法

在页面的顶部导入封装

import lolAPIWrapper

以下代码段将检索所需用户的最新游戏

// Initialise lolWrapper with api key
// For API Key register at https://developer.riotgames.com/
var lolApi = lolApiWrapper().ApiKey("00000000-0000-0000-0000-000000000000");

// Call recent games of user id 585897
lolApi.game("/by-summoner/585897/recent")
       .get()

封装细节

英雄

// Retrieve all champions
lolApi.champion()
       .get()

// Retrieve champion by ID
lolApi.champion("REQUIRED_CHAMPION_ID")
      .get()

游戏

// Get recent games by summoner ID
lolApi.game("/by-summoner/REQUIRED_SUMMONER_ID/recent")
      .get()

联盟

// Get leagues mapped by summoner ID for a given list of summoner IDs
lolApi.league("/by-summoner/REQUIRED_SUMMONER_ID")
      .get()

// Get league entries mapped by summoner ID for a given list of summoner IDs
lolApi.league("/by-summoner/REQUIRED_SUMMONER_ID/entry")
      .get()

// Get leagues mapped by team ID for a given list of team IDs
lolApi.league("/by-team/REQUIRED_TEAM_ID")
      .get()

// Get league entries mapped by team ID for a given list of team IDs
lolApi.league("/by-team/REQUIRED_TEAM_ID/entry")
      .get()

// Get challenger tier leagues
lolApi.league("/challenger")
      .get()

// Get master tier leagues
lolApi.league("/master")
      .get()

LOL 静态数据

// Retrieves champion list
lolApi.league()
      .get("/champion")

// Retrieves a champion by its id
lolApi.league("/champion/REQUIRED_ID")
      .get()

// Retrieves item list
lolApi.league("/item")
      .get()

// Retrieves item by its unique id
lolApi.league("/item/REQUIRED_ID")
      .get()

// Retrieve language strings data
lolApi.league("/language-strings")
      .get()

// Retrieve supported languages data
lolApi.league("/languages")
      .get()

// Retrieve map data
lolApi.league("/map")
      .get()

// Retrieves mastery list
lolApi.league("/mastery")
      .get()

// Retrieves mastery item by its unique id
lolApi.league("/mastery/REQUIRED_ID")
      .get()

// Retrieve realm data
lolApi.league("/realm")
      .get()

// Retrieves rune list
lolApi.league("/rune")
      .get()

// Retrieves rune by its unique id
lolApi.league("/rune/REQUIRED_ID")
      .get()

// Retrieves summoner spell list
lolApi.league("/summoner-spell")
      .get()

// Retrieves summoner spell by its unique id
lolApi.league("/summoner-spell/REQUIRED_ID")
      .get()

// Retrieve version data
lolApi.league("/versions")
      .get()

比赛

// Retrieve match by match ID
lolApi.match("/REQUIRED_MATCH_ID")
      .get()

比赛列表

// Retrieve match list by summoner ID
lolApi.matchlist("/by-summoner/REQUIRED_SUMMONER_ID")
      .get()

统计数据

// Get ranked stats by summoner ID
lolApi.stats("/by-summoner/REQUIRED_SUMMONER_ID/ranked")
      .get()

// Get player stats summaries by summoner ID
lolApi.stats("/by-summoner/REQUIRED_SUMMONER_ID/summary")
      .get()

召唤师

// Get summoner objects mapped by standardized summoner name for a given list of summoner names
lolApi.summoner("/by-name/REQUIRED_SUMMONER_NAME")
      .get()

// Get summoner objects mapped by summoner ID for a given list of summoner IDs
lolApi.summoner("/REQUIRED_SUMMONER_ID")
      .get()

// Get mastery pages mapped by summoner ID for a given list of summoner IDs
lolApi.summoner("/REQUIRED_SUMMONER_ID/masteries")
      .get()

// Get summoner names mapped by summoner ID for a given list of summoner IDs
lolApi.summoner("/REQUIRED_SUMMONER_ID/name")
      .get()

// Get rune pages mapped by summoner ID for a given list of summoner IDs
lolApi.summoner("/REQUIRED_SUMMONER_ID/runes")
      .get()

队伍

// Get teams mapped by summoner ID for a given list of summoner IDs
lolApi.team("/by-summoner/REQUIRED_SUMMONER_ID")
      .get()

// Get teams mapped by team ID for a given list of team IDs
lolApi.summoner("/REQUIRED_TEAM_ID")
      .get()

有关 LOL API 的更多细节

示例

要运行示例项目,请克隆仓库,并首先从 Example 文件夹中运行 pod install

修复 iOS 9 中“NSURLSession/NSURLConnection HTTP 加载失败”(kCFStreamErrorDomainSSL, -9802)错误

以下代码需要包含到 info.plist 中
要使用纯文本格式打开 info.plist 文件,请右键点击文件,然后选择“打开方式”>“源代码”。

    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSExceptionDomains</key>
        <dict>
            <key>api.pvp.net</key>
            <dict>
                <!--Include to allow subdomains-->
                <key>NSIncludesSubdomains</key>
                <true/>
                <!--Include to allow insecure HTTP requests-->
                <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
                <true/>
                <!--Include to specify minimum TLS version-->
                <key>NSTemporaryExceptionMinimumTLSVersion</key>
                <string>TLSv1.2</string>
            </dict>
        </dict>
    </dict>

待办事项

  • 添加以下 API 调用
    – current-game-v1.0
    – 特色游戏-v1.0
    – 英雄联盟状态-v1.0

  • 添加测试单元

许可协议

lolAPIWrapper 采用 MIT 许可协议。有关更多信息,请参阅 LICENSE 文件。