Skip to content

Commit 20cab81

Browse files
updated connect api url
Signed-off-by: NeelParihar <[email protected]>
1 parent 2b8d59b commit 20cab81

File tree

3 files changed

+25
-10
lines changed

3 files changed

+25
-10
lines changed

docs/_sidebar.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- [copy](api/woqlClient.js?id=copy)
1919
- [server](api/woqlClient.js?id=server)
2020
- [api](api/woqlClient.js?id=api)
21+
- [apiInfo](api/woqlClient.js?id=apiInfo)
2122
- [organization](api/woqlClient.js?id=organization)
2223
- [user](api/woqlClient.js?id=user)
2324
- [userOrganization](api/woqlClient.js?id=userOrganization)

docs/api/woqlClient.js.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ async function getSchema() {
4444
### TerminusDB Client API
4545

4646
### Connect
47-
#### woqlClient.connect([params]) ⇒ <code>Promise</code>
47+
#### woqlClient.connect() ⇒ <code>Promise</code>
4848
Connect to a Terminus server at the given URI with an API key
4949
Stores the system:ServerCapability document returned
5050
in the connection register which stores, the url, key, capabilities,
@@ -53,14 +53,9 @@ this.connectionConfig.server will be used if present,
5353
or the promise will be rejected.
5454

5555
**Returns**: <code>Promise</code> - the connection capabilities response object or an error object
56-
57-
| Param | Type | Description |
58-
| --- | --- | --- |
59-
| [params] | <code>typedef.ParamsObj</code> | TerminusDB Server connection parameters |
60-
6156
**Example**
6257
```js
63-
client.connect({key:"mykey",user:"admin"})
58+
client.connect()
6459
```
6560

6661
### Create Database
@@ -301,6 +296,16 @@ Retrieve the URL of the server’s API base that we are currently connected to
301296
let api_url = client.api()
302297
```
303298
299+
### apiInfo
300+
#### woqlClient.apiInfo() ⇒ <code>string</code>
301+
Retrieve the URL of the server’s Info API that we are currently connected to
302+
303+
**Returns**: <code>string</code> - the URL of the TerminusDB server info api endpoint we are connected to (typically server() + “api/info”)
304+
**Example**
305+
```js
306+
let api_url = client.apiInfo()
307+
```
308+
304309
### organization
305310
#### woqlClient.organization([orgId]) ⇒ <code>string</code> \| <code>boolean</code>
306311
Gets/Sets the client’s internal organization context value

lib/woqlClient.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,16 @@ WOQLClient.prototype.api = function() {
110110
return this.connectionConfig.apiURL()
111111
}
112112

113+
/**
114+
* Retrieve the URL of the server’s Info API that we are currently connected to
115+
* @returns {string} the URL of the TerminusDB server info api endpoint we are connected to (typically server() + “api/info”)
116+
* @example
117+
* let api_url = client.apiInfo()
118+
*/
119+
WOQLClient.prototype.apiInfo = function() {
120+
return this.connectionConfig.apiURL() + 'info'
121+
}
122+
113123
/**
114124
* Gets/Sets the client’s internal organization context value
115125
* @param {string | boolean} [orgId] the organization id to set the context to
@@ -346,15 +356,14 @@ WOQLClient.prototype.resource = function(resourceType, resourceId) {
346356
* and database meta-data for the connected server
347357
* this.connectionConfig.server will be used if present,
348358
* or the promise will be rejected.
349-
* @param {typedef.ParamsObj} [params] - TerminusDB Server connection parameters
350359
* @returns {Promise} the connection capabilities response object or an error object
351360
* @example
352-
* client.connect({key:"mykey",user:"admin"})
361+
* client.connect()
353362
*/
354363
WOQLClient.prototype.connect = function(params) {
355364
if (params) this.connectionConfig.update(params)
356365
// unset the current server setting until successful connect
357-
return this.dispatch(CONST.GET, this.api()).then(response => {
366+
return this.dispatch(CONST.GET, this.apiInfo()).then(response => {
358367
this.databases(response)
359368
return response
360369
})

0 commit comments

Comments
 (0)