Carbon LDP JavaScript SDK API Reference

Classes and Interfaces

C Carbon



Carbon
Module

Classes and Interfaces in the Module

C
Carbon
The main class of the SDK, which contains all the references of the modules used in the the SDK.




Carbon
Class

The main class of the SDK, which contains all the references of the modules used in the the SDK.


Reexports

AccessPoint
Document
Documents
Errors
Fragment
JSONLD
NamedFragment
ObjectSchema
PersistedApp
PersistedDocument
PersistedFragment
PersistedNamedFragment
PersistedResource
Platform
Pointer
Resource
SDKContext
Settings
SPARQL
Utils

Constructor


Carbon( settings?:Carbon.Settings.Class )

Param Type Default Description
settings Carbon.Settings.Class

Properties

#version
: string

Returns the version of the SDK.


.apps
: Carbon.Apps.Class

Instance of the class Carbon.Apps in the context of the instanced Carbon class.


.auth
: Carbon.Platform.Auth.Class

Instance of Carbon.Platform.Auth.Class class for manage the auth inside of the platform.


.version
: string

Returns the version of the SDK.


Methods

.getAPIDescription()
: Promise<Carbon.APIDescription.Class>


getAPIDescription():Promise<Carbon.APIDescription.Class>

Returns the API description of the related CarbonLDP Platform.




.resolve()
: string


resolve( uri:string ):string

Resolve the URI provided in the scope of the CarbonLDP Platform.


Param Type Default Description
uri string




Default Export:

Classes and Interfaces in the Module

I
Carbon.APIDescription.Class
Interface that represents a requested API description of the Carbon LDP Platform configured.

Properties




Interface that represents a requested API description of the Carbon LDP Platform configured.


Properties

.buildDate
: Date

The last time the platform was built.


.version
: string

The version of the Carbon LDP Platform configured.








Abstract class for defining contexts.


Constructor


Class()


Properties

.parentContext
: Carbon.Context.Class

The parent context provided in the constructor. If no context was provided, this property will be the singleton Carbon.SDKContext.instance of the class Carbon.SDKContext.Class.


Methods

.resolve()
: string


resolve( relativeURI:string ):string

Abstract method that returns an absolute URI in accordance to the context scope from the relative URI provided.


Param Type Default Description
relativeURI string




Default Export:

Classes and Interfaces in the Module

I
Carbon.AccessPoint.Class
Interface that represents the basic properties to construct a Carbon.AccessPoint.DocumentClass.
I
Carbon.AccessPoint.DocumentClass
Interface that represents the document of an in-memory access point.

Properties

#RDF_CLASS
: string





Interface that represents the basic properties to construct a Carbon.AccessPoint.DocumentClass.


Properties

.hasMemberRelation
: string | Carbon.Pointer.Class

The string URI or pointer URI that represents the member relation that the access point will manage.


.insertedContentRelation
: string | Carbon.Pointer.Class

The string URI or pointer URI that represents the inserted content relation of the access point.


.isMemberOfRelation
: string | Carbon.Pointer.Class

The string URI or pointer URI that represents the inverted relation that the access point will create.





Interface that represents the document of an in-memory access point.


Properties

.hasMemberRelation
: Carbon.Pointer.Class

Pointer that represents the member relation that the access point will manage.


.insertedContentRelation
: Carbon.Pointer.Class

Pointer that represents the inserted content relation of the access point.


.isMemberOfRelation
: Carbon.Pointer.Class

Pointer that represents the inverted relation that the access point will create.





Factory class for Carbon.AccessPoint.Class objects.


Methods

#create()
: Carbon.AccessPoint.Class


create( membershipResource:Carbon.Pointer.Class, hasMemberRelation:string | Carbon.Pointer.Class, isMemberOfRelation?:string | Carbon.Pointer.Class ):Carbon.AccessPoint.Class

Creates a Carbon.AccessPoint.Class object with the parameters specified.


Param Type Default Description
membershipResource Carbon.Pointer.Class

A Pointer to the parent of the AccessPoint.

hasMemberRelation string | Carbon.Pointer.Class

A URI or Pointer to the property in the parent resource managed by the AccessPoint.

isMemberOfRelation string | Carbon.Pointer.Class

A URI or Pointer to the property managed in the members added by the AccessPoint.



#createFrom()
: T & Carbon.AccessPoint.Class


createFrom<T extends Object>( object:T, membershipResource:Carbon.Pointer.Class, hasMemberRelation:string | Carbon.Pointer.Class, isMemberOfRelation?:string | Carbon.Pointer.Class ):T & Carbon.AccessPoint.Class

Creates a Carbon.AccessPoint.Class object from the object and parameters specified.


Param Type Default Description
object T

Object that will be converted into an AccessPoint.

membershipResource Carbon.Pointer.Class

A Pointer to the parent of the AccessPoint.

hasMemberRelation string | Carbon.Pointer.Class

A URI or Pointer to the property in the parent resource managed by the AccessPoint.

isMemberOfRelation string | Carbon.Pointer.Class

A URI or Pointer to the property managed in the members added by the AccessPoint.








Carbon.App.Class
Interface

Interface that represents a Carbon LDP Platform application.


Properties

.allowsOrigin
: (string | Carbon.Pointer.Class)[]

An array of string URIs or Pointers that refers to the origins allowed to connect to the application. An special URI that allows everyone to connect is at Carbon.NS.CS.Class.AllOrigins which translates to https://carbonldp.com/ns/v1/security#AllOrigins.


.description
: string

A brief description of the current application.


.name
: string

The name of the current application.





Factory class for Carbon.App.Class objects.


Methods

#create()
: Carbon.App.Class


create( name:string, description?:string ):Carbon.App.Class

Creates a Carbon.App.Class object with the parameters specified.


Param Type Default Description
name string

Name of the app to be created.

description string

Description of the app to be created.



#createFrom()
: T & Carbon.App.Class


createFrom<T extends Object>( object:T, name:string, description?:string ):T & Carbon.App.Class

Creates a Carbon.App.Class object from the object and parameters specified.


Param Type Default Description
object T

Object that will be converted into aa App.

name string

Name of the app to be created.

description string

Description of the app to be created.



#hasClassProperties()
: boolean


hasClassProperties( resource:Object ):boolean

Returns true if the object provided has the properties that defines a Carbon.App.Class object


Param Type Default Description
resource Object


#is()
: boolean


is( object:Object ):boolean

Returns true if the object provided is considered a Carbon.App.Class object


Param Type Default Description
object Object




Default Export:

Classes and Interfaces in the Module

C
Carbon.App.Agents.Class
Class for manage Agents of an application context.




Class for manage Agents of an application context.


Constructor


Class( context:Carbon.App.Context.Class )

Param Type Default Description
context Carbon.App.Context.Class

The application context where to manage its Agents.


Methods

.get()
: Promise<[ Carbon.App.PersistedAgent.Class, Carbon.HTTP.Response.Class ]>


get( agentURI:string, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ Carbon.App.PersistedAgent.Class, Carbon.HTTP.Response.Class ]>

Retrieves the application agent specified from the current application context.


Param Type Default Description
agentURI string

The URI of the application agent to retrieve.

requestOptions Carbon.HTTP.Request.Options

Customizable options for the request.





Default Export:

Classes and Interfaces in the Module

C
Carbon.App.Auth.Class
Implementation of Carbon.Auth.Class abstract class, that will manage the authentication and authorization specific of a Application Context.




Implementation of Carbon.Auth.Class abstract class, that will manage the authentication and authorization specific of a Application Context.


Constructor


Class( appContext:Carbon.App.Context )

Param Type Default Description
appContext Carbon.App.Context

Instance of the application context to manage its authentications and authorizations.


Properties

.roles
: Carbon.App.Roles.Class

Instance of Carbon.App.Roles.Class, for managing the roles of the current context.





Default Export:

Classes and Interfaces in the Module

C
Carbon.App.Context
Class that represents de scope of a CarbonLDP Application.




Class that represents de scope of a CarbonLDP Application.


Constructor


Context( parentContext:Carbon.Context.Class, app:Carbon.App.Context )

Param Type Default Description
parentContext Carbon.Context.Class
app Carbon.App.Context

Properties

.app
: Carbon.App.Class

The Document that represents the CarbonLDP Application.


.auth
: Carbon.App.Auth.Class

Instance of Carbon.App.Auth.Class class for manage the auth inside of an application.


Methods

.resolve()
: string


resolve( uri:string ):string

Resolve the URI provided in the scope of the application.


Param Type Default Description
uri string




Classes and Interfaces in the Module

I
Carbon.App.PersistedAgent.Class
Specific interface that represents the persisted agents from an application.




Specific interface that represents the persisted agents from an application.





Classes and Interfaces in the Module

I
Carbon.App.PersistedRole.Class
Specific interface that represents a persisted role of an application.




Specific interface that represents a persisted role of an application.


Properties

._roles
: Carbon.App.Roles.Class

(Internal) Instance of the AppRoles class that manage the current role.


.childRole
: Carbon.Pointer.Class[]

An array of pointer that references to all the children of the current role.


.parentRole
: Carbon.Pointer.Class

Reference to the parent of the current role.





Factory class for Carbon.App.PersistedRole.Class objects


Methods

#decorate()
: T & Carbon.App.PersistedRole.Class


decorate<T extends Carbon.PersistedDocument.Class>( object:T ):T & Carbon.App.PersistedRole.Class

Decorates the object provided with the methods and properties of a Carbon.App.PersistedRole.Class object.


Param Type Default Description
object T


#hasClassProperties()
: boolean


hasClassProperties( resource:Object ):boolean

Returns true if the object provided has the properties that defines a Carbon.App.PersistedRole.Class object


Param Type Default Description
resource Object


#is()
: boolean


is( object:Object ):boolean

Returns true if the object provided is considered a Carbon.App.PersistedRole.Class object


Param Type Default Description
object Object




Default Export:

Classes and Interfaces in the Module

C
Carbon.App.Roles.Class
Class for manage roles of an application.




Class for manage roles of an application.


Constructor


Class( appContext:Carbon.App.Context )

Param Type Default Description
appContext Carbon.App.Context

Methods

.createChild()
: Promise<[ Carbon.Pointer.Class, [ Carbon.HTTP.Response.Class, Carbon.HTTP.Response.Class] ]>


createChild( parentRole:string | Carbon.Pointer.Class, role:Carbon.App.Roles.Class, slug?:string, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ Carbon.Pointer.Class, [ Carbon.HTTP.Response.Class, Carbon.HTTP.Response.Class] ]>

Persists the AppRole provided with the slug, if specified, as a childRole of the parentRole specified. Returns a Promise with a Pointer for the stored role; and a tuple of two responses, the first one is the response of the creation, and the second one is the response of the creation of the relation parent-child of the roles.


Param Type Default Description
parentRole string | Carbon.Pointer.Class

The role that will be assigned as the parent of the role that wants to persist.

role Carbon.App.Roles.Class

The appRole that wants to persist.

slug string

The slug where the role will be persisted.

requestOptions Carbon.HTTP.Request.Options

The slug where the role will be persisted.



createChild( parentRole:string | Carbon.Pointer.Class, role:Carbon.App.Roles.Class, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ Carbon.Pointer.Class, [ Carbon.HTTP.Response.Class, Carbon.HTTP.Response.Class] ]>

Persists the AppRole provided as a childRole of the parentRole specified. Returns a Promise with a Pointer for the stored role; and a tuple of two responses, the first one is the response of the creation, and the second one is the response of the creation of the relation parent-child of the roles.


Param Type Default Description
parentRole string | Carbon.Pointer.Class

The role that will be assigned as the parent of the role that wants to persist.

role Carbon.App.Roles.Class

The appRole that wants to persist.

requestOptions Carbon.HTTP.Request.Options

The slug where the role will be persisted.



.get()
: Promise<[ Carbon.PersistedRole.Class, Carbon.HTTP.Response.Class ]>


get( roleURI:string, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ Carbon.PersistedRole.Class, Carbon.HTTP.Response.Class ]>

Retrieves a role from the current context.


Param Type Default Description
roleURI string

The URI of the app role to retrieve.

requestOptions Carbon.HTTP.Request.Options




Carbon/Apps
Module

Default Export:



Class for managing Carbon Apps.


Constructor


Class( context:Carbon.Context.Class )

Param Type Default Description
context Carbon.Context.Class

A context from where Carbon Apps can be administrated.


Methods

.create()
: Promise<[ Carbon.Pointer.Class, Carbon.HTTP.Response.Class ]>


create( appDocument:Carbon.App.Class, slug:string ):Promise<[ Carbon.Pointer.Class, Carbon.HTTP.Response.Class ]>

Persists a Carbon.App.Class object using the slug specified. Returns a Promise with a Pointer to the stored App, and the response of the request.


Param Type Default Description
appDocument Carbon.App.Class

App document that will be persisted.

slug string

Slug that will be used for the URI of the new app.



.delete()
: Promise<Carbon.HTTP.Response.Class>


delete( appURI:string, requestOptions:Carbon.HTTP.Request.Options ):Promise<Carbon.HTTP.Response.Class>

Deletes the app specified.


Param Type Default Description
appURI string

The URI of the app to be deleted.

requestOptions Carbon.HTTP.Request.Options


.getAllContexts()
: Promise<Carbon.App.Context[]>


getAllContexts():Promise<Carbon.App.Context[]>

Retrieves an array of Carbon.App.Context objects, of every app the current user have access to.




.getContext()
: Promise<Carbon.App.Context>


getContext( uri:string ):Promise<Carbon.App.Context>

Retrieves a Carbon.App.Context object from the specified app's URI.


Param Type Default Description
uri string

URI of the app to retrieve and create its context.



getContext( pointer:Carbon.Pointer.Class ):Promise<Carbon.App.Context>

Retrieves a Carbon.App.Context object from the specified app's Pointer.


Param Type Default Description
pointer Carbon.Pointer.Class

Pointer of the app to retrieve and create its context.





Default Export:

Classes and Interfaces in the Module

I
Carbon.App.Role.Class
Specific interface that represents an in memory role for an application.
C

Properties




Specific interface that represents an in memory role for an application.





Factory class for Carbon.App.Role.Class objects


Methods

#create()
: Carbon.App.Role.Class


create( name:string ):Carbon.App.Role.Class

Create a Carbon.App.Role.Class object with the specified name.


Param Type Default Description
name string


#createFrom()
: T & Carbon.App.Role.Class


createFrom( object:T extends Object, name:string ):T & Carbon.App.Role.Class

Create a Carbon.App.Role.Class object with the object provided and its name.


Param Type Default Description
object T extends Object
name string


#hasClassProperties()
: boolean


hasClassProperties( resource:Object ):boolean

Returns true if the object provided has the properties that defines a Carbon.App.Role.Class object


Param Type Default Description
resource Object


#is()
: boolean


is( object:Object ):boolean

Returns true if the object provided is considered a Carbon.App.Role.Class object


Param Type Default Description
object Object




Carbon/Auth
Module

Default Export:

Classes and Interfaces in the Module

C
Carbon.Auth.Class
Abstract class that manages authentications and authorizations of a context.

Reexports


.Method
: enum

Enum with the methods of authentication supported by CarbonLDP.

Enumeration Description
Carbon.Auth.Method.BASIC

HTTP Basic authentication sending the username and password in every call.

Carbon.Auth.Method.TOKEN

Authentication with username and password generating a token that will be sent in every call.




Abstract class that manages authentications and authorizations of a context.


Constructor


Class( context:Carbon.Context.Class )

Param Type Default Description
context Carbon.Context.Class

Properties

.agents
: Carbon.Auth.Agents.Class

Instance of Carbon.Auth.Agents.Class that helps you manage the agents of the current context.


.authenticatedAgent
: Carbon.Auth.PersistedAgent.Class

The agent of the user that has been authenticated. If no authentication exists in the current context, it will ask to it's parent context. Returns null if the user it not authenticated.


.roles
: Carbon.Auth.Roles.Class

Instance of a implementation of the Carbon.Auth.Roles.Class abstract class, that help managing the roles of the current context. In this class the property is set to null, and implementations of this class set it to their respective role model using a valid instance of Carbon.Auth.Roles.Class.


Methods

.addAuthentication()
: void


addAuthentication( options:Carbon.HTTP.Request.Options ):void

Adds the authentication header to a Carbon.HTTP.Request.Options object.


Param Type Default Description
options Carbon.HTTP.Request.Options


.authenticate()
: Promise<Carbon.Auth.Token.Class>


authenticate( username:string, password:string ):Promise<Carbon.Auth.Token.Class>

Authenticate the user with a username and password. Uses the TOKEN method for the authentication.


Param Type Default Description
username string
password string


.authenticateUsing()
: Promise<Carbon.Auth.UsernameAndPasswordCredentials.Class>


authenticateUsing( method:'BASIC', username:string, password:string ):Promise<Carbon.Auth.UsernameAndPasswordCredentials.Class>

Authenticates the user with Basic HTTP Authentication, which uses an encoded string with username and password in every request.


Param Type Default Description
method 'BASIC'
username string
password string


authenticateUsing( method:'TOKEN', username:string, password:string ):Promise<Carbon.Auth.Token.Class>

Authenticates the user with a username and password, and generates a JSON Web Token (JWT) credential that will be used in every request.


Param Type Default Description
method 'TOKEN'
username string
password string


authenticateUsing( method:'TOKEN', token:Carbon.Auth.Token.Class ):Promise<Carbon.Auth.Token.Class>

Authenticates the user with a Carbon.Auth.Token.Class, which contains a JSON Web Token (JWT) that will be used in every request.


Param Type Default Description
method 'TOKEN'
token Carbon.Auth.Token.Class


.clearAuthentication()
: void


clearAuthentication():void

Deletes the authentication of the current instance.




.createTicket()
: Promise<[ Carbon.Auth.Ticket.Class, Carbon.HTTP.Response.Class ]>


createTicket( uri:string, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ Carbon.Auth.Ticket.Class, Carbon.HTTP.Response.Class ]>

Retrieves an authentication ticket for the URI specified.


Param Type Default Description
uri string

The URI to get an authentication ticket for.

requestOptions Carbon.HTTP.Request.Options


.getAuthenticatedURL()
: Promise<string>


getAuthenticatedURL( uri:string, requestOptions?:Carbon.HTTP.Request.Options ):Promise<string>

