Class: Appwrite::Databases
- Defined in:
- lib/appwrite/services/databases.rb
Instance Method Summary collapse
-
#create(database_id:, name:, enabled: nil) ⇒ Database
Create a new Database.
-
#create_boolean_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil) ⇒ AttributeBoolean
Create a boolean attribute.
-
#create_collection(database_id:, collection_id:, name:, permissions: nil, document_security: nil, enabled: nil) ⇒ Collection
Create a new Collection.
-
#create_datetime_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil) ⇒ AttributeDatetime
Create a date time attribute according to the ISO 8601 standard.
-
#create_document(database_id:, collection_id:, document_id:, data:, permissions: nil) ⇒ Document
Create a new Document.
-
#create_email_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil) ⇒ AttributeEmail
Create an email attribute.
-
#create_enum_attribute(database_id:, collection_id:, key:, elements:, required:, default: nil, array: nil) ⇒ AttributeEnum
Create an enumeration attribute.
-
#create_float_attribute(database_id:, collection_id:, key:, required:, min: nil, max: nil, default: nil, array: nil) ⇒ AttributeFloat
Create a float attribute.
-
#create_index(database_id:, collection_id:, key:, type:, attributes:, orders: nil) ⇒ Index
Creates an index on the attributes listed.
-
#create_integer_attribute(database_id:, collection_id:, key:, required:, min: nil, max: nil, default: nil, array: nil) ⇒ AttributeInteger
Create an integer attribute.
-
#create_ip_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil) ⇒ AttributeIp
Create IP address attribute.
-
#create_relationship_attribute(database_id:, collection_id:, related_collection_id:, type:, two_way: nil, key: nil, two_way_key: nil, on_delete: nil) ⇒ AttributeRelationship
Create relationship attribute.
-
#create_string_attribute(database_id:, collection_id:, key:, size:, required:, default: nil, array: nil, encrypt: nil) ⇒ AttributeString
Create a string attribute.
-
#create_url_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil) ⇒ AttributeUrl
Create a URL attribute.
-
#delete(database_id:) ⇒ Object
Delete a database by its unique ID.
-
#delete_attribute(database_id:, collection_id:, key:) ⇒ Object
Deletes an attribute.
-
#delete_collection(database_id:, collection_id:) ⇒ Object
Delete a collection by its unique ID.
-
#delete_document(database_id:, collection_id:, document_id:) ⇒ Object
Delete a document by its unique ID.
-
#delete_index(database_id:, collection_id:, key:) ⇒ Object
Delete an index.
-
#get(database_id:) ⇒ Database
Get a database by its unique ID.
-
#get_attribute(database_id:, collection_id:, key:) ⇒ Object
Get attribute by ID.
-
#get_collection(database_id:, collection_id:) ⇒ Collection
Get a collection by its unique ID.
-
#get_document(database_id:, collection_id:, document_id:, queries: nil) ⇒ Document
Get a document by its unique ID.
-
#get_index(database_id:, collection_id:, key:) ⇒ Index
Get index by ID.
-
#initialize(client) ⇒ Databases
constructor
A new instance of Databases.
-
#list(queries: nil, search: nil) ⇒ DatabaseList
Get a list of all databases from the current Appwrite project.
-
#list_attributes(database_id:, collection_id:, queries: nil) ⇒ AttributeList
List attributes in the collection.
-
#list_collections(database_id:, queries: nil, search: nil) ⇒ CollectionList
Get a list of all collections that belong to the provided databaseId.
-
#list_documents(database_id:, collection_id:, queries: nil) ⇒ DocumentList
Get a list of all the user’s documents in a given collection.
-
#list_indexes(database_id:, collection_id:, queries: nil) ⇒ IndexList
List indexes in the collection.
-
#update(database_id:, name:, enabled: nil) ⇒ Database
Update a database by its unique ID.
-
#update_boolean_attribute(database_id:, collection_id:, key:, required:, default:, new_key: nil) ⇒ AttributeBoolean
Update a boolean attribute.
-
#update_collection(database_id:, collection_id:, name:, permissions: nil, document_security: nil, enabled: nil) ⇒ Collection
Update a collection by its unique ID.
-
#update_datetime_attribute(database_id:, collection_id:, key:, required:, default:, new_key: nil) ⇒ AttributeDatetime
Update a date time attribute.
-
#update_document(database_id:, collection_id:, document_id:, data: nil, permissions: nil) ⇒ Document
Update a document by its unique ID.
-
#update_email_attribute(database_id:, collection_id:, key:, required:, default:, new_key: nil) ⇒ AttributeEmail
Update an email attribute.
-
#update_enum_attribute(database_id:, collection_id:, key:, elements:, required:, default:, new_key: nil) ⇒ AttributeEnum
Update an enum attribute.
-
#update_float_attribute(database_id:, collection_id:, key:, required:, min:, max:, default:, new_key: nil) ⇒ AttributeFloat
Update a float attribute.
-
#update_integer_attribute(database_id:, collection_id:, key:, required:, min:, max:, default:, new_key: nil) ⇒ AttributeInteger
Update an integer attribute.
-
#update_ip_attribute(database_id:, collection_id:, key:, required:, default:, new_key: nil) ⇒ AttributeIp
Update an ip attribute.
-
#update_relationship_attribute(database_id:, collection_id:, key:, on_delete: nil, new_key: nil) ⇒ AttributeRelationship
Update relationship attribute.
-
#update_string_attribute(database_id:, collection_id:, key:, required:, default:, size: nil, new_key: nil) ⇒ AttributeString
Update a string attribute.
-
#update_url_attribute(database_id:, collection_id:, key:, required:, default:, new_key: nil) ⇒ AttributeUrl
Update an url attribute.
Constructor Details
#initialize(client) ⇒ Databases
Returns a new instance of Databases.
6 7 8 |
# File 'lib/appwrite/services/databases.rb', line 6 def initialize(client) @client = client end |
Instance Method Details
#create(database_id:, name:, enabled: nil) ⇒ Database
Create a new Database.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/appwrite/services/databases.rb', line 47 def create(database_id:, name:, enabled: nil) api_path = '/databases' if database_id.nil? raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if name.nil? raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { databaseId: database_id, name: name, enabled: enabled, } api_headers = { "content-type": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::Database ) end |
#create_boolean_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil) ⇒ AttributeBoolean
Create a boolean attribute.
433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 |
# File 'lib/appwrite/services/databases.rb', line 433 def create_boolean_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { key: key, required: required, default: default, array: array, } api_headers = { "content-type": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::AttributeBoolean ) end |
#create_collection(database_id:, collection_id:, name:, permissions: nil, document_security: nil, enabled: nil) ⇒ Collection
Create a new Collection. Before using this route, you should create a new database resource using either a [server integration](appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console.
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 |
# File 'lib/appwrite/services/databases.rb', line 225 def create_collection(database_id:, collection_id:, name:, permissions: nil, document_security: nil, enabled: nil) api_path = '/databases/{databaseId}/collections' .gsub('{databaseId}', database_id) if database_id.nil? raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if name.nil? raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { collectionId: collection_id, name: name, permissions: , documentSecurity: document_security, enabled: enabled, } api_headers = { "content-type": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::Collection ) end |
#create_datetime_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil) ⇒ AttributeDatetime
Create a date time attribute according to the ISO 8601 standard.
542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 |
# File 'lib/appwrite/services/databases.rb', line 542 def create_datetime_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { key: key, required: required, default: default, array: array, } api_headers = { "content-type": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::AttributeDatetime ) end |
#create_document(database_id:, collection_id:, document_id:, data:, permissions: nil) ⇒ Document
Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console.
1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 |
# File 'lib/appwrite/services/databases.rb', line 1714 def create_document(database_id:, collection_id:, document_id:, data:, permissions: nil) api_path = '/databases/{databaseId}/collections/{collectionId}/documents' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if document_id.nil? raise Appwrite::Exception.new('Missing required parameter: "documentId"') end if data.nil? raise Appwrite::Exception.new('Missing required parameter: "data"') end api_params = { documentId: document_id, data: data, permissions: , } api_headers = { "content-type": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::Document ) end |
#create_email_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil) ⇒ AttributeEmail
Create an email attribute.
652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 |
# File 'lib/appwrite/services/databases.rb', line 652 def create_email_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/email' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { key: key, required: required, default: default, array: array, } api_headers = { "content-type": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::AttributeEmail ) end |
#create_enum_attribute(database_id:, collection_id:, key:, elements:, required:, default: nil, array: nil) ⇒ AttributeEnum
Create an enumeration attribute. The ‘elements` param acts as a white-list of accepted values for this attribute.
765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 |
# File 'lib/appwrite/services/databases.rb', line 765 def create_enum_attribute(database_id:, collection_id:, key:, elements:, required:, default: nil, array: nil) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? raise Appwrite::Exception.new('Missing required parameter: "key"') end if elements.nil? raise Appwrite::Exception.new('Missing required parameter: "elements"') end if required.nil? raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { key: key, elements: elements, required: required, default: default, array: array, } api_headers = { "content-type": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::AttributeEnum ) end |
#create_float_attribute(database_id:, collection_id:, key:, required:, min: nil, max: nil, default: nil, array: nil) ⇒ AttributeFloat
Create a float attribute. Optionally, minimum and maximum values can be provided.
890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 |
# File 'lib/appwrite/services/databases.rb', line 890 def create_float_attribute(database_id:, collection_id:, key:, required:, min: nil, max: nil, default: nil, array: nil) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/float' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { key: key, required: required, min: min, max: max, default: default, array: array, } api_headers = { "content-type": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::AttributeFloat ) end |
#create_index(database_id:, collection_id:, key:, type:, attributes:, orders: nil) ⇒ Index
Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request. Attributes can be ‘key`, `fulltext`, and `unique`.
1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 |
# File 'lib/appwrite/services/databases.rb', line 1938 def create_index(database_id:, collection_id:, key:, type:, attributes:, orders: nil) api_path = '/databases/{databaseId}/collections/{collectionId}/indexes' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? raise Appwrite::Exception.new('Missing required parameter: "key"') end if type.nil? raise Appwrite::Exception.new('Missing required parameter: "type"') end if attributes.nil? raise Appwrite::Exception.new('Missing required parameter: "attributes"') end api_params = { key: key, type: type, attributes: attributes, orders: orders, } api_headers = { "content-type": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::Index ) end |
#create_integer_attribute(database_id:, collection_id:, key:, required:, min: nil, max: nil, default: nil, array: nil) ⇒ AttributeInteger
Create an integer attribute. Optionally, minimum and maximum values can be provided.
1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 |
# File 'lib/appwrite/services/databases.rb', line 1018 def create_integer_attribute(database_id:, collection_id:, key:, required:, min: nil, max: nil, default: nil, array: nil) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/integer' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { key: key, required: required, min: min, max: max, default: default, array: array, } api_headers = { "content-type": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::AttributeInteger ) end |
#create_ip_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil) ⇒ AttributeIp
Create IP address attribute.
1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 |
# File 'lib/appwrite/services/databases.rb', line 1143 def create_ip_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/ip' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { key: key, required: required, default: default, array: array, } api_headers = { "content-type": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::AttributeIp ) end |
#create_relationship_attribute(database_id:, collection_id:, related_collection_id:, type:, two_way: nil, key: nil, two_way_key: nil, on_delete: nil) ⇒ AttributeRelationship
Create relationship attribute. [Learn more about relationship attributes](appwrite.io/docs/databases-relationships#relationship-attributes).
1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 |
# File 'lib/appwrite/services/databases.rb', line 1257 def create_relationship_attribute(database_id:, collection_id:, related_collection_id:, type:, two_way: nil, key: nil, two_way_key: nil, on_delete: nil) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if .nil? raise Appwrite::Exception.new('Missing required parameter: "relatedCollectionId"') end if type.nil? raise Appwrite::Exception.new('Missing required parameter: "type"') end api_params = { relatedCollectionId: , type: type, twoWay: two_way, key: key, twoWayKey: two_way_key, onDelete: on_delete, } api_headers = { "content-type": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::AttributeRelationship ) end |
#create_string_attribute(database_id:, collection_id:, key:, size:, required:, default: nil, array: nil, encrypt: nil) ⇒ AttributeString
Create a string attribute.
1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 |
# File 'lib/appwrite/services/databases.rb', line 1314 def create_string_attribute(database_id:, collection_id:, key:, size:, required:, default: nil, array: nil, encrypt: nil) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/string' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? raise Appwrite::Exception.new('Missing required parameter: "key"') end if size.nil? raise Appwrite::Exception.new('Missing required parameter: "size"') end if required.nil? raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { key: key, size: size, required: required, default: default, array: array, encrypt: encrypt, } api_headers = { "content-type": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::AttributeString ) end |
#create_url_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil) ⇒ AttributeUrl
Create a URL attribute.
1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 |
# File 'lib/appwrite/services/databases.rb', line 1433 def create_url_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/url' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? raise Appwrite::Exception.new('Missing required parameter: "required"') end api_params = { key: key, required: required, default: default, array: array, } api_headers = { "content-type": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::AttributeUrl ) end |
#delete(database_id:) ⇒ Object
Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database.
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
# File 'lib/appwrite/services/databases.rb', line 153 def delete(database_id:) api_path = '/databases/{databaseId}' .gsub('{databaseId}', database_id) if database_id.nil? raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end api_params = { } api_headers = { "content-type": 'application/json', } @client.call( method: 'DELETE', path: api_path, headers: api_headers, params: api_params, ) end |
#delete_attribute(database_id:, collection_id:, key:) ⇒ Object
Deletes an attribute.
1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 |
# File 'lib/appwrite/services/databases.rb', line 1581 def delete_attribute(database_id:, collection_id:, key:) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? raise Appwrite::Exception.new('Missing required parameter: "key"') end api_params = { } api_headers = { "content-type": 'application/json', } @client.call( method: 'DELETE', path: api_path, headers: api_headers, params: api_params, ) end |
#delete_collection(database_id:, collection_id:) ⇒ Object
Delete a collection by its unique ID. Only users with write permissions have access to delete this resource.
355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 |
# File 'lib/appwrite/services/databases.rb', line 355 def delete_collection(database_id:, collection_id:) api_path = '/databases/{databaseId}/collections/{collectionId}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end api_params = { } api_headers = { "content-type": 'application/json', } @client.call( method: 'DELETE', path: api_path, headers: api_headers, params: api_params, ) end |
#delete_document(database_id:, collection_id:, document_id:) ⇒ Object
Delete a document by its unique ID.
1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 |
# File 'lib/appwrite/services/databases.rb', line 1854 def delete_document(database_id:, collection_id:, document_id:) api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{documentId}', document_id) if database_id.nil? raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if document_id.nil? raise Appwrite::Exception.new('Missing required parameter: "documentId"') end api_params = { } api_headers = { "content-type": 'application/json', } @client.call( method: 'DELETE', path: api_path, headers: api_headers, params: api_params, ) end |
#delete_index(database_id:, collection_id:, key:) ⇒ Object
Delete an index.
2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 |
# File 'lib/appwrite/services/databases.rb', line 2033 def delete_index(database_id:, collection_id:, key:) api_path = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? raise Appwrite::Exception.new('Missing required parameter: "key"') end api_params = { } api_headers = { "content-type": 'application/json', } @client.call( method: 'DELETE', path: api_path, headers: api_headers, params: api_params, ) end |
#get(database_id:) ⇒ Database
Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata.
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/appwrite/services/databases.rb', line 84 def get(database_id:) api_path = '/databases/{databaseId}' .gsub('{databaseId}', database_id) if database_id.nil? raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end api_params = { } api_headers = { "content-type": 'application/json', } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::Database ) end |
#get_attribute(database_id:, collection_id:, key:) ⇒ Object
Get attribute by ID.
1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 |
# File 'lib/appwrite/services/databases.rb', line 1540 def get_attribute(database_id:, collection_id:, key:) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? raise Appwrite::Exception.new('Missing required parameter: "key"') end api_params = { } api_headers = { "content-type": 'application/json', } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, ) end |
#get_collection(database_id:, collection_id:) ⇒ Collection
Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata.
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 |
# File 'lib/appwrite/services/databases.rb', line 270 def get_collection(database_id:, collection_id:) api_path = '/databases/{databaseId}/collections/{collectionId}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end api_params = { } api_headers = { "content-type": 'application/json', } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::Collection ) end |
#get_document(database_id:, collection_id:, document_id:, queries: nil) ⇒ Document
Get a document by its unique ID. This endpoint response returns a JSON object with the document data.
1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 |
# File 'lib/appwrite/services/databases.rb', line 1764 def get_document(database_id:, collection_id:, document_id:, queries: nil) api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{documentId}', document_id) if database_id.nil? raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if document_id.nil? raise Appwrite::Exception.new('Missing required parameter: "documentId"') end api_params = { queries: queries, } api_headers = { "content-type": 'application/json', } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::Document ) end |
#get_index(database_id:, collection_id:, key:) ⇒ Index
Get index by ID.
1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 |
# File 'lib/appwrite/services/databases.rb', line 1991 def get_index(database_id:, collection_id:, key:) api_path = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? raise Appwrite::Exception.new('Missing required parameter: "key"') end api_params = { } api_headers = { "content-type": 'application/json', } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::Index ) end |
#list(queries: nil, search: nil) ⇒ DatabaseList
Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/appwrite/services/databases.rb', line 17 def list(queries: nil, search: nil) api_path = '/databases' api_params = { queries: queries, search: search, } api_headers = { "content-type": 'application/json', } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::DatabaseList ) end |
#list_attributes(database_id:, collection_id:, queries: nil) ⇒ AttributeList
List attributes in the collection.
391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 |
# File 'lib/appwrite/services/databases.rb', line 391 def list_attributes(database_id:, collection_id:, queries: nil) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end api_params = { queries: queries, } api_headers = { "content-type": 'application/json', } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::AttributeList ) end |
#list_collections(database_id:, queries: nil, search: nil) ⇒ CollectionList
Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results.
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 |
# File 'lib/appwrite/services/databases.rb', line 185 def list_collections(database_id:, queries: nil, search: nil) api_path = '/databases/{databaseId}/collections' .gsub('{databaseId}', database_id) if database_id.nil? raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end api_params = { queries: queries, search: search, } api_headers = { "content-type": 'application/json', } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::CollectionList ) end |
#list_documents(database_id:, collection_id:, queries: nil) ⇒ DocumentList
Get a list of all the user’s documents in a given collection. You can use the query params to filter your results.
1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 |
# File 'lib/appwrite/services/databases.rb', line 1671 def list_documents(database_id:, collection_id:, queries: nil) api_path = '/databases/{databaseId}/collections/{collectionId}/documents' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end api_params = { queries: queries, } api_headers = { "content-type": 'application/json', } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::DocumentList ) end |
#list_indexes(database_id:, collection_id:, queries: nil) ⇒ IndexList
List indexes in the collection.
1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 |
# File 'lib/appwrite/services/databases.rb', line 1895 def list_indexes(database_id:, collection_id:, queries: nil) api_path = '/databases/{databaseId}/collections/{collectionId}/indexes' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end api_params = { queries: queries, } api_headers = { "content-type": 'application/json', } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::IndexList ) end |
#update(database_id:, name:, enabled: nil) ⇒ Database
Update a database by its unique ID.
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/appwrite/services/databases.rb', line 116 def update(database_id:, name:, enabled: nil) api_path = '/databases/{databaseId}' .gsub('{databaseId}', database_id) if database_id.nil? raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if name.nil? raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { name: name, enabled: enabled, } api_headers = { "content-type": 'application/json', } @client.call( method: 'PUT', path: api_path, headers: api_headers, params: api_params, response_type: Models::Database ) end |
#update_boolean_attribute(database_id:, collection_id:, key:, required:, default:, new_key: nil) ⇒ AttributeBoolean
Update a boolean attribute. Changing the ‘default` value will not update already existing documents.
486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 |
# File 'lib/appwrite/services/databases.rb', line 486 def update_boolean_attribute(database_id:, collection_id:, key:, required:, default:, new_key: nil) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { required: required, default: default, newKey: new_key, } api_headers = { "content-type": 'application/json', } @client.call( method: 'PATCH', path: api_path, headers: api_headers, params: api_params, response_type: Models::AttributeBoolean ) end |
#update_collection(database_id:, collection_id:, name:, permissions: nil, document_security: nil, enabled: nil) ⇒ Collection
Update a collection by its unique ID.
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 |
# File 'lib/appwrite/services/databases.rb', line 310 def update_collection(database_id:, collection_id:, name:, permissions: nil, document_security: nil, enabled: nil) api_path = '/databases/{databaseId}/collections/{collectionId}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) if database_id.nil? raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if name.nil? raise Appwrite::Exception.new('Missing required parameter: "name"') end api_params = { name: name, permissions: , documentSecurity: document_security, enabled: enabled, } api_headers = { "content-type": 'application/json', } @client.call( method: 'PUT', path: api_path, headers: api_headers, params: api_params, response_type: Models::Collection ) end |
#update_datetime_attribute(database_id:, collection_id:, key:, required:, default:, new_key: nil) ⇒ AttributeDatetime
Update a date time attribute. Changing the ‘default` value will not update already existing documents.
595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 |
# File 'lib/appwrite/services/databases.rb', line 595 def update_datetime_attribute(database_id:, collection_id:, key:, required:, default:, new_key: nil) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { required: required, default: default, newKey: new_key, } api_headers = { "content-type": 'application/json', } @client.call( method: 'PATCH', path: api_path, headers: api_headers, params: api_params, response_type: Models::AttributeDatetime ) end |
#update_document(database_id:, collection_id:, document_id:, data: nil, permissions: nil) ⇒ Document
Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.
1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 |
# File 'lib/appwrite/services/databases.rb', line 1810 def update_document(database_id:, collection_id:, document_id:, data: nil, permissions: nil) api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{documentId}', document_id) if database_id.nil? raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if document_id.nil? raise Appwrite::Exception.new('Missing required parameter: "documentId"') end api_params = { data: data, permissions: , } api_headers = { "content-type": 'application/json', } @client.call( method: 'PATCH', path: api_path, headers: api_headers, params: api_params, response_type: Models::Document ) end |
#update_email_attribute(database_id:, collection_id:, key:, required:, default:, new_key: nil) ⇒ AttributeEmail
Update an email attribute. Changing the ‘default` value will not update already existing documents.
706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 |
# File 'lib/appwrite/services/databases.rb', line 706 def update_email_attribute(database_id:, collection_id:, key:, required:, default:, new_key: nil) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { required: required, default: default, newKey: new_key, } api_headers = { "content-type": 'application/json', } @client.call( method: 'PATCH', path: api_path, headers: api_headers, params: api_params, response_type: Models::AttributeEmail ) end |
#update_enum_attribute(database_id:, collection_id:, key:, elements:, required:, default:, new_key: nil) ⇒ AttributeEnum
Update an enum attribute. Changing the ‘default` value will not update already existing documents.
825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 |
# File 'lib/appwrite/services/databases.rb', line 825 def update_enum_attribute(database_id:, collection_id:, key:, elements:, required:, default:, new_key: nil) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? raise Appwrite::Exception.new('Missing required parameter: "key"') end if elements.nil? raise Appwrite::Exception.new('Missing required parameter: "elements"') end if required.nil? raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { elements: elements, required: required, default: default, newKey: new_key, } api_headers = { "content-type": 'application/json', } @client.call( method: 'PATCH', path: api_path, headers: api_headers, params: api_params, response_type: Models::AttributeEnum ) end |
#update_float_attribute(database_id:, collection_id:, key:, required:, min:, max:, default:, new_key: nil) ⇒ AttributeFloat
Update a float attribute. Changing the ‘default` value will not update already existing documents.
948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 |
# File 'lib/appwrite/services/databases.rb', line 948 def update_float_attribute(database_id:, collection_id:, key:, required:, min:, max:, default:, new_key: nil) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? raise Appwrite::Exception.new('Missing required parameter: "required"') end if min.nil? raise Appwrite::Exception.new('Missing required parameter: "min"') end if max.nil? raise Appwrite::Exception.new('Missing required parameter: "max"') end if default.nil? raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { required: required, min: min, max: max, default: default, newKey: new_key, } api_headers = { "content-type": 'application/json', } @client.call( method: 'PATCH', path: api_path, headers: api_headers, params: api_params, response_type: Models::AttributeFloat ) end |
#update_integer_attribute(database_id:, collection_id:, key:, required:, min:, max:, default:, new_key: nil) ⇒ AttributeInteger
Update an integer attribute. Changing the ‘default` value will not update already existing documents.
1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 |
# File 'lib/appwrite/services/databases.rb', line 1076 def update_integer_attribute(database_id:, collection_id:, key:, required:, min:, max:, default:, new_key: nil) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? raise Appwrite::Exception.new('Missing required parameter: "required"') end if min.nil? raise Appwrite::Exception.new('Missing required parameter: "min"') end if max.nil? raise Appwrite::Exception.new('Missing required parameter: "max"') end if default.nil? raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { required: required, min: min, max: max, default: default, newKey: new_key, } api_headers = { "content-type": 'application/json', } @client.call( method: 'PATCH', path: api_path, headers: api_headers, params: api_params, response_type: Models::AttributeInteger ) end |
#update_ip_attribute(database_id:, collection_id:, key:, required:, default:, new_key: nil) ⇒ AttributeIp
Update an ip attribute. Changing the ‘default` value will not update already existing documents.
1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 |
# File 'lib/appwrite/services/databases.rb', line 1197 def update_ip_attribute(database_id:, collection_id:, key:, required:, default:, new_key: nil) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { required: required, default: default, newKey: new_key, } api_headers = { "content-type": 'application/json', } @client.call( method: 'PATCH', path: api_path, headers: api_headers, params: api_params, response_type: Models::AttributeIp ) end |
#update_relationship_attribute(database_id:, collection_id:, key:, on_delete: nil, new_key: nil) ⇒ AttributeRelationship
Update relationship attribute. [Learn more about relationship attributes](appwrite.io/docs/databases-relationships#relationship-attributes).
1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 |
# File 'lib/appwrite/services/databases.rb', line 1626 def update_relationship_attribute(database_id:, collection_id:, key:, on_delete: nil, new_key: nil) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? raise Appwrite::Exception.new('Missing required parameter: "key"') end api_params = { onDelete: on_delete, newKey: new_key, } api_headers = { "content-type": 'application/json', } @client.call( method: 'PATCH', path: api_path, headers: api_headers, params: api_params, response_type: Models::AttributeRelationship ) end |
#update_string_attribute(database_id:, collection_id:, key:, required:, default:, size: nil, new_key: nil) ⇒ AttributeString
Update a string attribute. Changing the ‘default` value will not update already existing documents.
1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 |
# File 'lib/appwrite/services/databases.rb', line 1375 def update_string_attribute(database_id:, collection_id:, key:, required:, default:, size: nil, new_key: nil) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { required: required, default: default, size: size, newKey: new_key, } api_headers = { "content-type": 'application/json', } @client.call( method: 'PATCH', path: api_path, headers: api_headers, params: api_params, response_type: Models::AttributeString ) end |
#update_url_attribute(database_id:, collection_id:, key:, required:, default:, new_key: nil) ⇒ AttributeUrl
Update an url attribute. Changing the ‘default` value will not update already existing documents.
1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 |
# File 'lib/appwrite/services/databases.rb', line 1487 def update_url_attribute(database_id:, collection_id:, key:, required:, default:, new_key: nil) api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}' .gsub('{databaseId}', database_id) .gsub('{collectionId}', collection_id) .gsub('{key}', key) if database_id.nil? raise Appwrite::Exception.new('Missing required parameter: "databaseId"') end if collection_id.nil? raise Appwrite::Exception.new('Missing required parameter: "collectionId"') end if key.nil? raise Appwrite::Exception.new('Missing required parameter: "key"') end if required.nil? raise Appwrite::Exception.new('Missing required parameter: "required"') end if default.nil? raise Appwrite::Exception.new('Missing required parameter: "default"') end api_params = { required: required, default: default, newKey: new_key, } api_headers = { "content-type": 'application/json', } @client.call( method: 'PATCH', path: api_path, headers: api_headers, params: api_params, response_type: Models::AttributeUrl ) end |