This repository is home to a library for Asana written in Kotlin, which implements task โ๏ธ object serialization, a DSL for working with resources, auto pagination handling, and more!
kotlin-asana
is aimed at extending the client's functionality with simple, declarative, and fun to use calls!
Essentially, this library saves you from spending lots of time crafting API calls, so you can focus on your business
logic. Read on to learn more and find examples.
๐ For library documentation, please click here.
- Overview of features
- Installation (with Maven)
- Quick setup
- Quick examples
- Detailed documentation and usage examples
- Default behavior
- Providing your own configuration
- Getting started with this library
- Serializing user-defined objects into tasks and back
- Support for serializing and deserializing
Tasks
and theirCustomField
s into data objects. - Declaratively working with custom fields, tasks, projects, and workspaces.
- Automagically handles pagination, passing query parameters, and other intricate setup work for you!
- Searching for tasks within a workspace or project, with support for filters.
- Enforces best practices for handling your access token.
Deployment of this project to Maven central coming soonโข๏ธ๏ธ. For now, use JitPack.
Include this git repository into your project's pom.xml
with the following dependency:
<dependency>
<groupId>com.github.OliverAbdulrahim</groupId>
<artifactId>kotlin-asana</artifactId>
</dependency>
You'll also want to make sure that you have the JitPack repository:
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
Recommended: for easy, autowired setup, supply the asana_access_token
environment variable wherever you use
kotlin-asana
.
java -jar <your app name>.jar asana_access_token=<your access token>
If you prefer to authenticate another way, or if you already have a java-asana
Client
object, follow these steps to
provide kotlin-asana
your own configuration (links to another document on this repository).
This library makes use of Kotlin function literals with receiver
and extension functions; these allow you to cleanly
and declaratively work with Asana resources like tasks, projects, and workspaces within any asanaContext
(the entry
point for this library).
asanaContext {
// Tasks
val person: Person = task("123").convertTo(Person::class)
// Projects
val taskAgain: Task = project("456") { person.convertToTask(this).update() }
// Workspaces
val search: List<Task> = workspace("789").search("ice cream sundae", "456")
}
Learn more about asanaContext
at this link. More information on
this library's serialization at this link.