Returns a Promise with a one time use only authenticated URI.


Param Type Default Description
uri string

The URI to generate an authenticated URI for.

requestOptions Carbon.HTTP.Request.Options


.isAuthenticated()
: boolean


isAuthenticated( askParent?:boolean ):boolean

Returns true if the user is authenticated.


Param Type Default Description
askParent boolean true




Classes and Interfaces in the Module

I
Carbon.Auth.PersistedACE.Class
Interface that represents a persisted Access Control Entry (ACE) of a persisted Access Control List (ACL).




Interface that represents a persisted Access Control Entry (ACE) of a persisted Access Control List (ACL).


Properties

.document
: Carbon.Auth.PersistedACL.Class

Reference to the persisted ACL where the current ACE belongs.





Default Export:

Classes and Interfaces in the Module

I
Carbon.Auth.ACL.Class
Interface that represents an in-memory Access Control List (ACL).
C
Carbon.Auth.ACL.Factory
Factory class for Carbon.Auth.ACL.Class objects.

Properties




Interface that represents an in-memory Access Control List (ACL).


Properties

.accessTo
: Carbon.Pointer.Class

Reference to the document the ACL belongs.


.entries
: Carbon.Auth.ACE.Class[]

Array of ACEs that only grants or denies permissions of the document the ACL belongs.


.inheritableEntries
: Carbon.Auth.ACE.Class[]

Array of ACEs that grants or denies permissions of the document's children the ACL belongs.


Methods

._parsePointer()
: Carbon.Pointer.Class


_parsePointer( element:string | Carbon.Pointer.Class ):Carbon.Pointer.Class

(Internal) Function that parse string URIs to pointers.


Param Type Default Description
element string | Carbon.Pointer.Class

The URI string o pointer to convert into pointer.



.configureChildInheritance()
: void


configureChildInheritance( granting:boolean, subject:string | Carbon.Pointer.Class, subjectClass:string | Carbon.Pointer.Class, permission:string | Carbon.Pointer.Class ):void

Configures the permission specified to the subject provided either granting or denying it for the children of the document related to the ACL.


Param Type Default Description
granting boolean

Boolean to indicate if the permission will be granted o denied.

subject string | Carbon.Pointer.Class

The subject which will be assigned the permission specified.

subjectClass string | Carbon.Pointer.Class

The type of subject provided.

permission string | Carbon.Pointer.Class

The permission that will be granted to the subject specified.



configureChildInheritance( granting:boolean, subject:string | Carbon.Pointer.Class, subjectClass:string | Carbon.Pointer.Class, permissions:(string | Carbon.Pointer.Class)[] ):void

Configure several permissions to the subject provided either granting or denying them for the children of the document related to the ACL.


Param Type Default Description
granting boolean

Boolean to indicate if the permission will be granted o denied.

subject string | Carbon.Pointer.Class

The subject which will be assigned the permission specified.

subjectClass string | Carbon.Pointer.Class

The type of subject provided.

permissions (string | Carbon.Pointer.Class)[]

The permissions that will be granted to the subject specified.



configureChildInheritance( granting:boolean, subjects:(string | Carbon.Pointer.Class)[], subjectClass:string | Carbon.Pointer.Class, permission:string | Carbon.Pointer.Class ):void

Configure the permission specified to the every subject provided either granting or denying it for the children of the document related to the ACL.


Param Type Default Description
granting boolean

Boolean to indicate if the permission will be granted o denied.

subjects (string | Carbon.Pointer.Class)[]

The subjects which will be assigned the every permissions specified.

subjectClass string | Carbon.Pointer.Class

The type of subjects provided.

permission string | Carbon.Pointer.Class

The permission that will be granted to the every subject.



configureChildInheritance( granting:boolean, subjects:(string | Carbon.Pointer.Class)[], subjectClass:string | Carbon.Pointer.Class, permissions:(string | Carbon.Pointer.Class)[] ):void

Configure several permissions to the every subject provided either granting or denying them for the children of the document related to the ACL.


Param Type Default Description
granting boolean

Boolean to indicate if the permission will be granted o denied.

subjects (string | Carbon.Pointer.Class)[]

The subjects which will be assigned the every permissions specified.

subjectClass string | Carbon.Pointer.Class

The type of subjects provided.

permissions (string | Carbon.Pointer.Class)[]

The permissions that will be granted to the every subject.



.denies()
: boolean


denies( subject:string | Carbon.Pointer.Class, permission:string | Carbon.Pointer.Class ):boolean

Returns true if the subject has a configuration where it denies the permission specified for the document related to de ACL. Returns null if no configuration of the subject and permission exists in the ACL.


Param Type Default Description
subject string | Carbon.Pointer.Class

The subject to look for its configuration.

permission string | Carbon.Pointer.Class

The permission to check if it has a granting configuration.



.deny()
: void


deny( subject:string | Carbon.Pointer.Class, subjectClass:string | Carbon.Pointer.Class, permission:string | Carbon.Pointer.Class ):void

Grant the permission specified to the subject provided for the document related to the ACL.


Param Type Default Description
subject string | Carbon.Pointer.Class

The subject which will be assigned the permission specified.

subjectClass string | Carbon.Pointer.Class

The type of subject provided.

permission string | Carbon.Pointer.Class

The permission that will be granted to the subject specified.



deny( subject:string | Carbon.Pointer.Class, subjectClass:string | Carbon.Pointer.Class, permissions:(string | Carbon.Pointer.Class)[] ):void

Grant several permissions to the subject provided for the document related to the ACL.


Param Type Default Description
subject string | Carbon.Pointer.Class

The subject which will be assigned the permission specified.

subjectClass string | Carbon.Pointer.Class

The type of subject provided.

permissions (string | Carbon.Pointer.Class)[]

The permissions that will be granted to the subject specified.



deny( subjects:(string | Carbon.Pointer.Class)[], subjectClass:string | Carbon.Pointer.Class, permission:string | Carbon.Pointer.Class ):void

Grant the permission specified to the every subject provided for the document related to the ACL.


Param Type Default Description
subjects (string | Carbon.Pointer.Class)[]

The subjects which will be assigned the every permissions specified.

subjectClass string | Carbon.Pointer.Class

The type of subjects provided.

permission string | Carbon.Pointer.Class

The permission that will be granted to the every subject.



deny( subjects:(string | Carbon.Pointer.Class)[], subjectClass:string | Carbon.Pointer.Class, permissions:(string | Carbon.Pointer.Class)[] ):void

Grant several permissions to the every subject provided for the document related to the ACL.


Param Type Default Description
subjects (string | Carbon.Pointer.Class)[]

The subjects which will be assigned the every permissions specified.

subjectClass string | Carbon.Pointer.Class

The type of subjects provided.

permissions (string | Carbon.Pointer.Class)[]

The permissions that will be granted to the every subject.



.getChildInheritance()
: boolean


getChildInheritance( subject:string | Carbon.Pointer.Class, permission:string | Carbon.Pointer.Class ):boolean

Returns if grants or denies a configuration of the subject and the permission specified for the children of document related to de ACL. Returns null if no configuration of the subject and permission exists in the ACL.


Param Type Default Description
subject string | Carbon.Pointer.Class

The subject to look for its configuration.

permission string | Carbon.Pointer.Class

The permission to check if it has a granting configuration.



.grant()
: void


grant( subject:string | Carbon.Pointer.Class, subjectClass:string | Carbon.Pointer.Class, permission:string | Carbon.Pointer.Class ):void

Grant the permission specified to the subject provided for the document related to the ACL.


Param Type Default Description
subject string | Carbon.Pointer.Class

The subject which will be assigned the permission specified.

subjectClass string | Carbon.Pointer.Class

The type of subject provided.

permission string | Carbon.Pointer.Class

The permission that will be granted to the subject specified.



grant( subject:string | Carbon.Pointer.Class, subjectClass:string | Carbon.Pointer.Class, permissions:(string | Carbon.Pointer.Class)[] ):void

Grant several permissions to the subject provided for the document related to the ACL.


Param Type Default Description
subject string | Carbon.Pointer.Class

The subject which will be assigned the permission specified.

subjectClass string | Carbon.Pointer.Class

The type of subject provided.

permissions (string | Carbon.Pointer.Class)[]

The permissions that will be granted to the subject specified.



grant( subjects:(string | Carbon.Pointer.Class)[], subjectClass:string | Carbon.Pointer.Class, permission:string | Carbon.Pointer.Class ):void

Grant the permission specified to the every subject provided for the document related to the ACL.


Param Type Default Description
subjects (string | Carbon.Pointer.Class)[]

The subjects which will be assigned the every permissions specified.

subjectClass string | Carbon.Pointer.Class

The type of subjects provided.

permission string | Carbon.Pointer.Class

The permission that will be granted to the every subject.



grant( subjects:(string | Carbon.Pointer.Class)[], subjectClass:string | Carbon.Pointer.Class, permissions:(string | Carbon.Pointer.Class)[] ):void

Grant several permissions to the every subject provided for the document related to the ACL.


Param Type Default Description
subjects (string | Carbon.Pointer.Class)[]

The subjects which will be assigned the every permissions specified.

subjectClass string | Carbon.Pointer.Class

The type of subjects provided.

permissions (string | Carbon.Pointer.Class)[]

The permissions that will be granted to the every subject.



.grants()
: boolean


grants( subject:string | Carbon.Pointer.Class, permission:string | Carbon.Pointer.Class ):boolean

Returns true if the subject has a configuration where it grants the permission specified for the document related to de ACL. Returns null if no configuration of the subject and permission exists in the ACL.


Param Type Default Description
subject string | Carbon.Pointer.Class

The subject to look for its configuration.

permission string | Carbon.Pointer.Class

The permission to check if it has a granting configuration.



.remove()
: void


remove( subject:string | Carbon.Pointer.Class, permission:string | Carbon.Pointer.Class ):void

Remove the configuration of a permission from a subject for the document related to the ACL.


Param Type Default Description
subject string | Carbon.Pointer.Class

The subject from will be removed the permission.

permission string | Carbon.Pointer.Class

The permission to remove from the subject configuration.



remove( subject:string | Carbon.Pointer.Class, permissions:(string | Carbon.Pointer.Class)[] ):void

Remove the configuration of several permissions from a subject for the document related to the ACL.


Param Type Default Description
subject string | Carbon.Pointer.Class

The subject from will removed the permission.

permissions (string | Carbon.Pointer.Class)[]

The permissions to remove from the subject configuration.



.removeChildInheritance()
: void


removeChildInheritance( subject:string | Carbon.Pointer.Class, permission:string | Carbon.Pointer.Class ):void

Remove the configuration of a permission from a subject for the children of the document related to the ACL.


Param Type Default Description
subject string | Carbon.Pointer.Class

The subject from will be removed the permission.

permission string | Carbon.Pointer.Class

The permission to remove from the subject configuration.





Factory class for Carbon.Auth.ACL.Class objects.


Methods

#decorate()
: T & Carbon.Auth.ACl.Class


decorate<T extends Object>( object:T ):T & Carbon.Auth.ACl.Class

Decorate the object with the methods o a Carbon.Auth.ACL.Class object.


Param Type Default Description
object T

The object to decorate.



#hasClassProperties()
: boolean


hasClassProperties( object:Object ):boolean

Return true if the object provided has the properties and methods of a Carbon.Auth.ACL.Class object.


Param Type Default Description
object Object

The object to analise.








Interface that represents an in-memory Agent of any Context.


Properties

.email
: string

The email of the agent.


.name
: string

The name of the agent.


.password
: string

The password of the agent.





Factory class for Carbon.Auth.Agent.Class objects.


Methods

#create()
: Carbon.Auth.Agent.Class


create( name:string, email:string, password:string ):Carbon.Auth.Agent.Class

Creates a Carbon.Auth.Agent.Class object with the name and email specified.


Param Type Default Description
name string

Name of the agent to be created.

email string

Email of the agent to be created.

password string

Password of the agent to be created.



#createFrom()
: T & Carbon.Auth.Agent.Class


createFrom<T extends Object>( object:T, name:string, email:string, password:string ):T & Carbon.Auth.Agent.Class

Creates a Carbon.Auth.Agent.Class object from the object and parameters specified.


Param Type Default Description
object T

Object that will be converted into an Agent.

name string

Name of the agent to be created.

email string

Email of the agent to be created.

password string

Password of the agent to be created.



#hasClassProperties()
: boolean


hasClassProperties( object:Object ):boolean

Returns true if the object provided has the properties that defines a Carbon.Auth.Agent.Class object.


Param Type Default Description
object Object


#is()
: boolean


is( object:Object ):boolean

Returns true if the object provided is considered a Carbon.Auth.Agent.Class object.


Param Type Default Description
object Object




Default Export:

Classes and Interfaces in the Module

C
Carbon.Auth.Agents.Class
Abstract class for manage Agents of a determined context.




Abstract class for manage Agents of a determined context.


Constructor


Class( context:Carbon.Context.Class )

Param Type Default Description
context Carbon.Context.Class

The context where to manage its Agents.


Methods

.delete()
: Promise<[ Carbon.Auth.PersistedAgent.Class, Carbon.HTTP.Response.Class ]>


delete( agentURI:string, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ Carbon.Auth.PersistedAgent.Class, Carbon.HTTP.Response.Class ]>

Deletes the agent specified.


Param Type Default Description
agentURI string

The URI of the agent to be deleted.

requestOptions Carbon.HTTP.Request.Options


.disable()
: Promise<[ Carbon.Auth.PersistedAgent.Class, [ Carbon.HTTP.Response.Class, Carbon.HTTP.Response.Class ] ]>


disable( agentURI:string, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ Carbon.Auth.PersistedAgent.Class, [ Carbon.HTTP.Response.Class, Carbon.HTTP.Response.Class ] ]>

Deactivate the account of the agent specified.


Param Type Default Description
agentURI string

The URI of the agent to be deactivated.

requestOptions Carbon.HTTP.Request.Options


.enable()
: Promise<[ Carbon.Auth.PersistedAgent.Class, [ Carbon.HTTP.Response.Class, Carbon.HTTP.Response.Class ] ]>


enable( agentURI:string, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ Carbon.Auth.PersistedAgent.Class, [ Carbon.HTTP.Response.Class, Carbon.HTTP.Response.Class ] ]>

Activate the account of the agent specified.


Param Type Default Description
agentURI string

The URI of the agent to be activated.

requestOptions Carbon.HTTP.Request.Options


.get()
: Promise<[ Carbon.Auth.PersistedAgent.Class, Carbon.HTTP.Response.Class ]>


get( agentURI:string, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ Carbon.Auth.PersistedAgent.Class, Carbon.HTTP.Response.Class ]>

Retrieves the agent specified from the current context.


Param Type Default Description
agentURI string

The URI of the agent to retrieve.

requestOptions Carbon.HTTP.Request.Options


.register()
: Promise<Carbon.Pointer.Class, Carbon.HTTP.Response.Class>


register( agentDocument:Carbon.Auth.Agent.Class, slug?:string ):Promise<Carbon.Pointer.Class, Carbon.HTTP.Response.Class>

Persists a Carbon.Auth.Agent.Class object using the slug specified. Returns a Promise with a Pointer to the stored Agent, and the response of the request.


Param Type Default Description
agentDocument Carbon.Auth.Agent.Class
slug string







Interface that represents the base of an authentication token.





Classes and Interfaces in the Module

I
Carbon.Auth.Authenticator.Class
Interface that represents the base of an authentication token.




Interface that represents the base of an authentication token.


Methods

.addAuthentication()
: Carbon.HTTP.Request.Options


addAuthentication( requestOptions:Carbon.HTTP.Request.Options ):Carbon.HTTP.Request.Options

If the authenticator is authenticated, it adds an authentication header in the request options object provided.


Param Type Default Description
requestOptions Carbon.HTTP.Request.Options

The request options object where to add the authentication header.



.authenticate()
: Promise<Carbon.Auth.Credentials.Class>


authenticate( authenticationToken:T ):Promise<Carbon.Auth.Credentials.Class>

Performs an authentication and stores the credentials for future use.


Param Type Default Description
authenticationToken T

The token that will be used to perform the authentication.



.clearAuthentication()
: void


clearAuthentication():void

Removes the stored credentials of any.




.isAuthenticated()
: boolean


isAuthenticated():boolean

Returns if its authenticated by checking the stored credentials within.









Authenticates requests using HTTP Basic Authentication.


Constructor


Class()


Methods

.addAuthentication()
: Carbon.HTTP.Request.Options


addAuthentication( requestOptions:Carbon.HTTP.Request.Options ):Carbon.HTTP.Request.Options

Adds the Basic authentication header to the passed request options object. The Carbon.HTTP.Request.Options provided is returned without modifications if it already has an authentication header.


Param Type Default Description
requestOptions Carbon.HTTP.Request.Options

Request options object to add Authentication headers.



.authenticate()
: Promise< Carbon.Auth.UsernameAndPasswordCredentials.Class >


authenticate( authenticationToken:Carbon.Auth.UsernameAndPasswordToken ):Promise< Carbon.Auth.UsernameAndPasswordCredentials.Class >

Stores credentials to authenticate future requests.


Param Type Default Description
authenticationToken Carbon.Auth.UsernameAndPasswordToken


.clearAuthentication()
: void


clearAuthentication():void

Clears any saved credentials and restores the Authenticator to its initial state.




.isAuthenticated()
: boolean


isAuthenticated():boolean

Returns true if the instance contains stored credentials.






Classes and Interfaces in the Module

I
Carbon.Auth.Credentials.Class
Interface that represents the base of a credentials object.




Interface that represents the base of a credentials object.





Classes and Interfaces in the Module

I
Carbon.Auth.PersistedACL.Class
Interface that represents a persisted Access Control List (ACL).




Interface that represents a persisted Access Control List (ACL).


Properties

.accessTo
: Carbon.Pointer.Class

Reference to the document the ACL belongs.


.entries
: Carbon.Auth.PersistedACE.Class[]

Array of persisted ACEs that only grants or denies permissions of the document the ACL belongs.


.inheritableEntries
: Carbon.Auth.PersistedACE.Class[]

Array of persisted ACEs that grants or denies permissions of the document's children the ACL belongs.


Methods

._parsePointer()
: Carbon.Pointer.Class


_parsePointer( element:string | Carbon.Pointer.Class ):Carbon.Pointer.Class

(Internal) Function that parse string URIs to pointers.


Param Type Default Description
element string | Carbon.Pointer.Class

The URI string o pointer to convert into pointer.



.configureChildInheritance()
: void


configureChildInheritance( granting:boolean, subject:string | Carbon.Pointer.Class, subjectClass:string | Carbon.Pointer.Class, permission:string | Carbon.Pointer.Class ):void

Configures the permission specified to the subject provided either granting or denying it for the children of the document related to the ACL.


Param Type Default Description
granting boolean

Boolean to indicate if the permission will be granted o denied.

subject string | Carbon.Pointer.Class

The subject which will be assigned the permission specified.

subjectClass string | Carbon.Pointer.Class

The type of subject provided.

permission string | Carbon.Pointer.Class

The permission that will be granted to the subject specified.



configureChildInheritance( granting:boolean, subject:string | Carbon.Pointer.Class, subjectClass:string | Carbon.Pointer.Class, permissions:(string | Carbon.Pointer.Class)[] ):void

Configure several permissions to the subject provided either granting or denying them for the children of the document related to the ACL.


Param Type Default Description
granting boolean

Boolean to indicate if the permission will be granted o denied.

subject string | Carbon.Pointer.Class

The subject which will be assigned the permission specified.

subjectClass string | Carbon.Pointer.Class

The type of subject provided.

permissions (string | Carbon.Pointer.Class)[]

The permissions that will be granted to the subject specified.



configureChildInheritance( granting:boolean, subjects:(string | Carbon.Pointer.Class)[], subjectClass:string | Carbon.Pointer.Class, permission:string | Carbon.Pointer.Class ):void

Configure the permission specified to the every subject provided either granting or denying it for the children of the document related to the ACL.


Param Type Default Description
granting boolean

Boolean to indicate if the permission will be granted o denied.

subjects (string | Carbon.Pointer.Class)[]

The subjects which will be assigned the every permissions specified.

subjectClass string | Carbon.Pointer.Class

The type of subjects provided.

permission string | Carbon.Pointer.Class

The permission that will be granted to the every subject.



configureChildInheritance( granting:boolean, subjects:(string | Carbon.Pointer.Class)[], subjectClass:string | Carbon.Pointer.Class, permissions:(string | Carbon.Pointer.Class)[] ):void

Configure several permissions to the every subject provided either granting or denying them for the children of the document related to the ACL.


Param Type Default Description
granting boolean

Boolean to indicate if the permission will be granted o denied.

subjects (string | Carbon.Pointer.Class)[]

The subjects which will be assigned the every permissions specified.

subjectClass string | Carbon.Pointer.Class

The type of subjects provided.

permissions (string | Carbon.Pointer.Class)[]

The permissions that will be granted to the every subject.



.denies()
: boolean


denies( subject:string | Carbon.Pointer.Class, permission:string | Carbon.Pointer.Class ):boolean

Returns true if the subject has a configuration where it denies the permission specified for the document related to de ACL. Returns null if no configuration of the subject and permission exists in the ACL.


Param Type Default Description
subject string | Carbon.Pointer.Class

The subject to look for its configuration.

permission string | Carbon.Pointer.Class

The permission to check if it has a granting configuration.



.deny()
: void


deny( subject:string | Carbon.Pointer.Class, subjectClass:string | Carbon.Pointer.Class, permission:string | Carbon.Pointer.Class ):void

Grant the permission specified to the subject provided for the document related to the ACL.


Param Type Default Description
subject string | Carbon.Pointer.Class

The subject which will be assigned the permission specified.

subjectClass string | Carbon.Pointer.Class

The type of subject provided.

permission string | Carbon.Pointer.Class

The permission that will be granted to the subject specified.



deny( subject:string | Carbon.Pointer.Class, subjectClass:string | Carbon.Pointer.Class, permissions:(string | Carbon.Pointer.Class)[] ):void

Grant several permissions to the subject provided for the document related to the ACL.


Param Type Default Description
subject string | Carbon.Pointer.Class

The subject which will be assigned the permission specified.

subjectClass string | Carbon.Pointer.Class

The type of subject provided.

permissions (string | Carbon.Pointer.Class)[]

The permissions that will be granted to the subject specified.



deny( subjects:(string | Carbon.Pointer.Class)[], subjectClass:string | Carbon.Pointer.Class, permission:string | Carbon.Pointer.Class ):void

Grant the permission specified to the every subject provided for the document related to the ACL.


Param Type Default Description
subjects (string | Carbon.Pointer.Class)[]

The subjects which will be assigned the every permissions specified.

subjectClass string | Carbon.Pointer.Class

The type of subjects provided.

permission string | Carbon.Pointer.Class

The permission that will be granted to the every subject.



deny( subjects:(string | Carbon.Pointer.Class)[], subjectClass:string | Carbon.Pointer.Class, permissions:(string | Carbon.Pointer.Class)[] ):void

Grant several permissions to the every subject provided for the document related to the ACL.


Param Type Default Description
subjects (string | Carbon.Pointer.Class)[]

The subjects which will be assigned the every permissions specified.

subjectClass string | Carbon.Pointer.Class

The type of subjects provided.

permissions (string | Carbon.Pointer.Class)[]

The permissions that will be granted to the every subject.



.getChildInheritance()
: boolean


getChildInheritance( subject:string | Carbon.Pointer.Class, permission:string | Carbon.Pointer.Class ):boolean

Returns if grants or denies a configuration of the subject and the permission specified for the children of document related to de ACL. Returns null if no configuration of the subject and permission exists in the ACL.


Param Type Default Description
subject string | Carbon.Pointer.Class

The subject to look for its configuration.

permission string | Carbon.Pointer.Class

The permission to check if it has a granting configuration.



.grant()
: void


grant( subject:string | Carbon.Pointer.Class, subjectClass:string | Carbon.Pointer.Class, permission:string | Carbon.Pointer.Class ):void

Grant the permission specified to the subject provided for the document related to the ACL.


Param Type Default Description
subject string | Carbon.Pointer.Class

The subject which will be assigned the permission specified.

subjectClass string | Carbon.Pointer.Class

The type of subject provided.

permission string | Carbon.Pointer.Class

The permission that will be granted to the subject specified.



grant( subject:string | Carbon.Pointer.Class, subjectClass:string | Carbon.Pointer.Class, permissions:(string | Carbon.Pointer.Class)[] ):void

Grant several permissions to the subject provided for the document related to the ACL.


Param Type Default Description
subject string | Carbon.Pointer.Class

The subject which will be assigned the permission specified.

subjectClass string | Carbon.Pointer.Class

The type of subject provided.

permissions (string | Carbon.Pointer.Class)[]

The permissions that will be granted to the subject specified.



grant( subjects:(string | Carbon.Pointer.Class)[], subjectClass:string | Carbon.Pointer.Class, permission:string | Carbon.Pointer.Class ):void

Grant the permission specified to the every subject provided for the document related to the ACL.


Param Type Default Description
subjects (string | Carbon.Pointer.Class)[]

The subjects which will be assigned the every permissions specified.

subjectClass string | Carbon.Pointer.Class

The type of subjects provided.

permission string | Carbon.Pointer.Class

The permission that will be granted to the every subject.



grant( subjects:(string | Carbon.Pointer.Class)[], subjectClass:string | Carbon.Pointer.Class, permissions:(string | Carbon.Pointer.Class)[] ):void

Grant several permissions to the every subject provided for the document related to the ACL.


Param Type Default Description
subjects (string | Carbon.Pointer.Class)[]

The subjects which will be assigned the every permissions specified.

subjectClass string | Carbon.Pointer.Class

The type of subjects provided.

permissions (string | Carbon.Pointer.Class)[]

The permissions that will be granted to the every subject.



.grants()
: boolean


grants( subject:string | Carbon.Pointer.Class, permission:string | Carbon.Pointer.Class ):boolean

Returns true if the subject has a configuration where it grants the permission specified for the document related to de ACL. Returns null if no configuration of the subject and permission exists in the ACL.


Param Type Default Description
subject string | Carbon.Pointer.Class

The subject to look for its configuration.

permission string | Carbon.Pointer.Class

The permission to check if it has a granting configuration.



.remove()
: void


remove( subject:string | Carbon.Pointer.Class, permission:string | Carbon.Pointer.Class ):void

Remove the configuration of a permission from a subject for the document related to the ACL.


Param Type Default Description
subject string | Carbon.Pointer.Class

The subject from will be removed the permission.

permission string | Carbon.Pointer.Class

The permission to remove from the subject configuration.



remove( subject:string | Carbon.Pointer.Class, permissions:(string | Carbon.Pointer.Class)[] ):void

Remove the configuration of several permissions from a subject for the document related to the ACL.


Param Type Default Description
subject string | Carbon.Pointer.Class

The subject from will removed the permission.

permissions (string | Carbon.Pointer.Class)[]

The permissions to remove from the subject configuration.



.removeChildInheritance()
: void


removeChildInheritance( subject:string | Carbon.Pointer.Class, permission:string | Carbon.Pointer.Class ):void

Remove the configuration of a permission from a subject for the children of the document related to the ACL.


Param Type Default Description
subject string | Carbon.Pointer.Class

The subject from will be removed the permission.

permission string | Carbon.Pointer.Class

The permission to remove from the subject configuration.





Factory class for Carbon.Auth.PersistedACL.Class objects.


Methods

#decorate()
: T & Carbon.Auth.PersistedACL.Class


decorate<T extends Carbon.PersistedDocument.Class>( document:T ):T & Carbon.Auth.PersistedACL.Class

Decorate the object with the properties and methods of a Carbon.Auth.PersistedACL.Class object.


Param Type Default Description
document T

The persisted document to decorate.



#hasClassProperties()
: boolean


hasClassProperties( object:Object ):boolean

Return true if the object provided has the properties and methods of a Carbon.Auth.PersistedACL.Class object.


Param Type Default Description
object Object

The object to analise.





Classes and Interfaces in the Module

I
Carbon.Auth.PersistedAgent.Class
Interface that represents the base of a persisted Agent in any context.




Interface that represents the base of a persisted Agent in any context.


Properties

.email
: string

The email of he current Agent.


.enabled
: boolean

Flag that indicates if the current agent has been activated o not.


.name
: string

The name of he current Agent.


.password
: string

Property that represents the password of the agent. This property is not retrieved but you can change the current password by setting a new one here and saving it.


Methods

.disable()
: Promise<[ Carbon.Auth.PersistedAgent.Class, Carbon.HTTP.Response.Class ]>


disable():Promise<[ Carbon.Auth.PersistedAgent.Class, Carbon.HTTP.Response.Class ]>

Deactivate the account of the agent.




.enable()
: Promise<[ Carbon.Auth.PersistedAgent.Class, Carbon.HTTP.Response.Class ]>


enable():Promise<[ Carbon.Auth.PersistedAgent.Class, Carbon.HTTP.Response.Class ]>

Activate the account of the agent.






Factory class for Carbon.Auth.PersistedAgent.Class objects.


Methods

#decorate()
: T & Carbon.Auth.PersistedAgent.Class


decorate<T extends Carbon.PersistedDocument.Class>( object:T ):T & Carbon.Auth.PersistedAgent.Class

Decorates the object provided with the properties and methods of a Carbon.Auth.PersistedAgent.Class object.


Param Type Default Description
object T

The object to decorate.



#hasClassProperties()
: boolean


hasClassProperties( object:Object ):boolean

Returns true if the object provided has the properties of a Carbon.Auth.PersistedAgent.Class object.


Param Type Default Description
object Object


#is()
: boolean


is( object:Object ):boolean

Returns true if the object provided is considered a Carbon.Auth.PersistedAgent.Class object.


Param Type Default Description
object Object




Classes and Interfaces in the Module

I
Carbon.App.PersistedRole.Class
Specific interface that represents a persisted role of an application.




Specific interface that represents a persisted role of an application.


Properties

._roles
: Carbon.Auth.Roles.Class

(Internal) Instance of an implementation of the Roles abstract class that manage the current role.


.agents
: Carbon.Pointer.Class[]

An array of pointers that references to all the agents that have the current role.


.name
: string

A name that describes the current role.


Methods

.addAgent()
: Promise<Carbon.HTTP.Response.Class>


addAgent( agent:string | Carbon.Pointer.Class, requestOptions?:Carbon.HTTP.Request.Options ):Promise<Carbon.HTTP.Response.Class>

Makes a relation in the role towards the agents specified.


Param Type Default Description
agent string | Carbon.Pointer.Class

The agents that wants to add to the role.

requestOptions Carbon.HTTP.Request.Options


.addAgents()
: Promise<Carbon.HTTP.Response.Class>


addAgents( agents:(string | Carbon.Pointer.Class)[], requestOptions?:Carbon.HTTP.Request.Options ):Promise<Carbon.HTTP.Response.Class>

Makes a relation in the role towards the agents specified.


Param Type Default Description
agents (string | Carbon.Pointer.Class)[]

An array with strings or Pointers that refers to the agents that wants to add to the role.

requestOptions Carbon.HTTP.Request.Options


.createChild()
: Promise<[ T & Carbon.Auth.PersistedRole.Class, Carbon.HTTP.Response.Class ]>


createChild<T extends Carbon.Auth.Roles.Class>( role:T, slug?:string, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ T & Carbon.Auth.PersistedRole.Class, Carbon.HTTP.Response.Class ]>

Persists a new role with the slug specified as a child of the current role.


Param Type Default Description
role T

The role to be persisted.

slug string

The slug that will be used in the child role URI.

requestOptions Carbon.HTTP.Request.Options

Customizable options for the request.



createChild<T extends Carbon.Auth.Roles.Class>( role:T, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ T & Carbon.Auth.PersistedRole.Class, Carbon.HTTP.Response.Class ]>

Persists a new role as a child of the current one.


Param Type Default Description
role T

The role to be persisted.

requestOptions Carbon.HTTP.Request.Options

Customizable options for the request.



.getAgents()
: Promise<[ carbon.Auth.PersistedRole.Class, Carbon.HTTP.Response.Class ]>


getAgents( requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ carbon.Auth.PersistedRole.Class, Carbon.HTTP.Response.Class ]>

Retrieves an array of resolved pointers for all the agents of the role.


Param Type Default Description
requestOptions Carbon.HTTP.Request.Options


getAgents( retrievalPreferences?:Carbon.RetrievalPreferences.Class, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ carbon.Auth.PersistedRole.Class, Carbon.HTTP.Response.Class ]>

Retrieves an array of resolved pointers for the agents of the role, in accordance of the retrievalPreferences provided.


Param Type Default Description
retrievalPreferences Carbon.RetrievalPreferences.Class

An object that specify the retrieval preferences for the request.

requestOptions Carbon.HTTP.Request.Options


.listAgents()
: Promise<[ Carbon.Auth.PersistedRole.Class, Carbon.HTTP.Response.Class ]>


listAgents( requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ Carbon.Auth.PersistedRole.Class, Carbon.HTTP.Response.Class ]>

Retrieves an array of unresolved pointers for all the agents of the role.


Param Type Default Description
requestOptions Carbon.HTTP.Request.Options


.removeAgent()
: Promise<Carbon.HTTP.Response.Class>


removeAgent( agent:string | Carbon.Pointer.Class, requestOptions?:Carbon.HTTP.Request.Options ):Promise<Carbon.HTTP.Response.Class>

Removes the relation in the role towards the agents specified.


Param Type Default Description
agent string | Carbon.Pointer.Class

The agents that wants to be removed from the role.

requestOptions Carbon.HTTP.Request.Options


.removeAgents()
: Promise<Carbon.HTTP.Response.Class>


removeAgents( agents:(string | Carbon.Pointer.Class)[], requestOptions?:Carbon.HTTP.Request.Options ):Promise<Carbon.HTTP.Response.Class>

Remove the relation in the role towards the agents specified.


Param Type Default Description
agents (string | Carbon.Pointer.Class)[]

An array with strings or Pointers that refers to the agents that wants to be removed from the role.

requestOptions Carbon.HTTP.Request.Options




Factory class for Carbon.Auth.PersistedRole.Class objects


Methods

#decorate()
: T & Carbon.Auth.PersistedRole.Class


decorate<T extends Carbon.PersistedDocument.Class>( object:T ):T & Carbon.Auth.PersistedRole.Class

Decorates the object provided with the methods and properties of a Carbon.Auth.PersistedRole.Class object.


Param Type Default Description
object T


#hasClassProperties()
: boolean


hasClassProperties( resource:Object ):boolean

Returns true if the object provided has the properties that defines a Carbon.Auth.PersistedRole.Class object


Param Type Default Description
resource Object


#is()
: boolean


is( object:Object ):boolean

Returns true if the object provided is considered a Carbon.Auth.PersistedRole.Class object


Param Type Default Description
object Object




Default Export:

Classes and Interfaces in the Module

I
Carbon.Auth.Role.Class
Specific interface that represents the base of an in-memory role for any context.
C

Properties




Specific interface that represents the base of an in-memory role for any context.


Properties

.name
: string

A descriptive name for the role.





Factory class for Carbon.Auth.Role.Class objects


Methods

#create()
: Carbon.Auth.Role.Class


create( name:string ):Carbon.Auth.Role.Class

Create a Carbon.Auth.Role.Class object with the name specified.


Param Type Default Description
name string

The name of the role to create.



#createFrom()
: T & Carbon.Auth.Role.Class


createFrom( object:T extends Object ):T & Carbon.Auth.Role.Class

Create a Carbon.Auth.Role.Class object with the object provided.


Param Type Default Description
object T extends Object


#hasClassProperties()
: boolean


hasClassProperties( object:Object ):boolean

Returns true if the object provided has the properties that defines a Carbon.Auth.Role.Class object


Param Type Default Description
object Object


#is()
: boolean


is( object:Object ):boolean

Returns true if the object provided is considered a Carbon.Auth.Role.Class object


Param Type Default Description
object Object




Default Export:

Classes and Interfaces in the Module

C
Carbon.Auth.Roles.Class
Class for manage roles of an application.




Class for manage roles of an application.


Constructor


Class( context:Carbon.Context.Class )

Param Type Default Description
context Carbon.Context.Class

Methods

.addAgent()
: Promise<Carbon.HTTP.Response.Class>


