{"id":22351905,"url":"https://github.com/screwdriver-cd/models","last_synced_at":"2026-04-02T19:21:57.246Z","repository":{"id":9610648,"uuid":"62759755","full_name":"screwdriver-cd/models","owner":"screwdriver-cd","description":"Screwdriver Models","archived":false,"fork":false,"pushed_at":"2026-03-31T01:57:25.000Z","size":2134,"stargazers_count":7,"open_issues_count":2,"forks_count":21,"subscribers_count":16,"default_branch":"master","last_synced_at":"2026-03-31T04:56:52.658Z","etag":null,"topics":["javascript"],"latest_commit_sha":null,"homepage":"https://cd.screwdriver.cd/pipelines/9","language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/screwdriver-cd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2016-07-06T23:24:04.000Z","updated_at":"2026-03-31T01:53:04.000Z","dependencies_parsed_at":"2023-10-31T16:38:18.066Z","dependency_job_id":"ad32c3b3-38b8-4d17-90e5-a6d5463d1a51","html_url":"https://github.com/screwdriver-cd/models","commit_stats":{"total_commits":549,"total_committers":59,"mean_commits":9.305084745762711,"dds":0.7978142076502732,"last_synced_commit":"d551d2c25ba53b9fd651af6dc0c121c655d5c7ca"},"previous_names":[],"tags_count":568,"template":false,"template_full_name":null,"purl":"pkg:github/screwdriver-cd/models","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/screwdriver-cd%2Fmodels","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/screwdriver-cd%2Fmodels/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/screwdriver-cd%2Fmodels/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/screwdriver-cd%2Fmodels/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/screwdriver-cd","download_url":"https://codeload.github.com/screwdriver-cd/models/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/screwdriver-cd%2Fmodels/sbom","scorecard":{"id":806246,"data":{"date":"2025-08-11","repo":{"name":"github.com/screwdriver-cd/models","commit":"45c5ff80b3b8ca4355345e4b91e6a73f23defcf6"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":5.7,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":5,"reason":"6 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 5","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":10,"reason":"all changesets reviewed","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":9,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Warn: project license file does not contain an FSF or OSI license."],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-23T11:50:16.360Z","repository_id":9610648,"created_at":"2025-08-23T11:50:16.360Z","updated_at":"2025-08-23T11:50:16.360Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31314375,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T12:59:32.332Z","status":"ssl_error","status_checked_at":"2026-04-02T12:54:48.875Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript"],"created_at":"2024-12-04T12:16:25.974Z","updated_at":"2026-04-02T19:21:57.230Z","avatar_url":"https://github.com/screwdriver-cd.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Screwdriver Models\n[![Version][npm-image]][npm-url] ![Downloads][downloads-image] [![Build Status][status-image]][status-url] [![Open Issues][issues-image]][issues-url] ![License][license-image]\n\n\u003e Screwdriver models\n\n## Usage\nAsynchronous methods return promises.\n\n```bash\nnpm install screwdriver-models\n```\n\n### Pipeline Factory\n#### Search\n```js\n'use strict';\nconst Model = require('screwdriver-models');\nconst factory = Model.PipelineFactory.getInstance({\n    datastore,\n    scm\n});\nconst config = {\n    params: {\n        scmUri: 'github.com:12345:banana'\n    },\n    paginate {\n        page: 2,\n        count: 3\n    },\n    sort: 'ascending',\n    sortBy: 'scmRepo.name'\n}\n\nfactory.list(config).then(pipelines =\u003e {\n    // Do stuff with list of pipelines\n});\n```\n\n| Parameter        | Type  |  Description |\n| :-------------   | :---- | :-------------|\n| config        | Object | Config Object |\n| config.paginate.page | Number | The page for pagination |\n| config.paginate.count | Number | The count for pagination |\n| config.params | Object | Fields to search on |\n| config.raw | Boolean | Whether to return raw data or not |\n| config.search | Object | Search parameters |\n| config.search.field | String or Array | Search field(s) (e.g.: jobName) |\n| config.search.keyword | String | Search keyword (e.g.: %PR-%) |\n| config.sort | String | Order to sort by (`ascending` or `descending`) |\n| config.sortBy | String | Key to sort by (default `id`) |\n\n#### Create\n```js\nfactory.create(config).then(model =\u003e {\n    // do stuff with pipeline model\n});\n```\n\n| Parameter        | Type  | Required  |  Description |\n| :-------------   | :---- | :---- | :-------------|\n| config        | Object | Yes | Configuration Object |\n| config.admins | Object | Yes | Admins for this pipeline, e.g { batman: true } |\n| config.scmUri | String | Yes | Source Code URI for the application |\n| config.scmContext | String | Yes | Scm context to which user belongs |\n\n#### Get\nGet a pipeline based on id. Can pass the generatedId for the pipeline, or the unique keys for the model, and the id will be determined automatically.\n```js\nfactory.get(id).then(model =\u003e {\n    // do stuff with pipeline model\n});\n\nfactory.get({ scmUri }).then(model =\u003e {\n    // do stuff with pipeline model\n});\n```\n\n| Parameter        | Type  |  Description |\n| :-------------   | :---- | :-------------|\n| id | Number | The unique ID for the pipeline |\n| config.scmUri | String | Source Code URI for the application |\n\n\n### Pipeline Model\n\n#### Update\nUpdate a specific pipeline model\n```js\nmodel.update()\n```\n\nExample:\n```js\n'use strict';\nconst Model = require('screwdriver-models');\nconst factory = Model.PipelineFactory.getInstance({\n    datastore,\n    scm\n});\nconst scmUri = 'github.com:12345:master';\nfactory.get({ scmUri }).then(model =\u003e {\n    model.scmUri = 'github.com:12345:foo';\n    return model.update();\n})\n```\n\n#### Add Screwdriver webhook\nAttach Screwdriver webhook to the pipeline's repository\n```js\nmodel.addWebhook(webhookUrl)\n```\n\n| Parameter        | Type  | Description |\n| :-------------   | :---- | :--------|\n| webhookUrl        | String | The webhook url to be added |\n\n\n#### Sync\nSync the pipeline. Look up the configuration in the repo to create and delete jobs if necessary.\n```js\nmodel.sync()\n```\n\n#### Get Configuration\nGet the screwdriver configuration for the pipeline at the given ref\n```js\nmodel.getConfiguration(config)\n```\n\n| Parameter        | Type  | Required | Description |\n| :-------------   | :---- | :--- | :--------|\n| ref        | String | No | Reference to the branch or PR |\n\n\n#### Get Jobs\nReturn a list of jobs that belong to this pipeline\n```js\nmodel.getJobs(config)\n```\n\n| Parameter        | Type  | Required | Default | Description |\n| :-------------   | :---- | :--- | :--- | :-------------|\n| config        | Object | No | | Configuration Object |\n| config.params | Object | No | | Fields to search on |\n| config.paginate.page | Number | No | | The page for pagination |\n| config.paginate.count | Number | No | | The count for pagination |\n\n\n#### Get Events\nReturn a list of events that belong to this pipeline\n```js\nmodel.getEvents(config)\n```\n\n| Parameter        | Type  | Required | Default | Description |\n| :-------------   | :---- | :--- | :--- | :-------------|\n| config        | Object | No | | Config Object |\n| config.type | Number | No | `pipeline` | Type of event: `pipeline` or `pr` |\n| config.sort | String | No | `descending`| Order to sort by (`ascending` or `descending`) |\n\n#### Tokens\nGet the pipeline's access tokens\n```js\nmodel.tokens\n    .then((tokens) =\u003e {\n        // do stuff with tokens\n    });\n```\n\n#### Get Event Metrics\nGet all the event durations for this pipeline within time range\n```js\nmodel.getMetrics()\n    .then((metrics) =\u003e {\n        // do stuff with metrics\n    });\n```\n\n### Job Factory\n#### Search\n```js\n'use strict';\nconst Model = require('screwdriver-models');\nconst factory = Model.JobFactory.getInstance({\n    datastore\n});\nconst config = {\n    params: {\n        pipelineId: 1\n    },\n    paginate {\n        page: 2,\n        count: 3\n    }\n}\n\nfactory.list(config).then(jobs =\u003e {\n    // Do stuff with list of jobs\n});\n```\n\n| Parameter        | Type  |  Description |\n| :-------------   | :---- | :-------------|\n| config        | Object | Configuration Object |\n| config.paginate.page | Number | The page for pagination |\n| config.paginate.count | Number | The count for pagination |\n| config.params | Object | fields to search on |\n\n#### Create\n```js\nfactory.create(config).then(model =\u003e {\n    // do stuff with job model\n});\n```\n\n| Parameter        | Type  |  Description |\n| :-------------   | :---- | :-------------|\n| config        | Object | Configuration Object |\n| config.pipelineId | Number | The pipelineId that the job belongs to |\n| config.name | String | The name of the job |\n\n#### Get\nGet a job based on id. Can pass the generatedId for the job, or the unique keys for the model, and the id will be determined automatically.\n```js\nfactory.get(id).then(model =\u003e {\n    // do stuff with job model\n});\n\nfactory.get({ pipelineId, name }).then(model =\u003e {\n    // do stuff with job model\n});\n```\n\n| Parameter        | Type  |  Description |\n| :-------------   | :---- | :-------------|\n| id | Number | The unique ID for the job |\n| config.pipelineId | Number | Id of the pipeline the job is associated with |\n| config.name | String | Name of the job |\n\n### Job Model\n```js\n'use strict';\nconst Model = require('screwdriver-models');\nconst factory = Model.JobFactory.getInstance({\n    datastore\n});\n\nfactory.get(id).then(model =\u003e {\n    model.name = 'hello';\n    return model.update();\n});\n```\n\n#### Update\nUpdate a job\n```js\nmodel.update()\n```\n\n#### Get builds\nReturn builds that belong to this job\n```js\nmodel.getBuilds(config)\n```\n\n| Parameter        | Type  | Required | Default |  Description |\n| :-------------   | :---- | :--- | :---- | :-------------|\n| config        | Object | No | | Configuration Object |\n| config.sort | String | No | descending | `ascending` or `descending` |\n\n#### Get running builds\nReturn all running builds that belong to this jobId\n```js\nmodel.getRunningBuilds()\n```\n\n#### Get Build Metrics\nGet all the build durations for this job within time range\n```js\nmodel.getMetrics()\n    .then((metrics) =\u003e {\n        // do stuff with metrics\n    });\n```\n\n### Build Factory\n#### Search\n```js\n'use strict';\nconst Model = require('screwdriver-models');\nconst factory = Model.BuildFactory.getInstance({  \n    datastore,\n    scm,\n    executor,\n    uiUri\n});\nconst config = {\n    params: {\n        jobId: 4\n    },\n    paginate {\n        page: 2,\n        count: 3\n    }\n}\n\nfactory.list(config).then(builds =\u003e {\n    // Do stuff with list of builds\n});\n```\n\n| Parameter        | Type  |  Description |\n| :-------------   | :---- | :-------------|\n| config        | Object | Config Object |\n| config.paginate.page | Number | The page for pagination |\n| config.paginate.count | Number | The count for pagination |\n| config.params | Object | fields to search on |\n\n#### Create\n```js\nfactory.create(config).then(model =\u003e {\n    // do stuff with build model\n});\n```\n\n| Parameter        | Type  |  Required | Description |\n| :-------------   | :---- | :-------------|  :-------------|\n| config        | Object | Yes | Configuration Object |\n| config.apiUri | String | Yes | URI back to the API |\n| config.tokenGen | Function | Yes | Generator for building tokens |\n| config.username | String | Yes | User who made the change to kick off the build |\n| config.scmContext | String | Yes | Scm context to which user belongs |\n| config.container | String | No | Container for the build to run in |\n| config.sha | String | No | SHA used to kick off the build |\n| config.prRef | String | No | PR branch or reference; required for PR jobs |\n| config.eventId | Number | No | Id of the event this build belongs to |\n\n#### Get\nGet a build based on id. Can pass the generatedId for the build, or the unique keys for the model, and the id will be determined automatically.\n```js\nfactory.get(id).then(model =\u003e {\n    // do stuff with build model\n});\n\nfactory.get({ jobId, number }).then(model =\u003e {\n    // do stuff with build model\n});\n```\n\n| Parameter      | Type  |  Description   |\n| :------------- | :---- | :------------- |\n| id | Number | The unique ID for the build |\n| config.jobId | Number | The unique ID for a job |\n| config.number | Number | build number |\n\n#### Get Build Statuses\nGet the statuses of the newest builds of jobs based on job ids (in ascending order). Can specify the number of build statuses desired per job id, this defaults to 1. \nCan specify the number of build statuses to skip per job id, this defaults to 0.\n```js\nfactory.getBuildStatuses(config).then(statuses =\u003e {\n    // do stuff with the statuses\n});\n```\n\n| Parameter       | Type  |  Required | Description |\n| :-------------  | :---- | :-------- | :---------- |\n| config        | Object | Yes | Configuration Object |\n| config.jobIds | Array | Yes | Ids of the jobs to get build statuses for |\n| config.numBuilds | Number | No | Number of build statuses to return per job |\n| config.offset | Number | No | Number of build statuses to skip per job|\n\n#### Get Latest Builds\nGet the latest builds for each job in corresponding groupEventId.\n```js\nfactory.getLatestBuilds(config).then(latestBuilds =\u003e {\n    // do stuff with the latest builds\n});\n```\n\n| Parameter      | Type  |  Required | Description |\n| :------------- | :---- | :-------- | :---------- |\n| config        | Object | Yes | Configuration Object |\n| config.groupEventId | Number | Yes | Group event ID to get latest builds for |\n\n### Build Model\n```js\n'use strict';\nconst Model = require('screwdriver-models');\nconst factory = Model.BuildFactory.getInstance({  \n    datastore,\n    scm,\n    executor,\n    uiUri\n});\n\nfactory.get(id).then(model =\u003e {\n    model.state = 'FAILURE';\n    model.update();\n});\n```\n\n#### Update\nUpdate a specific build\n```js\nmodel.update()\n```\n\n#### Stream\nStream the log of a build\n```js\nmodel.stream()\n```\n\n#### Update commit status\nUpdate  a commit status\n```js\nmodel.updateCommitStatus(pipeline)\n```\n| Parameter        | Type  |  Description |\n| :-------------   | :---- | :----------- |\n| pipeline        | Pipeline | The pipeline that this build belongs to |\n\n#### Start a build\nStart the build and update commit status as pending\n```js\nmodel.start()\n```\n\n#### Stop a build\n```js\nmodel.stop()\n```\n\n#### Check if a build is done\n```js\nmodel.isDone()\n```\n\n### User Factory\n#### Search\n```js\n'use strict';\nconst Model = require('screwdriver-models');\nconst factory = Model.UserFactory.getInstance({\n    datastore,\n    scm,\n    password            // Password to seal/unseal user's token\n});\nconst config = {\n    params: {\n        username: 'batman',\n        scmContext: 'github:github.com'\n    },\n    paginate {\n        page: 2,\n        count: 3\n    }\n}\n\nfactory.list(config).then(users =\u003e {\n    // Do stuff with list of users\n});\n```\n\n| Parameter        | Type  |  Description |\n| :-------------   | :---- | :-------------|\n| config        | Object | Config Object |\n| config.paginate.page | Number | The page for pagination |\n| config.paginate.count | Number | The count for pagination |\n| config.params | Object | fields to search on |\n\n#### Create\n```js\nfactory.create(config).then(model =\u003e {\n    // do stuff with user model\n});\n```\n\n| Parameter        | Type  |  Required | Description |\n| :-------------   | :---- | :-------------|  :-------------|\n| config        | Object | Yes | Configuration Object |\n| config.username | String | Yes | User who made the change to kick off the build |\n| config.token | String | Yes | unsealed token |\n| config.scmContext | String | Yes | Scm context to which user belongs |\n| config.password | String | Yes | User's password used to seal/unseal token, not saved in datastore |\n\n#### Get\nGet a user based on id. Can pass the generatedId for the user, or the username, and the id will be determined automatically.\nCan also pass a Screwdriver access token, and will get the user associated with that token.\n```js\nfactory.get(id).then(model =\u003e {\n    // do stuff with user model\n});\n\nfactory.get({ username }).then(model =\u003e {\n    // do stuff with user model\n});\n\nfactory.get({ token }).then(model =\u003e {\n    // do stuff with user model\n});\n```\n\n| Parameter        | Type  |  Description |\n| :-------------   | :---- | :-------------|\n| id | Number | The unique ID for the build |\n| config.username | String | User name |\n| config.scmContext | String | Scm context to which user belongs |\n| config.accessToken | String | A user access token value |\n\n### User Model\n```js\n'use strict';\nconst Model = require('screwdriver-models');\nconst factory = Model.UserFactory.getInstance({\n    datastore,\n    scm,\n    password                    // Password to seal/unseal user's token\n});\nconst config = {\n    username: 'myself',\n    token: 'eyJksd3',            // User's github token\n    scmContext: 'github:github.com',          // Scm context to which user belongs\n    password\n}\n\nfactory.create(config)\n    .then(user =\u003e user.getPermissions(scmUri))\n    .then(permissions =\u003e {\n        // do stuff here\n    });\n```\n\n#### Update\nUpdate a specific user\n```js\nmodel.update()\n```\n\n#### Seal Token\nSeal a token\n```js\nmodel.sealToken(token)\n```\n\n| Parameter        | Type  |  Description |\n| :-------------   | :---- | :-------------|\n| token | String | The token to seal |\n\n\n#### Unseal Token\nUnseal the user's token\n```js\nmodel.unsealToken()\n```\n\n#### Get User's Permissions For a Repo\nGet user's permissions for a specific repo\n```js\nmodel.getPermissions(scmUri)\n```\n\n| Parameter        | Type  |  Description |\n| :-------------   | :---- | :-------------|\n| scmUri | String | The scmUri of the repo |\n\n#### Tokens\nGet the user's access tokens\n```js\nmodel.tokens\n    .then((tokens) =\u003e {\n        // do stuff with tokens\n    });\n```\n\n\n### Secret Factory\n#### Search\n```js\n'use strict';\nconst Model = require('screwdriver-models');\nconst factory = Model.SecretFactory.getInstance({\n    datastore,\n    password            // Password for encryption operations\n});\nconst config = {\n    params: {\n        pipelineId: 1\n    },\n    paginate {\n        page: 2,\n        count: 3\n    }\n}\n\nfactory.list(config).then(secrets =\u003e {\n    // Do stuff with list of secrets\n});\n```\n\n| Parameter        | Type  |  Description |\n| :-------------   | :---- | :-------------|\n| config        | Object | Config Object |\n| config.paginate.page | Number | The page for pagination |\n| config.paginate.count | Number | The count for pagination |\n| config.params | Object | fields to search on |\n\n#### Create\n```js\nfactory.create(config).then(model =\u003e {\n    // do stuff with secret model\n});\n```\n\n| Parameter        | Type  |  Required | Description |\n| :-------------   | :---- | :-------------|  :-------------|\n| config        | Object | Yes | Configuration Object |\n| config.pipelineId | Number | Yes | Pipeline that this secret belongs to |\n| config.name | String | Yes | Secret name |\n| config.value | String | Yes | Secret value |\n| config.allowInPR | String | Yes | Flag to denote if this secret can be shown in PR builds |\n\n#### Get\nGet a secret based on id. Can pass the generatedId for the secret, or the combination of pipelineId and secret name, and the id will be determined automatically.\n```js\nfactory.get(id).then(model =\u003e {\n    // do stuff with secret model\n});\n\nfactory.get({ pipelineId, name }).then(model =\u003e {\n    // do stuff with secret model\n});\n```\n\n| Parameter        | Type  |  Description |\n| :-------------   | :---- | :-------------|\n| id | Number | The unique ID for the build |\n| config.pipelineId | Number | Pipeline that the secret belongs to |\n| config.name | String | Secret name |\n\n\n### Secret Model\n```js\n'use strict';\nconst Model = require('screwdriver-models');\nconst factory = Model.SecretFactory.getInstance({\n    datastore,\n    password            // Password for encryption operations\n});\nconst config = {\n    pipelineId: 1,\n    name: 'NPM_TOKEN',\n    value: banana,\n    allowInPR: false\n}\n\nfactory.create(config)\n    .then(model =\u003e // do something\n    });\n```\n\n#### Update\nUpdate a specific secret\n```js\nmodel.update()\n```\n\n### Stage Factory\n#### Create\n```js\nfactory.create(config).then(model =\u003e {\n    // do stuff with stage model\n});\n```\n\n| Parameter        | Type  |  Required | Description |\n| :-------------   | :---- | :-------------|  :-------------|\n| config        | Object | Yes | Configuration Object |\n| config.pipelineId | Number | Yes | Pipeline that this stage belongs to |\n| config.name | String | Yes | Stage name |\n| config.jobIds | Array | No | Jobs IDs that belong to this stage. Default `[]`. |\n| config.groupEventId | Number | Yes | Group event ID that this stage belongs to |\n| config.description | String | No | Description for stage |\n\n#### Get\nGet stage based on ID.\n```js\nfactory.get(id).then(model =\u003e {\n    // do stuff with stage model\n});\n```\n\n| Parameter        | Type  |  Description |\n| :-------------   | :---- | :-------------|\n| id | Number | The unique ID for the stage |\n\n#### List\nList stages that have pipelineId as `12345` and groupEventId as `555`\n```js\nfactory.list({\n    params: {\n        pipelineId: 12345,\n        groupEventId: 555\n    }\n}).then(recs =\u003e\n    // do things with the records\n);\n```\n\n### Event Factory\n#### Search\n```js\n'use strict';\nconst Model = require('screwdriver-models');\nconst factory = Model.EventFactory.getInstance({\n    datastore,\n    scm\n});\nconst config = {\n    params: {\n        pipelineId: 1\n    }\n}\n\nfactory.list(config).then(events =\u003e {\n    // Do stuff with list of events\n});\n```\n\n| Parameter        | Type  |  Description |\n| :-------------   | :---- | :-------------|\n| config        | Object | Config Object |\n| config.params | Object | fields to search on |\n\n#### Create\n```js\nfactory.create(config).then(model =\u003e {\n    // do stuff with event model\n});\n```\n\n| Parameter        | Type  |  Required | Description |\n| :-------------   | :---- | :-------------|  :-------------|\n| config        | Object | Yes | Configuration Object |\n| config.type | String | No | Event type: pipeline or pr |\n| config.pipelineId | Number | Yes | Unique identifier of pipeline |\n| config.sha | String | Yes | Commit sha that the event was based on |\n| config.workflowGraph | Object | No | Workflow graph of the pipeline, with edges and nodes |\n| config.username | String | Yes | Username of the user that creates this event |\n| config.causeMessage | String | No | Message that describes why the event was created |\n\n#### Get\nGet an event based on id. Can pass the generatedId for the event, or { pipelineId, sha } and the id will be determined automatically.\n```js\nfactory.get(id).then(model =\u003e {\n    // do stuff with event model\n});\n\nfactory.get({ pipelineId, sha }).then(model =\u003e {\n    // do stuff with event model\n});\n```\n\n| Parameter        | Type  |  Description |\n| :-------------   | :---- | :-------------|\n| id | Number | The unique ID for the build |\n| config.pipelineId | Number | Unique identifier of pipeline |\n| config.sha | String | Commit sha that the event was based on |\n\n### Event Model\n```js\n'use strict';\nconst Model = require('screwdriver-models');\nconst factory = Model.EventFactory.getInstance({\n    datastore,\n    scm\n});\nconst config = {\n    pipelineId: 1,\n    sha: 'ccc49349d3cffbd12ea9e3d41521480b4aa5de5f',\n    workflowGraph: {\n        nodes: [\n            { name: '~pr' },\n            { name: '~commit' },\n            { name: 'main' },\n            { name: 'publish' }\n        ],\n        edges: [\n            { src: '~pr', dest: 'main' },\n            { src: '~commit', dest: 'main' },\n            { src: 'main', dest: 'publish' }\n        ]\n    },    \n    username: 'stjohn',\n    causeMessage: 'Merge pull request #26 from screwdriver-cd/models'\n}\n\nfactory.create(config)\n    .then(model =\u003e {    // do something\n    });\n```\n\nExample event model that got created:\n```json\n{\n    \"type\": \"pipeline\",\n    \"pipelineId\": \"1\",\n    \"sha\": \"ccc49349d3cffbd12ea9e3d41521480b4aa5de5f\",\n    \"createTime\": \"2038-01-19T03:14:08.131Z\",\n    \"commit\": {\n        \"url\": \"https://link.to/commitDiff\",\n        \"message\": \"some commit message that is here\",\n        \"author\": {\n            \"avatar\": \"https://avatars.githubusercontent.com/u/1234567?v=3\",\n            \"name\": \"Batman\",\n            \"url\": \"https://internal-ghe.mycompany.com/imbatman\",\n            \"username\": \"imbatman\"\n        }\n    },\n    \"workflowGraph\": {\n        \"nodes\": [\n            { \"name\": \"~pr\" },\n            { \"name\": \"~commit\" },\n            { \"name\": \"main\" },\n            { \"name\": \"publish\" }\n        ],\n        \"edges\": [\n            { \"src\": \"~pr\", \"dest\": \"main\" },\n            { \"src\": \"~commit\", \"dest\": \"main\" },\n            { \"src\": \"main\", \"dest\": \"publish\" }\n        ]\n    },\n    \"causeMessage\": \"Merge pull request #26 from screwdriver-cd/models\",\n    \"creator\": {\n        \"avatar\": \"https://avatars.githubusercontent.com/u/2042?v=3\",\n        \"name\": \"St John\",\n        \"url\": \"https://github.com/stjohn\",\n        \"username\": \"stjohn\"\n    }\n}\n```\n\n#### Update\nUpdate a specific event\n```js\nmodel.update()\n```\n\n#### Get builds\nGet builds that belong to this event\n```js\nmodel.getBuilds()\n```\n\n#### Get Build Metrics\nGet all the build durations for this event within time range\n```js\nmodel.getMetrics()\n    .then((metrics) =\u003e {\n        // do stuff with metrics\n    });\n```\n\n### Template Model\n```js\n'use strict';\nconst Model = require('screwdriver-models');\nconst factory = Model.TemplateFactory.getInstance({\n    datastore\n});\nconst config = {\n    name: 'testTemplate',\n    namespace: 'templateNamespace',   // optional\n    version: '1.3',\n    description: 'I am a test template',    \n    maintainer: 'foo@bar.com',\n    scmUri: 'github:123:master',\n    config: { image: 'node:6'},\n    labels: ['beta', 'stable']\n}\n\nfactory.create(config)\n    .then(model =\u003e {    // do something\n    });\n```\n\n#### Update\nUpdate a specific template\n```js\nmodel.update()\n```\n\n### Template Factory\n#### Create\n```js\nfactory.create(config).then(model =\u003e {\n    // do stuff with template model\n});\n```\n\n| Parameter        | Type  |  Required | Description |\n| :-------------   | :---- | :-------------|  :-------------|\n| config        | Object | Yes | Configuration Object |\n| config.name | String | Yes | The template name |\n| config.namespace | String | No | The template namespace |\n| config.version | String | Yes | Version of the template |\n| config.description | String | Yes | Description of the template |\n| config.maintainer | Array | Yes | Maintainer's email |\n| config.config | Object | Yes | Config of the screwdriver-template.yaml |\n| config.pipelineId | Number | Yes | pipelineId of the template |\n| config.labels | Array | No | Labels attached to the template |\n\n#### Get\nGet a template based on id or other params.\n```js\nfactory.get(id).then(model =\u003e {\n    // do stuff with template model\n});\n\nfactory.get({ namespace, name }).then(model =\u003e {\n    // do stuff with template model\n});\n```\n\n| Parameter        | Type  |  Description |\n| :-------------   | :---- | :-------------|\n| id | Number | The unique ID for the Template |\n| config.namespace | String | Template namespace |\n| config.name | String | Template name (can include namespace) |\n| config.version | String | Template version |\n\n#### Get Template\nGet the latest template by name or get a specific template using name and version or name and tag. The version can be in any valid version format: either major, major.minor, or major.minor.patch. If no version is specified, the function will resolve with the latest version published. If no match is found, the function will resolve null.\n```js\nfactory.getTemplate(fullTemplateName).then(model =\u003e {\n    // do stuff with template model\n});\n```\n\n| Parameter        | Type   |  Required | Description |\n| :-------------   | :----- | :-------------|  :-------------|\n| fullTemplateName | String | Yes | Name of the template and the version or tag (e.g. chef/publish@1.2.3 or chef/publish@latest). Can also be just name of the template (e.g. chef/publish) |\n\n#### Search Template\n```js\n'use strict';\nconst Model = require('screwdriver-models');\nconst factory = Model.TemplateFactory.getInstance({\n    datastore\n});\nconst config = {\n    params: {\n        name: 'chef/publish'\n    },\n    paginate {\n        page: 1,\n        count: 3\n    },\n    getCount: true\n}\n\nfactory.list(config).then(templates =\u003e {\n    // Do stuff with list of templates\n});\n```\n\n| Parameter        | Type  |  Description |\n| :-------------   | :---- | :-------------|\n| config        | Object | Config Object |\n| config.paginate.page | Number | The page for pagination |\n| config.paginate.count | Number | The count for pagination |\n| config.params | Object | fields to search on |\n| config.getCount | Boolean | Total count of record matching search param |\n\n### Template Tag Model\n```js\n'use strict';\nconst Model = require('screwdriver-models');\nconst factory = Model.TemplateTagFactory.getInstance({\n    datastore\n});\nconst config = {\n    name: 'testTemplate',\n    namespace: 'templateNamespace', // optional\n    tag: 'stable',\n    version: '1.3'\n}\n\nfactory.create(config)\n    .then(model =\u003e {    // do something\n    });\n```\n\n#### Update\nUpdate a specific template tag\n```js\n// update template version value\nmodel.version = '2.4';\n\nmodel.update();\n```\n\n### Template Tag Factory\n#### Create\n```js\nfactory.create(config).then(model =\u003e {\n    // do stuff with template tag model\n});\n```\n\n| Parameter        | Type  |  Required | Description |\n| :-------------   | :---- | :-------------|  :-------------|\n| config        | Object | Yes | Configuration Object |\n| config.name | String | Yes | The template name |\n| config.namespace | String | No | The template namespace |\n| config.tag | String | Yes | The template tag (e.g. stable, latest, etc) |\n| config.version | String | Yes | Version of the template |\n\n#### Get\nGet a template tag based on id.\n```js\nfactory.get(id).then(model =\u003e {\n    // do stuff with template model\n});\n\nfactory.get({ namespace, name }).then(model =\u003e {\n    // do stuff with template model\n});\n```\n\n| Parameter        | Type  |  Description |\n| :-------------   | :---- | :-------------|\n| id | Number | The unique ID for the Template tag |\n| config.namespace | String | Template namespace |\n| config.name | String | Template name (can include namespace) |\n\n#### Search Template Tags\n```js\n'use strict';\nconst Model = require('screwdriver-models');\nconst factory = Model.TemplateTagFactory.getInstance({\n    datastore\n});\nconst config = {\n    params: {\n        name: 'chef/publish'\n    },\n    paginate {\n        page: 1,\n        count: 3\n    }\n}\n\nfactory.list(config).then(templateTags =\u003e {\n    // Do stuff with list of templateTags\n});\n```\n\n| Parameter        | Type  |  Description |\n| :-------------   | :---- | :-------------|\n| config        | Object | Config Object |\n| config.paginate.page | Number | The page for pagination |\n| config.paginate.count | Number | The count for pagination |\n| config.params | Object | fields to search on |\n\n### Trigger Model\n```js\n'use strict';\nconst Model = require('screwdriver-models');\nconst factory = Model.TriggerFactory.getInstance({\n    datastore\n});\nconst config = {\n    dest: '~sd@123:component',\n    src: '~sd@456:main'\n}\n\nfactory.create(config)\n    .then(model =\u003e {    // do something\n});\n```\n\n### Trigger Factory\n#### Create\n```js\nfactory.create(config).then(model =\u003e {\n    // do stuff with trigger model\n});\n```\n\n| Parameter        | Type  |  Required | Description |\n| :-------------   | :---- | :-------------|  :-------------|\n| config        | Object | Yes | Configuration Object |\n| config.src | String | Yes | The job that initiates the trigger (ex: ~sd@123:component) |\n| config.dest | String | Yes | The job that is triggered (ex: ~sd@456:main) |\n\n#### Get\nGet trigger based on id.\n```js\nfactory.get(id).then(model =\u003e {\n    // do stuff with trigger model\n});\n```\n\n| Parameter        | Type  |  Description |\n| :-------------   | :---- | :-------------|\n| id | Number | The unique ID for the trigger |\n\n#### List\nList triggers that have dest as `~sd@456:main`\n```js\n// update template version value\nfactory.list({\n    params: {\n        dest: '~sd@456:main'\n    }\n}).then(recs =\u003e\n    // do things with the records\n);\n```\n\n#### Get destination(s) from source\nGet destinations based on source trigger.\n```js\n// update template version value\nfactory.getDestFromSrc('~sd@456:main').then(dests =\u003e\n    console.log(dests);\n    // [destA, destB]\n);\n```\n\n| Parameter        | Type  |  Description |\n| :-------------   | :---- | :-------------|\n| src           | String | The job that initiates the trigger (ex: ~sd@123:component) |\n\n#### Get Triggers\nGet triggers based on pipeline ID.\n```js\nfactory.getTriggers({ pipelineId, type }).then(result =\u003e {\n    console.log(result);\n    // [{\n    //     jobName1,\n    //     triggers: [destA, destB]\n    // }, {\n    //     jobName2,\n    //     triggers: [destC, destD]\n    // }]\n});\n```\n\n| Parameter        | Type  |  Description |\n| :-------------   | :---- | :-------------|\n| config           | Object | Config object |\n| config.pipelineId | Number | The unique ID for the pipeline |\n| config.type | String | Type of jobs to get (`pr` or `pipeline`; default `pipeline`) |\n\n### Token Factory\n#### Search\n```js\n'use strict';\nconst Model = require('screwdriver-models');\nconst factory = Model.TokenFactory.getInstance({\n    datastore\n});\nconst config = {\n    params: {\n        userId: 12345\n    },\n    paginate {\n        page: 1,\n        count: 3\n    }\n}\n\nfactory.list(config).then(tokens =\u003e {\n    // Do stuff with list of tokens\n});\n```\n\n| Parameter        | Type  |  Description |\n| :-------------   | :---- | :-------------|\n| config        | Object | Config Object |\n| config.paginate.page | Number | The page for pagination |\n| config.paginate.count | Number | The count for pagination |\n| config.params | Object | fields to search on |\n\n#### Create\n```js\nfactory.create(config).then(model =\u003e {\n    // do stuff with token model\n});\n```\n\n| Parameter        | Type  |  Required | Description |\n| :-------------   | :---- | :-------------|  :-------------|\n| config        | Object | Yes | Configuration Object |\n| config.userId | Number | Yes | User that this token belongs to |\n| config.name | String | Yes | Token name |\n| config.description | String | No | Description of the token |\n\n#### Get\nGet a token based on id. Can pass the generatedId for the token, or the token value, and the id will be determined automatically.\n```js\nfactory.get(id).then(model =\u003e {\n    // do stuff with token model\n});\n\nfactory.get({ value }).then(model =\u003e {\n    // do stuff with token model\n});\n```\n\n| Parameter        | Type  |  Description |\n| :-------------   | :---- | :-------------|\n| id | Number | The unique ID for the token |\n| config.value | String | The value of the token |\n\n\n### Token Model\n```js\n'use strict';\nconst Model = require('screwdriver-models');\nconst factory = Model.TokenFactory.getInstance({\n    datastore,\n});\nconst config = {\n    userId: 12345,\n    name: 'NPM_TOKEN',\n    description: 'A token for use by npm'\n}\n\nfactory.create(config)\n    .then(model =\u003e // do something\n    });\n```\n\n#### Update\nUpdate a specific token\n```js\nmodel.update()\n```\n\n#### Refresh\nRefresh a token's value while preserving its other metadata. Attaches a temporary \"value\" field to the model\n```js\ntoken.refresh()\n    .then(model =\u003e // do something with the new model.value\n    });\n```\n\n### Collection Factory\n#### Search\n```js\n'use strict';\nconst Model = require('screwdriver-models');\nconst factory = Model.CollectionFactory.getInstance({\n    datastore\n});\nconst config = {\n    params: {\n        userId: 12345\n    }\n};\n\nfactory.list(config).then(collections =\u003e {\n    // Do stuff with list of collections\n});\n```\n\n| Parameter     | Type   | Description         |\n| :-------------| :------| :-------------------|\n| config        | Object | Config object       |\n| config.params | Object | Fields to search on |\n\n#### Create\n```js\nfactory.create(config).then(model =\u003e {\n    // do stuff with collection model\n});\n```\n\n| Parameter          | Type   | Required | Description                                              |\n| :------------------| :------| :--------| :--------------------------------------------------------|\n| config             | Object | Yes      | Configuration Object                                     |\n| config.userId      | Number | Yes      | User that this collection belongs to                     |\n| config.name        | String | Yes      | Collection name                                          |\n| config.description | String | No       | Collection description                                   |\n| config.pipelineIds | Array  | No       | List of ids of pipelines associated with this collection |\n\n#### Get\nGet a collection based on unique id of collection. Can also pass in a combination of userId and collection name, and the id will be determined automatically.\n```js\nfactory.get(id).then(model =\u003e {\n    // do stuff with collection model\n});\n\nfactory.get({ userId, name }).then(model =\u003e {\n    // do stuff with collection model\n})\n```\n\n| Parameter | Type   | Description                      |\n| :---------| :------| :--------------------------------|\n| id        | Number | The unique id for the collection |\n\n### Collection Model\n```js\n'use strict';\nconst Model = require('screwdriver-models');\nconst factory = Model.CollectionFactory.getInstance({\n    datastore\n});\nconst config = {\n    userId: 12345,\n    name: 'Screwdriver',\n    description: 'Collection of screwdriver pipelines'\n};\n\nfactory.create(config)\n    .then(model =\u003e {\n        // do something with model\n    });\n```\n\n#### Update\nUpdate a specific collection\n```js\nmodel.update()\n```\n\n#### Remove\nRemove a specific collection\n```js\nmodel.remove()\n```\n\n### Command Model\n```js\n'use strict';\nconst Model = require('screwdriver-models');\nconst factory = Model.CommandFactory.getInstance({\n    datastore\n});\nconst config = {\n    namespace: 'testCommandNS',\n    name: 'testCommand',\n    version: '1.3',\n    description: 'This is a test command',\n    maintainer: 'foo@bar.com',\n    format: 'habitat',\n    habitat: {\n        mode: 'remote',\n        package: 'core/git/2.14.1',\n        command: 'git'\n    }\n}\n\nfactory.create(config)\n    .then(model =\u003e {    // do something\n    });\n```\n\n### Command Factory\n#### Create\n```js\nfactory.create(config).then(model =\u003e {\n    // do stuff with command model\n});\n```\n\n| Parameter        | Type  |  Required | Description |\n| :-------------   | :---- | :-------------|  :-------------|\n| config        | Object | Yes | Configuration Object |\n| config.namespace | String | Yes | The command namespace |\n| config.name | String | Yes | The command name |\n| config.version | String | Yes | Version of the command |\n| config.description | String | Yes | Description of the command |\n| config.usage | String | No | Command usage and arguments (e.g.: 'sd-cmd exec foo/bar@1 -d \u003cdomain\u003e -h \u003chost\u003e') |\n| config.maintainer | String | Yes | Maintainer's email |\n| config.format | String | Yes | Format of the command, habitat or docker or binary |\n| config.habitat | Object | Yes (any one of habitat, docker, binary) | Configuration Object for Habitat command |\n| config.docker | Object | Yes (any one of habitat, docker, binary) | Configuration Object for Docker command |\n| config.binary | Object | Yes (any one of habitat, docker, binary) | Configuration Object for Binary command |\n\n#### Get\nGet a command based on id.\n```js\nfactory.get(id).then(model =\u003e {\n    // do stuff with command model\n});\n```\n\n| Parameter        | Type  |  Description |\n| :-------------   | :---- | :-------------|\n| id | Number | The unique ID for the Command |\n\n#### Get Command\nGet the latest command by name or get a specific command using namespace, command name and version or tag. The version can be in any valid version format: either major, major.minor, or major.minor.patch. If no version is specified, the function will resolve with the latest version published. If no match is found, the function will resolve null.\n```js\nfactory.getCommand(fullCommandName).then(model =\u003e {\n    // do stuff with command model\n});\n```\n\n| Parameter        | Type   |  Required | Description |\n| :-------------   | :----- | :-------------|  :-------------|\n| fullCommandName | String | Yes | Namespace and name of the command and the version or tag (e.g. chefdk/knife@1.2.3 or chefdk/knife@latest). Can also be just namespace and name of the command (e.g. chefdk/knife) |\n\n### Command Tag Model\n```js\n'use strict';\nconst Model = require('screwdriver-models');\nconst factory = Model.CommandTagFactory.getInstance({\n    datastore\n});\nconst config = {\n    namespace: 'testCommandNS',\n    name: 'testCommand',\n    tag: 'stable',\n    version: '1.3.5'\n}\n\nfactory.create(config)\n    .then(model =\u003e {    // do something\n    });\n```\n\n#### Update\nUpdate a specific command tag\n```js\n// update command version value\nmodel.version = '2.4.8';\n\nmodel.update()\n```\n\n### Command Tag Factory\n#### Create\n```js\nfactory.create(config).then(model =\u003e {\n    // do stuff with command tag model\n});\n```\n\n| Parameter        | Type  |  Required | Description |\n| :-------------   | :---- | :-------------|  :-------------|\n| config        | Object | Yes | Configuration Object |\n| config.namespace | String | Yes | The command namespace |\n| config.name | String | Yes | The command name |\n| config.tag | String | Yes | The command tag (e.g. stable, latest, etc) |\n| config.version | String | Yes | Exact version of the command |\n\n#### Get\nGet a command tag based on id.\n```js\nfactory.get(id).then(model =\u003e {\n    // do stuff with command model\n});\n```\n\n| Parameter        | Type  |  Description |\n| :-------------   | :---- | :-------------|\n| id | Number | The unique ID for the Command Tag |\n\n### Banner Factory\n#### Search\n```js\n'use strict';\nconst Model = require('screwdriver-models');\nconst factory = Model.BannerFactory.getInstance({\n    datastore\n});\nconst config = {\n    params: {\n        isActive: true\n    }\n};\n\nfactory.list(config).then(banners =\u003e {\n    // Do stuff with list of banners\n});\n```\n\n| Parameter     | Type   | Description         |\n| :-------------| :------| :-------------------|\n| config        | Object | Config object       |\n| config.params | Object | Fields to search on |\n\n#### Create\n```js\nfactory.create(config).then(model =\u003e {\n    // do stuff with banner model\n});\n```\n\n| Parameter          | Type    | Required | Default | Description                                               |\n| :------------------| :-------| :--------| :-------| :---------------------------------------------------------|\n| config             | Object  | Yes      |         | Configuration Object                                      |\n| config.message     | String  | Yes      |         | Text of banner to be displayed                            |\n| config.isActive    | Boolean | No       | false   | Flag for whether banner should display                    |\n| config.type        | String  | No       | info    | Type/Severity of banner message. Options: `info`,`warn`   |\n| config.createdBy   | String  | Yes      |         | Username of the user creating the banner                  |\n\n#### Get\nGet a banner based on unique id of banner.\n```js\nfactory.get(id).then(model =\u003e {\n    // do stuff with banner model\n});\n```\n\n| Parameter | Type   | Description                      |\n| :---------| :------| :--------------------------------|\n| id        | Number | The unique id for the banner     |\n\n### Banner Model\n```js\n'use strict';\nconst Model = require('screwdriver-models');\nconst factory = Model.BannerFactory.getInstance({\n    datastore\n});\nconst config = {\n    message: 'There will be a brief outage between 9:00am and 9:15am tomorrow morning',\n    isActive: true,\n    type: 'info'\n};\n\nfactory.create(config)\n    .then(model =\u003e {\n        // do something with model\n    });\n```\n\n#### Update\nUpdate a specific banner\n```js\nmodel.update()\n```\n\n#### Remove\nRemove a specific banner\n```js\nmodel.remove()\n```\n\n### BuildCluster Factory\n#### Search\n```js\n'use strict';\nconst Model = require('screwdriver-models');\nconst factory = Model.BuildClusterFactory.getInstance({\n    datastore\n});\nconst config = {\n    params: {\n        isActive: true\n    }\n};\n\nfactory.list(config).then(buildclusters =\u003e {\n    // Do stuff with list of buildclusters\n});\n```\n\n| Parameter     | Type   | Description         |\n| :-------------| :------| :-------------------|\n| config        | Object | Config object       |\n| config.params | Object | Fields to search on |\n\n#### Create\n```js\nfactory.create(config).then(model =\u003e {\n    // do stuff with buildCluster model\n});\n```\n\n| Parameter                     | Type    | Required | Default | Description                                      |\n| :-----------------------------| :-------| :--------| :-------| :------------------------------------------------|\n| config                        | Object  | Yes      |         | Configuration Object                             |\n| config.name                   | String  | Yes      |         | Name of the build cluster (unique constraint)    |\n| config.description            | String  | No       |         | Description of the build cluster                 |\n| config.scmContext             | String  | Yes      |         | SCM context                                      |\n| config.scmOrganizations       | Array   | Yes      |         | SCM organizations that can use the build cluster |\n| config.isActive               | Boolean | No       | false   | Flag for whether banner should display           |\n| config.managedByScrewdriver   | Boolean | Yes      |         | Flag for whether the cluster managed by Screwdriver|\n| config.maintainer             | String  | Yes      |         | Email of the maintainer                          |\n| config.weightage              | String  | No       | 100     | Weight percentage for build cluster (from 1 to 100) |\n\n#### Get\nGet a buildcluster based on unique id of buildcluster.\n```js\nfactory.get(id).then(model =\u003e {\n    // do stuff with buildcluster model\n});\n```\n\n| Parameter | Type   | Description                            |\n| :---------| :------| :--------------------------------------|\n| id        | Number | The unique id for the buildcluster     |\n\n### BuildCluster Model\n```js\n'use strict';\nconst Model = require('screwdriver-models');\nconst factory = Model.BuildClusterFactory.getInstance({\n    datastore\n});\nconst config = {\n    name: 'sd',\n    scmContext: 'github:github.com',\n    scmOrganizations: [],\n    isActive: true,\n    managedByScrewdriver: true,\n    maintainer: 'foo@bar.com'\n};\n\nfactory.create(config)\n    .then(model =\u003e {\n        // do something with model\n    });\n```\n\n#### Update\nUpdate a specific BuildCluster\n```js\nmodel.update()\n```\n\n#### Remove\nRemove a specific BuildCluster\n```js\nmodel.remove()\n```\n\n## Testing\n\n```bash\n\nnpm test\n```\n\n## License\n\nCode licensed under the BSD 3-Clause license. See LICENSE file for terms.\n\n[npm-image]: https://img.shields.io/npm/v/screwdriver-models.svg\n[npm-url]: https://npmjs.org/package/screwdriver-models\n[downloads-image]: https://img.shields.io/npm/dt/screwdriver-models.svg\n[license-image]: https://img.shields.io/npm/l/screwdriver-models.svg\n[issues-image]: https://img.shields.io/github/issues/screwdriver-cd/screwdriver.svg\n[issues-url]: https://github.com/screwdriver-cd/screwdriver/issues\n[status-image]: https://cd.screwdriver.cd/pipelines/9/badge\n[status-url]: https://cd.screwdriver.cd/pipelines/9\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscrewdriver-cd%2Fmodels","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscrewdriver-cd%2Fmodels","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscrewdriver-cd%2Fmodels/lists"}