diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml index a88ded0..ce889bd 100644 --- a/.idea/codeStyles/Project.xml +++ b/.idea/codeStyles/Project.xml @@ -1,8 +1,5 @@ - - diff --git a/.idea/misc.xml b/.idea/misc.xml index 703e5d4..8a8f75b 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -5,7 +5,7 @@ - + diff --git a/.idea/modules.xml b/.idea/modules.xml index f908fc1..8bc0607 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -5,6 +5,9 @@ + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 94a25f7..35eb1dd 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/build.gradle b/build.gradle index 8e005cb..1ec67d7 100644 --- a/build.gradle +++ b/build.gradle @@ -3,9 +3,9 @@ buildscript { ext { - android_gradle_ver = '3.5.3' + android_gradle_ver = '3.6.1' - kotlin_ver = '1.3.61' + kotlin_ver = '1.3.70' ktlint_ver = '0.36.0' retrofit_ver = '2.7.1' moshi_ver = '1.9.2' diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index f6b961f..f3d88b1 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index fdd6e1f..6254d2d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Sat Aug 03 18:52:30 CEST 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.1-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip diff --git a/gradlew b/gradlew index cccdd3d..2fe81a7 100755 --- a/gradlew +++ b/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# 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 +# +# https://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. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -109,8 +125,8 @@ if $darwin; then GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" fi -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` @@ -138,19 +154,19 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $i + 1` done case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; esac fi @@ -159,14 +175,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +APP_ARGS=`save "$@"` # Collect all arguments for the java command, following the shell quoting and substitution rules eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index e95643d..9109989 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -13,8 +29,11 @@ if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/lib/build.gradle b/lib/build.gradle index 670da11..807917f 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -5,7 +5,7 @@ apply plugin: 'kotlin-kapt' android { compileSdkVersion 29 - buildToolsVersion "29.0.2" + buildToolsVersion "29.0.3" defaultConfig { minSdkVersion 21 diff --git a/lib/src/main/java/com/kirkbushman/zammad/ZammadApi.kt b/lib/src/main/java/com/kirkbushman/zammad/ZammadApi.kt index 412a717..983f3e8 100644 --- a/lib/src/main/java/com/kirkbushman/zammad/ZammadApi.kt +++ b/lib/src/main/java/com/kirkbushman/zammad/ZammadApi.kt @@ -11,6 +11,7 @@ interface ZammadApi { @GET("/api/v1/users/me") fun me( + @Query("expand") expanded: Boolean, @HeaderMap header: HashMap ): Call diff --git a/lib/src/main/java/com/kirkbushman/zammad/ZammadClient.kt b/lib/src/main/java/com/kirkbushman/zammad/ZammadClient.kt index e9fecb1..de7c861 100644 --- a/lib/src/main/java/com/kirkbushman/zammad/ZammadClient.kt +++ b/lib/src/main/java/com/kirkbushman/zammad/ZammadClient.kt @@ -79,12 +79,12 @@ class ZammadClient( } } - fun me(baseUrl: String, username: String, password: String, logging: Boolean): User? { + fun me(baseUrl: String, username: String, password: String, logging: Boolean, expanded: Boolean = false): User? { val auth = "$username:$password" val authMap = hashMapOf("Authorization" to "Basic ".plus(String(Base64.encode(auth.toByteArray(), Base64.NO_WRAP)))) val api = getApi(baseUrl, logging) - val req = api.me(authMap) + val req = api.me(expanded, authMap) val res = req.execute() if (!res.isSuccessful) { @@ -97,10 +97,10 @@ class ZammadClient( private val api = getApi(baseUrl, logging) - fun me(): User? { + fun me(expanded: Boolean = false): User? { val authMap = getHeaderMap() - val req = api.me(authMap) + val req = api.me(expanded, authMap) val res = req.execute() if (!res.isSuccessful) { diff --git a/lib/src/main/java/com/kirkbushman/zammad/models/User.kt b/lib/src/main/java/com/kirkbushman/zammad/models/User.kt index 366fa41..ca110ec 100644 --- a/lib/src/main/java/com/kirkbushman/zammad/models/User.kt +++ b/lib/src/main/java/com/kirkbushman/zammad/models/User.kt @@ -7,6 +7,7 @@ import com.kirkbushman.zammad.models.base.Updatable import com.squareup.moshi.Json import com.squareup.moshi.JsonClass import kotlinx.android.parcel.Parcelize +import kotlinx.android.parcel.RawValue @JsonClass(generateAdapter = true) @Parcelize @@ -136,6 +137,12 @@ data class User( val authorizationIds: List, @Json(name = "authorizations") - val authorizations: List? + val authorizations: List?, -) : Parcelable, Identifiable, Creatable, Updatable + @Json(name = "group_ids") + val groupIds: @RawValue Map>, + + @Json(name = "groups") + val groups: @RawValue Map>? + +): Parcelable, Identifiable, Creatable, Updatable