addAgent( roleURI:string, agent:string | Carbon.Pointer.Class, requestOptions?:Carbon.HTTP.Request.Options ):Promise<Carbon.HTTP.Response.Class>

Makes a relation in the role specified towards the agent provided.


Param Type Default Description
roleURI string

The URI of the role where to add the agent.

agent string | Carbon.Pointer.Class

The agent that wants to add to the role.

requestOptions Carbon.HTTP.Request.Options


.addAgents()
: Promise<Carbon.HTTP.Response.Class>


addAgents( roleURI:string, agents:(string | Carbon.Pointer.Class)[], requestOptions?:Carbon.HTTP.Request.Options ):Promise<Carbon.HTTP.Response.Class>

Makes a relation in the role specified towards the agents specified.


Param Type Default Description
roleURI string

The URI of the role where to add agents.

agents (string | Carbon.Pointer.Class)[]

An array with strings or Pointers that refers to the agents that wants to add to the role.

requestOptions Carbon.HTTP.Request.Options


.createChild()
: Promise<[ T & Carbon.Auth.PersistedRole.Class, Carbon.HTTP.Response.Class ]>


createChild<T extends Carbon.Auth.Roles.Class>( parentRole:string | Carbon.Pointer.Class, role:T, slug?:string, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ T & Carbon.Auth.PersistedRole.Class, Carbon.HTTP.Response.Class ]>

Persists the Role provided with the slug, if specified, as a childRole of the parentRole specified. Returns a Promise with a Pointer for the stored role; and a tuple of two responses, the first one is the response of the creation, and the second one is the response of the creation of the relation parent-child of the roles.


Param Type Default Description
parentRole string | Carbon.Pointer.Class

The role that will be assigned as the parent of the role that wants to persist.

role T

The appRole that wants to persist.

slug string

The slug where the role will be persisted.

requestOptions Carbon.HTTP.Request.Options

The slug where the role will be persisted.



createChild<T extends Carbon.Auth.Roles.Class>( parentRole:string | Carbon.Pointer.Class, role:T, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ T & Carbon.Auth.PersistedRole.Class, Carbon.HTTP.Response.Class ]>

Persists the Role provided as a childRole of the parentRole specified. Returns a Promise with a Pointer for the stored role; and a tuple of two responses, the first one is the response of the creation, and the second one is the response of the creation of the relation parent-child of the roles.


Param Type Default Description
parentRole string | Carbon.Pointer.Class

The role that will be assigned as the parent of the role that wants to persist.

role T

The appRole that wants to persist.

requestOptions Carbon.HTTP.Request.Options

The slug where the role will be persisted.



.get()
: Promise<[ T & Carbon.PersistedRole.Class, Carbon.HTTP.Response.Class ]>


get<T>( roleURI:string, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ T & Carbon.PersistedRole.Class, Carbon.HTTP.Response.Class ]>

Retrieves a role from the current context.


Param Type Default Description
roleURI string

The URI of the role to retrieve.

requestOptions Carbon.HTTP.Request.Options


.getAgents()
: Promise<[ (T & Carbon.PersistedDocument.Class)[], Carbon.HTTP.Response.Class ]>


getAgents<T>( roleURI:string, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ (T & Carbon.PersistedDocument.Class)[], Carbon.HTTP.Response.Class ]>

Retrieves an array of resolved pointers for all the agents of the specified role.


Param Type Default Description
roleURI string

The URI of the role to look for its agents.

requestOptions Carbon.HTTP.Request.Options


getAgents<T>( roleURI:string, retrievalPreferences?:Carbon.RetrievalPreferences.Class, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ (T & Carbon.PersistedDocument.Class)[], Carbon.HTTP.Response.Class ]>

Retrieves an array of resolved pointers for the agents of the role, in accordance of the retrievalPreferences provided.


Param Type Default Description
roleURI string

The URI of the role to look for its agents.

retrievalPreferences Carbon.RetrievalPreferences.Class

An object that specify the retrieval preferences for the request.

requestOptions Carbon.HTTP.Request.Options


.listAgents()
: Promise<[ Carbon.PersistedDocument.Class, Carbon.HTTP.Response.Class ]>


listAgents( roleURI:string, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ Carbon.PersistedDocument.Class, Carbon.HTTP.Response.Class ]>

Retrieves an array of unresolved pointers for all the agents of the specified role.


Param Type Default Description
roleURI string

The URI of the role to look for its agents.

requestOptions Carbon.HTTP.Request.Options


.removeAgent()
: Promise<Carbon.HTTP.Response.Class>


removeAgent( roleURI:string, agent:string | Carbon.Pointer.Class, requestOptions?:Carbon.HTTP.Request.Options ):Promise<Carbon.HTTP.Response.Class>

Removes the relation in the role specified towards the agent provided.


Param Type Default Description
roleURI string

The URI of the role from where to remove the agent.

agent string | Carbon.Pointer.Class

The agent that wants to be removed from the role.

requestOptions Carbon.HTTP.Request.Options


.removeAgents()
: Promise<Carbon.HTTP.Response.Class>


removeAgents( roleURI:string, agents:(string | Carbon.Pointer.Class)[], requestOptions?:Carbon.HTTP.Request.Options ):Promise<Carbon.HTTP.Response.Class>

Remove the relation in the role specified towards the agents specified.


Param Type Default Description
roleURI string

The URI of the role from where to remove the agents.

agents (string | Carbon.Pointer.Class)[]

An array with strings or Pointers that refers to the agents to be removed from the role.

requestOptions Carbon.HTTP.Request.Options







Interface that represents an authentication ticket.


Properties

.expirationTime
: Date

The time when the ticket will expire.


.forURI
: Carbon.Pointer.Class

Pointer that relates the document that the authentication ticket only works for.


.ticketKey
: string

The value to provide as the authentication ticket in a request.





Factory class for Carbon.Auth.Ticket.Class objects.


Methods

#create()
: Carbon.Auth.Ticket.Class


create( uri:string ):Carbon.Auth.Ticket.Class

Creates and returns a Carbon.Auth.Ticket.Class object for the specified URI.


Param Type Default Description
uri string

The URI to get an authentication ticket for.








Interface that represents an authentication token for every context.


Properties

.agent
: Carbon.Auth.PersistedAgent.Class

Agent that has been requested the token, and which authentication the token represents.


.expirationTime
: Date

The time when the token will expire.


.key
: string

The value to provide as the authentication token in the headers of a a request.





Factory class for Carbon.Auth.Token.Class objects.


Properties

Methods

#decorate()
: T & Carbon.Auth.Token.Class


decorate<T extends Object>( object:T ):T & Carbon.Auth.Token.Class

Decorates the object provided with the properties and methods of a Carbon.Auth.Token.Class object.


Param Type Default Description
object T


#hasClassProperties()
: boolean


hasClassProperties( object:Object ):boolean

Returns true if the object provided has the properties of a Carbon.Auth.Token.Class object.


Param Type Default Description
object Object


#is()
: boolean


is( value:any ):boolean

Returns true if the object provided is considered a Carbon.Auth.Token.Class object.


Param Type Default Description
value any




Classes and Interfaces in the Module

C
Carbon.Auth.TokenAuthenticator.Class
Authenticates requests using JSON Web Token (JWT) Authentication.




Authenticates requests using JSON Web Token (JWT) Authentication.


Constructor


Class( context:Carbon.Context.Class )

Param Type Default Description
context Carbon.Context.Class

The context where to authenticate the agent.


Methods

.addAuthentication()
: Carbon.HTTP.Request.Options


addAuthentication( requestOptions:Carbon.HTTP.Request.Options ):Carbon.HTTP.Request.Options

Adds the Token Authentication header to the passed request options object. The Carbon.HTTP.Request.Options provided is returned without modifications if it already has an authentication header.


Param Type Default Description
requestOptions Carbon.HTTP.Request.Options

Request options object to add Authentication headers.



.authenticate()
: Promise<Carbon.Auth.Token.Class>


authenticate( authenticationToken:Carbon.Auth.UsernameAndPasswordToken ):Promise<Carbon.Auth.Token.Class>

Stores credentials to authenticate future requests.


Param Type Default Description
authenticationToken Carbon.Auth.UsernameAndPasswordToken


authenticate( token:Carbon.Auth.Token.Class ):Promise<Carbon.Auth.Token.Class>

Stores credentials to authenticate future requests.


Param Type Default Description
token Carbon.Auth.Token.Class


.clearAuthentication()
: void


clearAuthentication():void

        Clears any saved credentials and restores the Authenticator to its initial state.
																



.isAuthenticated()
: boolean


isAuthenticated():boolean

Returns true if the instance contains stored credentials.









Wrapper to manage Authentication Credentials in form of Username/Password.


Constructor


Class( username:string, password:string )

Param Type Default Description
username string
password string

Properties

.password
: string


.username
: string








Wrapper to manage an Authentication Token in form of Username/Password.


Constructor


Class( username:string, password:string )

Param Type Default Description
username string
password string

Properties

.password
: string


.username
: string








Interface that represents the basic data of a blank node.


Properties

.bNodeIdentifier
: string

A UUID identifier for the blank node.





Factory class for Carbon.BlankNode.Class objects.


Methods

#createFrom()
: T & Carbon.BlankNode.Class


createFrom<T extends Object>( object:T extends Object, id:string, document:Carbon.Document.Class ):T & Carbon.BlankNode.Class

Creates a Carbon.BlankNode.Class object from the object and parameters specified.


Param Type Default Description
object T extends Object

Object to be converted into a Carbon.BlankNode.Class.

id string

The ID of the of the BlankNode to create. If no ID is provided, one will be created.

document Carbon.Document.Class

The Carbon.Document.Class object where the fragment is part of.



createFrom<T extends Object>( object:T extends Object, document:Carbon.Document.Class ):T & Carbon.BlankNode.Class

Creates a Carbon.BlankNode.Class object from the object and parameters specified.


Param Type Default Description
object T extends Object

Object to be converted into a Carbon.BlankNode.Class.

document Carbon.Document.Class

The Carbon.Document.Class object where the fragment is part of.



#decorate()
: T & Carbon.BlankNode.Class


decorate( object:T extends Object, bNodeIdentifier?:string ):T & Carbon.BlankNode.Class

Decorates the object provided with the properties and methods of a Carbon.FreeResources.Class object.


Param Type Default Description
object T extends Object

The object to be decorated.

bNodeIdentifier string

The identifier to be added to the decorated BlankNode.





Default Export:

Classes and Interfaces in the Module

I
Carbon.Context.Class
Interface that every context in the SDK implements.




Interface that every context in the SDK implements.


Properties

.auth
: Carbon.Auth.Class

The authentication and authorization class of the context.


.documents
: Carbon.Documents.Class

The documents class of the context.


.parentContext
: Carbon.Context.Class

The parent context of the current context. It will be null when the context has no parent.


Methods

.clearObjectSchema()
: void


clearObjectSchema( type?:string ):void

Remove the schema of the type specified, or the general schema if no type is provided.


Param Type Default Description
type string

The URI of the type to remove its schema.



.deleteSetting()
: void


deleteSetting( name:string ):void

Deletes the setting specified by the name provided from the current context.


Param Type Default Description
name string

Name of the setting to delete.



.extendObjectSchema()
: void


extendObjectSchema( type:string, objectSchema:Carbon.ObjectSchema.DigestedObjectSchema ):void

Extends the schema for a specified type of Resource. If a schema for the type exists in the parent context, this is duplicated for the actual context, but only the first time this schema is extended.


Param Type Default Description
type string

The URI of the type to extends its schema.

objectSchema Carbon.ObjectSchema.DigestedObjectSchema

The new schema that will extends the previous one.



extendObjectSchema( objectSchema:Carbon.ObjectSchema.DigestedObjectSchema ):void

Extends the general schema of the current context. If a general schema exists in the parent context, this is duplicated for the current context, but only the first time the schema is extended.


Param Type Default Description
objectSchema Carbon.ObjectSchema.DigestedObjectSchema

The new schema that will extends the previous one.



.getBaseURI()
: string


getBaseURI():string

Returns the base URI of the current context.




.getObjectSchema()
: Carbon.ObjectSchema.DigestedObjectSchema


getObjectSchema( type?:string ):Carbon.ObjectSchema.DigestedObjectSchema

Returns the ObjectSchema for the specified type. If no type is specified, the general object schema of the context should be returned.


Param Type Default Description
type string

The URI of the type to look for its schema.



.getSetting()
: any


getSetting( name:string ):any

Returns the value of the setting looked for.


Param Type Default Description
name string

Name of the setting to look for.



.hasObjectSchema()
: boolean


hasObjectSchema( type:string ):boolean

Returns true if there is an ObjectSchema for the specified type.


Param Type Default Description
type string

The URI of the type to look for its schema.



.hasSetting()
: boolean


hasSetting( name:string ):boolean

Returns if the context contains the provided setting.


Param Type Default Description
name string

Name of the setting to look for.



.resolve()
: string


resolve( relativeURI:string ):string

Resolves the relative URI provided in accordance to the base URI of the context.


Param Type Default Description
relativeURI string

The relative URI to be resolved.



.setSetting()
: void


setSetting( name:string, value:any ):void

Set a setting in the current context.


Param Type Default Description
name string

Name of the setting to look for.

value any

The value to store as the setting specified.








Interface that represents an in-memory Carbon LDP Document.


Properties

._fragmentsIndex
: Map<string, Carbon.Fragment.Class>

Map that stores the fragments (named fragments and blank nodes) of the Document.


.defaultInteractionModel
: Carbon.Pointer.Class

A Pointer URI representing the default interaction model of the document when persisted.


.hasMemberRelation
: Carbon.Pointer.Class

A Pointer with the inverted relation the document will have.


.isMemberOfRelation
: Carbon.Pointer.Class

A Pointer with the member of relation of the document.


Methods

._normalize()
: void


_normalize():void

Search over the document for normal objects to convert into fragments, and unused fragments to eliminate.




._removeFragment()
: void


_removeFragment( fragment:Carbon.Fragment.Class ):void

Remove the fragment referenced by the Carbon.Fragment.Class provided from the Document.


Param Type Default Description
fragment Carbon.Fragment.Class


_removeFragment( slug:string ):void

Remove the fragment referenced by the Slug provided from the Document.


Param Type Default Description
slug string


.createFragment()
: T & Carbon.Fragment.Class


createFragment<T>( object:T, slug:string ):T & Carbon.Fragment.Class

Creates a Carbon.NamedFragment.Class from the object provided and the slug specified. If the slug has the form of a BlankNode ID, a Carbon.Fragment.Class is created instead.


Param Type Default Description
object T
slug string


createFragment<T>( object:Object ):T & Carbon.Fragment.Class

Creates a Carbon.Fragment.Class from the object provided, since no slug is specified.


Param Type Default Description
object Object


createFragment( slug:string ):Carbon.Fragment.Class

Creates an empty Carbon.NamedFragment.Class with the slug specified. If the slug has the form of a BlankNode ID, a Carbon.Fragment.Class is created instead.


Param Type Default Description
slug string


createFragment():Carbon.Fragment.Class

Creates an empty Carbon.Fragment.Class, since no slug is provided.




.createNamedFragment()
: Carbon.NamedFragment.Class


createNamedFragment( slug:string ):Carbon.NamedFragment.Class

Creates a Carbon.NamedFragment.Class with the slug provided. If the slug has the form of a BlankNode ID, an Error is thrown.


Param Type Default Description
slug string


createNamedFragment<T>( object:T, slug:string ):T & Carbon.NamedFragment.Class

Creates a Carbon.NamedFragment.Class from the object provided and the slug specified. If the slug has the form of a BlankNode ID, an Error is thrown.


Param Type Default Description
object T
slug string


.getFragment()
: T & Carbon.Fragment.Class


getFragment<T>( id:string ):T & Carbon.Fragment.Class

Returns the fragment referenced by the ID provided. Returns null if no fragment exists in the Document.


Param Type Default Description
id string


.getFragments()
: Carbon.Fragment.Class[]


getFragments():Carbon.Fragment.Class[]

Returns an array with all the fragments in the Document.




.getNamedFragment()
: T & Carbon.Fragment.Class


getNamedFragment<T>( id:string ):T & Carbon.Fragment.Class

Returns the fragment referenced by the ID provided. Returns null if no fragment exists in the Document.


Param Type Default Description
id string


.getPointer()
: boolean


getPointer( id:string ):boolean

Returns the pointer referenced by the URI provided. If no pointer exists, one is created and then returned. Returns null if the URI is outside the scope of the Document.


Param Type Default Description
id string


.hasFragment()
: boolean


hasFragment( id:string ):boolean

Returns true if the Document has the fragment referenced by the ID provided.


Param Type Default Description
id string


.hasPointer()
: boolean


hasPointer( id:string ):boolean

Returns true if the Document has a pointer referenced by the URI provided.


Param Type Default Description
id string


.inScope()
: boolean


inScope( pointer:Carbon.Pointer.Class ):boolean

Returns true if the pointer provided is inside the scope of the Document.


Param Type Default Description
pointer Carbon.Pointer.Class


inScope( id:string ):boolean

Returns true if the URI provided is inside the scope of the Document.


Param Type Default Description
id string


.removeNamedFragment()
: void


removeNamedFragment( fragment:Carbon.NamedFragment.Class ):void

Remove the maned fragment referenced by the Carbon.NamedFragment.Class provided from the Document.


Param Type Default Description
fragment Carbon.NamedFragment.Class


removeNamedFragment( slug:string ):void

Remove the named fragment referenced by the Slug provided from the Document.


Param Type Default Description
slug string


.toJSON()
: string


toJSON( objectSchemaResolver:Carbon.ObjectSchema.Resolver, jsonLDConverter:Carbon.JSONLDConverter.Class ):string

Returns a JSON string from the Document using an ObjectSchema and a JSONLDConverter.


Param Type Default Description
objectSchemaResolver Carbon.ObjectSchema.Resolver
jsonLDConverter Carbon.JSONLDConverter.Class


toJSON( objectSchemaResolver:Carbon.ObjectSchema.Resolver ):string

Returns a JSON string from the Document using an ObjectSchema


Param Type Default Description
objectSchemaResolver Carbon.ObjectSchema.Resolver


toJSON():string

