Skip to content

Commit 1022175

Browse files
committed
feat(android): query
1 parent 1c74d87 commit 1022175

4 files changed

Lines changed: 275 additions & 1 deletion

File tree

‎packages/appwrite/index.android.ts‎

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,3 +677,87 @@ export class Session {
677677
};
678678
}
679679
}
680+
681+
export class Query {
682+
static between(attribute: string, start: number, end: number): string;
683+
static between(attribute: string, start: string, end: string): string;
684+
static between(attribute: string, start: number | string, end: number | string): string {
685+
return org.nativescript.plugins.appwrite.Query.between(attribute, start as never, end as never);
686+
}
687+
688+
static contains(attribute: string, value: any): string {
689+
return org.nativescript.plugins.appwrite.Query.contains(attribute, value);
690+
}
691+
692+
static cursorAfter(id: string): string {
693+
return org.nativescript.plugins.appwrite.Query.cursorAfter(id);
694+
}
695+
696+
static cursorBefore(id: string): string {
697+
return org.nativescript.plugins.appwrite.Query.cursorBefore(id);
698+
}
699+
700+
static endsWith(attribute: string, value: string): string {
701+
return org.nativescript.plugins.appwrite.Query.endsWith(attribute, value);
702+
}
703+
704+
static equal(attribute: string, value: any): string {
705+
return org.nativescript.plugins.appwrite.Query.equal(attribute, value);
706+
}
707+
708+
static greaterThanEqual(attribute: string, value: any): string {
709+
return org.nativescript.plugins.appwrite.Query.greaterThanEqual(attribute, value);
710+
}
711+
712+
static greaterThan(attribute: string, value: any): string {
713+
return org.nativescript.plugins.appwrite.Query.greaterThan(attribute, value);
714+
}
715+
716+
static isNotNull(attribute: string): string {
717+
return org.nativescript.plugins.appwrite.Query.isNotNull(attribute);
718+
}
719+
720+
static isNull(attribute: string): string {
721+
return org.nativescript.plugins.appwrite.Query.isNull(attribute);
722+
}
723+
724+
static lessThanEqualWithAttribute(attribute: string, value: any): string {
725+
return org.nativescript.plugins.appwrite.Query.lessThanEqual(attribute, value);
726+
}
727+
728+
static lessThan(attribute: string, value: any): string {
729+
return org.nativescript.plugins.appwrite.Query.lessThan(attribute, value);
730+
}
731+
732+
static limit(limit: number): string {
733+
return org.nativescript.plugins.appwrite.Query.limit(limit);
734+
}
735+
736+
static notEqual(attribute: string, value: any): string {
737+
return org.nativescript.plugins.appwrite.Query.notEqual(attribute, value);
738+
}
739+
740+
static offset(offset: number): string {
741+
return org.nativescript.plugins.appwrite.Query.offset(offset);
742+
}
743+
744+
static orderAsc(attribute: string): string {
745+
return org.nativescript.plugins.appwrite.Query.orderAsc(attribute);
746+
}
747+
748+
static orderDesc(attribute: string): string {
749+
return org.nativescript.plugins.appwrite.Query.orderDesc(attribute);
750+
}
751+
752+
static search(attribute: string, value: string): string {
753+
return org.nativescript.plugins.appwrite.Query.search(attribute, value);
754+
}
755+
756+
static select(attributes: string[]): string {
757+
return org.nativescript.plugins.appwrite.Query.select(Utils.dataSerialize(attributes, true));
758+
}
759+
760+
static startsWith(attribute: string, value: string): string {
761+
return org.nativescript.plugins.appwrite.Query.startsWith(attribute, value);
762+
}
763+
}

‎packages/appwrite/index.ios.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ export class Query {
682682
}
683683

684684
static select(attributes: string[]): string {
685-
return NSCAppwriteQuery.select(attributes as never);
685+
return NSCAppwriteQuery.select(Utils.dataSerialize(attributes, true));
686686
}
687687

