diff --git a/CHANGELOG.md b/CHANGELOG.md index 3cc0dc9..3167422 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Change Log +## 24.1.1 + +* Fixed: Removed `Advisor` service and `Insight`, `InsightCTA`, `InsightList`, `Report`, `ReportList` models (admin-only endpoints, not intended for client SDKs) +* Added: `sizeActual` field to `File` model + ## 24.1.0 * Added: Realtime `presences` channel and `RealtimePresence` types for presence subscriptions diff --git a/README.md b/README.md index d09a8ee..2be7047 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ repositories { Next, add the dependency to your project's `build.gradle(.kts)` file: ```groovy -implementation("io.appwrite:sdk-for-android:24.1.0") +implementation("io.appwrite:sdk-for-android:24.1.1") ``` ### Maven @@ -49,7 +49,7 @@ Add this to your project's `pom.xml` file: io.appwrite sdk-for-android - 24.1.0 + 24.1.1 ``` diff --git a/docs/examples/java/advisor/get-insight.md b/docs/examples/java/advisor/get-insight.md deleted file mode 100644 index 9ca79e4..0000000 --- a/docs/examples/java/advisor/get-insight.md +++ /dev/null @@ -1,25 +0,0 @@ -```java -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Advisor; - -Client client = new Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject(""); // Your project ID - -Advisor advisor = new Advisor(client); - -advisor.getInsight( - "", // reportId - "", // insightId - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - Log.d("Appwrite", result.toString()); - }) -); - -``` diff --git a/docs/examples/java/advisor/get-report.md b/docs/examples/java/advisor/get-report.md deleted file mode 100644 index 6382cd3..0000000 --- a/docs/examples/java/advisor/get-report.md +++ /dev/null @@ -1,24 +0,0 @@ -```java -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Advisor; - -Client client = new Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject(""); // Your project ID - -Advisor advisor = new Advisor(client); - -advisor.getReport( - "", // reportId - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - Log.d("Appwrite", result.toString()); - }) -); - -``` diff --git a/docs/examples/java/advisor/list-insights.md b/docs/examples/java/advisor/list-insights.md deleted file mode 100644 index dd18ce8..0000000 --- a/docs/examples/java/advisor/list-insights.md +++ /dev/null @@ -1,26 +0,0 @@ -```java -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Advisor; - -Client client = new Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject(""); // Your project ID - -Advisor advisor = new Advisor(client); - -advisor.listInsights( - "", // reportId - List.of(), // queries (optional) - false, // total (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - Log.d("Appwrite", result.toString()); - }) -); - -``` diff --git a/docs/examples/java/advisor/list-reports.md b/docs/examples/java/advisor/list-reports.md deleted file mode 100644 index 14f5b89..0000000 --- a/docs/examples/java/advisor/list-reports.md +++ /dev/null @@ -1,25 +0,0 @@ -```java -import io.appwrite.Client; -import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.services.Advisor; - -Client client = new Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject(""); // Your project ID - -Advisor advisor = new Advisor(client); - -advisor.listReports( - List.of(), // queries (optional) - false, // total (optional) - new CoroutineCallback<>((result, error) -> { - if (error != null) { - error.printStackTrace(); - return; - } - - Log.d("Appwrite", result.toString()); - }) -); - -``` diff --git a/docs/examples/kotlin/advisor/get-insight.md b/docs/examples/kotlin/advisor/get-insight.md deleted file mode 100644 index 6ff14eb..0000000 --- a/docs/examples/kotlin/advisor/get-insight.md +++ /dev/null @@ -1,16 +0,0 @@ -```kotlin -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Advisor - -val client = Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - -val advisor = Advisor(client) - -val result = advisor.getInsight( - reportId = "", - insightId = "", -) -``` diff --git a/docs/examples/kotlin/advisor/get-report.md b/docs/examples/kotlin/advisor/get-report.md deleted file mode 100644 index 5ab0305..0000000 --- a/docs/examples/kotlin/advisor/get-report.md +++ /dev/null @@ -1,15 +0,0 @@ -```kotlin -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Advisor - -val client = Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - -val advisor = Advisor(client) - -val result = advisor.getReport( - reportId = "", -) -``` diff --git a/docs/examples/kotlin/advisor/list-insights.md b/docs/examples/kotlin/advisor/list-insights.md deleted file mode 100644 index fb5dfb3..0000000 --- a/docs/examples/kotlin/advisor/list-insights.md +++ /dev/null @@ -1,17 +0,0 @@ -```kotlin -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Advisor - -val client = Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - -val advisor = Advisor(client) - -val result = advisor.listInsights( - reportId = "", - queries = listOf(), // (optional) - total = false, // (optional) -) -``` diff --git a/docs/examples/kotlin/advisor/list-reports.md b/docs/examples/kotlin/advisor/list-reports.md deleted file mode 100644 index 9d230d3..0000000 --- a/docs/examples/kotlin/advisor/list-reports.md +++ /dev/null @@ -1,16 +0,0 @@ -```kotlin -import io.appwrite.Client -import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.services.Advisor - -val client = Client(context) - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - -val advisor = Advisor(client) - -val result = advisor.listReports( - queries = listOf(), // (optional) - total = false, // (optional) -) -``` diff --git a/library/src/main/java/io/appwrite/Client.kt b/library/src/main/java/io/appwrite/Client.kt index 0fbb47a..ef9d8f5 100644 --- a/library/src/main/java/io/appwrite/Client.kt +++ b/library/src/main/java/io/appwrite/Client.kt @@ -87,7 +87,7 @@ class Client @JvmOverloads constructor( "x-sdk-name" to "Android", "x-sdk-platform" to "client", "x-sdk-language" to "android", - "x-sdk-version" to "24.1.0", + "x-sdk-version" to "24.1.1", "x-appwrite-response-format" to "1.9.5" ) config = mutableMapOf() diff --git a/library/src/main/java/io/appwrite/models/File.kt b/library/src/main/java/io/appwrite/models/File.kt index 0671cc8..26a716a 100644 --- a/library/src/main/java/io/appwrite/models/File.kt +++ b/library/src/main/java/io/appwrite/models/File.kt @@ -61,6 +61,12 @@ data class File( @SerializedName("sizeOriginal") val sizeOriginal: Long, + /** + * File actual stored size in bytes after compression and/or encryption. + */ + @SerializedName("sizeActual") + val sizeActual: Long, + /** * Total number of chunks available */ @@ -96,6 +102,7 @@ data class File( "signature" to signature as Any, "mimeType" to mimeType as Any, "sizeOriginal" to sizeOriginal as Any, + "sizeActual" to sizeActual as Any, "chunksTotal" to chunksTotal as Any, "chunksUploaded" to chunksUploaded as Any, "encryption" to encryption as Any, @@ -117,6 +124,7 @@ data class File( signature = map["signature"] as String, mimeType = map["mimeType"] as String, sizeOriginal = (map["sizeOriginal"] as Number).toLong(), + sizeActual = (map["sizeActual"] as Number).toLong(), chunksTotal = (map["chunksTotal"] as Number).toLong(), chunksUploaded = (map["chunksUploaded"] as Number).toLong(), encryption = map["encryption"] as Boolean, diff --git a/library/src/main/java/io/appwrite/models/Insight.kt b/library/src/main/java/io/appwrite/models/Insight.kt deleted file mode 100644 index 66c2804..0000000 --- a/library/src/main/java/io/appwrite/models/Insight.kt +++ /dev/null @@ -1,158 +0,0 @@ -package io.appwrite.models - -import com.google.gson.annotations.SerializedName -import io.appwrite.extensions.jsonCast - -/** - * Insight - */ -data class Insight( - /** - * Insight ID. - */ - @SerializedName("\$id") - val id: String, - - /** - * Insight creation date in ISO 8601 format. - */ - @SerializedName("\$createdAt") - val createdAt: String, - - /** - * Insight update date in ISO 8601 format. - */ - @SerializedName("\$updatedAt") - val updatedAt: String, - - /** - * Parent report ID. Insights always belong to a report. - */ - @SerializedName("reportId") - val reportId: String, - - /** - * Insight type. One of databaseIndex (legacy), tablesDBIndex, documentsDBIndex, vectorsDBIndex, databasePerformance, sitePerformance, siteAccessibility, siteSeo, functionPerformance. The index types are engine-specific so each CTA can pair the right service+method (databases.createIndex, tablesDB.createIndex, documentsDB.createIndex, or vectorsDB.createIndex). - */ - @SerializedName("type") - val type: String, - - /** - * Insight severity. One of info, warning, critical. - */ - @SerializedName("severity") - val severity: String, - - /** - * Insight status. One of active, dismissed. - */ - @SerializedName("status") - val status: String, - - /** - * Type of the resource the insight is about. Plural noun, e.g. databases, sites, functions. - */ - @SerializedName("resourceType") - val resourceType: String, - - /** - * ID of the resource the insight is about. - */ - @SerializedName("resourceId") - val resourceId: String, - - /** - * Plural noun for the parent resource that contains the insight's resource, e.g. an insight about a column index on a table → resourceType=indexes, parentResourceType=tables. Empty when the resource has no parent. - */ - @SerializedName("parentResourceType") - val parentResourceType: String, - - /** - * ID of the parent resource. Empty when the resource has no parent. - */ - @SerializedName("parentResourceId") - val parentResourceId: String, - - /** - * Insight title. - */ - @SerializedName("title") - val title: String, - - /** - * Short markdown summary describing the insight. - */ - @SerializedName("summary") - val summary: String, - - /** - * List of call-to-action buttons attached to this insight. - */ - @SerializedName("ctas") - val ctas: List, - - /** - * Time the insight was analyzed in ISO 8601 format. - */ - @SerializedName("analyzedAt") - var analyzedAt: String?, - - /** - * Time the insight was dismissed in ISO 8601 format. Empty when not dismissed. - */ - @SerializedName("dismissedAt") - var dismissedAt: String?, - - /** - * User ID that dismissed the insight. Empty when not dismissed. - */ - @SerializedName("dismissedBy") - var dismissedBy: String?, - -) { - fun toMap(): Map = mapOf( - "\$id" to id as Any, - "\$createdAt" to createdAt as Any, - "\$updatedAt" to updatedAt as Any, - "reportId" to reportId as Any, - "type" to type as Any, - "severity" to severity as Any, - "status" to status as Any, - "resourceType" to resourceType as Any, - "resourceId" to resourceId as Any, - "parentResourceType" to parentResourceType as Any, - "parentResourceId" to parentResourceId as Any, - "title" to title as Any, - "summary" to summary as Any, - "ctas" to ctas.map { it.toMap() } as Any, - "analyzedAt" to analyzedAt as Any, - "dismissedAt" to dismissedAt as Any, - "dismissedBy" to dismissedBy as Any, - ) - - companion object { - - @Suppress("UNCHECKED_CAST") - fun from( - map: Map, - ) = Insight( - id = map["\$id"] as String, - createdAt = map["\$createdAt"] as String, - updatedAt = map["\$updatedAt"] as String, - reportId = map["reportId"] as String, - type = map["type"] as String, - severity = map["severity"] as String, - status = map["status"] as String, - resourceType = map["resourceType"] as String, - resourceId = map["resourceId"] as String, - parentResourceType = map["parentResourceType"] as String, - parentResourceId = map["parentResourceId"] as String, - title = map["title"] as String, - summary = map["summary"] as String, - ctas = (map["ctas"] as List>).map { InsightCTA.from(map = it) }, - analyzedAt = map["analyzedAt"] as? String, - dismissedAt = map["dismissedAt"] as? String, - dismissedBy = map["dismissedBy"] as? String, - ) - } -} \ No newline at end of file diff --git a/library/src/main/java/io/appwrite/models/InsightCTA.kt b/library/src/main/java/io/appwrite/models/InsightCTA.kt deleted file mode 100644 index e2d889f..0000000 --- a/library/src/main/java/io/appwrite/models/InsightCTA.kt +++ /dev/null @@ -1,54 +0,0 @@ -package io.appwrite.models - -import com.google.gson.annotations.SerializedName -import io.appwrite.extensions.jsonCast - -/** - * InsightCTA - */ -data class InsightCTA( - /** - * Human-readable label for the CTA, used in UI. - */ - @SerializedName("label") - val label: String, - - /** - * Public API service (SDK namespace) the client should invoke. Must match the engine that owns the resource — for index suggestions: databases (legacy), tablesDB, documentsDB, or vectorsDB. - */ - @SerializedName("service") - val service: String, - - /** - * Public API method on the chosen service the client should invoke when this CTA is triggered. - */ - @SerializedName("method") - val method: String, - - /** - * Parameter map the client should pass to the service method when this CTA is triggered. Keys match the target API's parameter names (e.g. databaseId/tableId/columns for tablesDB, databaseId/collectionId/attributes for the legacy Databases API). - */ - @SerializedName("params") - val params: Any, - -) { - fun toMap(): Map = mapOf( - "label" to label as Any, - "service" to service as Any, - "method" to method as Any, - "params" to params as Any, - ) - - companion object { - - @Suppress("UNCHECKED_CAST") - fun from( - map: Map, - ) = InsightCTA( - label = map["label"] as String, - service = map["service"] as String, - method = map["method"] as String, - params = map["params"] as Any, - ) - } -} \ No newline at end of file diff --git a/library/src/main/java/io/appwrite/models/InsightList.kt b/library/src/main/java/io/appwrite/models/InsightList.kt deleted file mode 100644 index e04aa3f..0000000 --- a/library/src/main/java/io/appwrite/models/InsightList.kt +++ /dev/null @@ -1,38 +0,0 @@ -package io.appwrite.models - -import com.google.gson.annotations.SerializedName -import io.appwrite.extensions.jsonCast - -/** - * Insights List - */ -data class InsightList( - /** - * Total number of insights that matched your query. - */ - @SerializedName("total") - val total: Long, - - /** - * List of insights. - */ - @SerializedName("insights") - val insights: List, - -) { - fun toMap(): Map = mapOf( - "total" to total as Any, - "insights" to insights.map { it.toMap() } as Any, - ) - - companion object { - - @Suppress("UNCHECKED_CAST") - fun from( - map: Map, - ) = InsightList( - total = (map["total"] as Number).toLong(), - insights = (map["insights"] as List>).map { Insight.from(map = it) }, - ) - } -} \ No newline at end of file diff --git a/library/src/main/java/io/appwrite/models/Report.kt b/library/src/main/java/io/appwrite/models/Report.kt deleted file mode 100644 index 0e115e5..0000000 --- a/library/src/main/java/io/appwrite/models/Report.kt +++ /dev/null @@ -1,118 +0,0 @@ -package io.appwrite.models - -import com.google.gson.annotations.SerializedName -import io.appwrite.extensions.jsonCast - -/** - * Report - */ -data class Report( - /** - * Report ID. - */ - @SerializedName("\$id") - val id: String, - - /** - * Report creation date in ISO 8601 format. - */ - @SerializedName("\$createdAt") - val createdAt: String, - - /** - * Report update date in ISO 8601 format. - */ - @SerializedName("\$updatedAt") - val updatedAt: String, - - /** - * ID of the third-party app that submitted the report. - */ - @SerializedName("appId") - val appId: String, - - /** - * Analyzer that produced this report. e.g. lighthouse, audit, databaseAnalyzer. - */ - @SerializedName("type") - val type: String, - - /** - * Short, human-readable title for the report. - */ - @SerializedName("title") - val title: String, - - /** - * Markdown summary describing the report. - */ - @SerializedName("summary") - val summary: String, - - /** - * Plural noun describing what the report analyzes, e.g. databases, sites, urls. - */ - @SerializedName("targetType") - val targetType: String, - - /** - * Free-form target identifier (URL for lighthouse, resource ID for db). - */ - @SerializedName("target") - val target: String, - - /** - * Categories covered by the report, e.g. performance, accessibility. - */ - @SerializedName("categories") - val categories: List, - - /** - * Insights nested under this report. - */ - @SerializedName("insights") - val insights: List, - - /** - * Time the report was analyzed in ISO 8601 format. - */ - @SerializedName("analyzedAt") - var analyzedAt: String?, - -) { - fun toMap(): Map = mapOf( - "\$id" to id as Any, - "\$createdAt" to createdAt as Any, - "\$updatedAt" to updatedAt as Any, - "appId" to appId as Any, - "type" to type as Any, - "title" to title as Any, - "summary" to summary as Any, - "targetType" to targetType as Any, - "target" to target as Any, - "categories" to categories as Any, - "insights" to insights.map { it.toMap() } as Any, - "analyzedAt" to analyzedAt as Any, - ) - - companion object { - - @Suppress("UNCHECKED_CAST") - fun from( - map: Map, - ) = Report( - id = map["\$id"] as String, - createdAt = map["\$createdAt"] as String, - updatedAt = map["\$updatedAt"] as String, - appId = map["appId"] as String, - type = map["type"] as String, - title = map["title"] as String, - summary = map["summary"] as String, - targetType = map["targetType"] as String, - target = map["target"] as String, - categories = map["categories"] as List, - insights = (map["insights"] as List>).map { Insight.from(map = it) }, - analyzedAt = map["analyzedAt"] as? String, - ) - } -} \ No newline at end of file diff --git a/library/src/main/java/io/appwrite/models/ReportList.kt b/library/src/main/java/io/appwrite/models/ReportList.kt deleted file mode 100644 index a528a10..0000000 --- a/library/src/main/java/io/appwrite/models/ReportList.kt +++ /dev/null @@ -1,38 +0,0 @@ -package io.appwrite.models - -import com.google.gson.annotations.SerializedName -import io.appwrite.extensions.jsonCast - -/** - * Reports List - */ -data class ReportList( - /** - * Total number of reports that matched your query. - */ - @SerializedName("total") - val total: Long, - - /** - * List of reports. - */ - @SerializedName("reports") - val reports: List, - -) { - fun toMap(): Map = mapOf( - "total" to total as Any, - "reports" to reports.map { it.toMap() } as Any, - ) - - companion object { - - @Suppress("UNCHECKED_CAST") - fun from( - map: Map, - ) = ReportList( - total = (map["total"] as Number).toLong(), - reports = (map["reports"] as List>).map { Report.from(map = it) }, - ) - } -} \ No newline at end of file diff --git a/library/src/main/java/io/appwrite/services/Advisor.kt b/library/src/main/java/io/appwrite/services/Advisor.kt deleted file mode 100644 index b22bc19..0000000 --- a/library/src/main/java/io/appwrite/services/Advisor.kt +++ /dev/null @@ -1,159 +0,0 @@ -package io.appwrite.services - -import android.net.Uri -import io.appwrite.Client -import io.appwrite.Service -import io.appwrite.models.* -import io.appwrite.exceptions.AppwriteException -import io.appwrite.extensions.classOf -import okhttp3.Cookie -import java.io.File - -/** - * - */ -class Advisor(client: Client) : Service(client) { - - /** - * Get a list of all the project's analyzer reports. You can use the query params to filter your results. - * - * - * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: appId, type, targetType, target, analyzedAt - * @param total When set to false, the total count returned will be 0 and will not be calculated. - * @return [io.appwrite.models.ReportList] - */ - @JvmOverloads - suspend fun listReports( - queries: List? = null, - total: Boolean? = null, - ): io.appwrite.models.ReportList { - val apiPath = "/reports" - - val apiParams = mutableMapOf( - "queries" to queries, - "total" to total, - ) - val apiHeaders = mutableMapOf( - ) - val converter: (Any) -> io.appwrite.models.ReportList = { - @Suppress("UNCHECKED_CAST") - io.appwrite.models.ReportList.from(map = it as Map) - } - return client.call( - "GET", - apiPath, - apiHeaders, - apiParams, - responseType = io.appwrite.models.ReportList::class.java, - converter, - ) - } - - - /** - * Get an analyzer report by its unique ID. The response includes the report's metadata and the nested insights it produced. - * - * - * @param reportId Report ID. - * @return [io.appwrite.models.Report] - */ - suspend fun getReport( - reportId: String, - ): io.appwrite.models.Report { - val apiPath = "/reports/{reportId}" - .replace("{reportId}", reportId) - - val apiParams = mutableMapOf( - ) - val apiHeaders = mutableMapOf( - ) - val converter: (Any) -> io.appwrite.models.Report = { - @Suppress("UNCHECKED_CAST") - io.appwrite.models.Report.from(map = it as Map) - } - return client.call( - "GET", - apiPath, - apiHeaders, - apiParams, - responseType = io.appwrite.models.Report::class.java, - converter, - ) - } - - - /** - * List the insights produced under a single analyzer report. You can use the query params to filter your results further. - * - * - * @param reportId Parent report ID. - * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: type, severity, status, resourceType, resourceId, parentResourceType, parentResourceId, analyzedAt, dismissedAt, dismissedBy - * @param total When set to false, the total count returned will be 0 and will not be calculated. - * @return [io.appwrite.models.InsightList] - */ - @JvmOverloads - suspend fun listInsights( - reportId: String, - queries: List? = null, - total: Boolean? = null, - ): io.appwrite.models.InsightList { - val apiPath = "/reports/{reportId}/insights" - .replace("{reportId}", reportId) - - val apiParams = mutableMapOf( - "queries" to queries, - "total" to total, - ) - val apiHeaders = mutableMapOf( - ) - val converter: (Any) -> io.appwrite.models.InsightList = { - @Suppress("UNCHECKED_CAST") - io.appwrite.models.InsightList.from(map = it as Map) - } - return client.call( - "GET", - apiPath, - apiHeaders, - apiParams, - responseType = io.appwrite.models.InsightList::class.java, - converter, - ) - } - - - /** - * Get an insight by its unique ID, scoped to its parent report. - * - * - * @param reportId Parent report ID. - * @param insightId Insight ID. - * @return [io.appwrite.models.Insight] - */ - suspend fun getInsight( - reportId: String, - insightId: String, - ): io.appwrite.models.Insight { - val apiPath = "/reports/{reportId}/insights/{insightId}" - .replace("{reportId}", reportId) - .replace("{insightId}", insightId) - - val apiParams = mutableMapOf( - ) - val apiHeaders = mutableMapOf( - ) - val converter: (Any) -> io.appwrite.models.Insight = { - @Suppress("UNCHECKED_CAST") - io.appwrite.models.Insight.from(map = it as Map) - } - return client.call( - "GET", - apiPath, - apiHeaders, - apiParams, - responseType = io.appwrite.models.Insight::class.java, - converter, - ) - } - - -}