Import the library and you can create an instance of the GitHub API.
It is a wrapper over the GitHub REST API
import Octokot
let github = GitHubAPI()
Most methods are similar to urls from REST API.
You can call them using swift @dynamicMemberLookup …
let repo = try await github.repos.apple.swift()
… or you can use them via subscript.
let repo = try await github.repos["server-swift"]["async-http-client"]()
Authentication
Personal Access Token
Create a Personal Access Token
after which you can set it in the configuration and use the methods for which authentication is required.
var configuration = GitHubAPI.Configuration.default
configuration.accessToken = .string("<personal_access_token>")
let github = GitHubAPI(configuration: configuration)
let user = try await github.user()
Personal Access Token can be in base 64 encoded strings for this case there is a second method in the configuration.
🐱 Octokot
Swift toolkit for the GitHub API
Instalation
Add dependency to
Package.swift
…… and your target
Usage
Import the library and you can create an instance of the GitHub API. It is a wrapper over the GitHub REST API
Most methods are similar to urls from REST API.
You can call them using swift
@dynamicMemberLookup
…… or you can use them via
subscript
.Authentication
Personal Access Token
Create a Personal Access Token after which you can set it in the configuration and use the methods for which authentication is required.
Personal Access Token can be in base 64 encoded strings for this case there is a second method in the configuration.