A Swift framework for the esa.io API

Overview

Notice: EsaKit is no longer being maintained/updated.

EsaKit MIT license

A Swift framework for the esa.io API

let client = EsaClient(token: "your_token", teamName: "your_team_name")
client.members()
  .startWithResult { result in
    switch result {
    case let .success(response, members):
      print("\(response)") // => Response(xRateLimitLimit: 75, XRateLimitRemaining: 71)
      print("\(members)")  // => Memberss(members: [EsaKit.MemberUser(name:...
    case let .failure(error):
      print("An error occured: \(error)")
    }
  }

client.teamName = "other_your_team_name"
client.posts()
  .startWithResult { result in
    switch result {
    case let .success(response, posts):
      print("\(response)") // => Response(xRateLimitLimit: 75, XRateLimitRemaining: 70)
      print("\(posts)")    // => Posts(posts: [EsaKit.Post(number: 11, name:...
    case let .failure(error):
      print("An error occured: \(error)")
    }
  }

EsaKit is build with ReactiveSwift and Sourcery.

Requirements

EsaKit requires / supports the following environments:

  • Swift 3.0 / Xcode 8.1
  • OS X 10.10 or later
  • iOS 9.0 or later

Installation

Carthage

  • Insert github "pixyzehn/EsaKit" to your Cartfile.
  • Run carthage update.
  • Link your app with EsaKit.framework, ReactiveSwift.framework and Result.framework in Carthage/Build.

CocoaPods

  • Insert pod 'EsaKit' to your Podfile.
  • Run pod install.

Swift Package Manager

  • Add EsaKit as a dependency of your package in Package.swift. .Package(url: "https://github.com/pixyzehn/EsaKit.git", majorVersion: 0, minor: 3)

Usage

Read the docs. Generated with jazzy.

// Initialization
let client = EsaClient(token: "your_token", teamName: "your_team_name")

// Team API
client.teams()
// #=> GET /v1/teams

client.team()
// #=> GET /v1/teams/[your_team_name]


// Stats API
client.stats()
// #=> GET /v1/teams/[your_team_name]/stats


// Member API
client.members()
// #=> GET /v1/teams/[your_team_name]/members


// Post API
client.posts()
// #=> GET /v1/teams/[your_team_name]/posts

client.posts(query: "in:help")
// #=> GET /v1/teams/[your_team_name]/posts?q=in%3Ahelp

client.post(postNumber: 1)
// #=> GET /v1/teams/[your_team_name]/posts/1

client.createPost(parameters: PostParameters(name: "title"))
// #=> POST /v1/teams/[your_team_name]/posts

client.updatePost(postNumber: 1, parameters: PostParameters(name: "other_title"))
// #=> PATCH /v1/teams/[your_team_name]/posts/1

client.deletePost(postNumber: 1)
// #=> DELETE /v1/teams/[your_team_name]/posts/1


// Comment API
client.comments(postNumber: 1)
// #=> GET /v1/teams/[your_team_name]/posts/1/comments

client.comment(commentId: 123)
// #=> GET /v1/teams/[your_team_name]/comments/123

client.createComment(postNumber, bodyMd: "baz")
// #=> POST /v1/teams/[your_team_name]/posts/1/comments

client.updateComment(commentId, bodyMd: "bazbaz")
// #=> PATCH /v1/teams/[your_team_name]/comments/123

client.delete_comment(commentId)
// #=> DELETE /v1/teams/[your_team_name]/comments/123


// Star API
client.stargazersInPost(postNumber: 1)
// #=> GET /v1/teams/[your_team_name]/posts/1/stargazers

client.addStarInPost(postNumber: 1)
// #=> POST /v1/teams/[your_team_name]/posts/1/star

client.removeStarInPost(postNumber: 1)
// #=> DELETE /v1/teams/[your_team_name]/posts/1/star

client.stargazersInComment(commentId: 123)
// #=> GET /v1/teams/[your_team_name]/comments/123/stargazers

client.addStarInComment(commentId: 123)
// #=> POST /v1/teams/[your_team_name]/comments/123/star

client.removeStarInComment(commentId: 123)
// #=> DELETE /v1/teams/[your_team_name]/comments/123/star


// Watch API
client.watchers(postNumber: 1)
// #=> GET /v1/teams/[your_team_name]/posts/1/watchers

client.addWatch(postNumber: 1)
// #=> POST /v1/teams/[your_team_name]/posts/1/watch

client.removeWatch(postNumber: 1)
// #=> DELETE /v1/teams/[your_team_name]/posts/1/watch


// Category API
client.batchMove(from: "/foo/bar/",to: "/baz/")
// #=> POST /v1/teams/[your_team_name]/categories/batch_move


// Authenticated User API
client.user()
// #=> GET /v1/user

