A Qonto API client library for Kotlin, Java and more.
This library is written in Kotlin Multiplatform so in theory it can be used from the JVM, Android, and native iOS, Linux, MacOS, Windows and more. In practice this library has been tested and has samples for the JVM (Kotlin and Java), Android (Kotlin), MacOS (Kotlin), and iOS (Swift).
Several flavors of the client are available to match your needs:
- Coroutines (
suspend
) based: the default client for Kotlin projects - Blocking: useful for Java projects, or if you have your own async mechanism
- Callback based: useful for Java and Swift projects
Future
based (JVM only): useful for Java projects
The artifacts are hosted on the Maven Central repository.
Note: prior to v2.3.0, the artifacts used to be hosted on JCenter.
repositories {
/* ... */
mavenCentral()
}
dependencies {
/* ... */
implementation 'org.jraf:klibqonto:2.5.0'
}
TODO
The easiest way to see how to use it is to look at the samples:
- Coroutines (Kotlin)
- Blocking (Java)
- Future (Java)
- Callback (Kotlin)
- Callback (Swift) TODO
You will find your login and secret key in the Qonto web application under Settings, in the Integrations (API) tab.
To use OAuth, you must register your application by reaching out to Qonto as documented here.
OAuth usage is demonstrated in the sample.
val qontoClient = QontoClient.newInstance(
ClientConfiguration(
LoginSecretKeyAuthentication(
LOGIN,
SECRET_KEY
)
// Or use OAuthAuthentication for OAuth
)
)
To get other flavors of the client:
- Blocking:
BlockingQontoClient blockingClient = BlockingQontoClientUtils.asBlockingQontoClient(qontoClient)
- Callback:
CallbackQontoClient callbackClient = CallbackQontoClientUtils.asCallbackQontoClient(qontoClient)
- Future:
FutureQontoClient futureClient = FutureQontoClientUtils.asFutureQontoClient(qontoClient)
The client gives access to several API "areas":
oAuth
organizations
transactions
memberships
labels
attachments
Each area exposes related APIs, for instance: qontoClient.transactions.getTransactionList
.
The APIs that are paginated all follow the same principle:
- take a
Pagination
object as a parameter, which defines the page to retrieve, as well as the number of items per page - return a
Page<T>
with the result list but also a reference to the next and previousPagination
objects (handy when retrieving several pages).
To log HTTP requests/response, pass a HttpConfiguration
to QontoClient.newInstance()
.
Several levels are available: NONE
, INFO
, HEADERS
, BODY
and ALL
A proxy can be configured by passing a HttpConfiguration
to QontoClient.newInstance()
.
On Android, the proxy set in the system settings is automatically used.
In theory Kotlin Multiplatform projects can also target Javascript but as of today the author couldn't understand how to make that work. Please contact the author if you want to help :)
Note: this project is not officially related to or endorsed by Qonto or Olinda SAS.
Copyright (C) 2019-present Benoit 'BoD' Lubek ([email protected])
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.