feat: review comments

This commit is contained in:
Christy Jacob
2021-06-09 11:04:54 +05:30
parent e4080da687
commit f028c8a777
16 changed files with 164 additions and 235 deletions
+12
View File
@@ -0,0 +1,12 @@
*.iml
.gradle
/local.properties
/.idea/*
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
.local.properties
.env
*/build
+1 -1
View File
@@ -1 +1 @@
**CHANGELOG**
# Change Log
+12 -1
View File
@@ -1 +1,12 @@
test test test
Copyright (c) 2021 Appwrite (https://appwrite.io) and individual contributors.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name Appwrite nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+4 -85
View File
@@ -1,15 +1,15 @@
# Appwrite Kotlin SDK
# Appwrite Android SDK
![License](https://img.shields.io/github/license/appwrite/sdk-for-android.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-0.8.0-blue.svg?style=flat-square)
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite_io?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite_io)
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)
**This SDK is compatible with Appwrite server version 0.7.x. For older versions, please check previous releases.**
**This SDK is compatible with Appwrite server version 0.8.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-android/releases).**
Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Flutter SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to https://appwrite.io/docs
Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Android SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
![Appwrite](https://appwrite.io/v1/images/console.png)
![Appwrite](https://appwrite.io/images/github.png)
## Installation
@@ -48,87 +48,6 @@ Add this to your project's `pom.xml` file:
```
### Add your Android Platform
To init your SDK and start interacting with Appwrite services, you need to add a new Flutter platform to your project. To add a new platform, go to your Appwrite console, choose the project you created in the step before, and click the 'Add Platform' button.
From the options, choose to add a new **Flutter** platform and add your app credentials, ignoring iOS.
Add your app <u>name</u> and <u>package name</u>, Your package name is generally the applicationId in your app-level build.gradle file. By registering your new app platform, you are allowing your app to communicate with the Appwrite API.
### OAuth
In order to capture the Appwrite OAuth callback url, the following activity needs to be added to your [AndroidManifest.xml](https://github.com/appwrite/playground-for-flutter/blob/master/android/app/src/main/AndroidManifest.xml). Be sure to relpace the **[PROJECT_ID]** string with your actual Appwrite project ID. You can find your Appwrite project ID in you project settings screen in your Appwrite console.
```xml
<manifest>
<application>
<activity android:name="io.appwrite.views.CallbackActivity" >
<intent-filter android:label="android_web_auth">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="appwrite-callback-[PROJECT_ID]" />
</intent-filter>
</activity>
</application>
</manifest>
```
### Init your SDK
<p>Initialize your SDK code with your project ID, which can be found in your project settings page.
```kotlin
import io.appwrite.Client
import io.appwrite.services.Account
val client = Client(context)
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setSelfSigned(true) // Remove in production
```
Before starting to send any API calls to your new Appwrite instance, make sure your Android emulators has network access to the Appwrite server hostname or IP address.
When trying to connect to Appwrite from an emulator or a mobile device, localhost is the hostname for the device or emulator and not your local Appwrite instance. You should replace localhost with your private IP as the Appwrite endpoint's hostname. You can also use a service like [ngrok](https://ngrok.com/) to proxy the Appwrite API.
### Make Your First Request
<p>Once your SDK object is set, access any of the Appwrite services and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the API References section.
```kotlin
// Register User
val accountService = Account(client)
val user = accountService.create(
"email@example.com",
"password"
)
```
### Full Example
```kotlin
import io.appwrite.Client
import io.appwrite.services.Account
val client = Client(context)
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setSelfSigned(true) // Remove in production
val accountService = Account(client)
val user = accountService.create(
"email@example.com",
"password"
)
```
### Learn more
You can use following resources to learn more and get help
- 📜 [Appwrite Docs](https://appwrite.io/docs)
- 💬 [Discord Community](https://appwrite.io/discord)
## Contribution
This library is auto-generated by Appwrite custom [SDK Generator](https://github.com/appwrite/sdk-generator). To learn more about how you can help us improve this SDK, please check the [contribution guide](https://github.com/appwrite/sdk-generator/blob/master/CONTRIBUTING.md) before sending a pull-request.
+1 -1
View File
@@ -8,7 +8,7 @@ android {
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "{{ sdk.namespace | caseDot }}.android"
applicationId "io.appwrite.android"
minSdkVersion 21
targetSdkVersion 30
versionCode 1
+1 -1
View File
@@ -12,7 +12,7 @@ ext {
POM_URL = ''
POM_SCM_URL = 'https://github.com/appwrite/sdk-for-android'
POM_ISSUE_URL = 'https://github.com/appwrite/sdk-for-android/issues'
POM_DESCRIPTION = 'Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Flutter SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to https://appwrite.io/docs'
POM_DESCRIPTION = 'Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Android SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)'
POM_LICENSE_URL = 'https://opensource.org/licenses/GPL-3.0'
POM_LICENSE_NAME = "GPL-3.0"
POM_DEVELOPER_ID = ''
+1 -1
View File
@@ -60,7 +60,7 @@ class Client(
headers = mutableMapOf(
"content-type" to "application/json",
"x-sdk-version" to "appwrite:kotlin:0.0.0-SNAPSHOT",
"x-appwrite-response-format" to "0.7.0"
"X-Appwrite-Response-Format" to "0.8.0"
)
config = mutableMapOf()
@@ -1,6 +0,0 @@
package io.appwrite.enums
enum class OrderType {
ASC,
DESC
}
@@ -4,7 +4,6 @@ import android.net.Uri
import io.appwrite.Client
import io.appwrite.WebAuthComponent
import androidx.activity.ComponentActivity
import io.appwrite.enums.OrderType
import io.appwrite.exceptions.AppwriteException
import okhttp3.Cookie
import okhttp3.Response
@@ -19,7 +18,7 @@ class Account(private val client: Client) : BaseService(client) {
*
* Get currently logged in user data as JSON object.
*
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
@@ -48,14 +47,14 @@ class Account(private val client: Client) : BaseService(client) {
* @param email
* @param password
* @param name
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
suspend fun create(
email: String,
password: String,
name: String = ""
name: String? = null
): Response {
val path = "/account"
val params = mapOf<String, Any?>(
@@ -80,7 +79,7 @@ class Account(private val client: Client) : BaseService(client) {
* address. Any user-related resources like documents or storage files should
* be deleted separately.
*
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
@@ -108,7 +107,7 @@ class Account(private val client: Client) : BaseService(client) {
*
* @param email
* @param password
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
@@ -137,7 +136,7 @@ class Account(private val client: Client) : BaseService(client) {
* Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes
* from its creation and will be invalid if the user will logout.
*
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
@@ -159,7 +158,7 @@ class Account(private val client: Client) : BaseService(client) {
* Get currently logged in user list of latest security activity logs. Each
* log returns user IP address, location and date and time of log.
*
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
@@ -181,7 +180,7 @@ class Account(private val client: Client) : BaseService(client) {
* Update currently logged in user account name.
*
* @param name
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
@@ -209,13 +208,13 @@ class Account(private val client: Client) : BaseService(client) {
*
* @param password
* @param oldPassword
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
suspend fun updatePassword(
password: String,
oldPassword: String = ""
oldPassword: String? = null
): Response {
val path = "/account/password"
val params = mapOf<String, Any?>(
@@ -235,7 +234,7 @@ class Account(private val client: Client) : BaseService(client) {
*
* Get currently logged in user preferences as a key-value object.
*
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
@@ -258,12 +257,12 @@ class Account(private val client: Client) : BaseService(client) {
* specific settings you wish to update.
*
* @param prefs
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
suspend fun updatePrefs(
prefs: Any?
prefs: Any
): Response {
val path = "/account/prefs"
val params = mapOf<String, Any?>(
@@ -291,7 +290,7 @@ class Account(private val client: Client) : BaseService(client) {
*
* @param email
* @param url
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
@@ -329,7 +328,7 @@ class Account(private val client: Client) : BaseService(client) {
* @param secret
* @param password
* @param passwordAgain
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
@@ -360,7 +359,7 @@ class Account(private val client: Client) : BaseService(client) {
* Get currently logged in user list of active sessions across different
* devices.
*
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
@@ -384,7 +383,7 @@ class Account(private val client: Client) : BaseService(client) {
*
* @param email
* @param password
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
@@ -411,7 +410,7 @@ class Account(private val client: Client) : BaseService(client) {
* Delete all sessions from the user account and remove any sessions cookies
* from the end client.
*
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
@@ -436,7 +435,7 @@ class Account(private val client: Client) : BaseService(client) {
* account, you need to update its [email and
* password](/docs/client/account#accountUpdateEmail).
*
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
@@ -464,15 +463,15 @@ class Account(private val client: Client) : BaseService(client) {
* @param success
* @param failure
* @param scopes
* @return The request response with a JSON body
*
*/
@JvmOverloads
@Throws(AppwriteException::class)
suspend fun createOAuth2Session(
activity: ComponentActivity,
provider: String,
success: String = "https://appwrite.io/auth/oauth2/success",
failure: String = "https://appwrite.io/auth/oauth2/failure",
success: String? = null,
failure: String? = null,
scopes: List<Any>? = null
) {
val path = "/account/sessions/oauth2/{provider}".replace("{provider}", provider)
@@ -536,7 +535,7 @@ class Account(private val client: Client) : BaseService(client) {
* option id argument, only the session unique ID provider will be deleted.
*
* @param sessionId
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
@@ -574,7 +573,7 @@ class Account(private val client: Client) : BaseService(client) {
*
*
* @param url
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
@@ -603,7 +602,7 @@ class Account(private val client: Client) : BaseService(client) {
*
* @param userId
* @param secret
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
@@ -2,7 +2,6 @@ package io.appwrite.services
import android.net.Uri
import io.appwrite.Client
import io.appwrite.enums.OrderType
import io.appwrite.exceptions.AppwriteException
import okhttp3.Cookie
import okhttp3.Response
@@ -24,15 +23,15 @@ class Avatars(private val client: Client) : BaseService(client) {
* @param width
* @param height
* @param quality
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
suspend fun getBrowser(
code: String,
width: Int = 100,
height: Int = 100,
quality: Int = 100
width: Int? = null,
height: Int? = null,
quality: Int? = null
): Response {
val path = "/avatars/browsers/{code}".replace("{code}", code)
val params = mapOf<String, Any?>(
@@ -56,15 +55,15 @@ class Avatars(private val client: Client) : BaseService(client) {
* @param width
* @param height
* @param quality
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
suspend fun getCreditCard(
code: String,
width: Int = 100,
height: Int = 100,
quality: Int = 100
width: Int? = null,
height: Int? = null,
quality: Int? = null
): Response {
val path = "/avatars/credit-cards/{code}".replace("{code}", code)
val params = mapOf<String, Any?>(
@@ -85,7 +84,7 @@ class Avatars(private val client: Client) : BaseService(client) {
*
*
* @param url
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
@@ -112,15 +111,15 @@ class Avatars(private val client: Client) : BaseService(client) {
* @param width
* @param height
* @param quality
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
suspend fun getFlag(
code: String,
width: Int = 100,
height: Int = 100,
quality: Int = 100
width: Int? = null,
height: Int? = null,
quality: Int? = null
): Response {
val path = "/avatars/flags/{code}".replace("{code}", code)
val params = mapOf<String, Any?>(
@@ -144,14 +143,14 @@ class Avatars(private val client: Client) : BaseService(client) {
* @param url
* @param width
* @param height
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
suspend fun getImage(
url: String,
width: Int = 400,
height: Int = 400
width: Int? = null,
height: Int? = null
): Response {
val path = "/avatars/image"
val params = mapOf<String, Any?>(
@@ -183,16 +182,16 @@ class Avatars(private val client: Client) : BaseService(client) {
* @param height
* @param color
* @param background
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
suspend fun getInitials(
name: String = "",
width: Int = 500,
height: Int = 500,
color: String = "",
background: String = ""
name: String? = null,
width: Int? = null,
height: Int? = null,
color: String? = null,
background: String? = null
): Response {
val path = "/avatars/initials"
val params = mapOf<String, Any?>(
@@ -217,15 +216,15 @@ class Avatars(private val client: Client) : BaseService(client) {
* @param size
* @param margin
* @param download
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
suspend fun getQR(
text: String,
size: Int = 400,
margin: Int = 1,
download: Boolean = false
size: Int? = null,
margin: Int? = null,
download: Boolean? = null
): Response {
val path = "/avatars/qr"
val params = mapOf<String, Any?>(
@@ -2,7 +2,6 @@ package io.appwrite.services
import android.net.Uri
import io.appwrite.Client
import io.appwrite.enums.OrderType
import io.appwrite.exceptions.AppwriteException
import okhttp3.Cookie
import okhttp3.Response
@@ -26,19 +25,19 @@ class Database(private val client: Client) : BaseService(client) {
* @param orderType
* @param orderCast
* @param search
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
suspend fun listDocuments(
collectionId: String,
filters: List<Any>? = null,
limit: Int = 25,
offset: Int = 0,
orderField: String = "",
orderType: OrderType = OrderType.ASC,
orderCast: String = "string",
search: String = ""
limit: Int? = null,
offset: Int? = null,
orderField: String? = null,
orderType: String? = null,
orderCast: String? = null,
search: String? = null
): Response {
val path = "/database/collections/{collectionId}/documents".replace("{collectionId}", collectionId)
val params = mapOf<String, Any?>(
@@ -46,7 +45,7 @@ class Database(private val client: Client) : BaseService(client) {
"limit" to limit,
"offset" to offset,
"orderField" to orderField,
"orderType" to orderType.name,
"orderType" to orderType,
"orderCast" to orderCast,
"search" to search
)
@@ -73,18 +72,18 @@ class Database(private val client: Client) : BaseService(client) {
* @param parentDocument
* @param parentProperty
* @param parentPropertyType
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
suspend fun createDocument(
collectionId: String,
data: Any?,
data: Any,
read: List<Any>? = null,
write: List<Any>? = null,
parentDocument: String = "",
parentProperty: String = "",
parentPropertyType: String = "assign"
parentDocument: String? = null,
parentProperty: String? = null,
parentPropertyType: String? = null
): Response {
val path = "/database/collections/{collectionId}/documents".replace("{collectionId}", collectionId)
val params = mapOf<String, Any?>(
@@ -111,7 +110,7 @@ class Database(private val client: Client) : BaseService(client) {
*
* @param collectionId
* @param documentId
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
@@ -141,14 +140,14 @@ class Database(private val client: Client) : BaseService(client) {
* @param data
* @param read
* @param write
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
suspend fun updateDocument(
collectionId: String,
documentId: String,
data: Any?,
data: Any,
read: List<Any>? = null,
write: List<Any>? = null
): Response {
@@ -175,7 +174,7 @@ class Database(private val client: Client) : BaseService(client) {
*
* @param collectionId
* @param documentId
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
@@ -2,7 +2,6 @@ package io.appwrite.services
import android.net.Uri
import io.appwrite.Client
import io.appwrite.enums.OrderType
import io.appwrite.exceptions.AppwriteException
import okhttp3.Cookie
import okhttp3.Response
@@ -23,23 +22,23 @@ class Functions(private val client: Client) : BaseService(client) {
* @param limit
* @param offset
* @param orderType
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
suspend fun listExecutions(
functionId: String,
search: String = "",
limit: Int = 25,
offset: Int = 0,
orderType: OrderType = OrderType.ASC
search: String? = null,
limit: Int? = null,
offset: Int? = null,
orderType: String? = null
): Response {
val path = "/functions/{functionId}/executions".replace("{functionId}", functionId)
val params = mapOf<String, Any?>(
"search" to search,
"limit" to limit,
"offset" to offset,
"orderType" to orderType.name
"orderType" to orderType
)
val headers = mapOf(
@@ -59,13 +58,13 @@ class Functions(private val client: Client) : BaseService(client) {
*
* @param functionId
* @param data
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
suspend fun createExecution(
functionId: String,
data: String = ""
data: String? = null
): Response {
val path = "/functions/{functionId}/executions".replace("{functionId}", functionId)
val params = mapOf<String, Any?>(
@@ -86,7 +85,7 @@ class Functions(private val client: Client) : BaseService(client) {
*
* @param functionId
* @param executionId
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
@@ -2,7 +2,6 @@ package io.appwrite.services
import android.net.Uri
import io.appwrite.Client
import io.appwrite.enums.OrderType
import io.appwrite.exceptions.AppwriteException
import okhttp3.Cookie
import okhttp3.Response
@@ -20,7 +19,7 @@ class Locale(private val client: Client) : BaseService(client) {
*
* ([IP Geolocation by DB-IP](https://db-ip.com))
*
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
@@ -42,7 +41,7 @@ class Locale(private val client: Client) : BaseService(client) {
* List of all continents. You can use the locale header to get the data in a
* supported language.
*
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
@@ -64,7 +63,7 @@ class Locale(private val client: Client) : BaseService(client) {
* List of all countries. You can use the locale header to get the data in a
* supported language.
*
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
@@ -86,7 +85,7 @@ class Locale(private val client: Client) : BaseService(client) {
* List of all countries that are currently members of the EU. You can use the
* locale header to get the data in a supported language.
*
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
@@ -108,7 +107,7 @@ class Locale(private val client: Client) : BaseService(client) {
* List of all countries phone codes. You can use the locale header to get the
* data in a supported language.
*
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
@@ -131,7 +130,7 @@ class Locale(private val client: Client) : BaseService(client) {
* decimal digits for all major and minor currencies. You can use the locale
* header to get the data in a supported language.
*
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
@@ -153,7 +152,7 @@ class Locale(private val client: Client) : BaseService(client) {
* List of all languages classified by ISO 639-1 including 2-letter code, name
* in English, and name in the respective language.
*
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
@@ -2,7 +2,6 @@ package io.appwrite.services
import android.net.Uri
import io.appwrite.Client
import io.appwrite.enums.OrderType
import io.appwrite.exceptions.AppwriteException
import okhttp3.Cookie
import okhttp3.Response
@@ -23,22 +22,22 @@ class Storage(private val client: Client) : BaseService(client) {
* @param limit
* @param offset
* @param orderType
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
suspend fun listFiles(
search: String = "",
limit: Int = 25,
offset: Int = 0,
orderType: OrderType = OrderType.ASC
search: String? = null,
limit: Int? = null,
offset: Int? = null,
orderType: String? = null
): Response {
val path = "/storage/files"
val params = mapOf<String, Any?>(
"search" to search,
"limit" to limit,
"offset" to offset,
"orderType" to orderType.name
"orderType" to orderType
)
val headers = mapOf(
@@ -58,7 +57,7 @@ class Storage(private val client: Client) : BaseService(client) {
* @param file
* @param read
* @param write
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
@@ -88,7 +87,7 @@ class Storage(private val client: Client) : BaseService(client) {
* with the file metadata.
*
* @param fileId
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
@@ -115,14 +114,14 @@ class Storage(private val client: Client) : BaseService(client) {
* @param fileId
* @param read
* @param write
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
suspend fun updateFile(
fileId: String,
read: List<Any>?,
write: List<Any>?
read: List<Any>,
write: List<Any>
): Response {
val path = "/storage/files/{fileId}".replace("{fileId}", fileId)
val params = mapOf<String, Any?>(
@@ -144,7 +143,7 @@ class Storage(private val client: Client) : BaseService(client) {
* access to delete this resource.
*
* @param fileId
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
@@ -170,7 +169,7 @@ class Storage(private val client: Client) : BaseService(client) {
* downloading the file to user downloads directory.
*
* @param fileId
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
@@ -204,22 +203,22 @@ class Storage(private val client: Client) : BaseService(client) {
* @param rotation
* @param background
* @param output
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
suspend fun getFilePreview(
fileId: String,
width: Int = 0,
height: Int = 0,
quality: Int = 100,
borderWidth: Int = 0,
borderColor: String = "",
borderRadius: Int = 0,
opacity: Double = 1.0,
rotation: Int = 0,
background: String = "",
output: String = ""
width: Int? = null,
height: Int? = null,
quality: Int? = null,
borderWidth: Int? = null,
borderColor: String? = null,
borderRadius: Int? = null,
opacity: Double? = null,
rotation: Int? = null,
background: String? = null,
output: String? = null
): Response {
val path = "/storage/files/{fileId}/preview".replace("{fileId}", fileId)
val params = mapOf<String, Any?>(
@@ -247,7 +246,7 @@ class Storage(private val client: Client) : BaseService(client) {
* header.
*
* @param fileId
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
@@ -2,7 +2,6 @@ package io.appwrite.services
import android.net.Uri
import io.appwrite.Client
import io.appwrite.enums.OrderType
import io.appwrite.exceptions.AppwriteException
import okhttp3.Cookie
import okhttp3.Response
@@ -22,22 +21,22 @@ class Teams(private val client: Client) : BaseService(client) {
* @param limit
* @param offset
* @param orderType
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
suspend fun list(
search: String = "",
limit: Int = 25,
offset: Int = 0,
orderType: OrderType = OrderType.ASC
search: String? = null,
limit: Int? = null,
offset: Int? = null,
orderType: String? = null
): Response {
val path = "/teams"
val params = mapOf<String, Any?>(
"search" to search,
"limit" to limit,
"offset" to offset,
"orderType" to orderType.name
"orderType" to orderType
)
val headers = mapOf(
@@ -57,7 +56,7 @@ class Teams(private val client: Client) : BaseService(client) {
*
* @param name
* @param roles
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
@@ -85,7 +84,7 @@ class Teams(private val client: Client) : BaseService(client) {
* resource.
*
* @param teamId
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
@@ -111,7 +110,7 @@ class Teams(private val client: Client) : BaseService(client) {
*
* @param teamId
* @param name
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
@@ -138,7 +137,7 @@ class Teams(private val client: Client) : BaseService(client) {
* resource.
*
* @param teamId
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
@@ -167,23 +166,23 @@ class Teams(private val client: Client) : BaseService(client) {
* @param limit
* @param offset
* @param orderType
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
suspend fun getMemberships(
teamId: String,
search: String = "",
limit: Int = 25,
offset: Int = 0,
orderType: OrderType = OrderType.ASC
search: String? = null,
limit: Int? = null,
offset: Int? = null,
orderType: String? = null
): Response {
val path = "/teams/{teamId}/memberships".replace("{teamId}", teamId)
val params = mapOf<String, Any?>(
"search" to search,
"limit" to limit,
"offset" to offset,
"orderType" to orderType.name
"orderType" to orderType
)
val headers = mapOf(
@@ -215,16 +214,16 @@ class Teams(private val client: Client) : BaseService(client) {
* @param roles
* @param url
* @param name
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
suspend fun createMembership(
teamId: String,
email: String,
roles: List<Any>?,
roles: List<Any>,
url: String,
name: String = ""
name: String? = null
): Response {
val path = "/teams/{teamId}/memberships".replace("{teamId}", teamId)
val params = mapOf<String, Any?>(
@@ -247,14 +246,14 @@ class Teams(private val client: Client) : BaseService(client) {
* @param teamId
* @param membershipId
* @param roles
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
suspend fun updateMembershipRoles(
teamId: String,
membershipId: String,
roles: List<Any>?
roles: List<Any>
): Response {
val path = "/teams/{teamId}/memberships/{membershipId}".replace("{teamId}", teamId).replace("{membershipId}", membershipId)
val params = mapOf<String, Any?>(
@@ -277,7 +276,7 @@ class Teams(private val client: Client) : BaseService(client) {
*
* @param teamId
* @param membershipId
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)
@@ -307,7 +306,7 @@ class Teams(private val client: Client) : BaseService(client) {
* @param membershipId
* @param userId
* @param secret
* @return The request response with a JSON body
* @return [Response]
*/
@JvmOverloads
@Throws(AppwriteException::class)