Contributing

  1. Fork it ( https://github.com/pixyzehn/EsaKit )
  2. Create your feature branch (git checkout -b new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin new-feature)
  5. Create a new Pull Request
You might also like...
🌾 Harvest: Apple's Combine.framework + State Machine, inspired by Elm.
🌾 Harvest: Apple's Combine.framework + State Machine, inspired by Elm.

NOTE: This repository has been discontinued in favor of Actomaton. 🌾 Harvest Apple's Combine.framework (from iOS 13) + State Machine, inspired by Elm

A lightweight, event-driven architectural framework

Trellis Trellis features a declarative DSL that simplifies service bootstrapping: let cluster = try await Bootstrap { Group { Store(model:

Dynamic and type-safe framework for building linear and non-linear flows.

FlowKit FlowKit is a dynamic flow framework capable of building a flow, based on conditions and ordered according to a logic of next steps. By using F

Redux for Swift - a predictable state container for Swift apps

Merge / deprecation announcement: ReduxKit and Swift-Flow have joined forces! The result is ReSwift. The nitty gritty: We decided to deprecate ReduxKi

Unidirectional flow implemented using the latest Swift Generics and Swift Concurrency features.

swift-unidirectional-flow Unidirectional flow implemented using the latest Swift Generics and Swift Concurrency features. struct SearchState: Equatabl

Reactive Programming in Swift
Reactive Programming in Swift

Rx is a generic abstraction of computation expressed through ObservableElement interface, which lets you broadcast and subscribe to values and other

RxSwift extentions for Swift optionals and "Occupiable" types

RxOptional RxSwift extentions for Swift optionals and "Occupiable" types. Usage All operators are available on Driver as well unless otherwise marked.

Unidirectional Data Flow in Swift - Inspired by Redux
Unidirectional Data Flow in Swift - Inspired by Redux

ReSwift Supported Swift Versions: Swift 4.2, 5.x For Swift 3.2 or 4.0 Support use Release 5.0.0 or earlier. For Swift 2.2 Support use Release 2.0.0 or

A Swift Reactive Programming Kit
A Swift Reactive Programming Kit

ReactiveKit is a lightweight Swift framework for reactive and functional reactive programming that enables you to get into the reactive world today. T

Releases(0.3.1)
A configurable api client based on Alamofire4 and RxSwift4 for iOS

SimpleApiClient A configurable api client based on Alamofire4 and RxSwift4 for iOS Requirements iOS 8.0+ Swift 4 Table of Contents Basic Usage Unwrap

Jay 67 Dec 7, 2020
RxAlamoRecord combines the power of the AlamoRecord and RxSwift libraries to create a networking layer that makes interacting with API's easier than ever reactively.

Written in Swift 5 RxAlamoRecord combines the power of the AlamoRecord and RxSwift libraries to create a networking layer that makes interacting with

Dalton Hinterscher 9 Aug 7, 2020
Aftermath is a stateless message-driven micro-framework in Swift

Aftermath is a stateless message-driven micro-framework in Swift, which is based on the concept of the unidirectional data flow architecture.

HyperRedink 70 Dec 24, 2021
An observables framework for Swift

?? snail A lightweight observables framework, also available in Kotlin Installation Carthage You can install Carthage with Homebrew using the followin

Compass 179 Nov 21, 2022
A Swift framework for reactive programming.

CwlSignal An implementation of reactive programming. For details, see the article on Cocoa with Love, CwlSignal, a library for reactive programming. N

Matt Gallagher 304 Oct 25, 2022
Cocoa framework and Obj-C dynamism bindings for ReactiveSwift.

Reactive extensions to Cocoa frameworks, built on top of ReactiveSwift. ⚠️ Looking for the Objective-C API? ?? Migrating from RAC 4.x? ?? Release Road

null 20k Jan 8, 2023
RxReduce is a lightweight framework that ease the implementation of a state container pattern in a Reactive Programming compliant way.

About Architecture concerns RxReduce Installation The key principles How to use RxReduce Tools and dependencies Travis CI Frameworks Platform Licence

RxSwift Community 125 Jan 29, 2022
Open source implementation of Apple's Combine framework for processing values over time.

OpenCombine Open-source implementation of Apple's Combine framework for processing values over time. The main goal of this project is to provide a com

OpenCombine 2.4k Jan 2, 2023
This Repository holds learning data on Combine Framework

Combine Framework List of Topics Welcome, every section in this repo contains a collection of exercises demonstrating combine's utilization as well as

Julio Ismael Robles 2 Mar 17, 2022
Binding - Data binding framework (view model binding on MVVM) written using propertyWrapper and resultBuilder

Binding Data binding framework (view model binding on MVVM) written using @prope

Sugeng Wibowo 4 Mar 23, 2022