Skip to content
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
- name: Check out code
uses: actions/checkout@v3.1.0
- uses: GetStream/android-ci-actions/actions/setup-java@main
- name: spotless
- name: Run spotless check
run: ./gradlew spotlessCheck --scan
lint:
name: Lint
Expand All @@ -57,7 +57,7 @@ jobs:
- name: Check out code
uses: actions/checkout@v3.1.0
- uses: GetStream/android-ci-actions/actions/setup-java@main
- name: spotless
- name: Run lint check
run: ./gradlew lint

unitTest:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,11 @@ class StreamApiExplicitMarkerDetector : Detector(), Detector.UastScanner {
private fun JavaContext.packageMatchesConfig(pkg: String): Boolean {
val patterns = configuredPackageGlobs()

// Default if not configured → only io.getstream.android.core.*
val effectivePatterns = patterns.ifEmpty { listOf("io.getstream.android.core.api") }
// Default if not configured → io.getstream.android.core.api and its subpackages.
val effectivePatterns =
patterns.ifEmpty {
listOf("io.getstream.android.core.api", "io.getstream.android.core.api.*")
}

val included = effectivePatterns.any { pkgMatchesGlob(pkg, it) }
val excluded = packageMatchesExcludeConfig(pkg)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@
*/
package io.getstream.android.core.api.filter

import io.getstream.android.core.annotations.StreamPublishedApi

/**
* Interface representing a field that can be used in filters for querying data from the Stream API.
*
* Implementations of this interface should provide [remote], which is the name of the field as
* expected by the Stream API, and [localValue], a function to extract the field's value from a
* model instance.
*/
@StreamPublishedApi
public interface FilterField<M> {
/** The name of this field as expected by the Stream API. */
public val remote: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import io.getstream.android.core.internal.filter.BinaryOperator
import io.getstream.android.core.internal.filter.CollectionOperator

/** Utility class for building filters. */
@StreamPublishedApi
public object Filters {
/**
* Creates a filter that combines multiple filters with a logical AND operation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@
*/
package io.getstream.android.core.api.sort

import io.getstream.android.core.annotations.StreamPublishedApi

/**
* A sort configuration that combines a sort field with a direction.
*
* This class represents a complete sort specification that can be applied to collections of the
* associated model type. It provides both local sorting capabilities and the ability to generate
* remote API request parameters.
*/
@StreamPublishedApi
public open class Sort<T>(public val field: SortField<T>, public val direction: SortDirection) :
Comparator<T> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package io.getstream.android.core.api.sort

import io.getstream.android.core.annotations.StreamInternalApi
import io.getstream.android.core.annotations.StreamPublishedApi

/**
* A comparator that can sort model instances by extracting comparable values.
Expand All @@ -28,6 +29,7 @@ import io.getstream.android.core.annotations.StreamInternalApi
* @param V The type of the comparable value extracted from the model instances.
* @property value A lambda that extracts a comparable value from a model instance.
*/
@StreamPublishedApi
public class SortComparator<T, V : Comparable<V>>(public val value: (T) -> V) {

/**
Expand Down Expand Up @@ -70,6 +72,7 @@ public class SortComparator<T, V : Comparable<V>>(public val value: (T) -> V) {
* Type erased type avoids making SortField generic while keeping the underlying value type intact
* (no runtime type checks while sorting).
*/
@StreamPublishedApi
public class AnySortComparator<T>(private val compare: (T?, T?, SortDirection) -> Int) {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package io.getstream.android.core.api.utils

import io.getstream.android.core.annotations.StreamInternalApi
import io.getstream.android.core.api.model.exceptions.StreamEndpointErrorData
import io.getstream.android.core.api.serialization.StreamJsonSerialization
import okhttp3.Response
Expand All @@ -26,6 +27,7 @@ import okhttp3.Response
* @return The API error, or a failure if the response body could not be parsed.
* @receiver The response to extract the error from.
*/
@StreamInternalApi
public fun Response.toErrorData(with: StreamJsonSerialization): Result<StreamEndpointErrorData> =
runCatching { peekBody(Long.MAX_VALUE).string() }
.flatMap { with.fromJson(it, StreamEndpointErrorData::class.java) }