Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Kotlin version of the library #65

Merged
merged 81 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
16dcf94
chore: init library
Skythrew Aug 30, 2024
0c34104
feat: add geolocation
Skythrew Aug 30, 2024
40d499d
fix(geolocation): remove quotes from JSON output
Skythrew Aug 30, 2024
5e81faf
feat: add instance (info)
Skythrew Aug 30, 2024
0cc0995
refactor(api): move helpers to a subdirectory
Skythrew Aug 30, 2024
16273f7
feat: implement aes with base models
Skythrew Sep 1, 2024
43b63d2
fix(tests): add OptIn annotation needed for JSON
Skythrew Sep 1, 2024
571c91f
fix(tests): remove useless imports
Skythrew Sep 1, 2024
3fb04e2
feat(models): add `RefreshInformation`
Skythrew Sep 1, 2024
db117d9
fix(tests): add missing `Queue` class
Skythrew Sep 1, 2024
c16cb4d
fix(core): use a basic JSON object as request data
Skythrew Sep 1, 2024
82cd70a
feat(encoders): add `encodeAccountKindToPath` encoder
Skythrew Sep 2, 2024
7dc1c2c
feat(api): add `session-information` request
Skythrew Sep 2, 2024
203304e
fix(ResponseFN): catch all exceptions
Skythrew Sep 2, 2024
64ada2c
fix(project): use only session info when no other session data is needed
Skythrew Sep 2, 2024
5a56b8c
fix(models): use `LocalDateTime` instead of `Instant`
Skythrew Sep 2, 2024
c7bec3f
feat(decoders): add domain decoder
Skythrew Sep 2, 2024
98c91ca
feat(decoders): add pronote date decoder
Skythrew Sep 2, 2024
4d85115
feat(decoders): add `Holiday` decoder
Skythrew Sep 2, 2024
4e894e1
feat(decoders): add period decoder
Skythrew Sep 2, 2024
86e795c
feat(decoders): add `InstanceParameters` decoder
Skythrew Sep 2, 2024
d576973
feat(api): add `instanceParameters` request function
Skythrew Sep 2, 2024
34e78b7
fix(ResponseFN): allocate more memory for response data
Skythrew Sep 2, 2024
2485dd0
temporary: push for tests
Skythrew Sep 5, 2024
b8a4518
chore: remove useless logs
Vexcited Sep 6, 2024
ed31cd4
fix(req): compression hex interpretation
Vexcited Sep 6, 2024
bc6447c
perf(res): reduce useless compression allocation
Vexcited Sep 6, 2024
4fe4fc0
fix(login): move `login` to `commonMain`
Skythrew Sep 7, 2024
69cff02
fix(tabs): do not throw error when trying to parse an unknown tab
Skythrew Sep 7, 2024
dbe449a
fix(UserAuthorizations): use `Long` type instead of `Double`
Skythrew Sep 7, 2024
78cdd8f
fix(login): request first mobile authentication when logging in with …
Skythrew Sep 7, 2024
7d1ef4f
feat(api): add `homepage` part
Skythrew Sep 7, 2024
db47a54
fix(user-parameters): remove useless log
Skythrew Sep 7, 2024
e82132a
feat(api): add base for `news`
Skythrew Sep 8, 2024
db7873e
fix(user-resource): add missing case for "student" part
Skythrew Sep 9, 2024
7b232b9
feat(api): add `grades-overview`
Skythrew Sep 9, 2024
f688605
feat(api): add base for `assignments`
Skythrew Sep 10, 2024
79a4f25
fix(user-resource): make `avecPhoto` field optional
Skythrew Sep 15, 2024
7ed65c4
feat(api): add `timetable` part
Skythrew Sep 15, 2024
97dd05d
feat(api): add `account` part
Skythrew Sep 15, 2024
e6d30a1
feat(assignments): add ability to edit status
Skythrew Sep 15, 2024
0e7ff50
feat(api): add `evaluations` part
Skythrew Sep 16, 2024
06810f0
feat(api): add `menus` part
Skythrew Sep 16, 2024
7c4bd0a
refactor: rename some files to be consistent
Skythrew Sep 16, 2024
9252975
feat(api): add `notebook` part
Skythrew Sep 21, 2024
7aceee8
feat(assignments): add ability to remove previously uploaded file
Skythrew Sep 21, 2024
03ad146
feat(login): implement login completely
Skythrew Sep 25, 2024
103ace2
feat(api): add gradebook pdf generation
Skythrew Sep 26, 2024
421f9bb
refactor: rename file for consistency
Skythrew Sep 26, 2024
78f1d17
refactor: move to a fqdn package
Skythrew Sep 27, 2024
0a91b0b
feat(api): add `partner-url`
Skythrew Sep 27, 2024
17a6454
feat(api): add `presence`
Skythrew Sep 27, 2024
e8bbb6e
feat(api): add `resources` part
Skythrew Sep 28, 2024
72da565
feat(api): add `security` part
Skythrew Sep 28, 2024
c55115d
feat(api): add assignment file upload
Skythrew Sep 29, 2024
4b51e4c
feat(api): implement `discussions` base
Skythrew Sep 29, 2024
63a7715
feat(api): implement `discussion-messages`
Skythrew Oct 5, 2024
5dd9110
fix(api): reimplement discussions cache properly
Skythrew Oct 5, 2024
2f41f96
feat(api): implement `discussions-post-command`
Skythrew Oct 5, 2024
ec2db54
feat(api): implement `discussions-trash`
Skythrew Oct 5, 2024
d7a63ae
feat(api): implement `discussions-delete`
Skythrew Oct 5, 2024
8fbb330
refactor: rename file
Skythrew Oct 5, 2024
5607e2f
fix(discussion-messages): draft message decoding
Skythrew Oct 5, 2024
98e79d7
feat(api): implement `discussion-create-draft`
Skythrew Oct 5, 2024
b94c0f6
feat(api): implement `discussion-recipients`
Skythrew Oct 5, 2024
b8ed9ad
feat(api): implement `discussion-remote-mutate-draft`
Skythrew Oct 6, 2024
42afa8d
feat(api): implement `discussion-remove-draft`
Skythrew Oct 6, 2024
c22a892
feat(api): implement `discussion-restore-trash`
Skythrew Oct 6, 2024
19fbe59
fix(discussion-messages): draft "detection"
Skythrew Oct 6, 2024
ac666b2
feat(api): implement `discussion-send-draft`
Skythrew Oct 6, 2024
4fff2e8
feat(api): implement `discussion-send-message`
Skythrew Oct 6, 2024
2a43f51
feat(api): implement `new-discussion-recipients`
Skythrew Oct 6, 2024
1862c3a
feat(api): implement `new-discussion`
Skythrew Oct 6, 2024
08ec475
feat(api): implement `news-delete`
Skythrew Oct 6, 2024
2e1927f
feat(api): implement `news-information-acknowledge`
Skythrew Oct 6, 2024
3187737
feat(api): implement `news-survey-send`
Skythrew Oct 6, 2024
d4b6774
feat(api): implement `resource`
Skythrew Oct 6, 2024
723117e
refactor: format
Skythrew Oct 6, 2024
394ffb0
feat(api.helpers): add `parseTimetable` helper
Skythrew Oct 6, 2024
f38bbf6
feat(api.helpers): add `frequency` helper
Skythrew Oct 6, 2024
9168f83
feat(api.helpers): add `ical` helper
Skythrew Oct 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
*.iml
.gradle
.idea
.DS_Store
build
captures
.externalNativeBuild
.cxx
local.properties
xcuserdata
.kotlin
4 changes: 4 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
plugins {
alias(libs.plugins.androidLibrary).apply(false)
alias(libs.plugins.kotlinMultiplatform).apply(false)
}
12 changes: 12 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#Gradle
org.gradle.jvmargs=-Xmx2048M -Dfile.encoding=UTF-8 -Dkotlin.daemon.jvm.options\="-Xmx2048M"
org.gradle.caching=true
org.gradle.configuration-cache=true
#Kotlin
kotlin.code.style=official
kotlin.js.compiler=ir
#MPP
kotlin.mpp.enableCInteropCommonization=true
#Android
android.useAndroidX=true
android.nonTransitiveRClass=true
20 changes: 20 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[versions]
agp = "8.5.0"
kotlin = "2.0.0"
kotlinx-serialization = "1.7.1"
android-minSdk = "24"
android-compileSdk = "34"
ktor = "2.3.12"
kotlinx-datetime = "0.6.1"

[libraries]
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlin" }
ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
ktor-client-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref= "ktor" }
kotlinx-serialization-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "kotlinx-serialization" }
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization" }
kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinx-datetime" }

[plugins]
androidLibrary = { id = "com.android.library", version.ref = "agp" }
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 6 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
244 changes: 244 additions & 0 deletions gradlew
Original file line number Diff line number Diff line change
@@ -0,0 +1,244 @@
#!/bin/sh

#
# Copyright © 2015-2021 the original 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 POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################

# Attempt to set APP_HOME

# Resolve links: $0 may be a link
app_path=$0

# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done

# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum

warn () {
echo "$*"
} >&2

die () {
echo
echo "$*"
echo
exit 1
} >&2

# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar


# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi

# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi

# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.

# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )

JAVACMD=$( cygpath --unix "$JAVACMD" )

# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#

eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'

exec "$JAVACMD" "$@"
92 changes: 92 additions & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
@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
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
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="-Xmx64m" "-Xms64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*

:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega
Loading