appwrite 20.0.0 → 21.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/appwrite/client.rb +1 -2
- data/lib/appwrite/enums/browser_permission.rb +26 -0
- data/lib/appwrite/enums/deployment_status.rb +1 -0
- data/lib/appwrite/enums/name.rb +1 -0
- data/lib/appwrite/enums/o_auth_provider.rb +0 -1
- data/lib/appwrite/enums/order_by.rb +8 -0
- data/lib/appwrite/enums/roles.rb +9 -0
- data/lib/appwrite/enums/scopes.rb +61 -0
- data/lib/appwrite/models/attribute_longtext.rb +86 -0
- data/lib/appwrite/models/attribute_mediumtext.rb +86 -0
- data/lib/appwrite/models/attribute_text.rb +86 -0
- data/lib/appwrite/models/attribute_varchar.rb +91 -0
- data/lib/appwrite/models/bucket.rb +8 -3
- data/lib/appwrite/models/column_longtext.rb +86 -0
- data/lib/appwrite/models/column_mediumtext.rb +86 -0
- data/lib/appwrite/models/column_text.rb +86 -0
- data/lib/appwrite/models/column_varchar.rb +91 -0
- data/lib/appwrite/models/deployment.rb +1 -0
- data/lib/appwrite/models/file.rb +13 -3
- data/lib/appwrite/models/health_status_list.rb +32 -0
- data/lib/appwrite/query.rb +34 -0
- data/lib/appwrite/services/account.rb +3 -1
- data/lib/appwrite/services/avatars.rb +1 -1
- data/lib/appwrite/services/databases.rb +453 -16
- data/lib/appwrite/services/health.rb +31 -6
- data/lib/appwrite/services/storage.rb +6 -6
- data/lib/appwrite/services/tables_db.rb +458 -11
- data/lib/appwrite.rb +14 -2
- metadata +17 -5
- data/lib/appwrite/enums/output.rb +0 -13
|
@@ -291,7 +291,7 @@ module Appwrite
|
|
|
291
291
|
# @param [] enabled Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.
|
|
292
292
|
#
|
|
293
293
|
# @return [Database]
|
|
294
|
-
def update(database_id:, name
|
|
294
|
+
def update(database_id:, name: nil, enabled: nil)
|
|
295
295
|
api_path = '/databases/{databaseId}'
|
|
296
296
|
.gsub('{databaseId}', database_id)
|
|
297
297
|
|
|
@@ -299,10 +299,6 @@ module Appwrite
|
|
|
299
299
|
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
|
300
300
|
end
|
|
301
301
|
|
|
302
|
-
if name.nil?
|
|
303
|
-
raise Appwrite::Exception.new('Missing required parameter: "name"')
|
|
304
|
-
end
|
|
305
|
-
|
|
306
302
|
api_params = {
|
|
307
303
|
name: name,
|
|
308
304
|
enabled: enabled,
|
|
@@ -405,9 +401,11 @@ module Appwrite
|
|
|
405
401
|
# @param [Array] permissions An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
406
402
|
# @param [] document_security Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
407
403
|
# @param [] enabled Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled.
|
|
404
|
+
# @param [Array] attributes Array of attribute definitions to create. Each attribute should contain: key (string), type (string: string, integer, float, boolean, datetime), size (integer, required for string type), required (boolean, optional), default (mixed, optional), array (boolean, optional), and type-specific options.
|
|
405
|
+
# @param [Array] indexes Array of index definitions to create. Each index should contain: key (string), type (string: key, fulltext, unique, spatial), attributes (array of attribute keys), orders (array of ASC/DESC, optional), and lengths (array of integers, optional).
|
|
408
406
|
#
|
|
409
407
|
# @return [Collection]
|
|
410
|
-
def create_collection(database_id:, collection_id:, name:, permissions: nil, document_security: nil, enabled: nil)
|
|
408
|
+
def create_collection(database_id:, collection_id:, name:, permissions: nil, document_security: nil, enabled: nil, attributes: nil, indexes: nil)
|
|
411
409
|
api_path = '/databases/{databaseId}/collections'
|
|
412
410
|
.gsub('{databaseId}', database_id)
|
|
413
411
|
|
|
@@ -429,6 +427,8 @@ module Appwrite
|
|
|
429
427
|
permissions: permissions,
|
|
430
428
|
documentSecurity: document_security,
|
|
431
429
|
enabled: enabled,
|
|
430
|
+
attributes: attributes,
|
|
431
|
+
indexes: indexes,
|
|
432
432
|
}
|
|
433
433
|
|
|
434
434
|
api_headers = {
|
|
@@ -495,7 +495,7 @@ module Appwrite
|
|
|
495
495
|
# @param [] enabled Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled.
|
|
496
496
|
#
|
|
497
497
|
# @return [Collection]
|
|
498
|
-
def update_collection(database_id:, collection_id:, name
|
|
498
|
+
def update_collection(database_id:, collection_id:, name: nil, permissions: nil, document_security: nil, enabled: nil)
|
|
499
499
|
api_path = '/databases/{databaseId}/collections/{collectionId}'
|
|
500
500
|
.gsub('{databaseId}', database_id)
|
|
501
501
|
.gsub('{collectionId}', collection_id)
|
|
@@ -508,10 +508,6 @@ module Appwrite
|
|
|
508
508
|
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
|
509
509
|
end
|
|
510
510
|
|
|
511
|
-
if name.nil?
|
|
512
|
-
raise Appwrite::Exception.new('Missing required parameter: "name"')
|
|
513
|
-
end
|
|
514
|
-
|
|
515
511
|
api_params = {
|
|
516
512
|
name: name,
|
|
517
513
|
permissions: permissions,
|
|
@@ -1551,6 +1547,224 @@ module Appwrite
|
|
|
1551
1547
|
)
|
|
1552
1548
|
end
|
|
1553
1549
|
|
|
1550
|
+
# Create a longtext attribute.
|
|
1551
|
+
#
|
|
1552
|
+
#
|
|
1553
|
+
# @param [String] database_id Database ID.
|
|
1554
|
+
# @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
|
1555
|
+
# @param [String] key Attribute Key.
|
|
1556
|
+
# @param [] required Is attribute required?
|
|
1557
|
+
# @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
|
1558
|
+
# @param [] array Is attribute an array?
|
|
1559
|
+
#
|
|
1560
|
+
# @return [AttributeLongtext]
|
|
1561
|
+
def create_longtext_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil)
|
|
1562
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/longtext'
|
|
1563
|
+
.gsub('{databaseId}', database_id)
|
|
1564
|
+
.gsub('{collectionId}', collection_id)
|
|
1565
|
+
|
|
1566
|
+
if database_id.nil?
|
|
1567
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
|
1568
|
+
end
|
|
1569
|
+
|
|
1570
|
+
if collection_id.nil?
|
|
1571
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
|
1572
|
+
end
|
|
1573
|
+
|
|
1574
|
+
if key.nil?
|
|
1575
|
+
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
|
1576
|
+
end
|
|
1577
|
+
|
|
1578
|
+
if required.nil?
|
|
1579
|
+
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
|
1580
|
+
end
|
|
1581
|
+
|
|
1582
|
+
api_params = {
|
|
1583
|
+
key: key,
|
|
1584
|
+
required: required,
|
|
1585
|
+
default: default,
|
|
1586
|
+
array: array,
|
|
1587
|
+
}
|
|
1588
|
+
|
|
1589
|
+
api_headers = {
|
|
1590
|
+
"content-type": 'application/json',
|
|
1591
|
+
}
|
|
1592
|
+
|
|
1593
|
+
@client.call(
|
|
1594
|
+
method: 'POST',
|
|
1595
|
+
path: api_path,
|
|
1596
|
+
headers: api_headers,
|
|
1597
|
+
params: api_params,
|
|
1598
|
+
response_type: Models::AttributeLongtext
|
|
1599
|
+
)
|
|
1600
|
+
end
|
|
1601
|
+
|
|
1602
|
+
# Update a longtext attribute. Changing the `default` value will not update
|
|
1603
|
+
# already existing documents.
|
|
1604
|
+
#
|
|
1605
|
+
#
|
|
1606
|
+
# @param [String] database_id Database ID.
|
|
1607
|
+
# @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
|
1608
|
+
# @param [String] key Attribute Key.
|
|
1609
|
+
# @param [] required Is attribute required?
|
|
1610
|
+
# @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
|
1611
|
+
# @param [String] new_key New Attribute Key.
|
|
1612
|
+
#
|
|
1613
|
+
# @return [AttributeLongtext]
|
|
1614
|
+
def update_longtext_attribute(database_id:, collection_id:, key:, required:, default:, new_key: nil)
|
|
1615
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/longtext/{key}'
|
|
1616
|
+
.gsub('{databaseId}', database_id)
|
|
1617
|
+
.gsub('{collectionId}', collection_id)
|
|
1618
|
+
.gsub('{key}', key)
|
|
1619
|
+
|
|
1620
|
+
if database_id.nil?
|
|
1621
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
|
1622
|
+
end
|
|
1623
|
+
|
|
1624
|
+
if collection_id.nil?
|
|
1625
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
|
1626
|
+
end
|
|
1627
|
+
|
|
1628
|
+
if key.nil?
|
|
1629
|
+
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
|
1630
|
+
end
|
|
1631
|
+
|
|
1632
|
+
if required.nil?
|
|
1633
|
+
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
|
1634
|
+
end
|
|
1635
|
+
|
|
1636
|
+
if default.nil?
|
|
1637
|
+
raise Appwrite::Exception.new('Missing required parameter: "default"')
|
|
1638
|
+
end
|
|
1639
|
+
|
|
1640
|
+
api_params = {
|
|
1641
|
+
required: required,
|
|
1642
|
+
default: default,
|
|
1643
|
+
newKey: new_key,
|
|
1644
|
+
}
|
|
1645
|
+
|
|
1646
|
+
api_headers = {
|
|
1647
|
+
"content-type": 'application/json',
|
|
1648
|
+
}
|
|
1649
|
+
|
|
1650
|
+
@client.call(
|
|
1651
|
+
method: 'PATCH',
|
|
1652
|
+
path: api_path,
|
|
1653
|
+
headers: api_headers,
|
|
1654
|
+
params: api_params,
|
|
1655
|
+
response_type: Models::AttributeLongtext
|
|
1656
|
+
)
|
|
1657
|
+
end
|
|
1658
|
+
|
|
1659
|
+
# Create a mediumtext attribute.
|
|
1660
|
+
#
|
|
1661
|
+
#
|
|
1662
|
+
# @param [String] database_id Database ID.
|
|
1663
|
+
# @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
|
1664
|
+
# @param [String] key Attribute Key.
|
|
1665
|
+
# @param [] required Is attribute required?
|
|
1666
|
+
# @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
|
1667
|
+
# @param [] array Is attribute an array?
|
|
1668
|
+
#
|
|
1669
|
+
# @return [AttributeMediumtext]
|
|
1670
|
+
def create_mediumtext_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil)
|
|
1671
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/mediumtext'
|
|
1672
|
+
.gsub('{databaseId}', database_id)
|
|
1673
|
+
.gsub('{collectionId}', collection_id)
|
|
1674
|
+
|
|
1675
|
+
if database_id.nil?
|
|
1676
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
|
1677
|
+
end
|
|
1678
|
+
|
|
1679
|
+
if collection_id.nil?
|
|
1680
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
|
1681
|
+
end
|
|
1682
|
+
|
|
1683
|
+
if key.nil?
|
|
1684
|
+
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
|
1685
|
+
end
|
|
1686
|
+
|
|
1687
|
+
if required.nil?
|
|
1688
|
+
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
|
1689
|
+
end
|
|
1690
|
+
|
|
1691
|
+
api_params = {
|
|
1692
|
+
key: key,
|
|
1693
|
+
required: required,
|
|
1694
|
+
default: default,
|
|
1695
|
+
array: array,
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1698
|
+
api_headers = {
|
|
1699
|
+
"content-type": 'application/json',
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1702
|
+
@client.call(
|
|
1703
|
+
method: 'POST',
|
|
1704
|
+
path: api_path,
|
|
1705
|
+
headers: api_headers,
|
|
1706
|
+
params: api_params,
|
|
1707
|
+
response_type: Models::AttributeMediumtext
|
|
1708
|
+
)
|
|
1709
|
+
end
|
|
1710
|
+
|
|
1711
|
+
# Update a mediumtext attribute. Changing the `default` value will not update
|
|
1712
|
+
# already existing documents.
|
|
1713
|
+
#
|
|
1714
|
+
#
|
|
1715
|
+
# @param [String] database_id Database ID.
|
|
1716
|
+
# @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
|
1717
|
+
# @param [String] key Attribute Key.
|
|
1718
|
+
# @param [] required Is attribute required?
|
|
1719
|
+
# @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
|
1720
|
+
# @param [String] new_key New Attribute Key.
|
|
1721
|
+
#
|
|
1722
|
+
# @return [AttributeMediumtext]
|
|
1723
|
+
def update_mediumtext_attribute(database_id:, collection_id:, key:, required:, default:, new_key: nil)
|
|
1724
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/mediumtext/{key}'
|
|
1725
|
+
.gsub('{databaseId}', database_id)
|
|
1726
|
+
.gsub('{collectionId}', collection_id)
|
|
1727
|
+
.gsub('{key}', key)
|
|
1728
|
+
|
|
1729
|
+
if database_id.nil?
|
|
1730
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
|
1731
|
+
end
|
|
1732
|
+
|
|
1733
|
+
if collection_id.nil?
|
|
1734
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
|
1735
|
+
end
|
|
1736
|
+
|
|
1737
|
+
if key.nil?
|
|
1738
|
+
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
|
1739
|
+
end
|
|
1740
|
+
|
|
1741
|
+
if required.nil?
|
|
1742
|
+
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
|
1743
|
+
end
|
|
1744
|
+
|
|
1745
|
+
if default.nil?
|
|
1746
|
+
raise Appwrite::Exception.new('Missing required parameter: "default"')
|
|
1747
|
+
end
|
|
1748
|
+
|
|
1749
|
+
api_params = {
|
|
1750
|
+
required: required,
|
|
1751
|
+
default: default,
|
|
1752
|
+
newKey: new_key,
|
|
1753
|
+
}
|
|
1754
|
+
|
|
1755
|
+
api_headers = {
|
|
1756
|
+
"content-type": 'application/json',
|
|
1757
|
+
}
|
|
1758
|
+
|
|
1759
|
+
@client.call(
|
|
1760
|
+
method: 'PATCH',
|
|
1761
|
+
path: api_path,
|
|
1762
|
+
headers: api_headers,
|
|
1763
|
+
params: api_params,
|
|
1764
|
+
response_type: Models::AttributeMediumtext
|
|
1765
|
+
)
|
|
1766
|
+
end
|
|
1767
|
+
|
|
1554
1768
|
#
|
|
1555
1769
|
# @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createPointColumn` instead.
|
|
1556
1770
|
#
|
|
@@ -1950,6 +2164,115 @@ module Appwrite
|
|
|
1950
2164
|
)
|
|
1951
2165
|
end
|
|
1952
2166
|
|
|
2167
|
+
# Create a text attribute.
|
|
2168
|
+
#
|
|
2169
|
+
#
|
|
2170
|
+
# @param [String] database_id Database ID.
|
|
2171
|
+
# @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
|
2172
|
+
# @param [String] key Attribute Key.
|
|
2173
|
+
# @param [] required Is attribute required?
|
|
2174
|
+
# @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
|
2175
|
+
# @param [] array Is attribute an array?
|
|
2176
|
+
#
|
|
2177
|
+
# @return [AttributeText]
|
|
2178
|
+
def create_text_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil)
|
|
2179
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/text'
|
|
2180
|
+
.gsub('{databaseId}', database_id)
|
|
2181
|
+
.gsub('{collectionId}', collection_id)
|
|
2182
|
+
|
|
2183
|
+
if database_id.nil?
|
|
2184
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
|
2185
|
+
end
|
|
2186
|
+
|
|
2187
|
+
if collection_id.nil?
|
|
2188
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
|
2189
|
+
end
|
|
2190
|
+
|
|
2191
|
+
if key.nil?
|
|
2192
|
+
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
|
2193
|
+
end
|
|
2194
|
+
|
|
2195
|
+
if required.nil?
|
|
2196
|
+
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
|
2197
|
+
end
|
|
2198
|
+
|
|
2199
|
+
api_params = {
|
|
2200
|
+
key: key,
|
|
2201
|
+
required: required,
|
|
2202
|
+
default: default,
|
|
2203
|
+
array: array,
|
|
2204
|
+
}
|
|
2205
|
+
|
|
2206
|
+
api_headers = {
|
|
2207
|
+
"content-type": 'application/json',
|
|
2208
|
+
}
|
|
2209
|
+
|
|
2210
|
+
@client.call(
|
|
2211
|
+
method: 'POST',
|
|
2212
|
+
path: api_path,
|
|
2213
|
+
headers: api_headers,
|
|
2214
|
+
params: api_params,
|
|
2215
|
+
response_type: Models::AttributeText
|
|
2216
|
+
)
|
|
2217
|
+
end
|
|
2218
|
+
|
|
2219
|
+
# Update a text attribute. Changing the `default` value will not update
|
|
2220
|
+
# already existing documents.
|
|
2221
|
+
#
|
|
2222
|
+
#
|
|
2223
|
+
# @param [String] database_id Database ID.
|
|
2224
|
+
# @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
|
2225
|
+
# @param [String] key Attribute Key.
|
|
2226
|
+
# @param [] required Is attribute required?
|
|
2227
|
+
# @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
|
2228
|
+
# @param [String] new_key New Attribute Key.
|
|
2229
|
+
#
|
|
2230
|
+
# @return [AttributeText]
|
|
2231
|
+
def update_text_attribute(database_id:, collection_id:, key:, required:, default:, new_key: nil)
|
|
2232
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/text/{key}'
|
|
2233
|
+
.gsub('{databaseId}', database_id)
|
|
2234
|
+
.gsub('{collectionId}', collection_id)
|
|
2235
|
+
.gsub('{key}', key)
|
|
2236
|
+
|
|
2237
|
+
if database_id.nil?
|
|
2238
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
|
2239
|
+
end
|
|
2240
|
+
|
|
2241
|
+
if collection_id.nil?
|
|
2242
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
|
2243
|
+
end
|
|
2244
|
+
|
|
2245
|
+
if key.nil?
|
|
2246
|
+
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
|
2247
|
+
end
|
|
2248
|
+
|
|
2249
|
+
if required.nil?
|
|
2250
|
+
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
|
2251
|
+
end
|
|
2252
|
+
|
|
2253
|
+
if default.nil?
|
|
2254
|
+
raise Appwrite::Exception.new('Missing required parameter: "default"')
|
|
2255
|
+
end
|
|
2256
|
+
|
|
2257
|
+
api_params = {
|
|
2258
|
+
required: required,
|
|
2259
|
+
default: default,
|
|
2260
|
+
newKey: new_key,
|
|
2261
|
+
}
|
|
2262
|
+
|
|
2263
|
+
api_headers = {
|
|
2264
|
+
"content-type": 'application/json',
|
|
2265
|
+
}
|
|
2266
|
+
|
|
2267
|
+
@client.call(
|
|
2268
|
+
method: 'PATCH',
|
|
2269
|
+
path: api_path,
|
|
2270
|
+
headers: api_headers,
|
|
2271
|
+
params: api_params,
|
|
2272
|
+
response_type: Models::AttributeText
|
|
2273
|
+
)
|
|
2274
|
+
end
|
|
2275
|
+
|
|
1953
2276
|
#
|
|
1954
2277
|
# @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createUrlColumn` instead.
|
|
1955
2278
|
#
|
|
@@ -2065,6 +2388,123 @@ module Appwrite
|
|
|
2065
2388
|
)
|
|
2066
2389
|
end
|
|
2067
2390
|
|
|
2391
|
+
# Create a varchar attribute.
|
|
2392
|
+
#
|
|
2393
|
+
#
|
|
2394
|
+
# @param [String] database_id Database ID.
|
|
2395
|
+
# @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
|
2396
|
+
# @param [String] key Attribute Key.
|
|
2397
|
+
# @param [Integer] size Attribute size for varchar attributes, in number of characters. Maximum size is 16381.
|
|
2398
|
+
# @param [] required Is attribute required?
|
|
2399
|
+
# @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
|
2400
|
+
# @param [] array Is attribute an array?
|
|
2401
|
+
#
|
|
2402
|
+
# @return [AttributeVarchar]
|
|
2403
|
+
def create_varchar_attribute(database_id:, collection_id:, key:, size:, required:, default: nil, array: nil)
|
|
2404
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/varchar'
|
|
2405
|
+
.gsub('{databaseId}', database_id)
|
|
2406
|
+
.gsub('{collectionId}', collection_id)
|
|
2407
|
+
|
|
2408
|
+
if database_id.nil?
|
|
2409
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
|
2410
|
+
end
|
|
2411
|
+
|
|
2412
|
+
if collection_id.nil?
|
|
2413
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
|
2414
|
+
end
|
|
2415
|
+
|
|
2416
|
+
if key.nil?
|
|
2417
|
+
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
|
2418
|
+
end
|
|
2419
|
+
|
|
2420
|
+
if size.nil?
|
|
2421
|
+
raise Appwrite::Exception.new('Missing required parameter: "size"')
|
|
2422
|
+
end
|
|
2423
|
+
|
|
2424
|
+
if required.nil?
|
|
2425
|
+
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
|
2426
|
+
end
|
|
2427
|
+
|
|
2428
|
+
api_params = {
|
|
2429
|
+
key: key,
|
|
2430
|
+
size: size,
|
|
2431
|
+
required: required,
|
|
2432
|
+
default: default,
|
|
2433
|
+
array: array,
|
|
2434
|
+
}
|
|
2435
|
+
|
|
2436
|
+
api_headers = {
|
|
2437
|
+
"content-type": 'application/json',
|
|
2438
|
+
}
|
|
2439
|
+
|
|
2440
|
+
@client.call(
|
|
2441
|
+
method: 'POST',
|
|
2442
|
+
path: api_path,
|
|
2443
|
+
headers: api_headers,
|
|
2444
|
+
params: api_params,
|
|
2445
|
+
response_type: Models::AttributeVarchar
|
|
2446
|
+
)
|
|
2447
|
+
end
|
|
2448
|
+
|
|
2449
|
+
# Update a varchar attribute. Changing the `default` value will not update
|
|
2450
|
+
# already existing documents.
|
|
2451
|
+
#
|
|
2452
|
+
#
|
|
2453
|
+
# @param [String] database_id Database ID.
|
|
2454
|
+
# @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
|
2455
|
+
# @param [String] key Attribute Key.
|
|
2456
|
+
# @param [] required Is attribute required?
|
|
2457
|
+
# @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
|
2458
|
+
# @param [Integer] size Maximum size of the varchar attribute.
|
|
2459
|
+
# @param [String] new_key New Attribute Key.
|
|
2460
|
+
#
|
|
2461
|
+
# @return [AttributeVarchar]
|
|
2462
|
+
def update_varchar_attribute(database_id:, collection_id:, key:, required:, default:, size: nil, new_key: nil)
|
|
2463
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/varchar/{key}'
|
|
2464
|
+
.gsub('{databaseId}', database_id)
|
|
2465
|
+
.gsub('{collectionId}', collection_id)
|
|
2466
|
+
.gsub('{key}', key)
|
|
2467
|
+
|
|
2468
|
+
if database_id.nil?
|
|
2469
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
|
2470
|
+
end
|
|
2471
|
+
|
|
2472
|
+
if collection_id.nil?
|
|
2473
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
|
2474
|
+
end
|
|
2475
|
+
|
|
2476
|
+
if key.nil?
|
|
2477
|
+
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
|
2478
|
+
end
|
|
2479
|
+
|
|
2480
|
+
if required.nil?
|
|
2481
|
+
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
|
2482
|
+
end
|
|
2483
|
+
|
|
2484
|
+
if default.nil?
|
|
2485
|
+
raise Appwrite::Exception.new('Missing required parameter: "default"')
|
|
2486
|
+
end
|
|
2487
|
+
|
|
2488
|
+
api_params = {
|
|
2489
|
+
required: required,
|
|
2490
|
+
default: default,
|
|
2491
|
+
size: size,
|
|
2492
|
+
newKey: new_key,
|
|
2493
|
+
}
|
|
2494
|
+
|
|
2495
|
+
api_headers = {
|
|
2496
|
+
"content-type": 'application/json',
|
|
2497
|
+
}
|
|
2498
|
+
|
|
2499
|
+
@client.call(
|
|
2500
|
+
method: 'PATCH',
|
|
2501
|
+
path: api_path,
|
|
2502
|
+
headers: api_headers,
|
|
2503
|
+
params: api_params,
|
|
2504
|
+
response_type: Models::AttributeVarchar
|
|
2505
|
+
)
|
|
2506
|
+
end
|
|
2507
|
+
|
|
2068
2508
|
#
|
|
2069
2509
|
# @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.getColumn` instead.
|
|
2070
2510
|
#
|
|
@@ -2104,6 +2544,7 @@ module Appwrite
|
|
|
2104
2544
|
path: api_path,
|
|
2105
2545
|
headers: api_headers,
|
|
2106
2546
|
params: api_params,
|
|
2547
|
+
response_type: Models::AttributeBoolean
|
|
2107
2548
|
)
|
|
2108
2549
|
end
|
|
2109
2550
|
|
|
@@ -2553,7 +2994,7 @@ module Appwrite
|
|
|
2553
2994
|
# @param [String] transaction_id Transaction ID for staging the operation.
|
|
2554
2995
|
#
|
|
2555
2996
|
# @return [Document]
|
|
2556
|
-
def upsert_document(database_id:, collection_id:, document_id:, data
|
|
2997
|
+
def upsert_document(database_id:, collection_id:, document_id:, data: nil, permissions: nil, transaction_id: nil)
|
|
2557
2998
|
api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'
|
|
2558
2999
|
.gsub('{databaseId}', database_id)
|
|
2559
3000
|
.gsub('{collectionId}', collection_id)
|
|
@@ -2571,10 +3012,6 @@ module Appwrite
|
|
|
2571
3012
|
raise Appwrite::Exception.new('Missing required parameter: "documentId"')
|
|
2572
3013
|
end
|
|
2573
3014
|
|
|
2574
|
-
if data.nil?
|
|
2575
|
-
raise Appwrite::Exception.new('Missing required parameter: "data"')
|
|
2576
|
-
end
|
|
2577
|
-
|
|
2578
3015
|
api_params = {
|
|
2579
3016
|
data: data,
|
|
2580
3017
|
permissions: permissions,
|
|
@@ -55,7 +55,7 @@ module Appwrite
|
|
|
55
55
|
# successful.
|
|
56
56
|
#
|
|
57
57
|
#
|
|
58
|
-
# @return [
|
|
58
|
+
# @return [HealthStatusList]
|
|
59
59
|
def get_cache()
|
|
60
60
|
api_path = '/health/cache'
|
|
61
61
|
|
|
@@ -70,7 +70,7 @@ module Appwrite
|
|
|
70
70
|
path: api_path,
|
|
71
71
|
headers: api_headers,
|
|
72
72
|
params: api_params,
|
|
73
|
-
response_type: Models::
|
|
73
|
+
response_type: Models::HealthStatusList
|
|
74
74
|
)
|
|
75
75
|
end
|
|
76
76
|
|
|
@@ -101,7 +101,7 @@ module Appwrite
|
|
|
101
101
|
# Check the Appwrite database servers are up and connection is successful.
|
|
102
102
|
#
|
|
103
103
|
#
|
|
104
|
-
# @return [
|
|
104
|
+
# @return [HealthStatusList]
|
|
105
105
|
def get_db()
|
|
106
106
|
api_path = '/health/db'
|
|
107
107
|
|
|
@@ -116,14 +116,14 @@ module Appwrite
|
|
|
116
116
|
path: api_path,
|
|
117
117
|
headers: api_headers,
|
|
118
118
|
params: api_params,
|
|
119
|
-
response_type: Models::
|
|
119
|
+
response_type: Models::HealthStatusList
|
|
120
120
|
)
|
|
121
121
|
end
|
|
122
122
|
|
|
123
123
|
# Check the Appwrite pub-sub servers are up and connection is successful.
|
|
124
124
|
#
|
|
125
125
|
#
|
|
126
|
-
# @return [
|
|
126
|
+
# @return [HealthStatusList]
|
|
127
127
|
def get_pub_sub()
|
|
128
128
|
api_path = '/health/pubsub'
|
|
129
129
|
|
|
@@ -138,7 +138,32 @@ module Appwrite
|
|
|
138
138
|
path: api_path,
|
|
139
139
|
headers: api_headers,
|
|
140
140
|
params: api_params,
|
|
141
|
-
response_type: Models::
|
|
141
|
+
response_type: Models::HealthStatusList
|
|
142
|
+
)
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
# Get the number of audit logs that are waiting to be processed in the
|
|
146
|
+
# Appwrite internal queue server.
|
|
147
|
+
#
|
|
148
|
+
# @param [Integer] threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
|
|
149
|
+
#
|
|
150
|
+
# @return [HealthQueue]
|
|
151
|
+
def get_queue_audits(threshold: nil)
|
|
152
|
+
api_path = '/health/queue/audits'
|
|
153
|
+
|
|
154
|
+
api_params = {
|
|
155
|
+
threshold: threshold,
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
api_headers = {
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
@client.call(
|
|
162
|
+
method: 'GET',
|
|
163
|
+
path: api_path,
|
|
164
|
+
headers: api_headers,
|
|
165
|
+
params: api_params,
|
|
166
|
+
response_type: Models::HealthQueue
|
|
142
167
|
)
|
|
143
168
|
end
|
|
144
169
|
|
|
@@ -45,7 +45,7 @@ module Appwrite
|
|
|
45
45
|
# @param [] enabled Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled.
|
|
46
46
|
# @param [Integer] maximum_file_size Maximum file size allowed in bytes. Maximum allowed value is 30MB.
|
|
47
47
|
# @param [Array] allowed_file_extensions Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.
|
|
48
|
-
# @param [Compression] compression Compression algorithm
|
|
48
|
+
# @param [Compression] compression Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled
|
|
49
49
|
# @param [] encryption Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled
|
|
50
50
|
# @param [] antivirus Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled
|
|
51
51
|
# @param [] transformations Are image transformations enabled?
|
|
@@ -127,7 +127,7 @@ module Appwrite
|
|
|
127
127
|
# @param [] enabled Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled.
|
|
128
128
|
# @param [Integer] maximum_file_size Maximum file size allowed in bytes. Maximum allowed value is 30MB.
|
|
129
129
|
# @param [Array] allowed_file_extensions Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.
|
|
130
|
-
# @param [Compression] compression Compression algorithm
|
|
130
|
+
# @param [Compression] compression Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled
|
|
131
131
|
# @param [] encryption Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled
|
|
132
132
|
# @param [] antivirus Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled
|
|
133
133
|
# @param [] transformations Are image transformations enabled?
|
|
@@ -337,10 +337,10 @@ module Appwrite
|
|
|
337
337
|
# Update a file by its unique ID. Only users with write permissions have
|
|
338
338
|
# access to update this resource.
|
|
339
339
|
#
|
|
340
|
-
# @param [String] bucket_id
|
|
341
|
-
# @param [String] file_id File
|
|
342
|
-
# @param [String] name
|
|
343
|
-
# @param [Array] permissions An array of permission
|
|
340
|
+
# @param [String] bucket_id Bucket unique ID.
|
|
341
|
+
# @param [String] file_id File ID.
|
|
342
|
+
# @param [String] name File name.
|
|
343
|
+
# @param [Array] permissions An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
344
344
|
#
|
|
345
345
|
# @return [File]
|
|
346
346
|
def update_file(bucket_id:, file_id:, name: nil, permissions: nil)
|