Constructor
new RepoDataClient(optionsopt) → {RepoDataClient}
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object
|
<optional> |
The client options.
|
Example
Create a client
const repoData = new RepoDataClient({
apiKey: 'xxxXxXxX-XXXX-XXXX-xXXx-xxxXXXxXXXXX',
apiSecret: 'xxXXXxxXXXXXXXXXxxxxxxxXXXxXxXXXXXXxxXXx'
});
Methods
createIngestion(data) → {Promise.<Object>}
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>
Example
Create an ingestion
const credentials = await repoData.createIngestion({
url: 'https://github.com/Financial-Times/origami-repo-data',
tag: '57.0.0'
});
createKey(data) → {Promise.<Object>}
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>
Example
Create an API key
const credentials = await repoData.createKey({
description: 'A write key for manually adding ingestions',
read: true,
write: true,
admin: false
});
deleteIngestion(ingestionID) → {Promise.<Object>}
- 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>
Example
Delete an ingestion
await repoData.deleteIngestion('799798e6-967d-492e-8fee-f7f35ec39d44');
deleteKey(keyId) → {Promise.<Object>}
- 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>
Example
Delete an API key
await repoData.deleteKey('xxxXxXxX-XXXX-XXXX-xXXx-xxxXXXxXXXXX');
getIngestion(ingestionId) → {Promise.<Object>}
- 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>
Example
Get an ingestion
const ingestion = await repoData.getIngestion('799798e6-967d-492e-8fee-f7f35ec39d44');
getKey(keyId) → {Promise.<Object>}
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>
Example
Get an API key
const key = await repoData.getKey('xxxXxXxX-XXXX-XXXX-xXXx-xxxXXXxXXXXX');
getManifest(repoId, versionId, manifestType) → {Promise.<Object>}
- 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>
Examples
Get a manifest using UUIDs
const packageManifest = await repoData.getManifest('c3a499f8-3d20-503c-95b0-c4705bc272b3', 'a530dab8-f6ff-410a-9e56-8d6f49ecff2c', 'package');
Get a manifest using a name and number
const packageManifest = await repoData.getManifest('origami-repo-data', '57.0.0', 'package');
getMarkdown(repoId, versionId, markdownType) → {Promise.<String>}
- 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>
Examples
Get a markdown document using UUIDs
const readme = await repoData.getMarkdown('c3a499f8-3d20-503c-95b0-c4705bc272b3', 'a530dab8-f6ff-410a-9e56-8d6f49ecff2c', 'readme');
Get a markdown document using a name and number
const readme = await repoData.getMarkdown('origami-repo-data', '57.0.0', 'readme');
getReadme(repoId, versionId) → {Promise.<String>}
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>
Examples
Get the README using UUIDs
const readme = await repoData.getReadme('c3a499f8-3d20-503c-95b0-c4705bc272b3', 'a530dab8-f6ff-410a-9e56-8d6f49ecff2c');
Get the README using a name and number
const readme = await repoData.getReadme('origami-repo-data', '57.0.0');
getRepo(repoId) → {Promise.<Object>}
- 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>
Examples
Get a repository using a UUID
const repo = await repoData.getRepo('c3a499f8-3d20-503c-95b0-c4705bc272b3');
Get a repository using a name
const repo = await repoData.getRepo('origami-repo-data');
getVersion(repoId, versionId) → {Promise.<Object>}
- 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>
Examples
Get a repository version using UUIDs
const version = await repoData.getVersion('c3a499f8-3d20-503c-95b0-c4705bc272b3', 'a530dab8-f6ff-410a-9e56-8d6f49ecff2c');
Get a repository version using a name and number
const version = await repoData.getVersion('origami-repo-data', '57.0.0');
listBrandedRepos(brand) → {Promise.<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>
Example
List repositories based on brand
const repos = await repoData.listBrandedRepos('all');
listBundles(repoId, versionId, language, brand) → {Promise.<String>}
- 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>
Example
Get all CSS bundle information.
const bundles = await repoData.listBundles(
'c3a499f8-3d20-503c-95b0-c4705bc272b3',
'a530dab8-f6ff-410a-9e56-8d6f49ecff2c',
'css'
);
listDemos(repoId, versionId, brand) → {Promise.<String>}
- 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>
Examples
Get all demos
const demos = await repoData.listDemos('c3a499f8-3d20-503c-95b0-c4705bc272b3', 'a530dab8-f6ff-410a-9e56-8d6f49ecff2c');
Get all demos with a brand filter
const demos = await repoData.listDemos('c3a499f8-3d20-503c-95b0-c4705bc272b3', 'a530dab8-f6ff-410a-9e56-8d6f49ecff2c', 'internal');
listDependencies(repoId, versionId) → {Promise.<String>}
- 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>
Example
Get all dependencies
const dependencies = await repoData.listDependencies('c3a499f8-3d20-503c-95b0-c4705bc272b3', 'a530dab8-f6ff-410a-9e56-8d6f49ecff2c');
listImages(repoId, versionId, imageOptionsopt) → {Promise.<String>}
- 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>
Example
Get all images in an image set
const images = await repoData.listImages('c3a499f8-3d20-503c-95b0-c4705bc272b3', 'a530dab8-f6ff-410a-9e56-8d6f49ecff2c');
listIngestions() → {Promise.<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>
Example
List the ingestion queue
const ingestionQueue = await repoData.listIngestions();
listKeys() → {Promise.<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>
Example
List API keys
const repos = await repoData.listKeys();
listRepos(filtersopt) → {Promise.<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>
Examples
List repositories
const repos = await repoData.listRepos();
List repositories with filters
const repos = await repoData.listRepos({
brand: 'master',
search: 'color',
status: 'active',
type: 'module'
});
listVersions(repoId) → {Promise.<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>
Examples
Get all repository versions using a UUID
const versions = await repoData.listVersions('c3a499f8-3d20-503c-95b0-c4705bc272b3');
Get all repository versions using a name
const versions = await repoData.listVersions('origami-repo-data');