Returns a JSON string from the Document using the default ObjectSchema.






Factory class for Carbon.Document.Class objects.


Methods

#create()
: Carbon.Document.Class


create():Carbon.Document.Class

Creates a Carbon.Document.Class object.




#createFrom()
: T & Carbon.Document.Class


createFrom<T extends Object>( object:T ):T & Carbon.Document.Class

Creates a Carbon.Document.Class object from the object provided.


Param Type Default Description
object T

Object to be converted into a Document.



#decorate()
: T & Carbon.Document.Class


decorate<T extends Object>( object:T ):T & Carbon.Document.Class

Decorates the object provided with the properties and methods of a Carbon.Document.Class object.


Param Type Default Description
object T

Object to be decorated.



#hasClassProperties()
: boolean


hasClassProperties( documentResource:Object ):boolean

Returns true if the object provided has the properties and methods of a Carbon.Document.Class object.


Param Type Default Description
documentResource Object


#is()
: boolean


is( object:Object ):boolean

Returns true if the object provided is considered a Carbon.Document.Class object.


Param Type Default Description
object Object




Classes and Interfaces in the Module

C
Carbon.Documents.Class
Class that contains methods for retrieving, saving and updating documents from the CarbonLDP server.




Class that contains methods for retrieving, saving and updating documents from the CarbonLDP server.


Constructor


Class( context?:Carbon.Context.Class )

Param Type Default Description
context Carbon.Context.Class

The context where the documents instance will live. If no context is provided, calling its methods with relative URIs will throw an error, since there will be no form to resolve them.


Properties

.jsonldConverter
: Carbon.JSONLD.Converter.Class

Instance of Carbon.JSONLD.Converter.Class that is used to compact retrieved documents and to expand documents to persist. This property is not writable.


Methods

.addMember()
: Promise<Carbon.HTTP.Response.Class>


addMember( documentURI:string, member:Carbon.Pointer.Class, requestOptions?:Carbon.HTTP.Request.Options ):Promise<Carbon.HTTP.Response.Class>

Add a member relation to the resource Pointer in the document container specified.


Param Type Default Description
documentURI string

URI of the document container where the member will be added.

member Carbon.Pointer.Class

Pointer object that references the resource to add as a member.

requestOptions Carbon.HTTP.Request.Options

Customizable options for the request.



addMember( documentURI:string, memberURI:string, requestOptions?:Carbon.HTTP.Request.Options ):Promise<Carbon.HTTP.Response.Class>

Add a member relation to the resource URI in the document container specified.


Param Type Default Description
documentURI string

URI of the document container where the member will be added.

memberURI string

URI of the resource to add as a member.

requestOptions Carbon.HTTP.Request.Options

Customizable options for the request.



.addMembers()
: Promise<Carbon.HTTP.Response.Class>


addMembers( documentURI:string, members:(Carbon.Pointer.Class | string)[], requestOptions?:Carbon.HTTP.Request.Options ):Promise<Carbon.HTTP.Response.Class>

Add a member relation to every resource URI or Pointer provided in the document container specified.


Param Type Default Description
documentURI string

URI of the document container where the members will be added.

members (Carbon.Pointer.Class | string)[]

Array of URIs or Pointers to add as members.

requestOptions Carbon.HTTP.Request.Options

Customizable options for the request.



.createAccessPoint()
: Promise<[ T & Carbon.PersistedAccessPoint.Class, Carbon.HTTP.Response.Class ]>


createAccessPoint<T>( documentURI:string, accessPoint:T & Carbon.AccessPoint.Class, slug?:string, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ T & Carbon.PersistedAccessPoint.Class, Carbon.HTTP.Response.Class ]>

Persists an AccessPoint in the document specified.


Param Type Default Description
documentURI string

URI of the document where to create a new access point.

accessPoint T & Carbon.AccessPoint.Class

AccessPoint Document to persist.

slug string

Slug that will be used for the URI of the new access point.

requestOptions Carbon.HTTP.Request.Options

Customizable options for the request.



createAccessPoint<T>( documentURI:string, accessPoint:T & Carbon.AccessPoint.Class, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ T & Carbon.PersistedAccessPoint.Class, Carbon.HTTP.Response.Class ]>

Persists an AccessPoint in the document specified.


Param Type Default Description
documentURI string

URI of the document where to create a new access point.

accessPoint T & Carbon.AccessPoint.Class

AccessPoint Document to persist.

requestOptions Carbon.HTTP.Request.Options

Customizable options for the request.



.createAccessPoints()
: Promise<[ (T & Carbon.PersistedAccessPoint.Class)[], Carbon.HTTP.Response.Class[] ]>


createAccessPoints<T>( documentURI:string, accessPoints:T & Carbon.AccessPoint.Class, slugs?:string[], requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ (T & Carbon.PersistedAccessPoint.Class)[], Carbon.HTTP.Response.Class[] ]>

Persists multiple access points objects for the specified document.


Param Type Default Description
documentURI string

URI of the document where to create the new access points.

accessPoints T & Carbon.AccessPoint.Class

Array with the access points to persist.

slugs string[]

Array with the slugs that corresponds to each object in accessPoints parameter, in the order in which they were defined. If an element in the array is undefined or null, the slug will be generated by the platform.

requestOptions Carbon.HTTP.Request.Options

Customizable options for the request.



createAccessPoints<T>( documentURI:string, accessPoints:T & Carbon.AccessPoint.Class, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ (T & Carbon.PersistedAccessPoint.Class)[], Carbon.HTTP.Response.Class[] ]>

Persists multiple access points objects for the specified document.


Param Type Default Description
documentURI string

URI of the document where to create the new access points.

accessPoints T & Carbon.AccessPoint.Class

Array with the access points to persist.

requestOptions Carbon.HTTP.Request.Options

Customizable options for the request.



.createChild()
: Promise<[ T & Carbon.PersistedProtectedDocument.Class, Carbon.HTTP.Response.Class ]>


createChild<T>( parentURI:string, childObject:T, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ T & Carbon.PersistedProtectedDocument.Class, Carbon.HTTP.Response.Class ]>

Persists JavaScript object as a child document for the respective parent source.


Param Type Default Description
parentURI string

URI of the document where to create a new child.

childObject T

A normal JavaScript object that will be converted and persisted as a new child document.

requestOptions Carbon.HTTP.Request.Options

Customizable options for the request.



createChild<T>( parentURI:string, childObject:T, slug?:string, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ T & Carbon.PersistedProtectedDocument.Class, Carbon.HTTP.Response.Class ]>

Persists JavaScript object as a child document for the respective parent source.


Param Type Default Description
parentURI string

URI of the document where to create a new child.

childObject T

A normal JavaScript object that will be converted and persisted as a new child document.

slug string

Slug that will be used for the URI of the new child.

requestOptions Carbon.HTTP.Request.Options

Customizable options for the request.



.createChildAndRetrieve()
: Promise<[ T & Carbon.PersistedProtectedDocument.Class, [ Carbon.HTTP.Response.Class, Carbon.HTTP.Response.Class ] ]>


createChildAndRetrieve<T>( parentURI:string, childObject:T, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ T & Carbon.PersistedProtectedDocument.Class, [ Carbon.HTTP.Response.Class, Carbon.HTTP.Response.Class ] ]>

Persists JavaScript object as a child document for the respective parent source and retrieves tha updated data from the server.


Param Type Default Description
parentURI string

URI of the document where to create a new child.

childObject T

A normal JavaScript object that will be converted and persisted as a new child document.

requestOptions Carbon.HTTP.Request.Options

Customizable options for the request.



createChildAndRetrieve<T>( parentURI:string, childObject:T, slug?:string, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ T & Carbon.PersistedProtectedDocument.Class, [ Carbon.HTTP.Response.Class, Carbon.HTTP.Response.Class ] ]>

Persists JavaScript object as a child document for the respective parent source and retrieves tha updated data from the server.


Param Type Default Description
parentURI string

URI of the document where to create a new child.

childObject T

A normal JavaScript object that will be converted and persisted as a new child document.

slug string

Slug that will be used for the URI of the new child.

requestOptions Carbon.HTTP.Request.Options

Customizable options for the request.



.createChildren()
: Promise<[ (T & Carbon.PersistedProtectedDocument.Class)[], Carbon.HTTP.Response.Class[] ]>


createChildren<T>( parentURI:string, childrenObjects:T[], requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ (T & Carbon.PersistedProtectedDocument.Class)[], Carbon.HTTP.Response.Class[] ]>

Persists multiple JavaScript objects as children of the parent document.


Param Type Default Description
parentURI string

URI of the document where to create a new child.

childrenObjects T[]

An array with the objects to be converted and persisted as new children of the parent document.

requestOptions Carbon.HTTP.Request.Options

Customizable options for every the request.



createChildren<T>( parentURI:string, childrenObjects:T[], slugs?:string[], requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ (T & Carbon.PersistedProtectedDocument.Class)[], Carbon.HTTP.Response.Class[] ]>

Persists multiple JavaScript objects as children of the parent document.


Param Type Default Description
parentURI string

URI of the document where to create a new child.

childrenObjects T[]

An array with the objects to be converted and persisted as new children of the parent document.

slugs string[]

Array with the slugs that corresponds to each object in childrenObjects, in the order in which they were defined. If an element in the array is undefined or null, the slug will be generated by the platform.

requestOptions Carbon.HTTP.Request.Options

Customizable options for every the request.



.createChildrenAndRetrieve()
: Promise<[ (T & Carbon.PersistedProtectedDocument.Class)[], [ Carbon.HTTP.Response.Class[], Carbon.HTTP.Response.Class[] ] ]>


createChildrenAndRetrieve<T>( parentURI:string, childrenObjects:T[], requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ (T & Carbon.PersistedProtectedDocument.Class)[], [ Carbon.HTTP.Response.Class[], Carbon.HTTP.Response.Class[] ] ]>

Persists multiple JavaScript objects as children of the parent document and retrieves tha updated data from the server.


Param Type Default Description
parentURI string

URI of the document where to create a new child.

childrenObjects T[]

An array with the objects to be converted and persisted as new children of the parent document.

requestOptions Carbon.HTTP.Request.Options

Customizable options for every the request.



createChildrenAndRetrieve<T>( parentURI:string, childrenObjects:T[], slugs?:string[], requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ (T & Carbon.PersistedProtectedDocument.Class)[], [ Carbon.HTTP.Response.Class[], Carbon.HTTP.Response.Class[] ] ]>

Persists multiple JavaScript objects as children of the parent document and retrieves tha updated data from the server.


Param Type Default Description
parentURI string

URI of the document where to create a new child.

childrenObjects T[]

An array with the objects to be converted and persisted as new children of the parent document.

slugs string[]

Array with the slugs that corresponds to each object in childrenObjects, in the order in which they were defined. If an element in the array is undefined or null, the slug will be generated by the platform.

requestOptions Carbon.HTTP.Request.Options

Customizable options for every the request.



.delete()
: Promise<Carbon.HTTP.Response.Class>


delete( documentURI:string, requestOptions?:Carbon.HTTP.Request.Options ):Promise<Carbon.HTTP.Response.Class>

Delete the resource from the CarbonLDP server referred by the URI provided.


Param Type Default Description
documentURI string

The resource to delete from the CarbonLDP server.

requestOptions Carbon.HTTP.Request.Options

Customizable options for the request.



.executeRawASKQuery()
: Promise<[ Carbon.SPARQL.RawResults.Class, Carbon.HTTP.Response.Class ]>


executeRawASKQuery( documentURI:string, askQuery:string, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ Carbon.SPARQL.RawResults.Class, Carbon.HTTP.Response.Class ]>

Executes an ASK query on a document and returns a raw application/sparql-results+json object.


Param Type Default Description
documentURI string

URI of the document that works as a SPARQL endpoint where to execute the SPARQL query.

askQuery string

ASK query to execute in the selected endpoint.

requestOptions Carbon.HTTP.Request.Options

Customizable options for the request.



.executeRawCONSTRUCTQuery()
: Promise<[ string, Carbon.HTTP.Response.Class ]>


executeRawCONSTRUCTQuery( documentURI:string, constructQuery:string, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ string, Carbon.HTTP.Response.Class ]>

Executes a CONSTRUCT query on a document and returns a string with the resulting model.


Param Type Default Description
documentURI string

URI of the document that works as a SPARQL endpoint where to execute the SPARQL query.

constructQuery string

CONSTRUCT query to execute in the selected endpoint.

requestOptions Carbon.HTTP.Request.Options

Customizable options for the request.



.executeRawDESCRIBEQuery()
: Promise<[ string, Carbon.HTTP.Response.Class ]>


executeRawDESCRIBEQuery( documentURI:string, describeQuery:string, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ string, Carbon.HTTP.Response.Class ]>

Executes a DESCRIBE query and returns a string with the resulting model.


Param Type Default Description
documentURI string

URI of the document that works as a SPARQL endpoint where to execute the SPARQL query.

describeQuery string

DESCRIBE query to execute in the selected endpoint.

requestOptions Carbon.HTTP.Request.Options

Customizable options for the request.



.executeRawSELECTQuery()
: Promise<[ Carbon.SPARQL.RawResults.Class, Carbon.HTTP.Response.Class ]>


executeRawSELECTQuery( documentURI:string, selectQuery:string, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ Carbon.SPARQL.RawResults.Class, Carbon.HTTP.Response.Class ]>

Executes a SELECT query on a document and returns a raw application/sparql-results+json object.


Param Type Default Description
documentURI string

URI of the document that works as a SPARQL endpoint where to execute the SPARQL query.

selectQuery string

SELECT query to execute in the selected endpoint.

requestOptions Carbon.HTTP.Request.Options

Customizable options for the request.



.executeUPDATE()
: Promise<Carbon.HTTP.Response.Class>


executeUPDATE( documentURI:string, update:string, requestOptions?:Carbon.HTTP.Request.Options ):Promise<Carbon.HTTP.Response.Class>

Executes a DESCRIBE query and returns a string with the resulting model.


Param Type Default Description
documentURI string

URI of the document that works as a SPARQL endpoint where to execute the SPARQL query.

update string

UPDATE query to execute in the selected endpoint.

requestOptions Carbon.HTTP.Request.Options

Customizable options for the request.



.exists()
: Promise<[ boolean, Carbon.HTTP.Response.Class ]>


exists( documentURI:string, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ boolean, Carbon.HTTP.Response.Class ]>

Retrieves a boolean indicating if the resource exists or not in the CarbonLDP server.


Param Type Default Description
documentURI string

The URI to verify if it exists.

requestOptions Carbon.HTTP.Request.Options

Customizable options for the request.



.get()
: Promise<[ T & Carbon.PersistedDocument.Class, HTTP.Response.Class ]>


get<T>( uri:string, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ T & Carbon.PersistedDocument.Class, HTTP.Response.Class ]>

Retrieves the Carbon Document referred by the URI specified from the CarbonLDP server.


Param Type Default Description
uri string

The URI of the document to retrieve.

requestOptions Carbon.HTTP.Request.Options

Customizable options for the request.



.getChildren()
: Promise<[ (T & Carbon.PersistedDocument.Class)[], Carbon.HTTP.Response.Class ]>


getChildren<T>( parentURI:string, retrievalPreferences?:Carbon.RetrievalPreferences.Class, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ (T & Carbon.PersistedDocument.Class)[], Carbon.HTTP.Response.Class ]>

Retrieves an array of resolved persisted documents that refers all children of the container specified, or a part of them in accordance to the retrieval preferences specified.


Param Type Default Description
parentURI string

URI of the document from where to look for its children.

retrievalPreferences Carbon.RetrievalPreferences.Class

An object that specify the retrieval preferences for the request.

requestOptions Carbon.HTTP.Request.Options

Customizable options for the request.



getChildren<T>( parentURI:string, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ (T & Carbon.PersistedDocument.Class)[], Carbon.HTTP.Response.Class ]>

Retrieves an array of resolved persisted documents that refers all children of the container specified.


Param Type Default Description
parentURI string

URI of the document from where to look for its children.

requestOptions Carbon.HTTP.Request.Options

Customizable options for the request.



.getDownloadURL()
: Promise<Carbon.HTTP.Response.Class>


getDownloadURL( documentURI:string, requestOptions?:Carbon.HTTP.Request.Options ):Promise<Carbon.HTTP.Response.Class>

Add to the URI provided the necessary properties for a single download request.


Param Type Default Description
documentURI string

The URI of the document that will be converted in a single download request.

requestOptions Carbon.HTTP.Request.Options


.getMembers()
: Promise<[ (T & Carbon.PersistedDocument.Class)[], Carbon.HTTP.Response.Class ]>


getMembers<T>( uri:string, includeNonReadable?:boolean, retrievalPreferences?:Carbon.RetrievalPreferences.Class, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ (T & Carbon.PersistedDocument.Class)[], Carbon.HTTP.Response.Class ]>

Retrieves all the members of a document and their contents, or a part of them in accordance to the retrieval preferences specified.


Param Type Default Description
uri string

URI of the document from where to look for its members.

includeNonReadable boolean

Specify if the response should include the Non Readable resources. By default this is set to true.

retrievalPreferences Carbon.RetrievalPreferences.Class

An object to specify the retrieval preferences for the request.

requestOptions Carbon.HTTP.Request.Options

Customizable options for the request.



getMembers<T>( uri:string, includeNonReadable?:boolean, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ (T & Carbon.PersistedDocument.Class)[], Carbon.HTTP.Response.Class ]>

Retrieves all the members of a document and their contents.


Param Type Default Description
uri string

URI of the document from where to look for its members.

includeNonReadable boolean

Specify if the response should include the Non Readable resources. By default this is set to true.

requestOptions Carbon.HTTP.Request.Options

Customizable options for the request.



getMembers<T>( uri:string, retrievalPreferences?:Carbon.RetrievalPreferences.Class, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ (T & Carbon.PersistedDocument.Class)[], Carbon.HTTP.Response.Class ]>

Retrieves all the members of a document and their content, or a part of them in accordance to the retrieval preferences specified.


Param Type Default Description
uri string

URI of the document from where to look for its members.

retrievalPreferences Carbon.RetrievalPreferences.Class

An object to specify the retrieval preferences for the request.

requestOptions Carbon.HTTP.Request.Options

Customizable options for the request.



