Skip to content

Commit c593ec8

Browse files
Francesca-Bitgithub-actions[bot]
authored andcommitted
Apply docs changes
1 parent f33a865 commit c593ec8

File tree

2 files changed

+77
-30
lines changed

2 files changed

+77
-30
lines changed

docs/api/typedef.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ the POST document interface query parameters
3232

3333
| Name | Type | Description |
3434
| --- | --- | --- |
35+
| [raw_json] | <code>boolean</code> | default is false, If true, the input documents are treated as raw JSON, inserted as type sys:JSONDocument and are not subject to schema restrictions. |
3536
| [graph_type] | <code>GraphType</code> | default is instance instance|schema Used to switch between getting documents from the instance or the schema graph. |
3637
| [full_replace] | <code>boolean</code> | default is false, If true, all existing documents are deleted before inserting the posted documents. This allows the full replacement of the contents of a database. This is especially useful for replacing the schema. |
3738

@@ -44,6 +45,7 @@ the PUT document interface query parameters
4445

4546
| Name | Type | Description |
4647
| --- | --- | --- |
48+
| [raw_json] | <code>boolean</code> | default is false, If true, the input documents are treated as raw JSON, inserted as type sys:JSONDocument and are not subject to schema restrictions. |
4749
| [graph_type] | <code>GraphType</code> | default is instance, instance|schema Used to switch between getting documents from the instance or the schema graph. |
4850

4951

docs/api/woqlclient.md

Lines changed: 75 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -384,14 +384,14 @@ user has fields: [id, name, notes, author]
384384
**Desription**: Gets the user's organization id
385385
386386
## databaseInfo
387-
##### woqlClient.databaseInfo([dbId]) ⇒ <code>object</code>
387+
##### woqlClient.databaseInfo([dbName]) ⇒ <code>object</code>
388388
Gets the database's details
389389
390-
**Returns**: <code>object</code> - the database description object //getDatabaseInfo
390+
**Returns**: <code>object</code> - the database description object
391391
392392
| Param | Type | Description |
393393
| --- | --- | --- |
394-
| [dbId] | <code>string</code> | the datbase id |
394+
| [dbName] | <code>string</code> | the datbase name |
395395
396396
397397
## db
@@ -699,7 +699,7 @@ and *dataVersion* object if ***getDataVersion*** parameter is true, or an Error
699699
| Param | Type | Description |
700700
| --- | --- | --- |
701701
| json | <code>object</code> | |
702-
| [params] | <code>typedef.DocParamsPost</code> | the post parameters |
702+
| [params] | <code>typedef.DocParamsPost</code> | the post parameters [#typedef.DocParamsPost](#typedef.DocParamsPost) |
703703
| [dbId] | <code>string</code> | the dbid |
704704
| [string] | <code>message</code> | the insert commit message |
705705
| [lastDataVersion] | <code>string</code> | the last data version tracking id. |
@@ -866,7 +866,7 @@ and *dataVersion* object if ***getDataVersion*** parameter is true, or an Error
866866
| Param | Type | Description |
867867
| --- | --- | --- |
868868
| json | <code>object</code> | |
869-
| [params] | <code>typedef.DocParamsPut</code> | the Put parameters |
869+
| [params] | <code>typedef.DocParamsPut</code> | the Put parameters [#typedef.DocParamsPut](#typedef.DocParamsPut) |
870870
| [dbId] | <code>\*</code> | the database id |
871871
| [message] | <code>\*</code> | the update commit message |
872872
| [lastDataVersion] | <code>string</code> | the last data version tracking id. |
@@ -1122,8 +1122,8 @@ async funtion callGetUserOrganizations(){
11221122
}
11231123
```
11241124
1125-
## getDiff
1126-
##### woqlClient.getDiff(before, after, options) ⇒ <code>Promise</code>
1125+
## getJSONDiff
1126+
##### woqlClient.getJSONDiff(before, after, [options]) ⇒ <code>Promise</code>
11271127
Get the patch of difference between two documents.
11281128
11291129
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
@@ -1132,58 +1132,103 @@ Get the patch of difference between two documents.
11321132
| --- | --- | --- |
11331133
| before | <code>object</code> | The current state of JSON document |
11341134
| after | <code>object</code> | The updated state of JSON document |
1135-
| options | <code>object</code> | [{}] - Options to send to the diff endpoint |
1135+
| [options] | <code>object</code> | {keep:{}} Options to send to the diff endpoint the diff api outputs the changes between the input (JSON Object), but you can list the properties that you would like to see in the diff result in any case. |
11361136
11371137
**Example**
11381138
```javascript
1139-
const diff = await client.getDiff(
1139+
client.getJSONDiff(
11401140
{ "@id": "Person/Jane", "@type": "Person", name: "Jane" },
11411141
{ "@id": "Person/Jane", "@type": "Person", name: "Janine" }
1142-
);
1142+
).then(diffResult=>{
1143+
console.log(diffResult)
1144+
})
1145+
//result example
1146+
//{'@id': 'Person/Jane',
1147+
// name: { '@after': 'Janine', '@before': 'Jane', '@op': 'SwapValue' }}
11431148
```
11441149
11451150
## getVersionObjectDiff
1146-
##### woqlClient.getVersionObjectDiff(id, beforeVersion, after, options) ⇒ <code>Promise</code>
1151+
##### woqlClient.getVersionObjectDiff(dataVersion, jsonObject, id, [options]) ⇒ <code>Promise</code>
11471152
Get the patch of difference between two documents.
11481153
11491154
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
11501155
11511156
| Param | Type | Description |
11521157
| --- | --- | --- |
1158+
| dataVersion | <code>string</code> | The version from which to compare the object |
1159+
| jsonObject | <code>object</code> | The updated state of JSON document |
11531160
| id | <code>string</code> | The object id to be diffed |
1154-
| beforeVersion | <code>string</code> | The version from which to compare the object |
1155-
| after | <code>object</code> | The updated state of JSON document |
1156-
| options | <code>object</code> | [{}] - Options to send to the diff endpoint |
1161+
| [options] | <code>object</code> | {keep:{}} Options to send to the diff endpoint the diff api outputs the changes between the input (branches or commits), but you can list the properties that you would like to see in the diff result in any case. |
11571162
11581163
**Example**
11591164
```javascript
1160-
const diff = await client.getVersionObjectDiff(
1161-
"Person/Jane",
1162-
"branch:a73ssscfx0kke7z76083cgswszdxy6l",
1163-
{ "@id": "Person/Jane", "@type": "Person", name: "Janine" }
1164-
);
1165+
const jsonObj = { "@id": "Person/Jane", "@type": "Person", name: "Janine" }
1166+
client.getVersionObjectDiff("main",jsonObj
1167+
"Person/Jane").then(diffResp=>{
1168+
console.log(diffResp)
1169+
})
11651170
```
11661171
11671172
## getVersionDiff
1168-
##### woqlClient.getVersionDiff(id, beforeVersion, afterVersion, options) ⇒ <code>Promise</code>
1169-
Get the patch of difference between two documents.
1173+
##### woqlClient.getVersionDiff(beforeVersion, afterVersion, [id], [options]) ⇒ <code>Promise</code>
1174+
Get the patch of difference between branches or commits.
11701175
11711176
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
11721177
11731178
| Param | Type | Description |
11741179
| --- | --- | --- |
1175-
| id | <code>string</code> | The object id to be diffed |
1176-
| beforeVersion | <code>string</code> | The version from which to compare the object |
1177-
| afterVersion | <code>string</code> | The version to which to compare the object |
1178-
| options | <code>object</code> | [{}] - Options to send to the diff endpoint |
1180+
| beforeVersion | <code>string</code> | Before branch/commit to compare |
1181+
| afterVersion | <code>string</code> | Before branch/commit to compare |
1182+
| [id] | <code>string</code> | The object id to be diffed, if it is omitted all the documents will be compared |
1183+
| [options] | <code>object</code> | {keep:{}} Options to send to the diff endpoint the diff api outputs the changes between the input (branches or commits), but you can list the properties that you would like to see in the diff result in any case. |
11791184
11801185
**Example**
11811186
```javascript
1182-
const diff = await client.getVersionDiff(
1183-
"Person/Jane",
1184-
"branch:a73ssscfx0kke7z76083cgswszdxy6l",
1185-
"branch:73rqpooz65kbsheuno5dsayh71x7wf4"
1186-
);
1187+
//This is to view all the changes between two commits
1188+
const beforeCommit = "a73ssscfx0kke7z76083cgswszdxy6l"
1189+
const afterCommit = "73rqpooz65kbsheuno5dsayh71x7wf4"
1190+
1191+
client.getVersionDiff( beforeCommit, afterCommit).then(diffResult=>{
1192+
console.log(diffResult)
1193+
})
1194+
1195+
//This is to view the changes between two commits but only for the given document
1196+
client.getVersionDiff( beforeCommit, afterCommit, "Person/Tom").then(diffResult=>{
1197+
console.log(diffResult)
1198+
})
1199+
1200+
//This is to view the changes between a branch (head) and a commit for the given document
1201+
client.getVersionDiff("main", afterCommit, "Person/Tom" ).then(diffResult=>{
1202+
console.log(diffResult)
1203+
})
1204+
1205+
//This is to view the changes between two branches with the keep options
1206+
const options = {"keep":{"@id":true, "name": true}}
1207+
client.getVersionDiff("main","mybranch",options).then(diffResult=>{
1208+
console.log(diffResult)
1209+
})
1210+
```
1211+
1212+
## apply
1213+
##### woqlClient.apply(beforeVersion, afterVersion, message, [match_final_state], [options])
1214+
Diff two different commits and apply changes on the current branch/commit
1215+
if you would like to change branch or commit before apply use client.checkout("branchName")
1216+
1217+
1218+
| Param | Type | Description |
1219+
| --- | --- | --- |
1220+
| beforeVersion | <code>string</code> | Before branch/commit to compare |
1221+
| afterVersion | <code>string</code> | Before branch/commit to compare |
1222+
| message | <code>string</code> | apply commit message |
1223+
| [match_final_state] | <code>boolean</code> | the deafult value is false |
1224+
| [options] | <code>object</code> | {keep:{}} Options to send to the apply endpoint |
1225+
1226+
**Example**
1227+
```javascript
1228+
client.checkout("mybranch")
1229+
client.apply("main","mybranch").then(result=>{
1230+
console.log(result)
1231+
})
11871232
```
11881233
11891234
## patch

0 commit comments

Comments
 (0)