oliverabdulrahim / kotlin-asana Goto Github PK
View Code? Open in Web Editor NEW๐ Client library for Asana written in Kotlin
License: MIT License
๐ Client library for Asana written in Kotlin
License: MIT License
Summary
No field in CustomField
captures the people_value
property given by custom field api endpoints. Example:
Example request
curl -X GET https://app.asana.com/api/1.0/tasks/12345?opt_fields=custom_fields
... header stuff ...
Example response
{
"data": {
"gid": "12345",
"custom_fields": [
{
"gid": "...",
"resource_subtype": "people",
"resource_type": "custom_field",
"people_value": [
{
"gid": "...",
"resource_type": "user"
},
{
"gid": "...",
"resource_type": "user"
}
],
"type": "people"
}
]
}
}
Relevant part of the response
"people_value": [
{
"gid": "...",
"resource_type": "user"
},
{
"gid": "...",
"resource_type": "user"
}
]
people_value
is an array of User
resources.Changes to CustomField
class (Java)
Must implement a field to serialize the people_value
object within CustomField
.
@SerializedName("people_value")
public Collection<User> peopleValue;
Allow fields annotated with the @AsanaCustomField
annotation to be processed optionally.
data class Person(
@AsanaCustomField("Preferred name") override var name: String = "",=
@AsanaCustomField("Fluent in Spanish?") override var bilingual: String = "",
) : AsanaSerializable<Person>
If the given Person
class is used to serialize a task in a project where the Fluent in Spanish
custom field does not exist, an error occurs:
Exception in thread "DefaultDispatcher-worker-4"
org.conservationco.asana.serialization.customfield.CustomFieldException: No custom field in CustomFieldContext matches name=var bilingual: kotlin.String
org.conservationco.asana.serialization.AsanaTaskSerializer.buildCustomFieldFrom(AsanaTaskSerializer.kt:92) at
org.conservationco.asana.serialization.AsanaTaskSerializer.convertPropertiesToCustomFields(AsanaTaskSerializer.kt:80) at
org.conservationco.asana.serialization.AsanaTaskSerializer.serialize(AsanaTaskSerializer.kt:44) at
org.conservationco.asana.serialization.AsanaTaskSerializer.serialize(AsanaTaskSerializer.kt:52) at
org.conservationco.asana.extensions.AsanaClientExtension.convertToTask(AsanaClientExtension.kt:360) at org.conservationco.asanahire.util.ApplicantsKt.copyAndUpdate(Applicants.kt:96) at
annotation class AsanaCustomField(
val name: String,
val isOptional: Boolean = false,
)
Then don't throw an exception on custom field that don't appear and are marked as optional == true
.
Summary
No field in CustomField
captures the date_value
property given by custom field api endpoints. Example:
Example request
curl -X GET https://app.asana.com/api/1.0/tasks/12345?opt_fields=custom_fields
... header stuff ...
Example response
{
"data": {
"gid": "12345",
"custom_fields": [
{
"gid": "...",
"resource_subtype": "date",
"resource_type": "custom_field",
"date_value": {
"date": "2022-10-03",
"date_time": "2022-10-03T23:00:00.000Z"
}
}
]
}
}
Relevant part of the response
"date_value": {
"date": "2022-10-03",
"date_time": "2022-10-03T23:00:00.000Z"
}
date_value.date
is a date string with the format YYYY-MM-DD
, anddate_value.date_time
is a full ISO-8601 string.Must implement a class to serialize the date_value
object.
DateValue Implementation (Kotlin example)
data class DateValue(val date: DateTime?, val dateTime: DateTime?)
Changes to CustomField
class (Java)
A field of type DateValue
will need to be declared CustomField
class:
@SerializedName("date_value")
public DateValue dateValue;
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.