getMembers<T>( uri:string, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ (T & Carbon.PersistedDocument.Class)[], Carbon.HTTP.Response.Class ]>

Retrieves all the members of a document and their contents.


Param Type Default Description
uri string

URI of the document from where to look for its members.

requestOptions Carbon.HTTP.Request.Options

Customizable options for the request.



.getPointer()
: boolean


getPointer( id:string ):boolean

Returns the pointer referenced by the URI provided. If no pointer exists, one is created and then returned. Returns null if the URI is outside the scope of the Documents instance.


Param Type Default Description
id string

URI to look for.



.hasPointer()
: boolean


hasPointer( id:string ):boolean

Returns true if the Documents instance has a pointer referenced by the URI provided.


Param Type Default Description
id string

URI to look for.



.inScope()
: boolean


inScope( pointer:Carbon.Pointer.Class ):boolean

Returns true if the pointer provided is inside the scope of the Documents instance.


Param Type Default Description
pointer Carbon.Pointer.Class

Pointer to evaluate.



inScope( id:string ):boolean

Returns true if the URI provided is inside the scope of the Documents instance.


Param Type Default Description
id string

URI to evaluate.



.listChildren()
: Promise<[ Carbon.PersistedDocument.Class[], Carbon.HTTP.Response ]>


listChildren( parentURI:string, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ Carbon.PersistedDocument.Class[], Carbon.HTTP.Response ]>

Retrieves an array of unresolved persisted documents that refers to the children of the container specified.


Param Type Default Description
parentURI string

URI of the document container where to look for its children.

requestOptions Carbon.HTTP.Request.Options

Customizable options for the request.



.listMembers()
: Promise<[ Carbon.PersistedDocument.Class[], Carbon.HTTP.Response.Class ]>


listMembers( uri:string, includeNonReadable?:boolean, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ Carbon.PersistedDocument.Class[], Carbon.HTTP.Response.Class ]>

Retrieves all the members of a document without resolving them.


Param Type Default Description
uri string

URI of the document from where to look for its members.

includeNonReadable boolean

Specify if the response should include the Non Readable resources. By default this is set to true.

requestOptions Carbon.HTTP.Request.Options

Customizable options for the request.



listMembers( uri:string, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ Carbon.PersistedDocument.Class[], Carbon.HTTP.Response.Class ]>

Retrieves all the members of a document without resolving them.


Param Type Default Description
uri string

URI of the document from where to look for its members.

requestOptions Carbon.HTTP.Request.Options

Customizable options for the request.



.refresh()
: Promise<[ T & Carbon.PersistedDocument.Class, Carbon.HTTP.Response ]>


refresh<T>( persistedDocument:T & Carbon.PersistedDocument.Class, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ T & Carbon.PersistedDocument.Class, Carbon.HTTP.Response ]>

Update the specified document with the data of the CarbonLDP server, if a newest version exists.


Param Type Default Description
persistedDocument T & Carbon.PersistedDocument.Class

The persisted document to update.

requestOptions Carbon.HTTP.Request.Options

Customizable options for the request.



.removeAllMembers()
: Promise<Carbon.HTTP.Response.Class>


removeAllMembers( documentURI:string, requestOptions?:Carbon.HTTP.Request.Options ):Promise<Carbon.HTTP.Response.Class>

Remove all the member relations from the document container specified.


Param Type Default Description
documentURI string

URI of the document container where the members will be removed.

requestOptions Carbon.HTTP.Request.Options

Customizable options for the request.



.removeMember()
: Promise<Carbon.HTTP.Response.Class>


removeMember( documentURI:string, member:Carbon.Pointer.Class, requestOptions?:Carbon.HTTP.Request.Options ):Promise<Carbon.HTTP.Response.Class>

Remove the member relation between the Pointer and the resource container specified.


Param Type Default Description
documentURI string

URI of the resource container from where the member will be removed.

member Carbon.Pointer.Class

Pointer object that references the resource to remove as a member.

requestOptions Carbon.HTTP.Request.Options

Customizable options for the request.



removeMember( documentURI:string, memberURI:string, requestOptions?:Carbon.HTTP.Request.Options ):Promise<Carbon.HTTP.Response.Class>

Remove the member relation between the resource URI and the resource container specified.


Param Type Default Description
documentURI string

URI of the resource container from where the member will be removed.

memberURI string

URI of the resource to remove as a member.

requestOptions Carbon.HTTP.Request.Options

Customizable options for the request.



.removeMembers()
: Promise<Carbon.HTTP.Response.Class>


removeMembers( documentURI:string, members:(Carbon.Pointer.Class | string)[], requestOptions?:Carbon.HTTP.Request.Options ):Promise<Carbon.HTTP.Response.Class>

Remove the member relation to every specified resource URI or Pointer form the document container specified.


Param Type Default Description
documentURI string

URI of the document container where the members will be removed.

members (Carbon.Pointer.Class | string)[]

Array of URIs or Pointers to remove as members

requestOptions Carbon.HTTP.Request.Options

Customizable options for the request.



.save()
: Promise<[ T & Carbon.PersistedDocument.Class, Carbon.HTTP.Response.Class ]>


save<T>( persistedDocument:T & Carbon.PersistedDocument.Class, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ T & Carbon.PersistedDocument.Class, Carbon.HTTP.Response.Class ]>

Update the data of the document provided in the server.


Param Type Default Description
persistedDocument T & Carbon.PersistedDocument.Class

The persisted document with the data to update in the server.

requestOptions Carbon.HTTP.Request.Options

Customisable options for the request.



.saveAndRefresh()
: Promise<[ T & Carbon.PersistedDocument.Class, [ HTTP.Response.Class, HTTP.Response.Class ] ]>


saveAndRefresh<T>( persistedDocument:T & Carbon.PersistedDocument.Class, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ T & Carbon.PersistedDocument.Class, [ HTTP.Response.Class, HTTP.Response.Class ] ]>

Save and refresh the PersistedDocument specified.


Param Type Default Description
persistedDocument T & Carbon.PersistedDocument.Class

The persistedDocument to save and refresh.

requestOptions Carbon.HTTP.Request.Options

Customizable options for the request.



.upload()
: Promise<[ Carbon.Pointer.Class, Carbon.HTTP.Response.Class ]>


upload( parentURI:string, data:Blob, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ Carbon.Pointer.Class, Carbon.HTTP.Response.Class ]>

Upload binary data, creating a child for the parent specified. This signature only works in a web browser.


Param Type Default Description
parentURI string

URI of the document where to upload the new binary data child.

data Blob

Blob of the binary data to upload.

requestOptions Carbon.HTTP.Request.Options

Customizable options for the request.



upload( parentURI:string, data:Blob, slug?:string, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ Carbon.Pointer.Class, Carbon.HTTP.Response.Class ]>

Upload binary data, creating a child for the parent specified. This signature only works in a web browser.


Param Type Default Description
parentURI string

URI of the document where to upload the new binary data child.

data Blob

Blob of the binary data to upload.

slug string

Slug that will be used for the URI of the new binary child.

requestOptions Carbon.HTTP.Request.Options

Customizable options for the request.



upload( parentURI:string, data:Buffer, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ Carbon.Pointer.Class, Carbon.HTTP.Response.Class ]>

Upload binary data, creating a child for the parent specified. This signature only works in Node.js.


Param Type Default Description
parentURI string

URI of the document where to upload the new binary data child.

data Buffer

Buffer of the binary data to upload.

requestOptions Carbon.HTTP.Request.Options

Customizable options for the request.



upload( parentURI:string, data:Buffer, slug?:string, requestOptions?:Carbon.HTTP.Request.Options ):Promise<[ Carbon.Pointer.Class, Carbon.HTTP.Response.Class ]>

Upload binary data, creating a child for the parent specified. This signature only works in Node.js.


Param Type Default Description
parentURI string

URI of the document where to upload the new binary data child.

data Buffer

Buffer of the binary data to upload.

slug string

Slug that will be used fot he URI of the new binary child.

requestOptions Carbon.HTTP.Request.Options

Customizable options for the request.








Classes and Interfaces in the Module

C
Carbon.Errors.AbstractError
Class that works as template for the custom errors in the SDK.




Class that works as template for the custom errors in the SDK.


Constructor


AbstractError( message:string )

Param Type Default Description
message string

Properties

.message
: string


.name
: string


Methods

.toString()
: string


toString():string

Returns a string representation of the error.






Classes and Interfaces in the Module

C
Carbon.Errors.IDAlreadyInUseError
Error class to indicate that an identifier (ID) is already in use.




Error class to indicate that an identifier (ID) is already in use.


Properties

.name
: string





Classes and Interfaces in the Module

C
Carbon.Errors.IllegalActionError
Error class to indicate that an action not allowed was attempted.




Error class to indicate that an action not allowed was attempted.


Properties

.name
: string





Classes and Interfaces in the Module

C
Carbon.Errors.IllegalArgumentError
Error class to indicate that a different argument than the expected was provided.




Error class to indicate that a different argument than the expected was provided.


Properties

.name
: string





Classes and Interfaces in the Module

C
Carbon.Errors.IllegalStateError
Error class to indicate that a task can't be completed because of the lack of pre-required configuration or execution of previous tasks.




Error class to indicate that a task can't be completed because of the lack of pre-required configuration or execution of previous tasks.


Constructor


IllegalStateError( message?:string )

Param Type Default Description
message string

Properties

.name
: string


Methods

.toString()
: string


toString():string





Classes and Interfaces in the Module

C
Carbon.Errors.InvalidJSONLDSyntaxError
Error class to indicate that there an invalid syntax in a JSON-LD object.




Error class to indicate that there an invalid syntax in a JSON-LD object.


Properties

.name
: string





Classes and Interfaces in the Module

C
Carbon.Errors.NotImplementedError
Error class to indicate that an action is not yet implemented.




Error class to indicate that an action is not yet implemented.


Constructor


NotImplementedError( message?:string )

Param Type Default Description
message string

Properties

.name
: string


Methods

.toString()
: string


toString():string





Default Export:

Classes and Interfaces in the Module

I
Carbon.Fragment.Class
Interface that an in-memory fragment of a document.
C
Carbon.Fragment.Factory
Factory class for Carbon.Fragment.Class objects.




Interface that an in-memory fragment of a document.


Properties

.document
: Carbon.Document.Class

The document the fragment belongs to.





Factory class for Carbon.Fragment.Class objects.


Methods

#create()
: Carbon.Fragment.Class


create( id:string, document:Carbon.Document.Class ):Carbon.Fragment.Class

Creates a Fragment with the ID provided.


Param Type Default Description
id string

The ID of the fragment to create.

document Carbon.Document.Class

The document that the fragment will be part of.



create( document:Carbon.Document.Class ):Carbon.Fragment.Class

Creates a BlankNode since no ID is provided.


Param Type Default Description
document Carbon.Document.Class

The document that the fragment will be part of.



#createFrom()
: T & Carbon.Fragment.Class


createFrom<T extends Object>( object:T, id:string, document:Carbon.Document.Class ):T & Carbon.Fragment.Class

Creates a Fragment from an Object with the ID provided.


Param Type Default Description
object T

Object that will be converted to a fragment.

id string

The ID that will be assigned to the fragment.

document Carbon.Document.Class

The document that the fragment will be part of.



createFrom<T extends Object>( object:T, document:Carbon.Document.Class ):T & Carbon.Fragment.Class

Creates a BlankNode since no ID is provided.


Param Type Default Description
object T

Object that will be converted to a fragment.

document Carbon.Document.Class

The document that the fragment will be part of.



#hasClassProperties()
: boolean


hasClassProperties( resource:Object ):boolean

Returns true if the object provided has the properties and methods of a Class.Fragment.Class object.


Param Type Default Description
resource Object




Default Export:

Classes and Interfaces in the Module

I
Carbon.FreeResources.Class
Interface that represents a set of free resources.




Interface that represents a set of free resources.


Properties

._documents
: Private property that contains the Documents class where the object scope is in.

._resourcesIndex
: Private property that contains the references of every free resource in a map form.

Map<string, Carbon.Resource.Class>


Methods

.createResource()
: Carbon.Resource.Class


createResource( id?:string ):Carbon.Resource.Class

Creates and returns a new free resource. Throw an Error if no valid ID if provided or if it's already in use.


Param Type Default Description
id string

The ID of the resource to create. It should be an ID as a BlankNode.



.createResourceFrom()
: Carbon.Resource.Class


createResourceFrom<T>( object:T, id?:string ):Carbon.Resource.Class

Create and returns a new free resource from an object. Throw an Error if no valid id is provided or if it is already in use.


Param Type Default Description
object T

The object to be used as the new resource.

id string

The ID of the resource to create. It should be an ID as a BlankNode.



.getPointer()
: Carbon.Pointer.Class


getPointer( id:string ):Carbon.Pointer.Class

Returns the pointer referred by the ID specified, or creates one if no pointer exists in the scope.


Param Type Default Description
id string

The ID of the pointer sought for or the one to create.



.getResource()
: Carbon.Resource.Class


getResource( id:string ):Carbon.Resource.Class

Returns the resource referred by the ID provided. If no resource exists with the ID specified, null is returned.


Param Type Default Description
id string

The ID of the resource to sought for.



.getResources()
: Carbon.Resource.Class[]


getResources():Carbon.Resource.Class[]

Returns an array with all the resources inside the FreeResources object.




.hasResource()
: boolean


hasResource( id:string ):boolean

Returns true if a resource with the ID specified exists.


Param Type Default Description
id string

The ID of the resource to sought for.



.toJSON()
: string


toJSON():string

Converts the resources contained in the current Carbon.FreeResources.Class object to a JSON string.






Factory class for Carbon.FreeResources.Class objects.


Methods

#create()
: Carbon.FreeResources.Class


create( documents:Carbon.Documents.Class ):Carbon.FreeResources.Class

Creates a empty Carbon.FreeResources.Class object.


Param Type Default Description
documents Carbon.Documents.Class

A Carbon.Documents.Class object where the FreeResources scope is in.



#createFrom()
: T & Carbon.FreeResources.Class


createFrom<T extends Object>( object:T, documents:Carbon.Documents.Class ):T & Carbon.FreeResources.Class

Creates a Carbon.FreeResources.Class object from the plain object provided.


Param Type Default Description
object T

The object that wants be converted in a Carbon.FreeResources.Class.

documents Carbon.Documents.Class

A Carbon.Documents.Class object where the FreeResource scope is in.



#decorate()
: T & Carbon.FreeResources.Class


decorate<T extends Object>( object:T ):T & Carbon.FreeResources.Class

Decorates the object provided with the properties and methods of a Carbon.FreeResources.Class object.


Param Type Default Description
object T


#hasClassProperties()
: boolean


hasClassProperties( object:Object ):boolean

Returns true if the object provided has the properties and methods of a Carbon.FreeResources.Class object.


Param Type Default Description
object Object

Object to evaluate.








Reexports


Properties

#client
: Array<Carbon.HTTP.Errors.HTTPError>

Array that contains all the error classes that represents the errors induced by the client.


#server
: Array<Carbon.HTTP.Errors.HTTPError>

Array that contains all the error classes that represents the errors caused by the server.


#statusCodeMap
: Map<number, Carbon.HTTP.Error.HTTPError>

Map where all the HTTP Status Codes used in the SDK are assigned to their specific error class.





Classes and Interfaces in the Module

C
Carbon.HTTP.Errors.HTTPError
Generic error class that defines any type of HTTP Error used in the SDK.




Generic error class that defines any type of HTTP Error used in the SDK.


Constructor


HTTPError( message:string, response:Carbon.HTTP.Response )

Param Type Default Description
message string
response Carbon.HTTP.Response

Properties

Methods

.toString()
: string


toString():string





Classes and Interfaces in the Module

C
Carbon.HTTP.Errors.UnknownError
Error class that defines any error that could not be identified.




Error class that defines any error that could not be identified.


Constructor


UnknownError( message:string, response:Carbon.HTTP.Response )

Param Type Default Description
message string
response Carbon.HTTP.Response

Properties

#statusCode
: number


.name
: string


Methods

.toString()
: string


toString():string








Error class to indicate that a malformed request has been sent.


Constructor


BadRequestError( message:string, response:Carbon.HTTP.Response )

Param Type Default Description
message string
response Carbon.HTTP.Response

Properties

#statusCode
: number


.name
: string


Methods

.toString()
: string


toString():string





Classes and Interfaces in the Module

C
Carbon.HTTP.Errors.ConflictError
Error class to indicate that the request could not be processed because of a conflict, such as an ID conflict.




Error class to indicate that the request could not be processed because of a conflict, such as an ID conflict.


Constructor


ConflictError( message:string, response:Carbon.HTTP.Response )

Param Type Default Description
message string
response Carbon.HTTP.Response

Properties

#statusCode
: number


.name
: string


Methods

.toString()
: string


toString():string





Classes and Interfaces in the Module

C
Carbon.HTTP.Errors.ForbiddenError
Error class to indicate that the current user doesn't have permissions to fulfill the request.




Error class to indicate that the current user doesn't have permissions to fulfill the request.


Constructor


ForbiddenError( message:string, response:Carbon.HTTP.Response )

Param Type Default Description
message string
response Carbon.HTTP.Response

Properties

#statusCode
: number


.name
: string


Methods

.toString()
: string


toString():string





Classes and Interfaces in the Module

C
Carbon.HTTP.Errors.MethodNotAllowedError
Error class to indicate that the method used in the request is not allowed for that URI.




Error class to indicate that the method used in the request is not allowed for that URI.


Constructor


MethodNotAllowedError( message:string, response:Carbon.HTTP.Response )

Param Type Default Description
message string
response Carbon.HTTP.Response

Properties

#statusCode
: number


.name
: string


Methods

.toString()
: string


toString():string





Classes and Interfaces in the Module

C
Carbon.HTTP.Errors.NotAcceptableError
Error class to indicate that the server cannot respond with the data type specified by the accept header of the request.




Error class to indicate that the server cannot respond with the data type specified by the accept header of the request.


Constructor


NotAcceptableError( message:string, response:Carbon.HTTP.Response )

Param Type Default Description
message string
response Carbon.HTTP.Response

Properties

#statusCode
: number


.name
: string


Methods

.toString()
: string


toString():string








Error class to indicate that the resource was not found.


Constructor


