Classes
Members
-
RDF_FORMATS :
Object
-
JSON_LD: application/ld+json
N_TRIPLES: application/n-triples
RDF_XML: application/rdf+xml
SPARQL_UPDATE: application/sparql-update
N3: text/n3
PLAIN: text/plain
TURTLE: text/turtle -
FILE_EXTENSIONS :
Object
-
.json: application/ld+json
.nt: application/n-triples
.xml: application/rdf+xml
.n3: text/n3
.txt: text/plain
.ttl: text/turtle -
GET_JSON_ACCEPT :
Object
-
Optional Accept HTTP header values for GET request of Content-Type=application/ld+json
-
GET_PREFER :
Object
-
Optional Prefer HTTP header values for GET request
-
PUT_PEFER :
Object
-
Optional Prefer HTTP header values for PUT request. Allows replacing the properties of a container without having to provide all of the server-managed triples.
-
acl :
class
-
set of functions for interacting with fin webac.
-
service :
class
-
set of functions for interacting with fin services.
-
transform :
Object
-
util functions for turtle, json-ld and sparql transforms
Functions
- setConfig(params)
-
Set the API config
To make authenticated requests you should supply either a username/refreshToken or username/password combo. Then if a JWT doesn't exist or is expired, the request function will fetch a new JWT before the request is made.
-
getConfig() ⇒
Object
-
return config object
-
isSuccess(response) ⇒
Boolean
-
Given a HTTP response see if response is in 200 range
-
get(options) ⇒
Promise
-
Retrieve the content of the resource
-
head(options) ⇒
Promise
-
Retrieve HTTP headers of the resource
-
post(options) ⇒
Promise
-
Create new resources within a LDP container
-
put(options) ⇒
Promise
-
Create a resource with a specified path, or replace the triples associated with a resource with the triples provided in the request body.
-
patch(options) ⇒
Promise
-
Sparql base update
-
delete(options) ⇒
Promise
-
Delete a resource
-
copy(options) ⇒
Promise
-
Copy a resource (and its subtree) to a new location
-
move(options) ⇒
Promise
-
Move a resource (and its subtree) to a new location
-
startTransaction(options) ⇒
Promise
-
Start a new transaction, returns transation token.
-
commitTransaction(options) ⇒
Promise
-
Commit transation
-
rollbackTransaction(options) ⇒
Promise
-
Rollback transation
-
getVersions(options) ⇒
Promise
-
Get a current version
-
getVersion(options) ⇒
Promise
-
createVersion(options) ⇒
Promise
-
revertToVersion(options) ⇒
Promise
-
deleteVersion(options) ⇒
Promise
-
parseLinkHeader(link) ⇒
Object
-
helper for parsing HTTP link header. many utils for this do not assume multiple rel's of the same value which fedora returns.
FinApi
new FinApi()
FIN API class
Many classes return a promise with a object that looks like {response, body, authenticated} where
- response: HTTP response object
- body: HTTP body contents
- authenticated: boolean flag if a JWT token was sent along with the request
Object
RDF_FORMATS : JSON_LD: application/ld+json
N_TRIPLES: application/n-triples
RDF_XML: application/rdf+xml
SPARQL_UPDATE: application/sparql-update
N3: text/n3
PLAIN: text/plain
TURTLE: text/turtle
Object
FILE_EXTENSIONS : .json: application/ld+json
.nt: application/n-triples
.xml: application/rdf+xml
.n3: text/n3
.txt: text/plain
.ttl: text/turtle
Object
GET_JSON_ACCEPT : Optional Accept HTTP header values for GET request of Content-Type=application/ld+json
Object
GET_PREFER : Optional Prefer HTTP header values for GET request
Object
PUT_PEFER : Optional Prefer HTTP header values for PUT request. Allows replacing the properties of a container without having to provide all of the server-managed triples.
class
acl : set of functions for interacting with fin webac.
class
service : set of functions for interacting with fin services.
Object
transform : util functions for turtle, json-ld and sparql transforms
setConfig(params)
Set the API config
To make authenticated requests you should supply either a username/refreshToken or username/password combo. Then if a JWT doesn't exist or is expired, the request function will fetch a new JWT before the request is made.
Kind: global function
Param | Description |
---|---|
params | key/value pairs to set |
params.host | FIN host ex. http://mydams.org |
params.fcBasePath | Fedora base path (default: /fcrepo/rest) |
params.jwt | JWT Token |
params.refreshToken | refresh token to use if JWT expires |
params.username | username to use with refreshToken or password if JWT expires |
params.password | password to use if JWT expires |
params.transactionToken | custom transaction token |
Object
getConfig() ⇒ return config object
Boolean
isSuccess(response) ⇒ Given a HTTP response see if response is in 200 range
Kind: global function
Param | Type | Description |
---|---|---|
response | Object |
HTTP response object |
Promise
get(options) ⇒ Retrieve the content of the resource
Kind: global function
Returns: Promise
- {response, body, authenticated}
Param | Type | Description |
---|---|---|
options | Object |
arguments |
options.path | String |
resource path |
options.headers | Object |
resource headers, key/value pairs |
options.host | String |
(optional) override config.host |
options.fcBasePath | String |
(optional) override config.fcBasePath |
Promise
head(options) ⇒ Retrieve HTTP headers of the resource
Kind: global function
Returns: Promise
- {response, body, authenticated}
Param | Type | Description |
---|---|---|
options | Object |
arguments |
options.path | String |
resource path |
options.headers | Object |
resource headers, key/value pairs |
options.host | String |
(optional) override config.host |
options.fcBasePath | String |
(optional) override config.fcBasePath |
Promise
post(options) ⇒ Create new resources within a LDP container
Kind: global function
Returns: Promise
- {response, body, authenticated}
Param | Type | Description |
---|---|---|
options | Object |
arguments |
options.path | String |
resource path |
options.headers | Object |
resource headers, key/value pairs |
options.file | Object |
(optional) path to file to upload |
options.content | Object |
(optional) content to upload |
options.host | String |
(optional) override config.host |
options.fcBasePath | String |
(optional) override config.fcBasePath |
options.transactionToken | String |
(optional) override config.transactionToken |
Promise
put(options) ⇒ Create a resource with a specified path, or replace the triples associated with a resource with the triples provided in the request body.
Kind: global function
Returns: Promise
- {response, body, authenticated}
Param | Type | Description |
---|---|---|
options | Object |
arguments |
options.path | String |
resource path |
options.headers | Object |
resource headers, key/value pairs |
options.file | Object |
(optional) path to file to upload |
options.content | Object |
(optional) content to upload |
options.partial | Object |
(optional) only partial update happening, sets Prefer header to handling=lenient; received="minimal" |
options.host | String |
(optional) override config.host |
options.fcBasePath | String |
(optional) override config.fcBasePath |
options.transactionToken | String |
(optional) override config.transactionToken |
Promise
patch(options) ⇒ Sparql base update
Kind: global function
Returns: Promise
- {response, body, authenticated}
Param | Type | Description |
---|---|---|
options | Object |
arguments |
options.path | String |
resource path |
options.headers | Object |
resource headers, key/value pairs |
options.file | Object |
(optional) path to file to upload |
options.content | Object |
(optional) content to upload |
options.host | String |
(optional) override config.host |
options.fcBasePath | String |
(optional) override config.fcBasePath |
options.transactionToken | String |
(optional) override config.transactionToken |
Promise
delete(options) ⇒ Delete a resource
Kind: global function
Returns: Promise
- {response, body, authenticated}
Param | Type | Description |
---|---|---|
options | Object |
arguments |
options.path | String |
resource path |
options.permanent | Boolean |
remove /fcr:tombstone as well |
options.headers | Object |
resource headers, key/value pairs |
options.host | String |
(optional) override config.host |
options.fcBasePath | String |
(optional) override config.fcBasePath |
options.transactionToken | String |
(optional) override config.transactionToken |
Promise
copy(options) ⇒ Copy a resource (and its subtree) to a new location
Kind: global function
Returns: Promise
- {response, body, authenticated}
Param | Type | Description |
---|---|---|
options | Object |
arguments |
options.path | String |
resource path |
options.destination | Boolean |
path to copy resource to |
options.headers | Object |
resource headers, key/value pairs |
options.host | String |
(optional) override config.host |
options.fcBasePath | String |
(optional) override config.fcBasePath |
options.transactionToken | String |
(optional) override config.transactionToken |
Promise
move(options) ⇒ Move a resource (and its subtree) to a new location
Kind: global function
Returns: Promise
- {response, body, authenticated}
Param | Type | Description |
---|---|---|
options | Object |
arguments |
options.path | String |
resource path |
options.destination | Boolean |
path to move resource to |
options.headers | Object |
resource headers, key/value pairs |
options.host | String |
(optional) override config.host |
options.fcBasePath | String |
(optional) override config.fcBasePath |
options.transactionToken | String |
(optional) override config.transactionToken |
Promise
startTransaction(options) ⇒ Start a new transaction, returns transation token.
Kind: global function
Returns: Promise
- {response, body, authenticated, transactionToken}
Param | Type | Description |
---|---|---|
options | Object |
arguments |
options.headers | Object |
resource headers, key/value pairs |
options.host | String |
(optional) override config.host |
options.fcBasePath | String |
(optional) override config.fcBasePath |
Promise
commitTransaction(options) ⇒ Commit transation
Kind: global function
Returns: Promise
- {response, body, authenticated}
Param | Type | Description |
---|---|---|
options | Object |
arguments |
options.headers | Object |
resource headers, key/value pairs |
options.host | String |
(optional) override config.host |
options.fcBasePath | String |
(optional) override config.fcBasePath |
options.transactionToken | String |
(optional) override config.transactionToken |
Promise
rollbackTransaction(options) ⇒ Rollback transation
Kind: global function
Returns: Promise
- {response, body, authenticated}
Param | Type | Description |
---|---|---|
options | Object |
arguments |
options.headers | Object |
resource headers, key/value pairs |
options.host | String |
(optional) override config.host |
options.fcBasePath | String |
(optional) override config.fcBasePath |
options.transactionToken | String |
(optional) override config.transactionToken |
Promise
getVersions(options) ⇒ Get a current version
Kind: global function
Returns: Promise
- {response, body, authenticated}
Param | Type | Description |
---|---|---|
options | Object |
|
options.headers | Object |
resource headers, key/value pairs |
options.host | String |
(optional) override config.host |
options.fcBasePath | String |
(optional) override config.fcBasePath |
Promise
getVersion(options) ⇒ Kind: global function
Returns: Promise
- {response, body, authenticated}
Param | Type | Description |
---|---|---|
options | Object |
|
options.versionName | String |
version to get |
options.headers | Object |
resource headers, key/value pairs |
options.host | String |
(optional) override config.host |
options.fcBasePath | String |
(optional) override config.fcBasePath |
Promise
createVersion(options) ⇒ Kind: global function
Returns: Promise
- {response, body, authenticated}
Param | Type | Description |
---|---|---|
options | Object |
|
options.versionName | String |
version to create |
options.headers | Object |
resource headers, key/value pairs |
options.host | String |
(optional) override config.host |
options.fcBasePath | String |
(optional) override config.fcBasePath |
Promise
revertToVersion(options) ⇒ Kind: global function
Returns: Promise
- {response, body, authenticated}
Param | Type | Description |
---|---|---|
options | Object |
|
options.versionName | String |
version name to revert to |
options.headers | Object |
resource headers, key/value pairs |
options.host | String |
(optional) override config.host |
options.fcBasePath | String |
(optional) override config.fcBasePath |
Promise
deleteVersion(options) ⇒ Kind: global function
Returns: Promise
- {response, body, authenticated}
Param | Type | Description |
---|---|---|
options | Object |
|
options.versionName | String |
version to delete |
options.headers | Object |
resource headers, key/value pairs |
options.host | String |
(optional) override config.host |
options.fcBasePath | String |
(optional) override config.fcBasePath |
Object
parseLinkHeader(link) ⇒ helper for parsing HTTP link header. many utils for this do not assume multiple rel's of the same value which fedora returns.
Kind: global function
Param | Type | Description |
---|---|---|
link | String |
HTTP link header |