new Modules(domain)
Parameters:
Name | Type | Description |
---|---|---|
domain |
string | The project domain |
- Source:
Methods
-
createModule(module-path, token, module-body, compile, Content-Type)
-
This method creates a new project module. If the
compile
option isnone
, the module will not be compiled, if it islax
it will be compiled and any potential compilation error reported. In this case, compilation errors will not prevent the module to be created. To only create the module if no compilation errors are present, set thecompile
option tostrict
. The default islax
.It is not allowed to create a project module with the same path of an existing system or project module. If the operation succeeds any precompiled query depending on the updated module will be deleted.
Parameters:
Name Type Description module-path
string The module path., token
string A project token., module-body
string The source code of the module., compile
string The kind of compilation to perform. The default is lax., Content-Type
string , - Source:
-
getModule(module-path, token)
-
This method retrieves the source code of a project module. The response content type is set according to the query language of the module. If the query does not declare its own dialect or cannot be parsed, the query language is considered to be
XQuery
.This operation cannot be used to retrieve the source code of system modules.
Parameters:
Name Type Description module-path
string The module path., token
string A project token., - Source:
-
listModules(starts-with, include-system, include-ns, include-src, token)
-
This method retrieves the list of modules which can be imported by a project.
By default, only modules defined in the project will be listed. To also list system-provided modules, you can set the
include-system
query parameter totrue
.To include module namespaces or source codes, you can set the
include-ns
orinclude-src
query parameters totrue
. Regardless of the value of theinclude-src
parameter, the source code of system modules will not be returned.To filter the returned modules you can use the
starts-with
query parameter. In this case, only the modules which path starts with the specified string will be returned.If two or more module have the same namespace and thus the same path, the details of the module which would be imported by a query are shown.
Parameters:
Name Type Description starts-with
string Filter the available module by their module path., include-system
boolean Include modules provided by the platform., include-ns
boolean Include each module's namespace in the listing., include-src
boolean Include each module's source code in the listing., token
string A project token., - Source:
-
removeModule(module-path, token)
-
This method removes the specified project module. If the operation succeeds any precompiled query depending on the updated module will be deleted.
Parameters:
Name Type Description module-path
string The module path., token
string A project token., - Source:
-
saveModule(module-path, token, module-body, compile)
-
This method creates or updates a project module. If the
compile
option isnone
, the module will not be compiled, if it islax
it will be compiled and any potential compilation error reported. In this case, compilation errors will not prevent the module to be created or updated. To only create the module if no compilation errors are present, set thecompile
option tostrict
. The default islax
.It is not allowed to update system modules. If the operation succeeds any precompiled query depending on the updated module will be deleted.
Parameters:
Name Type Description module-path
string The module path., token
string A project token., module-body
string The module source code, compile
string The kind of compilation to perform. The default is lax., - Source: