Skip to content

Commit 43513ca

Browse files
committed
rename operator to method to make it consistent with server implementation
1 parent 7b72df6 commit 43513ca

File tree

8 files changed

+24
-24
lines changed

8 files changed

+24
-24
lines changed

templates/android/library/src/main/java/io/appwrite/Query.kt.twig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ class Query {
2828

2929
fun offset(offset: Int) = "offset(${offset})"
3030

31-
private fun addQuery(attribute: String, oper: String, value: Any): String {
31+
private fun addQuery(attribute: String, method: String, value: Any): String {
3232
return when (value) {
33-
is List<*> -> "${oper}(\"${attribute}\", [${value.map{it -> parseValues(it!!)}.joinToString(",")}])"
34-
else -> "${oper}(\"${attribute}\", [${Query.parseValues(value)}])"
33+
is List<*> -> "${method}(\"${attribute}\", [${value.map{it -> parseValues(it!!)}.joinToString(",")}])"
34+
else -> "${method}(\"${attribute}\", [${Query.parseValues(value)}])"
3535
}
3636
}
3737
private fun parseValues(value: Any): String {

templates/dart/lib/query.dart.twig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ class Query {
2222
static search(String attribute, String value) =>
2323
_addQuery(attribute, 'search', value);
2424

25-
static String _addQuery(String attribute, String oper, dynamic value) => (value
25+
static String _addQuery(String attribute, String method, dynamic value) => (value
2626
is List)
27-
? '$oper("$attribute", [${value.map((item) => parseValues(item)).join(",")}])'
28-
: '$oper("$attribute", [${parseValues(value)}])';
27+
? '$method("$attribute", [${value.map((item) => parseValues(item)).join(",")}])'
28+
: '$method("$attribute", [${parseValues(value)}])';
2929

3030
static String orderAsc(String attribute) {
3131
return 'orderAsc("$attribute")';

templates/flutter/lib/query.dart.twig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ class Query {
2222
static search(String attribute, String value) =>
2323
_addQuery(attribute, 'search', value);
2424

25-
static String _addQuery(String attribute, String oper, dynamic value) => (value
25+
static String _addQuery(String attribute, String method, dynamic value) => (value
2626
is List)
27-
? '$oper("$attribute", [${value.map((item) => parseValues(item)).join(",")}])'
28-
: '$oper("$attribute", [${parseValues(value)}])';
27+
? '$method("$attribute", [${value.map((item) => parseValues(item)).join(",")}])'
28+
: '$method("$attribute", [${parseValues(value)}])';
2929

3030
static String orderAsc(String attribute) {
3131
return 'orderAsc("$attribute")';

templates/kotlin/src/main/kotlin/io/appwrite/Query.kt.twig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ class Query {
2828

2929
fun offset(offset: Int) = "offset(${offset})"
3030

31-
private fun addQuery(attribute: String, oper: String, value: Any): String {
31+
private fun addQuery(attribute: String, method: String, value: Any): String {
3232
return when (value) {
33-
is List<*> -> "${oper}(\"${attribute}\", [${value.map{it -> parseValues(it!!)}.joinToString(",")}])"
34-
else -> "${oper}(\"${attribute}\", [${Query.parseValues(value)}])"
33+
is List<*> -> "${method}(\"${attribute}\", [${value.map{it -> parseValues(it!!)}.joinToString(",")}])"
34+
else -> "${method}(\"${attribute}\", [${Query.parseValues(value)}])"
3535
}
3636
}
3737
private fun parseValues(value: Any): String {

templates/php/src/Query.php.twig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,13 @@ class Query
152152
* Add Query
153153
*
154154
* @param string $attribute
155-
* @param string $operator
155+
* @param string $method
156156
* @param mixed $value
157157
* @return string
158158
*/
159-
private static function addQuery(string $attribute, string $oper, $value)
159+
private static function addQuery(string $attribute, string $method, $value)
160160
{
161-
return is_array($value) ? $oper . '("' . $attribute . '", [' . implode(",", array_map(function ($item) {return self::parseValues($item);}, $value)) . '])' : $oper . '("' . $attribute . '", [' . self::parseValues($value) . '])';
161+
return is_array($value) ? $method . '("' . $attribute . '", [' . implode(",", array_map(function ($item) {return self::parseValues($item);}, $value)) . '])' : $method . '("' . $attribute . '", [' . self::parseValues($value) . '])';
162162
}
163163
164164
/**

templates/python/package/query.py.twig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ class Query:
5252
return 'offset({})'.format(offset)
5353

5454
@staticmethod
55-
def addQuery(attribute, oper, value):
55+
def addQuery(attribute, method, value):
5656
if type(value) == list:
57-
return '{}("{}", [{}])'.format(oper, attribute, ','.join(map(Query.parseValues, value)))
57+
return '{}("{}", [{}])'.format(method, attribute, ','.join(map(Query.parseValues, value)))
5858
else:
59-
return '{}("{}", [{}])'.format(oper, attribute, Query.parseValues(value))
59+
return '{}("{}", [{}])'.format(method, attribute, Query.parseValues(value))
6060

6161
@staticmethod
6262
def parseValues(value):

templates/ruby/lib/container/query.rb.twig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ module {{spec.title | caseUcfirst}}
5050

5151
private
5252

53-
def addQuery(attribute, oper, value)
53+
def addQuery(attribute, method, value)
5454
if value.is_a?(Array)
55-
"#{oper}(\"#{attribute}\", [#{value.map {|item| parseValues(item)}.join(',')}])"
55+
"#{method}(\"#{attribute}\", [#{value.map {|item| parseValues(item)}.join(',')}])"
5656
else
57-
return "#{oper}(\"#{attribute}\", [#{parseValues(value)}])"
57+
return "#{method}(\"#{attribute}\", [#{parseValues(value)}])"
5858
end
5959
end
6060

templates/swift/Sources/Query.swift.twig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ public class Query {
2828
buildQueryWhere(attribute, is: "search", to: value)
2929
}
3030

31-
public static func buildQueryWhere(_ attribute: String, is oper: String, to value: Any) -> String {
31+
public static func buildQueryWhere(_ attribute: String, is method: String, to value: Any) -> String {
3232
switch value {
3333
case let value as Array<Any>:
34-
return "\(oper)(\"\(attribute)\", [\(value.map { parseValues($0) }.joined(separator: ",") )])"
34+
return "\(method)(\"\(attribute)\", [\(value.map { parseValues($0) }.joined(separator: ",") )])"
3535
default:
36-
return "\(oper)(\"\(attribute)\", [\(parseValues(value))])"
36+
return "\(method)(\"\(attribute)\", [\(parseValues(value))])"
3737
}
3838
}
3939

0 commit comments

Comments
 (0)