Skip to content

Commit

Permalink
Merge branch 'v2.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
BoD committed Dec 13, 2020
2 parents 5e33e00 + f9a2474 commit c081922
Show file tree
Hide file tree
Showing 56 changed files with 1,038 additions and 599 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ out
.idea/*
!.idea/codeStyles
!.idea/copyright
local.properties
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 2.2.0 (2020-12-12)
- Updated all dependencies to their latest version
- Use the new qonto.com domain instead of qonto.eu
- Reflect API changes (a few new fields and objects)

## 2.1.0
Add the `fileName: String` field to the `Attachment` model.

Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# klibqonto

A [Qonto API](https://api-doc.qonto.eu) client library for Kotlin, Java and more.
A [Qonto API](https://api-doc.qonto.com) client library for Kotlin, Java and more.

This library is written in [Kotlin Multiplatform](https://kotlinlang.org/docs/reference/multiplatform.html)
so _in theory_ it can be used from the JVM, Android, and native iOS, Linux, MacOS, Windows and more.
Expand All @@ -23,17 +23,17 @@ Several flavors of the client are available to match your needs:

### 1/ Add the dependencies to your project
#### Gradle based projects
The artifact is hosted on a specific bintray repository.
The artifact is hosted on the JCenter repository.
```groovy
repositories {
/* ... */
maven { url 'https://dl.bintray.com/bod/JRAF' }
jcenter()
}
```
```groovy
dependencies {
/* ... */
implementation 'org.jraf:klibqonto:2.1.0'
implementation 'org.jraf:klibqonto:2.1.1'
}
```

Expand Down Expand Up @@ -97,7 +97,7 @@ On Android, the proxy set in the system settings is automatically used.
## Javascript support
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 me if you want to help :)
that work. Please [contact me](mailto:[email protected]) if you want to help :)

## Author and License
*Note: this project is not officially related to or endorsed by Qonto or Olinda SAS.*
Expand Down
36 changes: 0 additions & 36 deletions build.gradle

This file was deleted.

66 changes: 66 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask

plugins {
id("com.github.ben-manes.versions") version Versions.BEN_MANES_VERSIONS_PLUGIN
}

buildscript {
repositories {
google()
jcenter()
}

dependencies {
classpath("com.android.tools.build", "gradle", Versions.ANDROID_GRADLE_PLUGIN)
classpath(kotlin("gradle-plugin", Versions.KOTLIN))
classpath("com.github.ben-manes", "gradle-versions-plugin", Versions.BEN_MANES_VERSIONS_PLUGIN)
classpath("org.jetbrains.dokka", "dokka-gradle-plugin", Versions.DOKKA_PLUGIN)
}
}

allprojects {
repositories {
mavenLocal()
google()
jcenter()
}

group = "org.jraf"
version = "2.2.0"

// Show a report in the log when running tests
tasks.withType<Test> {
testLogging {
events("passed", "skipped", "failed", "standardOut", "standardError")
}
}
}

tasks {
register<Delete>("clean") {
delete(rootProject.buildDir)
}

wrapper {
distributionType = Wrapper.DistributionType.ALL
gradleVersion = Versions.GRADLE
}

// Configuration for gradle-versions-plugin
// Run `./gradlew dependencyUpdates` to see latest versions of dependencies
withType<DependencyUpdatesTask> {
resolutionStrategy {
componentSelection {
all {
if (
setOf("alpha", /*"beta", "rc",*/ "preview", "eap", "m1").any {
candidate.version.contains(it, true)
}
) {
reject("Non stable")
}
}
}
}
}
}
15 changes: 15 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// https://docs.gradle.org/current/userguide/kotlin_dsl.html#sec:kotlin-dsl_plugin
plugins {
`kotlin-dsl`
}

repositories {
// The org.jetbrains.kotlin.jvm plugin requires a repository
// where to download the Kotlin compiler dependencies from.
jcenter()
}

dependencies {
implementation("ca.rmen:lib-french-revolutionary-calendar:1.8.0")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin-api:1.4.21")
}
28 changes: 28 additions & 0 deletions buildSrc/src/main/kotlin/Globals.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
object Versions {
// Misc and plugins
const val GRADLE = "6.7.1"
const val KOTLIN = "1.4.21"
const val BEN_MANES_VERSIONS_PLUGIN = "0.36.0"
const val ANDROID_GRADLE_PLUGIN = "4.1.1"
const val DOKKA_PLUGIN = "1.4.20"

// Lib dependencies
const val KOTLIN_SERIALIZATION = "1.4.21"
const val KTOR = "1.4.3"
const val COROUTINES = "1.4.2"
const val SLF4J = "1.7.30"

// Testing dependencies
const val ESPRESSO = "3.3.0"
const val JUNIT = "4.13.1"
}

object AppConfig {
const val APPLICATION_ID = "org.jraf.android.fotomator"
const val COMPILE_SDK = 30
const val TARGET_SDK = 30
const val MIN_SDK = 23

var buildNumber: Int = 0
val buildProperties = mutableMapOf<String, String>()
}
137 changes: 137 additions & 0 deletions buildSrc/src/main/kotlin/Utils.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
import ca.rmen.lfrc.FrenchRevolutionaryCalendar
import org.gradle.api.Project
import org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler
import java.io.File
import java.io.FileInputStream
import java.io.FileOutputStream
import java.text.SimpleDateFormat
import java.util.Date
import java.util.GregorianCalendar
import java.util.Locale
import java.util.Properties
import java.util.TimeZone

/**
* Returns a file on the project's root - creates it from a sample if it doesn't exist.
*/
fun Project.getOrCreateFile(fileName: String): File {
val res = file(fileName)
if (!res.exists()) {
logger.warn("$fileName file does not exist: creating it now - please check its values")
copy {
from("${fileName}.SAMPLE")
into(project.projectDir)
rename { fileName }
}
}
return res
}

/**
* Get a Map<String, String> loaded from properties file.
*/
fun MutableMap<String, String>.loadFromFile(file: File) {
val properties = Properties()
val fileInputStream = FileInputStream(file)
fileInputStream.use {
properties.load(it)
}
for ((k, v) in properties) {
put(k.toString(), v.toString())
}
}

/**
* Store a Map<String, String> into a propertoes file.
*/
fun Map<String, String>.storeToFile(file: File) {
val properties = Properties()
for ((k, v) in this) {
properties.setProperty(k, v)
}
val fileOutputStream = FileOutputStream(file)
fileOutputStream.use {
properties.store(it, null)
}
}

private fun exec(vararg command: String): String = ProcessBuilder(*command)
.start()
.inputStream
.bufferedReader()
.readLine()

/**
* Returns the SHA1 of the current git commit.
*/
fun Project.getGitSha1(): String = try {
exec("git", "--git-dir=${rootDir}/.git", "--work-tree=${rootDir}", "rev-parse", "--short", "HEAD")
} catch (t: Throwable) {
"(Unknown)"
}

/**
* Returns the name of the current git branch.
*/
fun Project.getGitBranch(): String = try {
exec("git", "--git-dir=${rootDir}/.git", "--work-tree=${rootDir}", "rev-parse", "--abbrev-ref", "HEAD")
} catch (t: Throwable) {
"(Unknown)"
}

/**
* The current date/time formatted in UTC.
*/
val buildDate: String by lazy {
SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'", Locale.US).apply {
timeZone = TimeZone.getTimeZone("UTC")
}
.format(Date())
}

/**
* This is for amusement purposes :)
*/
fun getFrenchDate(): String {
val frenchDate = FrenchRevolutionaryCalendar(
Locale.FRENCH,
FrenchRevolutionaryCalendar.CalculationMethod.ROMME
).getDate(GregorianCalendar())
return "Le ${frenchDate.weekdayName} ${frenchDate.dayOfMonth} ${frenchDate.monthName} de l'an ${frenchDate.year}. (${frenchDate.objectTypeName} du jour : ${frenchDate.objectOfTheDay})"
}


/**
* Show a "splash screen".
*/
fun Project.printSplashScreen() {
val ansiPurple = "\u001B[95m"
val ansiReset = "\u001B[0m"
println(
"""
====================================${ansiPurple}
_____ ___ ____
__ / / _ \/ _ | / __/___ _______ _
/ // / , _/ __ |/ _/_/ _ \/ __/ _ `/
\___/_/¦_/_/ |_/_/ (_)___/_/ \_, /
/___/
${ansiReset}
Building ${rootProject.name}.
${getFrenchDate()}
rootDir: $rootDir
buildDate: $buildDate
versionCode: ${AppConfig.buildNumber}
versionName: ${AppConfig.buildProperties["versionName"]}
gitBranch: ${getGitBranch()}
gitSha1: ${getGitSha1()}
====================================
""".trimIndent()
)
}

fun KotlinDependencyHandler.implementation(group: String, artifact: String, version: String) =
implementation("$group:$artifact:$version")
Loading

0 comments on commit c081922

Please sign in to comment.