688688
static startsWith(attribute: string, value: string): string {
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
package org.nativescript.plugins.appwrite
2+
3+
4+
class Query {
5+
companion object {
6+
@JvmStatic
7+
fun equal(attribute: String, value: Any): String {
8+
return io.appwrite.Query.equal(attribute, value)
9+
}
10+
11+
@JvmStatic
12+
fun notEqual(attribute: String, value: Any): String {
13+
return io.appwrite.Query.notEqual(attribute, value)
14+
}
15+
16+
@JvmStatic
17+
fun lessThan(attribute: String, value: Any): String {
18+
return io.appwrite.Query.lessThan(attribute, value)
19+
}
20+
21+
@JvmStatic
22+
fun lessThanEqual(attribute: String, value: Any): String {
23+
return io.appwrite.Query.lessThanEqual(attribute, value)
24+
}
25+
26+
@JvmStatic
27+
fun greaterThan(attribute: String, value: Any): String {
28+
return io.appwrite.Query.greaterThan(attribute, value)
29+
}
30+
31+
@JvmStatic
32+
fun greaterThanEqual(attribute: String, value: Any): String {
33+
return io.appwrite.Query.greaterThanEqual(attribute, value)
34+
}
35+
36+
@JvmStatic
37+
fun isNull(attribute: String): String {
38+
return io.appwrite.Query.isNull(attribute)
39+
}
40+
41+
@JvmStatic
42+
fun isNotNull(attribute: String): String {
43+
return io.appwrite.Query.isNotNull(attribute)
44+
}
45+
46+
@JvmStatic
47+
fun between(attribute: String, start: Int, end: Int): String {
48+
return io.appwrite.Query.between(attribute, start, end)
49+
}
50+
51+
@JvmStatic
52+
fun between(attribute: String, start: Double, end: Double): String {
53+
return io.appwrite.Query.between(attribute, start, end)
54+
}
55+
56+
@JvmStatic
57+
fun between(attribute: String, start: String, end: String): String {
58+
return io.appwrite.Query.between(attribute, start, end)
59+
}
60+
61+
@JvmStatic
62+
fun startsWith(attribute: String, value: String): String {
63+
return io.appwrite.Query.startsWith(attribute, value)
64+
}
65+
66+
@JvmStatic
67+
fun endsWith(attribute: String, value: String): String {
68+
return io.appwrite.Query.endsWith(attribute, value)
69+
}
70+
71+
@JvmStatic
72+
fun select(attributes: List<String>): String {
73+
return io.appwrite.Query.select(attributes)
74+
}
75+
76+
@JvmStatic
77+
fun search(attribute: String, value: String): String {
78+
return io.appwrite.Query.search(attribute, value)
79+
}
80+
81+
@JvmStatic
82+
fun orderAsc(attribute: String): String {
83+
return io.appwrite.Query.orderAsc(attribute)
84+
}
85+
86+
@JvmStatic
87+
fun orderDesc(attribute: String): String {
88+
return io.appwrite.Query.orderDesc(attribute)
89+
}
90+
91+
@JvmStatic
92+
fun cursorBefore(id: String): String {
93+
return io.appwrite.Query.cursorBefore(id)
94+
}
95+
96+
@JvmStatic
97+
fun cursorAfter(id: String): String {
98+
return io.appwrite.Query.cursorAfter(id)
99+
}
100+
101+
@JvmStatic
102+
fun limit(limit: Int): String {
103+
return io.appwrite.Query.limit(limit)
104+
}
105+
106+
@JvmStatic
107+
fun offset(offset: Int): String {
108+
return io.appwrite.Query.limit(offset)
109+
}
110+
111+
@JvmStatic
112+
fun contains(attribute: String, value: Any): String {
113+
return io.appwrite.Query.contains(attribute, value)
114+
}
115+
116+
@JvmStatic
117+
fun or(queries: List<String>): String {
118+
return io.appwrite.Query.or(queries)
119+
}
120+
121+
@JvmStatic
122+
fun and(queries: List<String>): String {
123+
return io.appwrite.Query.and(queries)
124+
}
125+
}
126+
}

‎packages/appwrite/typings/org.nativescript.plugins.appwrite.android.d.ts‎

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,68 @@ declare module org {
8080
}
8181
}
8282

83+
declare module org {
84+
export module nativescript {
85+
export module plugins {
86+
export module appwrite {
87+
export class Query {
88+
public static class: java.lang.Class<org.nativescript.plugins.appwrite.Query>;
89+
public static lessThan(attribute: string, value: any): string;
90+
public static notEqual(attribute: string, value: any): string;
91+
public static select(attributes: java.util.List<string>): string;
92+
public static or(queries: java.util.List<string>): string;
93+
public static startsWith(attribute: string, value: string): string;
94+
public static endsWith(attribute: string, value: string): string;
95+
public static greaterThanEqual(attribute: string, value: any): string;
96+
public static isNotNull(attribute: string): string;
97+
public static equal(attribute: string, value: any): string;
98+
public static between(attribute: string, start: string, end: string): string;
99+
public static search(attribute: string, value: string): string;
100+
public static between(attribute: string, start: number, end: number): string;
101+
public static lessThanEqual(attribute: string, value: any): string;
102+
public static limit(limit: number): string;
103+
public constructor();
104+
public static orderDesc(attribute: string): string;
105+
public static offset(offset: number): string;
106+
public static contains(attribute: string, value: any): string;
107+
public static and(queries: java.util.List<string>): string;
108+
public static greaterThan(attribute: string, value: any): string;
109+
public static isNull(attribute: string): string;
110+
public static cursorBefore(id: string): string;
111+
public static orderAsc(attribute: string): string;
112+
public static cursorAfter(id: string): string;
113+
}
114+
export module Query {
115+
export class Companion {
116+
public static class: java.lang.Class<org.nativescript.plugins.appwrite.Query.Companion>;
117+
public between(attribute: string, start: string, end: string): string;
118+
public search(attribute: string, value: string): string;
119+
public endsWith(attribute: string, value: string): string;
120+
public orderDesc(attribute: string): string;
121+
public equal(attribute: string, value: any): string;
122+
public between(attribute: string, start: number, end: number): string;
123+
public isNull(attribute: string): string;
124+
public startsWith(attribute: string, value: string): string;
125+
public select(attributes: java.util.List<string>): string;
126+
public contains(attribute: string, value: any): string;
127+
public offset(offset: number): string;
128+
public cursorBefore(id: string): string;
129+
public lessThan(attribute: string, value: any): string;
130+
public greaterThan(attribute: string, value: any): string;
131+
public lessThanEqual(attribute: string, value: any): string;
132+
public isNotNull(attribute: string): string;
133+
public limit(limit: number): string;
134+
public orderAsc(attribute: string): string;
135+
public or(queries: java.util.List<string>): string;
136+
public and(queries: java.util.List<string>): string;
137+
public notEqual(attribute: string, value: any): string;
138+
public cursorAfter(id: string): string;
139+
public greaterThanEqual(attribute: string, value: any): string;
140+
}
141+
}
142+
}
143+
}
144+
}
145+
}
146+
83147
//Generics information:

0 commit comments

Comments
 (0)