Skip to content

askrav/MonoProvider

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MonoProvider

Swift Vapor

MonoProvider is a Vapor 3 package for the MonoBank API.

How To Use

In your Package.swift file, add the following line:

.package(url: "https://github.com/askrav/MonoProvider.git", from: "1.0.0")

Register the config and the provider in configure.swift

//Public API
let monoPublicConfig = MonoPublicConfig()
services.register(monoPublicConfig)
try services.register(MonoPublicProvider())

//Personal API
let monoPersonalConfig = MonoPersonalConfig(xToken: "YOUR_PERSONAL_TOKEN")
services.register(monoPersonalConfig)
try services.register(MonoPersonalProvider())

An usage example:

static func getPersonalInfo(_ req: Request) throws -> Future<UserInfo> {
  return try req.make(MonoPersonalClient.self).personal.userInfo().flatMap { userInfo in
    let userName = userInfo.name
    // ...
    // Do whatever you need to
    // ...
    return req.future(userInfo)
  }
}

All the documentation is available on the MonoBank API website.

Mono Provider is available under the MIT license. See the LICENSE file for more info.

About

MonoBank API Vapor Provider

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages