Skip to content

Commit

Permalink
Introduce a simulated GAE proto endpoint.
Browse files Browse the repository at this point in the history
This 'simulates' the eventual endpoint that will be added to Oppia web
by using internal compatibility checking, proto conversion, and the
GAE/GCS JSON endpoints currently available via Oppia web.
  • Loading branch information
BenHenning committed May 27, 2024
1 parent 50080af commit 0d03b75
Show file tree
Hide file tree
Showing 3 changed files with 937 additions and 0 deletions.
36 changes: 36 additions & 0 deletions scripts/src/java/org/oppia/android/scripts/gae/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
"""
Library for providing access to Oppia's HTTP endpoints.
"""

load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library")

kt_jvm_library(
name = "gae",
testonly = True,
srcs = [
"GaeAndroidEndpoint.kt",
],
visibility = ["//scripts:oppia_script_library_visibility"],
deps = [
"//third_party:oppia_proto_api_java_protos",
"//third_party:org_jetbrains_kotlinx_kotlinx-coroutines-core",
],
)

kt_jvm_library(
name = "gae_json_impl",
testonly = True,
srcs = [
"GaeAndroidEndpointJsonImpl.kt",
],
visibility = ["//scripts:oppia_script_library_visibility"],
deps = [
":gae",
"//scripts/src/java/org/oppia/android/scripts/gae/compat",
"//scripts/src/java/org/oppia/android/scripts/gae/json:api",
"//scripts/src/java/org/oppia/android/scripts/gae/json:model",
"//scripts/src/java/org/oppia/android/scripts/gae/proto:json_to_proto_converter",
"//third_party:oppia_proto_api_java_protos",
"//third_party:org_jetbrains_kotlinx_kotlinx-coroutines-core",
],
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package org.oppia.android.scripts.gae

import kotlinx.coroutines.Deferred
import org.oppia.proto.v1.api.TopicContentRequestDto
import org.oppia.proto.v1.api.TopicContentResponseDto
import org.oppia.proto.v1.api.TopicListRequestDto
import org.oppia.proto.v1.api.TopicListResponseDto

interface GaeAndroidEndpoint {
fun fetchTopicListAsync(
request: TopicListRequestDto,
reportProgress: (Int, Int) -> Unit = { _, _ -> }
): Deferred<TopicListResponseDto>

fun fetchTopicContentAsync(
request: TopicContentRequestDto,
reportProgress: (Int, Int) -> Unit = { _, _ -> }
): Deferred<TopicContentResponseDto>
}
Loading

0 comments on commit 0d03b75

Please sign in to comment.