Skip to content

Commit 1401a88

Browse files
authored
Merge pull request #89 from appwrite/dev
Add time between queries
2 parents 96fc295 + 9a8a71a commit 1401a88

File tree

14 files changed

+186
-16
lines changed

14 files changed

+186
-16
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ repositories {
3838
Next, add the dependency to your project's `build.gradle(.kts)` file:
3939

4040
```groovy
41-
implementation("io.appwrite:sdk-for-android:9.0.0")
41+
implementation("io.appwrite:sdk-for-android:10.0.0")
4242
```
4343

4444
### Maven
@@ -49,7 +49,7 @@ Add this to your project's `pom.xml` file:
4949
<dependency>
5050
<groupId>io.appwrite</groupId>
5151
<artifactId>sdk-for-android</artifactId>
52-
<version>9.0.0</version>
52+
<version>10.0.0</version>
5353
</dependency>
5454
</dependencies>
5555
```

docs/examples/java/account/update-prefs.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ Client client = new Client(context)
99
Account account = new Account(client);
1010

1111
account.updatePrefs(
12-
mapOf( "a" to "b" ), // prefs
12+
mapOf(
13+
"language" to "en",
14+
"timezone" to "UTC",
15+
"darkTheme" to true
16+
), // prefs
1317
new CoroutineCallback<>((result, error) -> {
1418
if (error != null) {
1519
error.printStackTrace();

docs/examples/java/databases/create-document.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@ databases.createDocument(
1212
"<DATABASE_ID>", // databaseId
1313
"<COLLECTION_ID>", // collectionId
1414
"<DOCUMENT_ID>", // documentId
15-
mapOf( "a" to "b" ), // data
15+
mapOf(
16+
"username" to "walter.obrien",
17+
"email" to "[email protected]",
18+
"fullName" to "Walter O'Brien",
19+
"age" to 30,
20+
"isAdmin" to false
21+
), // data
1622
listOf("read("any")"), // permissions (optional)
1723
new CoroutineCallback<>((result, error) -> {
1824
if (error != null) {

docs/examples/java/tablesdb/create-row.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@ tablesDB.createRow(
1212
"<DATABASE_ID>", // databaseId
1313
"<TABLE_ID>", // tableId
1414
"<ROW_ID>", // rowId
15-
mapOf( "a" to "b" ), // data
15+
mapOf(
16+
"username" to "walter.obrien",
17+
"email" to "[email protected]",
18+
"fullName" to "Walter O'Brien",
19+
"age" to 30,
20+
"isAdmin" to false
21+
), // data
1622
listOf("read("any")"), // permissions (optional)
1723
new CoroutineCallback<>((result, error) -> {
1824
if (error != null) {

docs/examples/kotlin/account/update-prefs.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,9 @@ val client = Client(context)
99
val account = Account(client)
1010

1111
val result = account.updatePrefs(
12-
prefs = mapOf( "a" to "b" ),
12+
prefs = mapOf(
13+
"language" to "en",
14+
"timezone" to "UTC",
15+
"darkTheme" to true
16+
),
1317
)

docs/examples/kotlin/databases/create-document.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ val result = databases.createDocument(
1212
databaseId = "<DATABASE_ID>",
1313
collectionId = "<COLLECTION_ID>",
1414
documentId = "<DOCUMENT_ID>",
15-
data = mapOf( "a" to "b" ),
15+
data = mapOf(
16+
"username" to "walter.obrien",
17+
"email" to "[email protected]",
18+
"fullName" to "Walter O'Brien",
19+
"age" to 30,
20+
"isAdmin" to false
21+
),
1622
permissions = listOf("read("any")"), // (optional)
1723
)

docs/examples/kotlin/tablesdb/create-row.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ val result = tablesDB.createRow(
1212
databaseId = "<DATABASE_ID>",
1313
tableId = "<TABLE_ID>",
1414
rowId = "<ROW_ID>",
15-
data = mapOf( "a" to "b" ),
15+
data = mapOf(
16+
"username" to "walter.obrien",
17+
"email" to "[email protected]",
18+
"fullName" to "Walter O'Brien",
19+
"age" to 30,
20+
"isAdmin" to false
21+
),
1622
permissions = listOf("read("any")"), // (optional)
1723
)

library/src/main/java/io/appwrite/Client.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class Client @JvmOverloads constructor(
8787
"x-sdk-name" to "Android",
8888
"x-sdk-platform" to "client",
8989
"x-sdk-language" to "android",
90-
"x-sdk-version" to "9.0.0",
90+
"x-sdk-version" to "10.0.0",
9191
"x-appwrite-response-format" to "1.8.0"
9292
)
9393
config = mutableMapOf()

library/src/main/java/io/appwrite/Query.kt

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,15 @@ class Query(
254254
*/
255255
fun createdAfter(value: String) = Query("createdAfter", null, listOf(value)).toJson()
256256

257+
/**
258+
* Filter resources where document was created between start and end dates (inclusive).
259+
*
260+
* @param start The start date value.
261+
* @param end The end date value.
262+
* @returns The query string.
263+
*/
264+
fun createdBetween(start: String, end: String) = Query("createdBetween", null, listOf(start, end)).toJson()
265+
257266
/**
258267
* Filter resources where document was updated before date.
259268
*
@@ -270,6 +279,15 @@ class Query(
270279
*/
271280
fun updatedAfter(value: String) = Query("updatedAfter", null, listOf(value)).toJson()
272281

282+
/**
283+
* Filter resources where document was updated between start and end dates (inclusive).
284+
*
285+
* @param start The start date value.
286+
* @param end The end date value.
287+
* @returns The query string.
288+
*/
289+
fun updatedBetween(start: String, end: String) = Query("updatedBetween", null, listOf(start, end)).toJson()
290+
273291
/**
274292
* Combine multiple queries using logical OR operator.
275293
*
@@ -286,6 +304,122 @@ class Query(
286304
*/
287305
fun and(queries: List<String>) = Query("and", null, queries.map { it.fromJson<Query>() }).toJson()
288306

307+
/**
308+
* Filter resources where attribute is at a specific distance from the given coordinates.
309+
*
310+
* @param attribute The attribute to filter on.
311+
* @param values The coordinate values.
312+
* @param distance The distance value.
313+
* @param meters Whether the distance is in meters.
314+
* @returns The query string.
315+
*/
316+
fun distanceEqual(attribute: String, values: List<Any>, distance: Number, meters: Boolean = true) = Query("distanceEqual", attribute, listOf(listOf(values, distance, meters))).toJson()
317+
318+
/**
319+
* Filter resources where attribute is not at a specific distance from the given coordinates.
320+
*
321+
* @param attribute The attribute to filter on.
322+
* @param values The coordinate values.
323+
* @param distance The distance value.
324+
* @param meters Whether the distance is in meters.
325+
* @returns The query string.
326+
*/
327+
fun distanceNotEqual(attribute: String, values: List<Any>, distance: Number, meters: Boolean = true) = Query("distanceNotEqual", attribute, listOf(listOf(values, distance, meters))).toJson()
328+
329+
/**
330+
* Filter resources where attribute is at a distance greater than the specified value from the given coordinates.
331+
*
332+
* @param attribute The attribute to filter on.
333+
* @param values The coordinate values.
334+
* @param distance The distance value.
335+
* @param meters Whether the distance is in meters.
336+
* @returns The query string.
337+
*/
338+
fun distanceGreaterThan(attribute: String, values: List<Any>, distance: Number, meters: Boolean = true) = Query("distanceGreaterThan", attribute, listOf(listOf(values, distance, meters))).toJson()
339+
340+
/**
341+
* Filter resources where attribute is at a distance less than the specified value from the given coordinates.
342+
*
343+
* @param attribute The attribute to filter on.
344+
* @param values The coordinate values.
345+
* @param distance The distance value.
346+
* @param meters Whether the distance is in meters.
347+
* @returns The query string.
348+
*/
349+
fun distanceLessThan(attribute: String, values: List<Any>, distance: Number, meters: Boolean = true) = Query("distanceLessThan", attribute, listOf(listOf(values, distance, meters))).toJson()
350+
351+
/**
352+
* Filter resources where attribute intersects with the given geometry.
353+
*
354+
* @param attribute The attribute to filter on.
355+
* @param values The coordinate values.
356+
* @returns The query string.
357+
*/
358+
fun intersects(attribute: String, values: List<Any>) = Query("intersects", attribute, listOf(values)).toJson()
359+
360+
/**
361+
* Filter resources where attribute does not intersect with the given geometry.
362+
*
363+
* @param attribute The attribute to filter on.
364+
* @param values The coordinate values.
365+
* @returns The query string.
366+
*/
367+
fun notIntersects(attribute: String, values: List<Any>) = Query("notIntersects", attribute, listOf(values)).toJson()
368+
369+
/**
370+
* Filter resources where attribute crosses the given geometry.
371+
*
372+
* @param attribute The attribute to filter on.
373+
* @param values The coordinate values.
374+
* @returns The query string.
375+
*/
376+
fun crosses(attribute: String, values: List<Any>) = Query("crosses", attribute, listOf(values)).toJson()
377+
378+
/**
379+
* Filter resources where attribute does not cross the given geometry.
380+
*
381+
* @param attribute The attribute to filter on.
382+
* @param values The coordinate values.
383+
* @returns The query string.
384+
*/
385+
fun notCrosses(attribute: String, values: List<Any>) = Query("notCrosses", attribute, listOf(values)).toJson()
386+
387+
/**
388+
* Filter resources where attribute overlaps with the given geometry.
389+
*
390+
* @param attribute The attribute to filter on.
391+
* @param values The coordinate values.
392+
* @returns The query string.
393+
*/
394+
fun overlaps(attribute: String, values: List<Any>) = Query("overlaps", attribute, listOf(values)).toJson()
395+
396+
/**
397+
* Filter resources where attribute does not overlap with the given geometry.
398+
*
399+
* @param attribute The attribute to filter on.
400+
* @param values The coordinate values.
401+
* @returns The query string.
402+
*/
403+
fun notOverlaps(attribute: String, values: List<Any>) = Query("notOverlaps", attribute, listOf(values)).toJson()
404+
405+
/**
406+
* Filter resources where attribute touches the given geometry.
407+
*
408+
* @param attribute The attribute to filter on.
409+
* @param values The coordinate values.
410+
* @returns The query string.
411+
*/
412+
fun touches(attribute: String, values: List<Any>) = Query("touches", attribute, listOf(values)).toJson()
413+
414+
/**
415+
* Filter resources where attribute does not touch the given geometry.
416+
*
417+
* @param attribute The attribute to filter on.
418+
* @param values The coordinate values.
419+
* @returns The query string.
420+
*/
421+
fun notTouches(attribute: String, values: List<Any>) = Query("notTouches", attribute, listOf(values)).toJson()
422+
289423
/**
290424
* Parse the value to a list of values.
291425
*

library/src/main/java/io/appwrite/enums/CreditCard.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ enum class CreditCard(val value: String) {
2727
NARANJA("naranja"),
2828
@SerializedName("targeta-shopping")
2929
TARJETA_SHOPPING("targeta-shopping"),
30-
@SerializedName("union-china-pay")
31-
UNION_CHINA_PAY("union-china-pay"),
30+
@SerializedName("unionpay")
31+
UNION_PAY("unionpay"),
3232
@SerializedName("visa")
3333
VISA("visa"),
3434
@SerializedName("mir")

0 commit comments

Comments
 (0)