NotFoundError( message:string, response:Carbon.HTTP.Response )

Param Type Default Description
message string
response Carbon.HTTP.Response

Properties

#statusCode
: number


.name
: string


Methods

.toString()
: string


toString():string





Classes and Interfaces in the Module

C
Carbon.HTTP.Errors.PreconditionFailedError
Error class to indicate that the precondition header was resolved to false.




Error class to indicate that the precondition header was resolved to false.


Constructor


PreconditionFailedError( message:string, response:Carbon.HTTP.Response )

Param Type Default Description
message string
response Carbon.HTTP.Response

Properties

#statusCode
: number


.name
: string


Methods

.toString()
: string


toString():string








Error class to indicate that the request is missing a precondition header.


Constructor


PreconditionRequiredError( message:string, response:Carbon.HTTP.Response )

Param Type Default Description
message string
response Carbon.HTTP.Response

Properties

#statusCode
: number


.name
: string


Methods

.toString()
: string


toString():string





Classes and Interfaces in the Module

C
Carbon.HTTP.Errors.RequestEntityTooLargeError
Error class to indicate that the request entity is larger than the server is able to process.




Error class to indicate that the request entity is larger than the server is able to process.


Constructor


RequestEntityTooLargeError( message:string, response:Carbon.HTTP.Response )

Param Type Default Description
message string
response Carbon.HTTP.Response

Properties

#statusCode
: number


.name
: string


Methods

.toString()
: string


toString():string





Classes and Interfaces in the Module

C
Carbon.HTTP.Errors.RequestHeaderFieldsTooLargeError
Error class to indicate that the server is not able to process the request because its header fields are too large.




Error class to indicate that the server is not able to process the request because its header fields are too large.


Constructor


RequestHeaderFieldsTooLargeError( message:string, response:Carbon.HTTP.Response )

Param Type Default Description
message string
response Carbon.HTTP.Response

Properties

#statusCode
: number


.name
: string


Methods

.toString()
: string


toString():string





Classes and Interfaces in the Module

C
Carbon.HTTP.Errors.RequestURITooLongError
Error class to indicate that the server is not able to process the request because the URI is too long.




Error class to indicate that the server is not able to process the request because the URI is too long.


Constructor


RequestURITooLongError( message:string, response:Carbon.HTTP.Response )

Param Type Default Description
message string
response Carbon.HTTP.Response

Properties

#statusCode
: number


.name
: string


Methods

.toString()
: string


toString():string





Classes and Interfaces in the Module

C
Carbon.HTTP.Errors.TooManyRequestsError
Error class to indicate that the current user has sent too many request in a given amount of time.




Error class to indicate that the current user has sent too many request in a given amount of time.


Constructor


TooManyRequestsError( message:string, response:Carbon.HTTP.Response )

Param Type Default Description
message string
response Carbon.HTTP.Response

Properties

#statusCode
: number


.name
: string


Methods

.toString()
: string


toString():string





Classes and Interfaces in the Module

C
Carbon.HTTP.Errors.UnauthorizedError
Error class to indicate that authentication is required or has failed.




Error class to indicate that authentication is required or has failed.


Constructor


UnauthorizedError( message:string, response:Carbon.HTTP.Response )

Param Type Default Description
message string
response Carbon.HTTP.Response

Properties

#statusCode
: number


.name
: string


Methods

.toString()
: string


toString():string





Classes and Interfaces in the Module

C
Carbon.HTTP.Errors.UnsupportedMediaTypeError
Error class to indicate that the request has a media-type not supported by the server.




Error class to indicate that the request has a media-type not supported by the server.


Constructor


UnsupportedMediaTypeError( message:string, response:Carbon.HTTP.Response )

Param Type Default Description
message string
response Carbon.HTTP.Response

Properties

#statusCode
: number


.name
: string


Methods

.toString()
: string


toString():string





Classes and Interfaces in the Module

C
Carbon.HTTP.Errors.BadGatewayError
Error class to indicate that the server was acting as a gateway or proxy and received an invalid response from the upstream server.




Error class to indicate that the server was acting as a gateway or proxy and received an invalid response from the upstream server.


Constructor


BadGatewayError( message:string, response:Carbon.HTTP.Response )

Param Type Default Description
message string
response Carbon.HTTP.Response

Properties

#statusCode
: number


.name
: string


Methods

.toString()
: string


toString():string





Classes and Interfaces in the Module

C
Carbon.HTTP.Errors.BadResponseError
Error class to indicate that the response obtained isn't the expected or can't be interpreted.




Error class to indicate that the response obtained isn't the expected or can't be interpreted.


Constructor


BadResponseError( message:string, response:Carbon.HTTP.Response )

Param Type Default Description
message string
response Carbon.HTTP.Response

Properties

#statusCode
: number


.name
: string


Methods

.toString()
: string


toString():string





Classes and Interfaces in the Module

C
Carbon.HTTP.Errors.GatewayTimeoutError
Error class to indicate that the server, while acting as a gateway or proxy, did not receive a timely response from the upstream server.




Error class to indicate that the server, while acting as a gateway or proxy, did not receive a timely response from the upstream server.


Constructor


GatewayTimeoutError( message:string, response:Carbon.HTTP.Response )

Param Type Default Description
message string
response Carbon.HTTP.Response

Properties

#statusCode
: number


.name
: string


Methods

.toString()
: string


toString():string





Classes and Interfaces in the Module

C
Carbon.HTTP.Errors.HTTPVersionNotSupportedError
Error class to indicate that the server doesn't support the HTTP protocol version used in the request.




Error class to indicate that the server doesn't support the HTTP protocol version used in the request.


Constructor


HTTPVersionNotSupportedError( message:string, response:Carbon.HTTP.Response )

Param Type Default Description
message string
response Carbon.HTTP.Response

Properties

#statusCode
: number


.name
: string


Methods

.toString()
: string


toString():string





Classes and Interfaces in the Module

C
Carbon.HTTP.Errors.InternalServerErrorError
Error class to indicate that the server encountered an unexpected condition. This generic error is given when no other specific error is suitable.




Error class to indicate that the server encountered an unexpected condition. This generic error is given when no other specific error is suitable.


Constructor


InternalServerErrorError( message:string, response:Carbon.HTTP.Response )

Param Type Default Description
message string
response Carbon.HTTP.Response

Properties

#statusCode
: number


.name
: string


Methods

.toString()
: string


toString():string





Classes and Interfaces in the Module

C
Carbon.HTTP.Errors.NotImplementedError
Error class to indicate that the server doesn't have the ability to fulfill the request yet.




Error class to indicate that the server doesn't have the ability to fulfill the request yet.


Constructor


NotImplementedError( message:string, response:Carbon.HTTP.Response )

Param Type Default Description
message string
response Carbon.HTTP.Response

Properties

#statusCode
: number


.name
: string


Methods

.toString()
: string


toString():string





Classes and Interfaces in the Module

