Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
20 changes: 0 additions & 20 deletions libs/canvas-api-2/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@ apply plugin: 'kotlin-parcelize'
apply plugin: 'com.google.devtools.ksp'
apply plugin: 'dagger.hilt.android.plugin'

def pineDebugBaseUrl = "https://pine-api-dev.us-east-1.core.inseng.io"
def pineReleaseBaseUrl = "https://pine-api.us-east-1.core.inseng.io"

def cedarDebugBaseUrl = "https://cedar-api-dev.us-east-1.core.inseng.io"
def cedarReleaseBaseUrl = "https://cedar-api.us-east-1.core.inseng.io"

def redwoodDebugBaseUrl = "https://redwood-api-dev.us-east-1.core.inseng.io"
def redwoodReleaseBaseUrl = "https://redwood-api.us-east-1.core.inseng.io"

Expand Down Expand Up @@ -62,14 +56,10 @@ android {

buildTypes {
debug {
buildConfigField "String", "PINE_BASE_URL", "\"$pineDebugBaseUrl\""
buildConfigField "String", "CEDAR_BASE_URL", "\"$cedarDebugBaseUrl\""
buildConfigField "String", "REDWOOD_BASE_URL", "\"$redwoodDebugBaseUrl\""
buildConfigField "String", "JOURNEY_BASE_URL", "\"$journeyDebugBaseUrl\""
}
release {
buildConfigField "String", "PINE_BASE_URL", "\"$pineReleaseBaseUrl\""
buildConfigField "String", "CEDAR_BASE_URL", "\"$cedarReleaseBaseUrl\""
buildConfigField "String", "REDWOOD_BASE_URL", "\"$redwoodReleaseBaseUrl\""
buildConfigField "String", "JOURNEY_BASE_URL", "\"$journeyReleaseBaseUrl\""

Expand Down Expand Up @@ -113,16 +103,6 @@ apollo {

generateSourcesDuringGradleSync.set(true)
}
service("cedar") {
setSourceFolder("com/instructure/cedar")
packageName.set("com.instructure.cedar")
mapScalar("ID", "kotlin.String")
}
service("pine") {
setSourceFolder("com/instructure/pine")
packageName.set("com.instructure.pine")
mapScalar("ID", "kotlin.String")
}
service("redwood") {
setSourceFolder("com/instructure/redwood")
packageName.set("com.instructure.redwood")
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@
package com.instructure.canvasapi2

import android.content.Context
import com.instructure.canvasapi2.utils.CedarAuthenticator
import com.instructure.canvasapi2.utils.DomainServicesAuthenticator
import com.instructure.canvasapi2.utils.JourneyAuthenticator
import com.instructure.canvasapi2.utils.PineAuthenticator
import com.instructure.canvasapi2.utils.RedwoodAuthenticator
import dagger.hilt.android.qualifiers.ApplicationContext
import okhttp3.Cache
Expand Down Expand Up @@ -67,26 +65,6 @@ abstract class DomainServicesAdapter(
}
}

class PineAdapter @Inject constructor(
@ApplicationContext context: Context,
pineRequestInterceptor: PineRequestInterceptor,
pineAuthenticator: PineAuthenticator
) : DomainServicesAdapter(
File(context.cacheDir, "pine_cache"),
pineAuthenticator,
pineRequestInterceptor
)

class CedarAdapter @Inject constructor(
@ApplicationContext context: Context,
cedarRequestInterceptor: CedarRequestInterceptor,
cedarAuthenticator: CedarAuthenticator
) : DomainServicesAdapter(
File(context.cacheDir, "cedar_cache"),
cedarAuthenticator,
cedarRequestInterceptor
)

class RedwoodAdapter @Inject constructor(
@ApplicationContext context: Context,
redwoodRequestInterceptor: RedwoodRequestInterceptor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,6 @@ abstract class DomainServicesGraphQLClientConfig(
}
}

class PineGraphQLClientConfig @Inject constructor(
adapter: PineAdapter
): DomainServicesGraphQLClientConfig(
url = BuildConfig.PINE_BASE_URL + "/graphql",
httpClient = adapter.buildOHttpClient()
)

class CedarGraphQLClientConfig @Inject constructor(
adapter: CedarAdapter
): DomainServicesGraphQLClientConfig(
url = BuildConfig.CEDAR_BASE_URL + "/graphql",
httpClient = adapter.buildOHttpClient()
)

class RedwoodGraphQLClientConfig @Inject constructor(
adapter: RedwoodAdapter
): DomainServicesGraphQLClientConfig(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ package com.instructure.canvasapi2
import com.instructure.canvasapi2.builders.RestParams
import com.instructure.canvasapi2.utils.APIHelper
import com.instructure.canvasapi2.utils.ApiPrefs
import com.instructure.canvasapi2.utils.CedarApiPref
import com.instructure.canvasapi2.utils.JourneyApiPref
import com.instructure.canvasapi2.utils.PineApiPref
import com.instructure.canvasapi2.utils.RedwoodApiPref
import com.instructure.canvasapi2.utils.restParams
import okhttp3.CacheControl
Expand Down Expand Up @@ -60,24 +58,6 @@ abstract class DomainServicesRequestInterceptor(
}
}

class PineRequestInterceptor @Inject constructor(
private val pineApiPref: PineApiPref,
apiPrefs: ApiPrefs
) : DomainServicesRequestInterceptor(apiPrefs) {
override fun intercept(chain: Interceptor.Chain): Response {
return super.intercept(chain, pineApiPref.token)
}
}

class CedarRequestInterceptor @Inject constructor(
private val cedarApiPref: CedarApiPref,
apiPrefs: ApiPrefs
) : DomainServicesRequestInterceptor(apiPrefs) {
override fun intercept(chain: Interceptor.Chain): Response {
return super.intercept(chain, cedarApiPref.token)
}
}

class RedwoodRequestInterceptor @Inject constructor(
private val redwoodApiPref: RedwoodApiPref,
apiPrefs: ApiPrefs
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.instructure.canvasapi2.apis

import com.instructure.canvasapi2.models.journey.JourneyAssistRequestBody
import com.instructure.canvasapi2.models.journey.JourneyAssistResponse
import retrofit2.http.Body
import retrofit2.http.POST

interface JourneyAssistAPI {
@POST("assist")
suspend fun answerPrompt(
@Body body: JourneyAssistRequestBody,
): JourneyAssistResponse
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright (C) 2025 - present Instructure, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.instructure.canvasapi2.builders

import com.instructure.canvasapi2.BuildConfig
import com.instructure.canvasapi2.JourneyAdapter
import com.instructure.canvasapi2.calladapter.DataResultCallAdapterFactory
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
import javax.inject.Inject

class JourneyRestBuilder @Inject constructor(
private val journeyAdapter: JourneyAdapter
) {
fun <T> build(clazz: Class<T>): T {
return Retrofit.Builder()
.baseUrl(BuildConfig.JOURNEY_BASE_URL + "/api/v1/")
.client(journeyAdapter.buildOHttpClient())
.addCallAdapterFactory(DataResultCallAdapterFactory())
.addConverterFactory(GsonConverterFactory.create())
.build()
.create(clazz)
}
}
Loading
Loading