@@ -925,11 +925,11 @@ static Models.AttributeIp Convert(Dictionary<string, object> it) =>
925925 var apiParameters = new Dictionary < string , object ? > ( )
926926 {
927927 { "relatedCollectionId" , relatedCollectionId } ,
928- { "type" , type } ,
928+ { "type" , type ? . Value } ,
929929 { "twoWay" , twoWay } ,
930930 { "key" , key } ,
931931 { "twoWayKey" , twoWayKey } ,
932- { "onDelete" , onDelete }
932+ { "onDelete" , onDelete ? . Value }
933933 } ;
934934
935935 var apiHeaders = new Dictionary < string , string > ( )
@@ -1177,7 +1177,7 @@ public Task<object> DeleteAttribute(string databaseId, string collectionId, stri
11771177
11781178 var apiParameters = new Dictionary < string , object ? > ( )
11791179 {
1180- { "onDelete" , onDelete } ,
1180+ { "onDelete" , onDelete ? . Value } ,
11811181 { "newKey" , newKey }
11821182 } ;
11831183
@@ -1319,6 +1319,7 @@ static Models.DocumentList Convert(Dictionary<string, object> it) =>
13191319 /// new collection resource using either a [server
13201320 /// integration](https://appwrite.io/docs/server/databases#databasesCreateCollection)
13211321 /// API or directly from your database console.
1322+ ///
13221323 /// </para>
13231324 /// </summary>
13241325 public Task < Models . DocumentList > UpsertDocuments ( string databaseId , string collectionId , List < object > documents )
@@ -1570,6 +1571,78 @@ public Task<object> DeleteDocument(string databaseId, string collectionId, strin
15701571
15711572 }
15721573
1574+ /// <para>
1575+ /// Decrement a specific attribute of a document by a given value.
1576+ /// </para>
1577+ /// </summary>
1578+ public Task < Models . Document > DecrementDocumentAttribute ( string databaseId , string collectionId , string documentId , string attribute , double ? xvalue = null , double ? min = null )
1579+ {
1580+ var apiPath = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement"
1581+ . Replace ( "{databaseId}" , databaseId )
1582+ . Replace ( "{collectionId}" , collectionId )
1583+ . Replace ( "{documentId}" , documentId )
1584+ . Replace ( "{attribute}" , attribute ) ;
1585+
1586+ var apiParameters = new Dictionary < string , object ? > ( )
1587+ {
1588+ { "value" , xvalue } ,
1589+ { "min" , min }
1590+ } ;
1591+
1592+ var apiHeaders = new Dictionary < string , string > ( )
1593+ {
1594+ { "content-type" , "application/json" }
1595+ } ;
1596+
1597+
1598+ static Models . Document Convert ( Dictionary < string , object > it ) =>
1599+ Models . Document . From ( map : it ) ;
1600+
1601+ return _client . Call < Models . Document > (
1602+ method : "PATCH" ,
1603+ path : apiPath ,
1604+ headers : apiHeaders ,
1605+ parameters : apiParameters . Where ( it => it . Value != null ) . ToDictionary ( it => it . Key , it => it . Value ) ! ,
1606+ convert : Convert ) ;
1607+
1608+ }
1609+
1610+ /// <para>
1611+ /// Increment a specific attribute of a document by a given value.
1612+ /// </para>
1613+ /// </summary>
1614+ public Task < Models . Document > IncrementDocumentAttribute ( string databaseId , string collectionId , string documentId , string attribute , double ? xvalue = null , double ? max = null )
1615+ {
1616+ var apiPath = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment"
1617+ . Replace ( "{databaseId}" , databaseId )
1618+ . Replace ( "{collectionId}" , collectionId )
1619+ . Replace ( "{documentId}" , documentId )
1620+ . Replace ( "{attribute}" , attribute ) ;
1621+
1622+ var apiParameters = new Dictionary < string , object ? > ( )
1623+ {
1624+ { "value" , xvalue } ,
1625+ { "max" , max }
1626+ } ;
1627+
1628+ var apiHeaders = new Dictionary < string , string > ( )
1629+ {
1630+ { "content-type" , "application/json" }
1631+ } ;
1632+
1633+
1634+ static Models . Document Convert ( Dictionary < string , object > it ) =>
1635+ Models . Document . From ( map : it ) ;
1636+
1637+ return _client . Call < Models . Document > (
1638+ method : "PATCH" ,
1639+ path : apiPath ,
1640+ headers : apiHeaders ,
1641+ parameters : apiParameters . Where ( it => it . Value != null ) . ToDictionary ( it => it . Key , it => it . Value ) ! ,
1642+ convert : Convert ) ;
1643+
1644+ }
1645+
15731646 /// <para>
15741647 /// List indexes in the collection.
15751648 /// </para>
@@ -1617,7 +1690,7 @@ static Models.IndexList Convert(Dictionary<string, object> it) =>
16171690 var apiParameters = new Dictionary < string , object ? > ( )
16181691 {
16191692 { "key" , key } ,
1620- { "type" , type } ,
1693+ { "type" , type ? . Value } ,
16211694 { "attributes" , attributes } ,
16221695 { "orders" , orders } ,
16231696 { "lengths" , lengths }
0 commit comments