C
Carbon.HTTP.Errors.ServiceUnavailableError
Error class to indicate that the server is currently unavailable (because it's overloaded or down for maintenance).




Error class to indicate that the server is currently unavailable (because it's overloaded or down for maintenance).


Constructor


ServiceUnavailableError( message:string, response:Carbon.HTTP.Response )

Param Type Default Description
message string
response Carbon.HTTP.Response

Properties

#statusCode
: number


.name
: string


Methods

.toString()
: string


toString():string





Default Export:

Classes and Interfaces in the Module

C
Carbon.HTTP.Header.Class
Class to manage the values in an HTTP header.
C
Carbon.HTTP.Header.Util
Class with useful functions to manage headers.
C
Carbon.HTTP.Header.Value
Wrapper class for a value of an HTTP header.




Class to manage the values in an HTTP header.


Constructor


Class( values:Array<Carbon.HTTP.Header.Value> ):void

Param Type Default Description
values Array<Carbon.HTTP.Header.Value>


Class( value:string ):void

Param Type Default Description
value string

Properties

.values
: Array<Carbon.HTTP.Header.Value>

Array that contains each value of the header.


Methods

.toString()
: string


toString():string





Class with useful functions to manage headers.


Methods

#parseHeaders()
: Map <string, Carbon.HTTP.Header.Class>


parseHeaders( headersString:string ):Map <string, Carbon.HTTP.Header.Class>

Returns a Map object which relates all header names with a Carbon.HTTP.Header.Class object containing their values.


Param Type Default Description
headersString string




Wrapper class for a value of an HTTP header.


Constructor


Value( value:string )

Param Type Default Description
value string

Methods

.toString()
: string


toString():string





Classes and Interfaces in the Module

C
Carbon.HTTP.JSONParser.Class
Wrapper class for the native JSON.parse() function using the Promise pattern.




Implements:

Wrapper class for the native JSON.parse() function using the Promise pattern.


Methods

.parse()
: Promise<Object>


parse( body:string ):Promise<Object>

Param Type Default Description
body string

A JSON string to parse.





.Method
: enum

Enum with the HTTP/1.1 methods.

Enumeration Description
Carbon.HTTP.Method.OPTIONS

Enum that identifies the OPTIONS HTTP/1.1 method, which allows the client to determine the options and/or requirements associated with a resource, or the capabilities of a server, without implying a resource action or initiating a resource retrieval.

Carbon.HTTP.Method.HEAD

Enum that identifies the HEAD HTTP/1.1 method, which returns only the headers of a GET HTTP request.

Carbon.HTTP.Method.GET

Enum that identifies the GET HTTP/1.1 method, which returns whatever information is identified by the request URI.

Carbon.HTTP.Method.POST

Enum that identifies the POST HTTP/1.1 method, which requests to the server to create a new entity.

Carbon.HTTP.Method.PUT

Enum that identifies the PUT HTTP/1.1 method, which allows you to replace an entirely entity, or to send a signal to a resource.

Carbon.HTTP.Method.PATCH

Enum that identifies the PATCH HTTP/1.1 method, which allows you to update specified fields of an entity.

Carbon.HTTP.Method.DELETE

Enum that identifies the DELETE HTTP/1.1 method, which allows you to request the deletion of a resource identified by the request URI.




Default Export:

Classes and Interfaces in the Module

I
Carbon.HTTP.Parser.Class
Interface that represents a what a parser must contains to be used when converting the response of a request.




Interface that represents a what a parser must contains to be used when converting the response of a request.


Methods

.parse()
: Promise<T>


parse( body:string ):Promise<T>

Method that parse the provided string to an specified T element.


Param Type Default Description
body string

The string to parse.





Classes and Interfaces in the Module

I
Carbon.HTTP.Request.ContainerRetrievalPreferences
Object used at Carbon.HTTP.Request.Util.setContainerRetrievalPreferences() method, which specifies the behaviour of the of the requested document as a ldp:container.
I
Carbon.HTTP.Request.Options
Customizable options that can change the behaviour of the request.
C
Carbon.HTTP.Request.Service
Class with functions to easily manage HTTP requests.
C
Carbon.HTTP.Request.Util
Class with useful functions to manage the options object of a request.




Object used at Carbon.HTTP.Request.Util.setContainerRetrievalPreferences() method, which specifies the behaviour of the of the requested document as a ldp:container.


Properties

.include
: string[]

Prefer URIs that indicates some specific information should be returned in the request's response.


.omit
: string[]

Prefer URIs that indicates some specific information should NOT be included in the request's response.





Customizable options that can change the behaviour of the request.


Properties

.headers
: Map<string, Carbon.HTTP.Header.Class>

Map that contains the references to the headers to include in the request.


.sendCredentialsOnCORS
: boolean

Flag that enables Cross-Origin Resource Sharing (CORS).





Class with functions to easily manage HTTP requests.


Methods

#delete()
: Promise<Carbon.HTTP.Response>


delete( url:string, body:string, options?:object ):Promise<Carbon.HTTP.Response>

Simple delete request.


Param Type Default Description
url string
body string
options object { sendCredentialsOnCORS: true }


delete( url:string, options?:object, parser?:Carbon.HTTP.Parser<T> ):Promise<Carbon.HTTP.Response>

Delete request with specified response parser.


Param Type Default Description
url string
options object { sendCredentialsOnCORS: true }
parser Carbon.HTTP.Parser<T>


delete( url:string, options?:object ):Promise<Carbon.HTTP.Response>

Simple delete request.


Param Type Default Description
url string
options object { sendCredentialsOnCORS: true }


delete( url:string, options?:object, parser?:Carbon.HTTP.Parser<T> ):Promise<Carbon.HTTP.Response>

Delete request with specified response parser.


Param Type Default Description
url string
options object { sendCredentialsOnCORS: true }
parser Carbon.HTTP.Parser<T>


#get()
: Promise<Carbon.HTTP.Response>


get( url:string, options?:object ):Promise<Carbon.HTTP.Response>

Simple get request.


Param Type Default Description
url string
options object { sendCredentialsOnCORS: true }


get( url:string, options?:object, parser?:Carbon.HTTP.Parser<T> ):Promise<[Object, Carbon.HTTP.Response]>

Get request with specified response parser.


Param Type Default Description
url string
options object { sendCredentialsOnCORS: true }
parser Carbon.HTTP.Parser<T>


#head()
: Promise<Carbon.HTTP.Response>


head( url:string, options?:object ):Promise<Carbon.HTTP.Response>

Param Type Default Description
url string
options object { sendCredentialsOnCORS: true }


#options()
: Promise<Carbon.HTTP.Response>


options( url:string, options?:object ):Promise<Carbon.HTTP.Response>

Param Type Default Description
url string
options object { sendCredentialsOnCORS: true }


#patch()
: Promise<Carbon.HTTP.Response>


patch( url:string, body:string, options?:object ):Promise<Carbon.HTTP.Response>

Simple patch request.


Param Type Default Description
url string
body string
options object { sendCredentialsOnCORS: true }


patch( url:string, options?:object, parser?:Carbon.HTTP.Parser<T> ):Promise<Carbon.HTTP.Response>

Patch request with specified response parser.


Param Type Default Description
url string
options object { sendCredentialsOnCORS: true }
parser Carbon.HTTP.Parser<T>


#post()
: Promise<Carbon.HTTP.Response>


post( url:string, body:string, options?:object ):Promise<Carbon.HTTP.Response>

Simple post request.


Param Type Default Description
url string
body string
options object { sendCredentialsOnCORS: true }


post( url:string, options?:object, parser?:Carbon.HTTP.Parser<T> ):Promise<Carbon.HTTP.Response>

Post request with specified response parser.


Param Type Default Description
url string
options object { sendCredentialsOnCORS: true }
parser Carbon.HTTP.Parser<T>


#put()
: Promise<Carbon.HTTP.Response>


put( url:string, body:string, options?:object ):Promise<Carbon.HTTP.Response>

Simple put request.


Param Type Default Description
url string
body string
options object { sendCredentialsOnCORS: true }


put( url:string, options?:object, parser?:Carbon.HTTP.Parser<T> ):Promise<Carbon.HTTP.Response>

Put request with specified response parser.


Param Type Default Description
url string
options object { sendCredentialsOnCORS: true }
parser Carbon.HTTP.Parser<T>


#send()
: Promise<Carbon.HTTP.Response>


send( url:string, body:string, options:object ):Promise<Carbon.HTTP.Response>

Generic send method, to be used by the others methods in the class.


Param Type Default Description
url string
body string
options object




Class with useful functions to manage the options object of a request.


Methods

#getHeader()
: Carbon.HTTP.Header.Class


getHeader( headerName:string, requestOptions:Object, initialize?:boolean ):Carbon.HTTP.Header.Class

Returns the header object of a header-name inside an options object request. Returns undefined if the header doesn't exists. If initialize flag is provided with true, an empty header will be created even if it already exits.


Param Type Default Description
headerName string
requestOptions Object
initialize boolean false


#isOptions()
: boolean


isOptions( object:Object ):boolean

Returns true if the object provided has at least a property of a Carbon.HTTP.Request.Option object.


Param Type Default Description
object Object

The object to evaluate.



#setAcceptHeader()
: Object


setAcceptHeader( accept:string, requestOptions:Object ):Object

Set an Accept header in an options object request.


Param Type Default Description
accept string
requestOptions Object


#setContainerRetrievalPreferences()
: Object


setContainerRetrievalPreferences( preference:Carbon.HTTP.Request.ContainerRetrievalPreferences, requestOptions:Carbon.HTTP.Request.Options, returnRepresentation?:boolean ):Object

Set a Prefer header with return=representation in an options object request.


Param Type Default Description
preference Carbon.HTTP.Request.ContainerRetrievalPreferences
requestOptions Carbon.HTTP.Request.Options
returnRepresentation boolean

If set to true, add return=representation; before include and/or omit. Default value is set to true.



#setContentTypeHeader()
: Object


setContentTypeHeader( contentType:string, requestOptions:Object ):Object

Set a Content-Type header in an options object request.


Param Type Default Description
contentType string
requestOptions Object


#setIfMatchHeader()
: Object


setIfMatchHeader( etag:string, requestOptions:Object ):Object

Set an If-Match header in an options object request.


Param Type Default Description
etag string
requestOptions Object


#setPreferredInteractionModel()
: Object


setPreferredInteractionModel( interactionModelURI:string, requestOptions:Object ):Object

Set a Prefer header with rel=interaction-model in an options object request.


Param Type Default Description
interactionModelURI string
requestOptions Object


#setSlug()
: Object


setSlug( slug:string, requestOptions:Object ):Object

Set a Slug header in an options object request.


Param Type Default Description
slug string
requestOptions Object




Default Export:

Classes and Interfaces in the Module

C
Carbon.HTTP.Response.Class
Class that represents an HTTP Response.
C
Carbon.HTTP.Response.Util
Class with useful functions to manage Carbon.HTTP.Response.Class objects.




Class that represents an HTTP Response.


Constructor


Class( request:XMLHttpRequest ):void

Signature that only works in a web browser.


Param Type Default Description
request XMLHttpRequest


Class( request:ClientRequest, data:string, response:IncomingMessage ):void

Signature that only works in Node.js.


Param Type Default Description
request ClientRequest
data string
response IncomingMessage

Properties

.data
: string

The raw body returned by the request.


.headers
: Map<string, Carbon.HTTP.Header.Class>

A map object containing the headers returned by the request.


.request
: XMLHttpRequest | ClientRequest

The XMLHttpRequest object that was provided in the constructor when working in a Browser, or the ClientRequest object when working with Node.js.


.status
: number

The status code returned by the request.


Methods

.getHeader()
: Carbon.HTTP.Header.Class


getHeader( name:string ):Carbon.HTTP.Header.Class

Return the Header object referred by the name specified.


Param Type Default Description
name string




Class with useful functions to manage Carbon.HTTP.Response.Class objects.


Methods

#getETag()
: string


getETag( response:Carbon.HTTP.Response.Class ):string

Return the ETag header of a Carbon.HTTP.Response.Class object. Returns null if no ETag exists.


Param Type Default Description
response Carbon.HTTP.Response.Class




.Method
: enum

Enum with the HTTP/1.1 status codes.

Enumeration Description
Carbon.HTTP.Method.CONTINUE

Enum that identifies the HTTP/1.1 100 status code.

Carbon.HTTP.Method.OK

Enum that identifies the HTTP/1.1 200 status code.

Carbon.HTTP.Method.CREATED

Enum that identifies the HTTP/1.1 201 status code.

Carbon.HTTP.Method.ACCEPTED

Enum that identifies the HTTP/1.1 202 status code.

Carbon.HTTP.Method.NON_AUTHORITATIVE_INFORMATION

Enum that identifies the HTTP/1.1 203 status code.

Carbon.HTTP.Method.NO_CONTENT

Enum that identifies the HTTP/1.1 204 status code.

Carbon.HTTP.Method.RESET_CONTENT

Enum that identifies the HTTP/1.1 205 status code.

Carbon.HTTP.Method.PARTIAL_CONTENT

Enum that identifies the HTTP/1.1 206 status code.

Carbon.HTTP.Method.MULTIPLE_CHOICES

Enum that identifies the HTTP/1.1 300 status code.

Carbon.HTTP.Method.MOVED_PERMANENTLY

Enum that identifies the HTTP/1.1 301 status code.

Carbon.HTTP.Method.FOUND

Enum that identifies the HTTP/1.1 302 status code.

Carbon.HTTP.Method.SEE_OTHER

Enum that identifies the HTTP/1.1 303 status code.

Carbon.HTTP.Method.NOT_MODIFIED

Enum that identifies the HTTP/1.1 304 status code.

Carbon.HTTP.Method.USE_PROXY

Enum that identifies the HTTP/1.1 305 status code.

Carbon.HTTP.Method.TEMPORARY_REDIRECT

Enum that identifies the HTTP/1.1 307 status code.

Carbon.HTTP.Method.BAD_REQUEST

Enum that identifies the HTTP/1.1 400 status code.

Carbon.HTTP.Method.UNAUTHORIZED

Enum that identifies the HTTP/1.1 401 status code.

Carbon.HTTP.Method.PAYMENT_REQUIRED

Enum that identifies the HTTP/1.1 402 status code.

Carbon.HTTP.Method.FORBIDDEN

Enum that identifies the HTTP/1.1 403 status code.

Carbon.HTTP.Method.NOT_FOUND

Enum that identifies the HTTP/1.1 404 status code.

Carbon.HTTP.Method.METHOD_NOT_ALLOWED

Enum that identifies the HTTP/1.1 405 status code.

Carbon.HTTP.Method.NOT_ACCEPTABLE

Enum that identifies the HTTP/1.1 406 status code.

Carbon.HTTP.Method.PROXY_AUTHENTICATION_REQUIRED

Enum that identifies the HTTP/1.1 407 status code.

Carbon.HTTP.Method.REQUEST_TIME_OUT

Enum that identifies the HTTP/1.1 408 status code.

Carbon.HTTP.Method.CONFLICT

Enum that identifies the HTTP/1.1 409 status code.

Carbon.HTTP.Method.GONE

Enum that identifies the HTTP/1.1 410 status code.

Carbon.HTTP.Method.LENGTH_REQUIRED

Enum that identifies the HTTP/1.1 411 status code.

Carbon.HTTP.Method.PRECONDITION_FAILED

Enum that identifies the HTTP/1.1 412 status code.

Carbon.HTTP.Method.REQUEST_ENTITY_TOO_LARGE

Enum that identifies the HTTP/1.1 413 status code.

Carbon.HTTP.Method.REQUEST_URI_TOO_LARGE

Enum that identifies the HTTP/1.1 414 status code.

Carbon.HTTP.Method.UNSUPPORTED_MEDIA_TYPE

Enum that identifies the HTTP/1.1 415 status code.

Carbon.HTTP.Method.REQUESTED_RANGE_NOT_SATISFIABLE

Enum that identifies the HTTP/1.1 416 status code.

Carbon.HTTP.Method.EXPECTATION_FAILED

Enum that identifies the HTTP/1.1 417 status code.

Carbon.HTTP.Method.INTERNAL_SERVER_ERROR

Enum that identifies the HTTP/1.1 500 status code.

Carbon.HTTP.Method.NOT_IMPLEMENTED

Enum that identifies the HTTP/1.1 501 status code.

Carbon.HTTP.Method.BAD_GATEWAY

Enum that identifies the HTTP/1.1 502 status code.

Carbon.HTTP.Method.SERVICE_UNAVAILABLE

Enum that identifies the HTTP/1.1 503 status code.

Carbon.HTTP.Method.GATEWAY_TIME_OUT

Enum that identifies the HTTP/1.1 504 status code.

Carbon.HTTP.Method.HTTP_VERSION_NOT_SUPPORTED

Enum that identifies the HTTP/1.1 505 status code.







Implements:

Parses a Carbon.HTTP.Response.Class and returns a string.


Methods

.parse()
: Promise<string>


parse( body:Carbon.HTTP.Response.Class ):Promise<string>

Gets a string and returns a Promise with the same string.


Param Type Default Description
body Carbon.HTTP.Response.Class







Classes and Interfaces in the Module

C
Carbon.JSONLD.Converter.Class
Class that have methods for convert expanded JSON-LD objects to compacted Carbon SDK Resources and vice versa.




Class that have methods for convert expanded JSON-LD objects to compacted Carbon SDK Resources and vice versa.


Constructor


Class( literalSerializers?:Map<string, Carbon.RDF.Literal.Serializer> )

Param Type Default Description
literalSerializers Map<string, Carbon.RDF.Literal.Serializer>

A Map object with the data type serializers that the converter will only be able to handle.


Properties

.literalSerializers
: Map<string, Carbon.RDF.Literal.Serializer>

A Map object with data-type/serializer pairs for stringify the data of a SDK Resource when expanding it.


Methods

.compact()
: Object


compact( expandedObject:Object, targetObject:Object, digestedSchema:Carbon.ObjectSchema.DigestedObjectSchema, pointerLibrary:Carbon.Pointer.Library ):Object

Assign the data of the expanded JSON-LD object, to the target object in a friendly mode, ie. without the JSON-LD Syntax Tokens and parsed values, in accordance to the schema provided.


Param Type Default Description
expandedObject Object

The JSON-LD object to compact.

targetObject Object

The target object where will be added the data of the expanded object.

digestedSchema Carbon.ObjectSchema.DigestedObjectSchema

The schema that describes how compact the expanded object.

pointerLibrary Carbon.Pointer.Library

An object from where one can obtain pointers to SDK Resources.



.expand()
: Object


expand( compactedObject:Object, digestedSchema:Carbon.ObjectSchema.DigestedObjectSchema ):Object

Creates a expanded JSON-LD object from the compacted object in accordance to the schema provided.


Param Type Default Description
compactedObject Object

The compacted object to generate its expanded JSON-LD object.

digestedSchema Carbon.ObjectSchema.DigestedObjectSchema

The schema that describes how construct the expanded object.





Default Export:

Classes and Interfaces in the Module

C
Carbon.JSONLD.Parser.Class
Class to parse strings to valid JSONLD objects.




Implements:

Class to parse strings to valid JSONLD objects.


Methods

.parse()
: Promise<Object[]>


parse( body:string ):Promise<Object[]>

Parse the string provided using the Carbon.JSONLD.Processor.Class#expand() method.


Param Type Default Description
body string

A JSON-LD string to parse.





Classes and Interfaces in the Module

C
Carbon.JSONLD.Processor.Class
Class that contains methods that can process JSON-LD objects.




Class that contains methods that can process JSON-LD objects.


Methods

#expand()
: Promise<Array<Object>>


expand( input:Object ):Promise<Array<Object>>

Static method that expand a compacted JSON-LD object.


Param Type Default Description
input Object

The compacted JSON-LD object to expand.











Interface that represents an object to be sent in a request that add members to a container.


Properties

.targetMembers
: Carbon.Pointer.Class[]

Array with the members to be added to the container.





Factory class for Carbon.LDP.AddMemberAction.Class objects.


Methods

#createDocument()
: Carbon.Document.Class


createDocument( targetMembers:Carbon.Pointer.Class[] ):Carbon.Document.Class

Creates and returns a Carbon.Document.Class object with a Carbon.LDP.AddMemberAction.Class fragment for the specified targetMembers.


Param Type Default Description
targetMembers Carbon.Pointer.Class[]

The target members to add in a addMember request.



#hasClassProperties()
: boolean


hasClassProperties( resource:Carbon.RDF.Node.Class ):boolean

Returns true if the object has the properties of a Carbon.LDP.AddMemberAction.Class object.


Param Type Default Description
resource Carbon.RDF.Node.Class







Factory class for Carbon.LDP.DirectContainer.Class objects.


Methods

#create()
: Carbon.LDP.DirectContainer.Class


create( membershipResource:Carbon.Pointer.Class, hasMemberRelation:string | Carbon.Pointer.Class, isMemberOfRelation?:string | Carbon.Pointer.Class ):Carbon.LDP.DirectContainer.Class

Creates a Carbon.LDP.DirectContainer.Class object with the parameters specified.


Param Type Default Description
membershipResource Carbon.Pointer.Class
hasMemberRelation string | Carbon.Pointer.Class
isMemberOfRelation string | Carbon.Pointer.Class


#createFrom()
: T & Carbon.LDP.DirectContainer.Class


createFrom<T extends Object>( object:T, membershipResource:Carbon.Pointer.Class, hasMemberRelation:string | Carbon.Pointer.Class, isMemberOfRelation?:string | Carbon.Pointer.Class ):T & Carbon.LDP.DirectContainer.Class

Creates a Carbon.LDP.DirectContainer.Class object with the object provided and the parameters specified.


Param Type Default Description
object T
membershipResource Carbon.Pointer.Class
hasMemberRelation string | Carbon.Pointer.Class
isMemberOfRelation string | Carbon.Pointer.Class


#hasClassProperties()
: boolean


hasClassProperties( resource:Object ):boolean

Returns true if the object provided has the properties of a Carbon.LDP.DirectContainer.Class object.


Param Type Default Description
resource Object

Object to evaluate.



#is()
: boolean


is( object:Object ):boolean

Returns true if the object provided is considered a Carbon.LDP.DirectContainer.Class object.


Param Type Default Description
object Object

Object to evaluate.





Interface that represents an ldp:DirectContainer.


Properties

.membershipResource
: Carbon.Pointer.Class

Pointer that references the document that the direct container belongs to.








Interface that represents an error occurred in the server.


Properties

.carbonCode
: string

An specific code that indicates the type of carbon error the current object is.


.message
: string

Message that explains the error occurred in the server.





Classes and Interfaces in the Module

I
Carbon.LDP.ErrorResponse.Class
Interface that its used to represents part of an error (or multiple of them) thrown by the server.
C
Carbon.LDP.ErrorResponse.Util
Useful functions for managing Carbon.LDP.ErrorResponse.Class objects.

Properties




Interface that its used to represents part of an error (or multiple of them) thrown by the server.


Properties

.errors
: Carbon.LDP.Error.Class[]

Array that list the error occurred in the server.


.requestID
: string

An ID that identifies the request which cause the error.


.statusCode
: number

The HTTP status code that represents all the errors occurred.





Parser class for Carbon.LDP.ErrorResponse.Class objects.


Methods

#parse()
: Promise<Carbon.LDP.ErrorResponse.Class>


parse( data:string, object:Object ):Promise<Carbon.LDP.ErrorResponse.Class>

Parse the string data provided and create a Carbon.LDP.ErrorResponse.Class object.


Param Type Default Description
data string

The json-ld string, which represents an error response from a Carbon server.

object Object {}

The object to use as a base when parsing the ErrorResponse object





Useful functions for managing Carbon.LDP.ErrorResponse.Class objects.


Methods

#getMessage()
: string


getMessage( errorResponse:Carbon.LDP.ErrorResponse.Class ):string

Returns a string with the message of all the errors in the ErrorResponse.


Param Type Default Description
errorResponse Carbon.LDP.ErrorResponse.Class

The ErrorResponse object to obtain the message from.








Factory class for Carbon.LDP.IndirectContainer.Class objects.


Methods

#hasClassProperties()
: boolean


hasClassProperties( resource:Object ):boolean

Returns true if the object provided has the properties of a Carbon.LDP.IndirectContainer.Class object.


Param Type Default Description
resource Object




Interface that represents an ldp:IndirectContainer.


Properties

.insertedContentRelation
: Carbon.Pointer.Class

Pointer that refers the inserted content relation for the indirect container.





Classes and Interfaces in the Module

I
Carbon.PersistedBlankNode.Class
Interface that represents a persisted blank node of a persisted document.




Interface that represents a persisted blank node of a persisted document.


Properties

.bNodeIdentifier
: string

A UUID identifier for the blank node.








Interface that represents an object to be sent in a request that removes specific members to a container.


Properties

.targetMembers
: Carbon.Pointer.Class[]

Array with the members to be removed from the container.





Factory class for Carbon.LDP.RemoveMemberAction.Class objects.


Methods

#createDocument()
: Carbon.Document.Class


createDocument( targetMembers:Carbon.Pointer.Class ):Carbon.Document.Class

Creates and returns a Carbon.Document.Class object with a Carbon.LDP.RemoveMemberAction.Class fragment for the specified targetMembers.


Param Type Default Description
targetMembers Carbon.Pointer.Class

The target members of the remove action.



#hasClassProperties()
: boolean


hasClassProperties( resource:Carbon.RDF.Node.Class ):boolean

Returns true if the object has the properties of a Carbon.LDP.RemoveMemberAction.Class object.


Param Type Default Description
resource Carbon.RDF.Node.Class




Classes and Interfaces in the Module

I
Carbon.LDP.ResourceMetadata.Class
Interface that represents a free node resource that contains dynamic information about an specific resource.

Properties




Interface that represents a free node resource that contains dynamic information about an specific resource.


Properties

.eTag
: string

The ETag of the resource the metadata refers to.


.resource
: Carbon.Pointer.Class

Reference to the resource the metadata information refers to.





Factory class for Carbon.LDP.ResourceMetadata.Class objects.


Methods

#hasClassProperties()
: boolean


hasClassProperties( object:Object ):boolean

Return true if the object provided has the properties of a Carbon.LDP.ResourceMetadata.Class object.


Param Type Default Description
object Object

Object to check.



#hasRDFClass()
: boolean


hasRDFClass( object:Object ):boolean

Return true if the object provided have the RDF_CLASS of a ResourceMetadata, either if it's a Carbon Resource or an RDF object.


Param Type Default Description
object Object

Object to check.



#is()
: boolean


is( object:Object ):boolean

Return true if the object provided is considered a Carbon.LDP.ResourceMetadata.Class object.


Param Type Default Description
object Object

Object to check.





Classes and Interfaces in the Module

I
Carbon.LDP.ResponseMetadata.Class
Interface that represents the main resource of a set of metadata resources, which references everyone resource related to an specific dynamic response of tha server.

Properties




Interface that represents the main resource of a set of metadata resources, which references everyone resource related to an specific dynamic response of tha server.


Properties

.resourcesMetadata
: Carbon.LDP.ResourceMetadata.Class[]

An array with all the metadata resources of the dynamic response.





Factory class for Carbon.LDP.ResponseMetadata.Class objects.


Methods

#hasClassProperties()
: boolean


hasClassProperties( object:Object ):boolean

Return true if the object provided has the properties of a Carbon.LDP.ResponseMetadata.Class object.


Param Type Default Description
object Object

Object to check.



#hasRDFClass()
: boolean


hasRDFClass( object:Object ):boolean

Return true if the object provided have the RDF_CLASS of a ResponseMetadata, either if it's a Carbon Resource or an RDF object.


Param Type Default Description
object Object

Object to check.



#is()
: boolean


is( object:Object ):boolean

Return true if the object provided is considered a Carbon.LDP.ResponseMetadata.Class object.


Param Type Default Description
object Object

Object to check





Classes and Interfaces in the Module

I
Carbon.LDP.VolatileResource.Class
Interface that represents a free resource, i.e. a dynamic generated resource that does not have a persisted form.

Properties

#RDF_CLASS
: string





Interface that represents a free resource, i.e. a dynamic generated resource that does not have a persisted form.





Factory class for Carbon.LDP.VolatileResource.Class objects.


Methods

#hasRDFClass()
: boolean


hasRDFClass( object:Object ):boolean

Return true if the object provided have the RDF_CLASS of a VolatileResource, either if it's a Carbon Resource or an RDF object.


Param Type Default Description
object Object

Object to check.



#is()
: boolean


is( object:Object ):boolean

Return true if the object provided is considered a Carbon.LDP.VolatileResource.Class object.


Param Type Default Description
object Object

Object to check.








Carbon/NS/C
Module

Classes and Interfaces in the Module

C
Carbon.NS.C.Class
Class that contains classes defined by the Carbon Platform.
C
Carbon.NS.C.Predicate
Class that contains predicates defined by the Carbon Platform.

Properties

#namespace
: string








Class that contains predicates defined by the Carbon Platform.


Properties




Carbon/NS/CP
Module

Classes and Interfaces in the Module

C
Carbon.NS.CP.Predicate
Class that contains predicates defined by Carbon Patch.

Properties

#namespace
: string





Class that contains predicates defined by Carbon Patch.


Properties




Carbon/NS/CS
Module

Classes and Interfaces in the Module

C
Carbon.NS.CS.Class
Class that contains classes defined by Carbon Security.
C
Carbon.NS.CS.Predicate
Class that contains predicates defined by Carbon Security.

Properties

#namespace
: string





Class that contains classes defined by Carbon Security.


Properties




Class that contains predicates defined by Carbon Security.


Properties