{"id":20710225,"url":"https://github.com/kkbox/openapi-swift","last_synced_at":"2025-04-23T05:05:45.221Z","repository":{"id":56917261,"uuid":"118796000","full_name":"KKBOX/OpenAPI-Swift","owner":"KKBOX","description":"KKBOX Open API Swift Developer SDK for iOS/macOS/watchOS/tvOS","archived":false,"fork":false,"pushed_at":"2019-10-16T09:44:04.000Z","size":1269,"stargazers_count":14,"open_issues_count":0,"forks_count":3,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-23T05:04:33.794Z","etag":null,"topics":["cocoapods","ios","kkbox","macos","openapi","swift","tvos","watchos"],"latest_commit_sha":null,"homepage":"https://developer.kkbox.com/","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KKBOX.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-24T17:08:09.000Z","updated_at":"2024-01-15T02:06:42.000Z","dependencies_parsed_at":"2022-08-21T03:50:45.647Z","dependency_job_id":null,"html_url":"https://github.com/KKBOX/OpenAPI-Swift","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KKBOX%2FOpenAPI-Swift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KKBOX%2FOpenAPI-Swift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KKBOX%2FOpenAPI-Swift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KKBOX%2FOpenAPI-Swift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KKBOX","download_url":"https://codeload.github.com/KKBOX/OpenAPI-Swift/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250372936,"owners_count":21419722,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cocoapods","ios","kkbox","macos","openapi","swift","tvos","watchos"],"created_at":"2024-11-17T02:10:34.293Z","updated_at":"2025-04-23T05:05:45.202Z","avatar_url":"https://github.com/KKBOX.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# KKBOX Open API Swift Developer SDK for iOS/macOS/watchOS/tvOS\n\n2019 © KKBOX.\n\n[![Actions Status](https://github.com/KKBOX/OpenAPI-Swift/workflows/Build/badge.svg)](https://github.com/KKBOX/OpenAPI-Swift/actions)\u0026nbsp;\n[![build](https://travis-ci.org/KKBOX/OpenAPI-Swift.svg?branch=master)](https://travis-ci.org/KKBOX/OpenAPI-Swift)\u0026nbsp;\n[![License Apache](https://img.shields.io/badge/license-Apache-green.svg?style=flat)](https://raw.githubusercontent.com/KKBOX/OpenAPI-Swift/master/LICENSE)\u0026nbsp;\n[![CocoaPods](http://img.shields.io/cocoapods/v/KKBOXOpenAPISwift.svg?style=flat)](http://cocoapods.org/pods/KKBOXOpenAPISwift)\u0026nbsp;\n[![Support](https://img.shields.io/badge/macOS-10.10-blue.svg)](https://www.apple.com/tw/macos)\u0026nbsp;\n[![Support](https://img.shields.io/badge/iOS-9-blue.svg)](https://www.apple.com/tw/ios)\u0026nbsp;\n[![Support](https://img.shields.io/badge/watchOS-2-blue.svg)](https://www.apple.com/tw/watchos)\u0026nbsp;\n[![Support](https://img.shields.io/badge/tvOS-9-blue.svg)](https://www.apple.com/tw/tvos)\u0026nbsp;\n\nKKBOX's Open API provides various data from KKBOX's rich music archive. It helps\nyou to access data about KKBOX's song tracks, albums, artist playlist and so on.\n\nThis is a pure Swift implementation of a client to access KKBOX's Open API. You\ncan easily integrate the SDK into your iOS/macOS/watchOS/tvOS project using\nSwift Package Manager or CocoaPods.\n\nThe SDK leverages lots of powerful features of Swift programming language, such\nas wrapping API responses into enums, and the JSON encoder / decoder since Swift\n4.\n\nOn the other hand, the SDK could not be called in your Objective-C code\ndirectly. If you need to work with KKBOX's Open API in your Objective-C code,\nyou may need to wrap the SDK in your own bridging code, or, you may want to take\na look of KKBOX's [Objective-C SDK](https://github.com/KKBOX/OpenAPI-ObjectiveC)\n\nFor further information, please visit\n[KKBOX Developer Site](https://docs-en.kkbox.codes).\n\n## Requirement\n\nThe SDK supports\n\n- Swift 4.2\n- 📱 iOS 9.x or above\n- 💻 Mac OS X 10.10 or above\n- ⌚️ watchOS 2.x or above\n- 📺 tvOS 9.x or above\n\nThs SDK uses\n[NSURLSession](https://developer.apple.com/documentation/foundation/nsurlsession)\nto do HTTP connections. Since NSURLSession has not been ported to Linux, you\ncannot run the Swift SDK on Linux yet, even Swift runs on Linux.\n\n## Build ⚒\n\nYou need the latest Xcode and macOS. Xcode 9 and macOS 10.13 High\nSierra are recommended.\n\n## Installation\n\nThe SDK supports both CocoaPods and Swift Package Manager.\n\n### CocoaPods\n\nThe SDK supports CocoaPods. Please add `pod 'KKBOXOpenAPISwift'`\nto your Podfile, and then call `pod install`.\n\n### Carthage\n\nAdd the following line to your `Cartfile`\n\n```\ngithub 'KKBOX/OpenAPI-Swift'\n```\n\nThen run `carthage update`.\n\n### Swift Package Manager\n\nAdd the SDK as a dependency to your Package.swift:\n\n```swift\n// swift-tools-version:4.0\n\nimport PackageDescription\n\nlet package = Package(\n    name: \"KKBOXOpenAPI-test\",\n    products: [\n        .executable(name: \"KKBOXOpenAPI-test\", targets: [\"YourTargetName\"])\n    ],\n    dependencies: [\n        .package(url: \"https://github.com/KKBOX/OpenAPI-Swift\", .upToNextMinor(from: \"1.1.6\"))\n    ],\n    targets: [\n        .target(name: \"YourTargetName\", dependencies: [\"KKBOXOpenAPISwift\"], path: \"./Path/To/Your/Sources\")\n    ]\n)\n```\n\n## Usage\n\nTo start using the SDK, you need to create an instance of KKBOXOpenAPI.\n\n``` swift\nlet API = KKBOXOpenAPI(clientID: \"YOUR_CLIENT_ID\", secret: \"YOUR_CLIENT_SECRET\")\n```\n\nThen, ask the instance to fetch an access token by passing a client credential.\n\n``` swift\n_ = try? self.API.fetchAccessTokenByClientCredential { result in\n    switch result {\n    case .error(let error):\n        // Handle error...\n    case .success(_):\n        // Successfully logged-in\n    }\n}\n```\n\nFinally, you can start to do the API calls. For example, you can fetch the details\nof a song track by calling 'fetchTrack'.\n\n``` swift\n_ = try? self.API.fetch(track: \"4kxvr3wPWkaL9_y3o_\") { result in\n    switch result {\n    case .error(let error):\n        // Handle error...\n    case .success(let track):\n        // Handle the song track.\n    }\n}\n```\n\nYou can develop your app using the SDK with Swift or Objective-C programming\nlanguage, although we have only Swift sample code here.\n\n## API Documentation 📖\n\n- Documentation for the SDK is available at https://kkbox.github.io/OpenAPI-Swift/ .\n- KKBOX's Open API documentation is available at https://developer.kkbox.com/ .\n\n## License\n\nCopyright 2019 KKBOX Technologies Limited\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkkbox%2Fopenapi-swift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkkbox%2Fopenapi-swift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkkbox%2Fopenapi-swift/lists"}