Constructor
new RepoDataClient(optionsopt) → {RepoDataClient}
Create an Origami Repo Data client.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object
|
<optional> |
The client options.
|
Example
const repoData = new RepoDataClient({
apiKey: 'xxxXxXxX-XXXX-XXXX-xXXx-xxxXXXxXXXXX',
apiSecret: 'xxXXXxxXXXXXXXXXxxxxxxxXXXxXxXXXXXXxxXXx'
});
Methods
createIngestion(data) → {Promise.<Object>}
Create a new ingestion and add it to the queue (requires write permissions).
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
data |
Object
|
Information about the ingestion being created.
|
Throws:
-
Will throw if a network error occurs, or if the API responds with a 40x/50x status.
- Type
-
Error
Returns:
- Type:
-
Promise.<Object>
A promise which resolves with the new ingestion.
Example
const credentials = await repoData.createIngestion({
url: 'https://github.com/Financial-Times/origami-repo-data',
tag: '57.0.0'
});
createKey(data) → {Promise.<Object>}
Create a new API key which can be used to access the service (requires admin permissions).
Parameters:
Name | Type | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data |
Object
|
Information about the key being created.
|
Throws:
-
Will throw if a network error occurs, or if the API responds with a 40x/50x status.
- Type
-
Error
Returns:
- Type:
-
Promise.<Object>
A promise which resolves with the new credentials.
These will need to be stored somewhere, as the secret will never be displayed again.
Example
const credentials = await repoData.createKey({
description: 'A write key for manually adding ingestions',
read: true,
write: true,
admin: false
});
deleteIngestion(ingestionID) → {Promise.<Object>}
Delete a single ingestion from the queue by ID, preventing that repo/tag combination from being ingested (requires admin permissions).
- Source:
- See:
Parameters:
Name | Type | Description |
---|---|---|
ingestionID |
String
|
The ingestion UUID. |
Throws:
-
Will throw if a network error occurs, or if the API responds with a 40x/50x status.
- Type
-
Error
Returns:
- Type:
-
Promise.<Object>
A promise which resolves when the ingestion is deleted.
Example
await repoData.deleteIngestion('799798e6-967d-492e-8fee-f7f35ec39d44');
deleteKey(keyId) → {Promise.<Object>}
Delete a single API key from the service by ID.
- Source:
- See:
Parameters:
Name | Type | Description |
---|---|---|
keyId |
String
|
The key UUID. |
Throws:
-
Will throw if a network error occurs, or if the API responds with a 40x/50x status.
- Type
-
Error
Returns:
- Type:
-
Promise.<Object>
A promise which resolves when the key is deleted.
Example
await repoData.deleteKey('xxxXxXxX-XXXX-XXXX-xXXx-xxxXXXxXXXXX');
getIngestion(ingestionId) → {Promise.<Object>}
Get a single ingestion in the queue by ID.
- Source:
- See:
Parameters:
Name | Type | Description |
---|---|---|
ingestionId |
String
|
The ingestion UUID. |
Throws:
-
Will throw if a network error occurs, or if the API responds with a 40x/50x status.
- Type
-
Error
Returns:
- Type:
-
Promise.<Object>
A promise which resolves with the ingestion.
Example
const ingestion = await repoData.getIngestion('799798e6-967d-492e-8fee-f7f35ec39d44');
getKey(keyId) → {Promise.<Object>}
Get a single API key for the service by ID.
Parameters:
Name | Type | Description |
---|---|---|
keyId |
String
|
The key UUID. |
Throws:
-
Will throw if a network error occurs, or if the API responds with a 40x/50x status.
- Type
-
Error
Returns:
- Type:
-
Promise.<Object>
A promise which resolves with the API key.
Example
const key = await repoData.getKey('xxxXxXxX-XXXX-XXXX-xXXx-xxxXXXxXXXXX');
getManifest(repoId, versionId, manifestType) → {Promise.<Object>}
Get a single manifest for an Origami repository and version by type.
- Source:
- See:
Parameters:
Name | Type | Description |
---|---|---|
repoId |
String
|
The repository UUID or name. Warning: using name over ID incurs a redirect. |
versionId |
String
|
The version UUID or number. Warning: using number over ID incurs a redirect. |
manifestType |
String
|
The type of manifest to retrieve. One of "about", "bower", "imageSet", "origami", or "package". |
Throws:
-
Will throw if a network error occurs, or if the API responds with a 40x/50x status.
- Type
-
Error
Returns:
- Type:
-
Promise.<Object>
A promise which resolves with the manifest file contents parsed as JSON.
Examples
const packageManifest = await repoData.getManifest('c3a499f8-3d20-503c-95b0-c4705bc272b3', 'a530dab8-f6ff-410a-9e56-8d6f49ecff2c', 'package');
const packageManifest = await repoData.getManifest('origami-repo-data', '57.0.0', 'package');
getMarkdown(repoId, versionId, markdownType) → {Promise.<String>}
Get a single markdown document for an Origami repository and version by type.
- Source:
- See:
Parameters:
Name | Type | Description |
---|---|---|
repoId |
String
|
The repository UUID or name. Warning: using name over ID incurs a redirect. |
versionId |
String
|
The version UUID or number. Warning: using number over ID incurs a redirect. |
markdownType |
String
|
The type of markdown document to retrieve. One of "designguidelines" or "readme". |
Throws:
-
Will throw if a network error occurs, or if the API responds with a 40x/50x status.
- Type
-
Error
Returns:
- Type:
-
Promise.<String>
A promise which resolves with the markdown document as a string.
Examples
const readme = await repoData.getMarkdown('c3a499f8-3d20-503c-95b0-c4705bc272b3', 'a530dab8-f6ff-410a-9e56-8d6f49ecff2c', 'readme');
const readme = await repoData.getMarkdown('origami-repo-data', '57.0.0', 'readme');
getReadme(repoId, versionId) → {Promise.<String>}
Get the README text for an Origami repository and version. This is a shortcut method which uses RepoDataClient.getMarkdown.
Parameters:
Name | Type | Description |
---|---|---|
repoId |
String
|
The repository UUID or name. Warning: using name over ID incurs a redirect. |
versionId |
String
|
The version UUID or number. Warning: using number over ID incurs a redirect. |
Throws:
-
Will throw if a network error occurs, or if the API responds with a 40x/50x status.
- Type
-
Error
Returns:
- Type:
-
Promise.<String>
A promise which resolves with the README as a string.
Examples
const readme = await repoData.getReadme('c3a499f8-3d20-503c-95b0-c4705bc272b3', 'a530dab8-f6ff-410a-9e56-8d6f49ecff2c');
const readme = await repoData.getReadme('origami-repo-data', '57.0.0');
getRepo(repoId) → {Promise.<Object>}
Get a single Origami repository by ID or name.
- Source:
- See:
Parameters:
Name | Type | Description |
---|---|---|
repoId |
String
|
The repository UUID or name. Warning: using name over ID incurs a redirect. |
Throws:
-
Will throw if a network error occurs, or if the API responds with a 40x/50x status.
- Type
-
Error
Returns:
- Type:
-
Promise.<Object>
A promise which resolves with the repository.
Examples
const repo = await repoData.getRepo('c3a499f8-3d20-503c-95b0-c4705bc272b3');
const repo = await repoData.getRepo('origami-repo-data');
getVersion(repoId, versionId) → {Promise.<Object>}
Get a single version for an Origami repository by ID or name.
- Source:
- See:
Parameters:
Name | Type | Description |
---|---|---|
repoId |
String
|
The repository UUID or name. Warning: using name over ID incurs a redirect. |
versionId |
String
|
The version UUID or number. Warning: using number over ID incurs a redirect. |
Throws:
-
Will throw if a network error occurs, or if the API responds with a 40x/50x status.
- Type
-
Error
Returns:
- Type:
-
Promise.<Object>
A promise which resolves with the version.
Examples
const version = await repoData.getVersion('c3a499f8-3d20-503c-95b0-c4705bc272b3', 'a530dab8-f6ff-410a-9e56-8d6f49ecff2c');
const version = await repoData.getVersion('origami-repo-data', '57.0.0');
listBrandedRepos(brand) → {Promise.<Array>}
Get a list of all branded Origami repositories as an array.
- Deprecated:
- Deprecated in favour of filter options for RepoDataClient#listRepos.
- Source:
- See:
Parameters:
Name | Type | Description |
---|---|---|
brand |
String
|
Brand to look for. One of: 'all', 'master', 'internal', 'whitelabel' or 'none' |
Throws:
-
Will throw if a network error occurs, or if the API responds with a 40x/50x status.
- Type
-
Error
Returns:
- Type:
-
Promise.<Array>
A promise which resolves with the repositories.
Example
const repos = await repoData.listBrandedRepos('all');
listBundles(repoId, versionId, language, brand) → {Promise.<String>}
Get a list of bundle information for an Origami repository and version as an array.
- Source:
- See:
Parameters:
Name | Type | Default | Description |
---|---|---|---|
repoId |
String
|
The repository UUID or name. Warning: using name over ID incurs a redirect. | |
versionId |
String
|
The version UUID or number. Warning: using number over ID incurs a redirect. | |
language |
String
|
The bundle language. One of "js" or "css". | |
brand |
String
|
null |
[null] - A brand (or an array of brands) to filter bundles by.
One of: 'master' , 'internal' , 'whitelabel' .
Any non-branded bundles will not be included in the response.
If this parameter is set to 'none' or null then only bundles which are not branded will be output.
If this parameter is set to 'all' then only branded bundles will be output.
|
Throws:
-
Will throw if a network error occurs, or if the API responds with a 40x/50x status.
- Type
-
Error
Returns:
- Type:
-
Promise.<String>
A promise which resolves with the bundles.
Example
const bundles = await repoData.listBundles(
'c3a499f8-3d20-503c-95b0-c4705bc272b3',
'a530dab8-f6ff-410a-9e56-8d6f49ecff2c',
'css'
);
listDemos(repoId, versionId, brand) → {Promise.<String>}
Get a list of all demos for an Origami repository and version as an array.
- Source:
- See:
Parameters:
Name | Type | Default | Description |
---|---|---|---|
repoId |
String
|
The repository UUID or name. Warning: using name over ID incurs a redirect. | |
versionId |
String
|
The version UUID or number. Warning: using number over ID incurs a redirect. | |
brand |
String
|
null | [null] - The brand to filter demos by. If included, only demos with the specified brand (or no brands at all) will be returned. |
Throws:
-
Will throw if a network error occurs, or if the API responds with a 40x/50x status.
- Type
-
Error
Returns:
- Type:
-
Promise.<String>
A promise which resolves with the demos.
Examples
const demos = await repoData.listDemos('c3a499f8-3d20-503c-95b0-c4705bc272b3', 'a530dab8-f6ff-410a-9e56-8d6f49ecff2c');
const demos = await repoData.listDemos('c3a499f8-3d20-503c-95b0-c4705bc272b3', 'a530dab8-f6ff-410a-9e56-8d6f49ecff2c', 'internal');
listDependencies(repoId, versionId) → {Promise.<String>}
Get a list of all dependencies for an Origami repository and version as an array.
- Source:
- See:
Parameters:
Name | Type | Description |
---|---|---|
repoId |
String
|
The repository UUID or name. Warning: using name over ID incurs a redirect. |
versionId |
String
|
The version UUID or number. Warning: using number over ID incurs a redirect. |
Throws:
-
Will throw if a network error occurs, or if the API responds with a 40x/50x status.
- Type
-
Error
Returns:
- Type:
-
Promise.<String>
A promise which resolves with the dependencies.
Example
const dependencies = await repoData.listDependencies('c3a499f8-3d20-503c-95b0-c4705bc272b3', 'a530dab8-f6ff-410a-9e56-8d6f49ecff2c');
listImages(repoId, versionId, imageOptionsopt) → {Promise.<String>}
Get a list of all image set images for an Origami repository and version as an array.
- Source:
- See:
Parameters:
Name | Type | Attributes | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
repoId |
String
|
The repository UUID or name. Warning: using name over ID incurs a redirect. | |||||||||
versionId |
String
|
The version UUID or number. Warning: using number over ID incurs a redirect. | |||||||||
imageOptions |
Object
|
<optional> |
Options which change the format of the returned images.
|
Throws:
-
Will throw if a network error occurs, or if the API responds with a 40x/50x status.
- Type
-
Error
Returns:
- Type:
-
Promise.<String>
A promise which resolves with the images.
Example
const images = await repoData.listImages('c3a499f8-3d20-503c-95b0-c4705bc272b3', 'a530dab8-f6ff-410a-9e56-8d6f49ecff2c');
listIngestions() → {Promise.<Array>}
Get a list of all current ingestions in the queue as an array.
Throws:
-
Will throw if a network error occurs, or if the API responds with a 40x/50x status.
- Type
-
Error
Returns:
- Type:
-
Promise.<Array>
A promise which resolves with the ingestion queue.
Example
const ingestionQueue = await repoData.listIngestions();
listKeys() → {Promise.<Array>}
Get a list of all available API keys for the service as an array (requires admin permissions).
Throws:
-
Will throw if a network error occurs, or if the API responds with a 40x/50x status.
- Type
-
Error
Returns:
- Type:
-
Promise.<Array>
A promise which resolves with the API keys.
Example
const repos = await repoData.listKeys();
listRepos(filtersopt) → {Promise.<Array>}
Get a list of all available Origami repositories as an array.
- Source:
- See:
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
filters |
Object
|
<optional> |
Parameters to filter repositories by.
|
Throws:
-
Will throw if a network error occurs, or if the API responds with a 40x/50x status.
- Type
-
Error
Returns:
- Type:
-
Promise.<Array>
A promise which resolves with the repositories.
Examples
const repos = await repoData.listRepos();
const repos = await repoData.listRepos({
brand: 'master',
search: 'color',
status: 'active',
type: 'module'
});
listVersions(repoId) → {Promise.<Array>}
Get a list of all versions for an Origami repository as an array.
- Source:
- See:
Parameters:
Name | Type | Description |
---|---|---|
repoId |
String
|
The repository UUID or name. Warning: using name over ID incurs a redirect. |
Throws:
-
Will throw if a network error occurs, or if the API responds with a 40x/50x status.
- Type
-
Error
Returns:
- Type:
-
Promise.<Array>
A promise which resolves with the versions.
Examples
const versions = await repoData.listVersions('c3a499f8-3d20-503c-95b0-c4705bc272b3');
const versions = await repoData.listVersions('origami-repo-data');