diff --git a/.github/ISSUE_TEMPLATE/1-bug-report.md b/.github/ISSUE_TEMPLATE/1-bug-report.md new file mode 100644 index 0000000..c445a05 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/1-bug-report.md @@ -0,0 +1,23 @@ +--- +name: "\U0001F41E Bug report" +about: Create a report to help us improve +title: '' +labels: 'T: fix' +assignees: '' + +--- + + + +**Describe the bug** + + + + +**Environment:** + +- Version: +- Language: diff --git a/.github/ISSUE_TEMPLATE/2-feature-request.md b/.github/ISSUE_TEMPLATE/2-feature-request.md new file mode 100644 index 0000000..1d2c4ba --- /dev/null +++ b/.github/ISSUE_TEMPLATE/2-feature-request.md @@ -0,0 +1,16 @@ +--- +name: "\U0001F680 Feature request" +about: Suggest an idea for this project +title: '' +labels: 'T: feat' +assignees: '' + +--- + + + +**Description** + diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..f9d326d --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,18 @@ +**Fixes: #Issue** + + + +**Checklist** + + +- [ ] Commit messages follow conventionalcommits.org + + +**Changes** + + diff --git a/.gitignore b/.gitignore index c27bc27..013695d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,7 @@ -.github -gitignore.io help: - list - lists the operating systems, programming languages and IDE input types - :types: - creates .gitignore files for types of operating systems, programming languages or IDEs \ No newline at end of file +# Generated files +src/ +lib/proto/ + +# Gradle +.gradle +build diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..4d0d798 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,34 @@ +language: java +install: true + +services: + - docker + +jdk: + - oraclejdk8 + +script: + - cd .. + - git clone https://github.com/googleapis/api-common-protos.git + - rm -r ./api-common-protos/google/api/ ./api-common-protos/google/rpc/ + - mkdir -p ./hpi-cloud-apis/src/main/java + - shopt -s globstar + - docker run --rm + -v $(pwd):$(pwd) + -w $(pwd) + thethingsindustries/protoc + --plugin=protoc-gen-grpc=/usr/bin/protoc-gen-grpc-java + --java_out=./hpi-cloud-apis/src/main/java + --grpc_out=./hpi-cloud-apis/src/main/java + --proto_path=./hpi-cloud-apis + --proto_path=./api-common-protos + ./hpi-cloud-apis/**/*.proto + ./api-common-protos/**/*.proto + - cd ./hpi-cloud-apis + - ./gradlew assemble + +deploy: + - provider: script + script: ./gradlew bintrayUpload + on: + tags: true diff --git a/.unicornfig.yml b/.unicornfig.yml index c4e2843..4d8ef26 100644 --- a/.unicornfig.yml +++ b/.unicornfig.yml @@ -7,5 +7,5 @@ description: "This repository contains the original interface definitions of pub \ definitions can provide a better understanding of HPI Cloud APIs and help you\ \ to utilize them more efficiently. You can also use these definitions with open\ \ source tools to generate client libraries, documentation, and other artifacts." -version: "0.0.1" -githubName: null +version: "0.0.3" +githubName: "HPI-de/hpi-cloud-apis" diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..8f527fb --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,43 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). + + + + +## [Unreleased] + + +## [0.0.3] - 2019-08-12 +### Added +- add documentation on how to generate Dart code +- **course:** add course definitions +- **food:** add food definitions +- **myhpi:** add MyHPI definitions + +### Changed +- shorten GitHub templates +- **news:** shorten proto descriptions + +## [0.0.2] - 2019-07-05 +### Changed +- Updated library `com.google.protobuf:protobuf-java` to version 3.8.0. + +## 0.0.1 - 2019-07-05 +Initial release with NewsService. + + +[Unreleased]: https://github.com/HPI-de/hpi-cloud-apis/compare/0.0.3...dev +[0.0.3]: https://github.com/HPI-de/hpi-cloud-apis/compare/0.0.2...0.0.3 +[0.0.2]: https://github.com/HPI-de/hpi-cloud-apis/compare/0.0.1...0.0.2 diff --git a/README.md b/README.md index 23fe5fc..c337145 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,97 @@ # hpi-cloud-apis +[![Build Status](https://travis-ci.com/HPI-de/hpi-cloud-apis.svg?branch=dev)](https://travis-ci.com/HPI-de/hpi-cloud-apis) +[![Download](https://api.bintray.com/packages/hpi/hpi-cloud-mvn/hpi-cloud/images/download.svg)](https://bintray.com/hpi/hpi-cloud-mvn/hpi-cloud/_latestVersion) + This repository contains the original interface definitions of public HPI Cloud APIs that support the gRPC protocol. Reading the original interface definitions can provide a better understanding of HPI Cloud APIs and help you to utilize them more efficiently. You can also use these definitions with open source tools to generate client libraries, documentation, and other artifacts. +These [Protocol Buffers](https://developers.google.com/protocol-buffers/) define the structure used for persistence. + + +> **Note:** All of the following commands should be executed from within this folder. + + +## Generate source code + +> **Note:** The following guide was only tested on Linux (Ubuntu). + +
+Install protoc + +Download release `protoc--linux-x86_64.zip` from https://github.com/protocolbuffers/protobuf/releases + +```sh +sudo apt install autoconf automake libtool curl make g++ unzip +unzip protoc--linux-x86_64.zip -d protoc3 +sudo mv protoc3/bin/* /usr/local/bin/ +sudo mv protoc3/include/* /usr/local/include/ +sudo chown $USER /usr/local/bin/protoc +sudo chown -R $USER /usr/local/include/google +``` +
+ +
+Install Dart + +Source: + +```sh +sudo apt update +sudo apt install apt-transport-https +sudo sh -c 'curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -' +sudo sh -c 'curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list' +sudo apt update +sudo apt install dart +export PATH=$PATH:/usr/lib/dart/bin +``` +
+ +
+Install protoc plugin for Dart + +Source: + +```sh +pub global activate protoc_plugin +export PATH=$PATH:$HOME/.pub-cache/bin +``` +
+ +
+Download Google Common Protos + +```sh +git clone https://github.com/googleapis/api-common-protos.git ../api-common-protos +``` +
+ + +### Dart + +```sh +shopt -s globstar +rm -rf ./lib/proto +mkdir -p ./lib/proto +protoc --proto_path=. \ + --proto_path=../api-common-protos \ + --dart_out=grpc:./lib/proto \ + ./hpi/**/*.proto \ + ../api-common-protos/**/*.proto +``` + ## License Copyright 2019 hpi-cloud-apis - 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 +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 - http://www.apache.org/licenses/LICENSE-2.0 + http://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. +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. diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..d0bee9b --- /dev/null +++ b/build.gradle @@ -0,0 +1,96 @@ +plugins { + id 'java-library' + id "maven-publish" + id "com.jfrog.bintray" version "1.8.4" +} + +repositories { + mavenLocal() + jcenter() +} +dependencies { + api("com.google.protobuf:protobuf-java:3.8.0") + // implementation as Android clients will replace this with grpc-protobuf-lite + implementation("io.grpc:grpc-protobuf:1.21.0") + api("io.grpc:grpc-stub:1.21.0") + // implementation as Android clients will replace this with grpc-okhttp + implementation("io.grpc:grpc-netty:1.21.0") +} + +// Publishing config +ext { + bintrayOrg = 'hpi' + bintrayRepo = 'hpi-cloud-mvn' + bintrayName = 'hpi-cloud' + + publishedGroupId = 'de.hpi.cloud' + artifact = 'hpi-cloud' + + description = "Auto-generated client libraries for HPI Cloud" + + siteUrl = 'https://github.com/HPI-de/hpi-cloud-apis' + issueUrl = 'https://github.com/HPI-de/hpi-cloud-apis/issues' + gitUrl = 'https://github.com/HPI-de/hpi-cloud-apis.git' + githubRepository = 'HPI-de/hpi-cloud-apis' + githubReleaseNotes = 'CHANGELOG.md' + allLicenses = ["Apache-2.0"] + + libraryVersion = "0.0.3" +} + +task sourcesJar(type: Jar, dependsOn: classes) { + classifier = 'sources' + from sourceSets.main.allSource +} +javadoc.failOnError = false +task javadocJar(type: Jar, dependsOn: javadoc) { + classifier = 'javadoc' + from javadoc.destinationDir +} +artifacts { + archives sourcesJar + archives javadocJar +} +publishing { + publications { + all(MavenPublication) { + from components.java + artifact sourcesJar { + classifier "sources" + } + artifact javadocJar { + classifier "javadoc" + } + + groupId publishedGroupId + artifactId artifact + version libraryVersion + } + } +} +bintray { + user = System.getenv('BINTRAY_USER') + key = System.getenv('BINTRAY_KEY') + + publications = ["all"] + publish = true + pkg { + repo = bintrayRepo + name = bintrayName + userOrg = bintrayOrg + desc = description + websiteUrl = siteUrl + issueTrackerUrl = issueUrl + vcsUrl = gitUrl + licenses = allLicenses + + githubRepo = githubRepository + githubReleaseNotesFile = githubReleaseNotes + + version { + name = libraryVersion + vcsTag = libraryVersion + } + } +} +bintrayUpload.dependsOn generatePomFileForAllPublication diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..5c2d1cf Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..b0acbdc --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100755 index 0000000..8e25e6c --- /dev/null +++ b/gradlew @@ -0,0 +1,188 @@ +#!/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 +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +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='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# 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 + ;; + 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" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +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 + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((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" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +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 new file mode 100644 index 0000000..9618d8d --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,100 @@ +@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=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@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%" == "0" goto init + +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 init + +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 + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +: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 %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="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! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/hpi/cloud/common/v1test/image.proto b/hpi/cloud/common/v1test/image.proto new file mode 100644 index 0000000..f5dc7da --- /dev/null +++ b/hpi/cloud/common/v1test/image.proto @@ -0,0 +1,21 @@ +syntax = "proto3"; + +package hpi.cloud.common.v1test; + +option java_multiple_files = true; +option java_outer_classname = "ImageProto"; +option java_package = "de.hpi.cloud.common.v1test"; + + +// An image including source and alt-text for accessibility. +message Image { + // Required. + // + // The source (URL) of this image. + string source = 1; + + // Optional. + // + // Alternative text describing the contents of this image. + string alt = 2; +} diff --git a/hpi/cloud/course/v1test/course.proto b/hpi/cloud/course/v1test/course.proto new file mode 100644 index 0000000..a45c470 --- /dev/null +++ b/hpi/cloud/course/v1test/course.proto @@ -0,0 +1,114 @@ +syntax = "proto3"; + +package hpi.cloud.course.v1test; + +// A series of courses that cover the same topic and can take place on multiple +// semesters. +message CourseSeries { + // Required, output only. The unique ID of this course. + string id = 1; + + // Required. The title, e.g. "Internet- and WWW-Technologies". + string title = 2; + + // Required. A short version of the title, e.g. "Internet and WWW". + string short_title = 3; + + // Required. An abbreviation of the title, e.g. "WWW". + string abbreviation = 4; + + // Required. The number of ECTS that the courses of this series give to the + // participants. + sint32 ects = 5; + + // Required. The hours per week that courses of this series typically require. + sint32 hours_per_week = 6; + + // Required. Whether it's mandatory to particiapte in a course of this series. + bool mandatory = 7; + + // The language courses of this series are taught in. Must be a valid [BCP 47](https://en.wikipedia.org/wiki/IETF_language_tag) language tag. + string language = 8; + + enum Type { + LECTURE = 0; + SEMINAR = 1; + BLOCK_SEMINAR = 2; + EXERCISE = 3; + } + + // Types of this course series. + repeated Type types = 9; +} + +// A semester. +message Semester { + // Required, output only. The unique ID of this semester. + string id = 1; + + enum Term { + WINTER = 0; + SUMMER = 1; + } + + // Required. The term. + Term term = 2; + + // Required. The year. + sint64 year = 3; +} + +// A course. +message Course { + // Required, output only. The unique ID of this course. + string id = 1; + + // Required. The ID of the course series that this course is an instance of. + string course_series_id = 2; + + // Required. The ID of the semester that this course takes place in. + string semester_id = 3; + + // Required. The lecturer. + string lecturer = 4; + + // Optional. The assistants. + repeated string assistants = 5; + + // Optional. A website that contains more information about the course. + string website = 6; +} + +// Details of a course. +message CourseDetail { + // Required. The unique ID of course these details belong to. + string course_id = 1; + + // Required. A link to the course on teletask. + string teletask = 2; + + message ProgramList { + repeated string programs = 1; + } + + // Required. Programs this course can be graded in. + map programs = 3; + + // Required. A description (HTML). + string description = 4; + + // Requirements to participate in this course (HTML). + string requirements = 5; + + // What you'll learn by participating in this course (HTML). + string learning = 6; + + // Which and how many exams take place (HTML). + string examination = 7; + + // When the course takes place (HTML). + string dates = 8; + + // Additional literature for this course (HTML). + string literature = 9; +} diff --git a/hpi/cloud/course/v1test/course_service.proto b/hpi/cloud/course/v1test/course_service.proto new file mode 100644 index 0000000..3e055ce --- /dev/null +++ b/hpi/cloud/course/v1test/course_service.proto @@ -0,0 +1,107 @@ +syntax = "proto3"; + +package hpi.cloud.course.v1test; + +import "hpi/cloud/course/v1test/course.proto"; + +option java_multiple_files = true; +option java_outer_classname = "CourseServiceProto"; +option java_package = "de.hpi.cloud.course.v1test"; + +// Provides access course information. +service CourseService { + // Lists course series. + rpc ListCourseSeries (ListCourseSeriesRequest) returns (ListCourseSeriesResponse); + + // Gets a course serie. + rpc GetCourseSeries (GetCourseSeriesRequest) returns (CourseSeries); + + + // Lists semesters. + rpc ListSemesters (ListSemestersRequest) returns (ListSemestersResponse); + + // Gets a semester. + rpc GetSemester (GetSemesterRequest) returns (Semester); + + + // Lists courses. + rpc ListCourses (ListCoursesRequest) returns (ListCoursesResponse); + + // Gets a course. + rpc GetCourse (GetCourseRequest) returns (Course); + + + // Lists course details. + rpc ListCourseDetails (ListCourseDetailsRequest) returns (ListCourseDetailsResponse); + + // Gets details for a course. + rpc GetCourseDetail (GetCourseDetailRequest) returns (CourseDetail); +} + +// Request message for listing course series using [ListCourseSeries][hpi.cloud.course.v1test.CourseService.ListCourseSeries]. +message ListCourseSeriesRequest { +} + +// Response message for listing CourseSeries using [ListCourseSeries][hpi.cloud.course.v1test.CourseService.ListCourseSeries]. +message ListCourseSeriesResponse { + repeated CourseSeries course_series = 1; +} + +// Request message for [GetCourseSeries][hpi.cloud.course.v1test.CourseService.GetCourseSeries]. +message GetCourseSeriesRequest { + // Required. The course series ID. + string id = 1; +} + + +// Request message for listing semesters using [ListSemesters][hpi.cloud.course.v1test.CourseService.ListSemesters]. +message ListSemestersRequest { +} + +// Response message for listing semesters using [ListSemesters][hpi.cloud.course.v1test.CourseService.ListSemesters]. +message ListSemestersResponse { + repeated Semester semesters = 1; +} + +// Request message for [GetSemester][hpi.cloud.course.v1test.CourseService.GetSemester]. +message GetSemesterRequest { + // Required. The semester ID. + string id = 1; +} + + +// Request message for listing courses using [ListCourses][hpi.cloud.course.v1test.CourseService.ListCourses]. +message ListCoursesRequest { + // If specified, only courses of this series are returned. + string course_series_id = 1; + + // If specified, only courses offered in this semester are returned. + string semester_id = 2; +} + +// Response message for listing courses using [ListCourses][hpi.cloud.course.v1test.CourseService.ListCourses]. +message ListCoursesResponse { + repeated Course courses = 1; +} + +// Request message for [GetCourse][hpi.cloud.course.v1test.CourseService.GetCourse]. +message GetCourseRequest { + // Required. The course ID. + string id = 1; +} + + +// Request message for listing course details using [ListCourseDetails][hpi.cloud.course.v1test.CourseService.ListCourseDetails]. +message ListCourseDetailsRequest { +} + +// Response message for listing course details using [ListCourseDetails][hpi.cloud.course.v1test.CourseService.ListCourseDetails]. +message ListCourseDetailsResponse { + repeated CourseDetail details = 1; +} + +// Request message for [GetCourseDetail][hpi.cloud.course.v1test.CourseService.GetCourseDetail]. +message GetCourseDetailRequest { + // Required. The ID of the course whose details to get. + string course_id = 1; +} diff --git a/hpi/cloud/food/v1test/food_service.proto b/hpi/cloud/food/v1test/food_service.proto new file mode 100644 index 0000000..d37f47a --- /dev/null +++ b/hpi/cloud/food/v1test/food_service.proto @@ -0,0 +1,85 @@ +syntax = "proto3"; + +package hpi.cloud.food.v1test; + +import "google/type/date.proto"; +import "hpi/cloud/food/v1test/restaurant.proto"; + +option java_multiple_files = true; +option java_outer_classname = "FoodServiceProto"; +option java_package = "de.hpi.cloud.food.v1test"; + +// Provides access to food served at restaurants like the canteen and Ulf's Café. +service FoodService { + // Lists restaurants. + rpc ListRestaurants (ListRestaurantsRequest) returns (ListRestaurantsResponse); + + // Gets a restaurant. + rpc GetRestaurant (GetRestaurantRequest) returns (Restaurant); + + + // Lists items on the menu. + rpc ListMenuItems (ListMenuItemsRequest) returns (ListMenuItemsResponse); + + // Gets an item as it appears on the menu. + rpc GetMenuItem (GetMenuItemRequest) returns (MenuItem); + + + // Lists labels. + rpc ListLabels (ListLabelsRequest) returns (ListLabelsResponse); + + // Gets a label. + rpc GetLabel (GetLabelRequest) returns (Label); +} + +// Request message for listing restaurants using [ListRestaurants][hpi.cloud.food.v1test.FoodService.ListRestaurants]. +message ListRestaurantsRequest { +} + +// Response message for listing restaurants using [ListRestaurants][hpi.cloud.food.v1test.FoodService.ListRestaurants]. +message ListRestaurantsResponse { + repeated Restaurant restaurants = 1; +} + +// Request message for [GetRestaurant][hpi.cloud.food.v1test.FoodService.GetRestaurant]. +message GetRestaurantRequest { + // Required. The restaurant ID. + string id = 1; +} + + +// Request message for listing items on the menu using [ListMenuItems][hpi.cloud.food.v1test.FoodService.ListMenuItems]. +message ListMenuItemsRequest { + // If specified, only menu items served at this restaurant are returned. + string restaurant_id = 1; + + // If specified, only menu items served on this day are returned. + google.type.Date date = 2; +} + +// Response message for listing MenuItems using [ListMenuItems][hpi.cloud.food.v1test.FoodService.ListMenuItems]. +message ListMenuItemsResponse { + repeated MenuItem items = 1; +} + +// Request message for [GetMenuItem][hpi.cloud.food.v1test.FoodService.GetMenuItem]. +message GetMenuItemRequest { + // Required. The ID of the menu item. + string id = 1; +} + + +// Request message for listing labels using [ListLabels][hpi.cloud.food.v1test.FoodService.ListLabels]. +message ListLabelsRequest { +} + +// Response message for listing Labels using [ListLabels][hpi.cloud.food.v1test.FoodService.ListLabels]. +message ListLabelsResponse { + repeated Label Labels = 1; +} + +// Request message for [GetLabel][hpi.cloud.food.v1test.FoodService.GetLabel]. +message GetLabelRequest { + // Required. The label ID. + string id = 1; +} diff --git a/hpi/cloud/food/v1test/restaurant.proto b/hpi/cloud/food/v1test/restaurant.proto new file mode 100644 index 0000000..614c1a9 --- /dev/null +++ b/hpi/cloud/food/v1test/restaurant.proto @@ -0,0 +1,58 @@ +syntax = "proto3"; + +package hpi.cloud.food.v1test; + +import "google/type/date.proto"; +import "google/type/money.proto"; + +option java_multiple_files = true; +option java_outer_classname = "RestaurantProto"; +option java_package = "de.hpi.cloud.food.v1test"; + +// A restaurant that serves food. +message Restaurant { + // Required, output only. The unique ID. + string id = 1; + + // Required. The title. + string title = 2; +} + +// An item on a menu. +message MenuItem { + // Required, output only. The unique ID. + string id = 1; + + // Required. ID of the restaurant where this menu was/will be served. + string restaurant_id = 2; + + // Required. The date of when this menu was/will be served. + google.type.Date date = 3; + + // Required. The title. + string title = 4; + + // Optional. An optional substitution that's offered to the hungry consumer. + string substitution = 5; + + // Required. The price to pay for this item. + google.type.Money price = 6; + + // Optional. The counter where this item is served. + string counter = 7; + + // Optional. IDs of the labels of the item. + repeated string label_ids = 8; +} + +// A label on a menu item. +message Label { + // Required, output only. The unique ID. + string id = 1; + + // Required. The title. + string title = 2; + + // The URL pointing to an icon. + string icon = 3; +} diff --git a/hpi/cloud/myhpi/v1test/info_bit.proto b/hpi/cloud/myhpi/v1test/info_bit.proto new file mode 100644 index 0000000..9f637b8 --- /dev/null +++ b/hpi/cloud/myhpi/v1test/info_bit.proto @@ -0,0 +1,42 @@ +syntax = "proto3"; + +package hpi.cloud.myhpi.v1test; + +// A bit of information to show in a MyHPI context. +message InfoBit { + // Required, output only. The unique ID of this info bit. + string id = 1; + + // Required. The title. + string title = 2; + + // Required. The description. + string description = 3; + + // Optional. IDs of the actions of this info bit. + repeated string action_ids = 4; +} + +// An action of an info bit. +message Action { + // Required, output only. The unique ID of this info bit. + string id = 1; + + // Required. The title. + string title = 2; + + message Link { + // Required. The URL. + string url = 1; + } + + message Text { + // Required. The text to show. + string content = 1; + } + + oneof type { + Link link = 3; + Text text = 4; + } +} diff --git a/hpi/cloud/myhpi/v1test/myhpi_service.proto b/hpi/cloud/myhpi/v1test/myhpi_service.proto new file mode 100644 index 0000000..ffbe715 --- /dev/null +++ b/hpi/cloud/myhpi/v1test/myhpi_service.proto @@ -0,0 +1,56 @@ +syntax = "proto3"; + +package hpi.cloud.myhpi.v1test; + +import "hpi/cloud/myhpi/v1test/info_bit.proto"; + +option java_multiple_files = true; +option java_outer_classname = "MyHpiServiceProto"; +option java_package = "de.hpi.cloud.myhpi.v1test"; + +// Provides access to useful information, mostly originating from MyHPI. +service MyHpiService { + // Lists bits of information. + rpc ListInfoBits (ListInfoBitsRequest) returns (ListInfoBitsResponse); + + // Gets a bit of information. + rpc GetInfoBit (GetInfoBitRequest) returns (InfoBit); + + + // Lists actions. + rpc ListActions (ListActionsRequest) returns (ListActionsResponse); + + // Gets a action. + rpc GetAction (GetActionRequest) returns (Action); +} + +// Request message for listing bits of information using [ListInfoBits][hpi.cloud.myhpi.v1test.MyHpiService.ListInfoBits]. +message ListInfoBitsRequest { +} + +// Response message for listing bits of information using [ListInfoBits][hpi.cloud.myhpi.v1test.MyHpiService.ListInfoBits]. +message ListInfoBitsResponse { + repeated InfoBit info_bits = 1; +} + +// Request message for [GetInfoBit][hpi.cloud.myhpi.v1test.MyHpiService.GetInfoBit]. +message GetInfoBitRequest { + // Required. The InfoBit ID. + string id = 1; +} + + +// Request message for listing actions using [ListActions][hpi.cloud.myhpi.v1test.MyHpiService.ListActions]. +message ListActionsRequest { +} + +// Response message for listing actions using [ListActions][hpi.cloud.myhpi.v1test.MyHpiService.ListActions]. +message ListActionsResponse { + repeated Action Actions = 1; +} + +// Request message for [GetAction][hpi.cloud.myhpi.v1test.MyHpiService.GetAction]. +message GetActionRequest { + // Required. The action ID. + string id = 1; +} diff --git a/hpi/cloud/news/v1test/article.proto b/hpi/cloud/news/v1test/article.proto new file mode 100644 index 0000000..dbfa5b1 --- /dev/null +++ b/hpi/cloud/news/v1test/article.proto @@ -0,0 +1,83 @@ +syntax = "proto3"; + +package hpi.cloud.news.v1test; + +import "google/protobuf/timestamp.proto"; +import "hpi/cloud/common/v1test/image.proto"; + +option java_multiple_files = true; +option java_outer_classname = "ArticleProto"; +option java_package = "de.hpi.cloud.news.v1test"; + + +// A news article, e.g. from HPI News and HPImgzn. +message Article { + // Required, output only. The unique ID (across sites) of this article. + string id = 1; + + // Required. ID of the original source of this article. + string source_id = 2; + + // Required. A link to the original source. + string link = 3; + + // Required. The title of this news article. + string title = 4; + + // Required. The publishing date. + google.protobuf.Timestamp publish_date = 5; + + // IDs of the author(s). + repeated string author_ids = 6; + + // The cover image. + hpi.cloud.common.v1test.Image cover = 7; + + // Required. A short text summarizing this article. Recommended for a preview. + string teaser = 8; + + // Required. The actual HTML-content of this article. + string content = 9; + + // Categories of this article. + repeated Category categories = 10; + + // Tags of this article. + repeated Tag tags = 11; + + // The number of times this article was viewed. + uint32 view_count = 12; +} + +// An article source, e.g. HPI News or HPImgzn. +message Source { + // Required, output only. The unique ID of this source. + string id = 1; + + // Required. The name of this source. + string name = 2; + + // Required. The url of this source. + string link = 3; +} + +// A category by which articles can be organized and filtered. +message Category { + // Required, output only. The unique ID of this category. + string id = 1; + + // Required. The name of this category. + string name = 2; +} + +// A tag by which articles can be organized and filtered. +message Tag { + // Required, output only. The unique ID of this tag. + string id = 1; + + // Required. The name of this tag. + string name = 2; + + // Required. The number of articles tagged with this tag. + uint32 article_count = 3; +} diff --git a/hpi/cloud/news/v1test/news_service.proto b/hpi/cloud/news/v1test/news_service.proto new file mode 100644 index 0000000..89ae117 --- /dev/null +++ b/hpi/cloud/news/v1test/news_service.proto @@ -0,0 +1,110 @@ +syntax = "proto3"; + +package hpi.cloud.news.v1test; + +import "hpi/cloud/news/v1test/article.proto"; + +option java_multiple_files = true; +option java_outer_classname = "NewsServiceProto"; +option java_package = "de.hpi.cloud.news.v1test"; + +// Provides access to news from various sources, e.g. HPI News and HPImgzn. +service NewsService { + // Lists articles. + rpc ListArticles (ListArticlesRequest) returns (ListArticlesResponse); + + // Gets an article. + rpc GetArticle (GetArticleRequest) returns (Article); + + + // Lists sources. + rpc ListSources (ListSourcesRequest) returns (ListSourcesResponse); + + // Gets a source. + rpc GetSource (GetSourceRequest) returns (Source); + + + // Lists categories. + rpc ListCategories (ListCategoriesRequest) returns (ListCategoriesResponse); + + // Gets a category. + rpc GetCategory (GetCategoryRequest) returns (Category); + + + // Lists tags. + rpc ListTags (ListTagsRequest) returns (ListTagsResponse); + + // Gets a tag. + rpc GetTag (GetTagRequest) returns (Tag); +} + +// Request message for listing articles using [ListArticles][hpi.cloud.news.v1test.NewsService.ListArticles]. +message ListArticlesRequest { + // If specified, only articles from this site are returned. + string site_id = 1; + + // If specified, only articles from this category are returned. + string category_id = 2; + + // If specified, only articles tagged with this tag are returned. + string tag_id = 3; +} + +// Response message for listing articles using [ListArticles][hpi.cloud.news.v1test.NewsService.ListArticles]. +message ListArticlesResponse { + repeated Article articles = 1; +} + +// Request message for [GetArticle][hpi.cloud.news.v1test.NewsService.GetArticle]. +message GetArticleRequest { + // Required. The article ID. + string id = 1; +} + + +// Request message for listing sources using [ListSources][hpi.cloud.news.v1test.NewsService.ListSources]. +message ListSourcesRequest { +} + +// Response message for listing sources using [ListSources][hpi.cloud.news.v1test.NewsService.ListSources]. +message ListSourcesResponse { + repeated Source sources = 1; +} + +// Request message for [GetSource][hpi.cloud.news.v1test.NewsService.GetSource]. +message GetSourceRequest { + // Required. The source ID. + string id = 1; +} + + +// Request message for listing categories using [ListCategories][hpi.cloud.news.v1test.NewsService.ListCategories]. +message ListCategoriesRequest { +} + +// Response message for listing categories using [ListCategories][hpi.cloud.news.v1test.NewsService.ListCategories]. +message ListCategoriesResponse { + repeated Category categories = 1; +} + +// Request message for [GetCategory][hpi.cloud.news.v1test.NewsService.GetCategory]. +message GetCategoryRequest { + // Required. The category ID. + string id = 1; +} + + +// Request message for listing tags using [ListTags][hpi.cloud.news.v1test.NewsService.ListTags]. +message ListTagsRequest { +} + +// Response message for listing tags using [ListTags][hpi.cloud.news.v1test.NewsService.ListTags]. +message ListTagsResponse { + repeated Tag tags = 1; +} + +// Request message for [GetTag][hpi.cloud.news.v1test.NewsService.GetTag]. +message GetTagRequest { + // Required. The tag ID. + string id = 1; +} diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..5c8d457 --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'hpi-cloud-apis'