<commit_before>var parser      = require('cron-parser');
var debug       = require('debug')('hooks:routes:v1');
var Promise     = require('promise');
var taskcluster = require('taskcluster-client');
var API         = require('taskcluster-lib-api');
var nextDate    = require('../src/nextdate');
var _           = require('lodash');
var Ajv         = require('ajv');

var api = new API({
  title:         'Hooks API Documentation',
  description:   [
    'Hooks are a mechanism for creating tasks in response to events.',
    '',
    'Hooks are identified with a `hookGroupId` and a `hookId`.',
    '',
    'When an event occurs, the resulting task is automatically created.  The',
    'task is created using the scope `assume:hook-id:<hookGroupId>/<hookId>`,',
    'which must have scopes to make the createTask call, including satisfying all',
    'scopes in `task.scopes`.  The new task has a `taskGroupId` equal to its',
    '`taskId`, as is the convention for decision tasks.',
    '',
    'Hooks can have a "schedule" indicating specific times that new tasks should',
    'be created.  Each schedule is in a simple cron format, per ',
    'https://www.npmjs.com/package/cron-parser.  For example:',
    ' * `[\'0 0 1 * * *\']` -- daily at 1:00 UTC',
    ' * `[\'0 0 9,21 * * 1-5\', \'0 0 12 * * 0,6\']` -- weekdays at 9:00 and 21:00 UTC, weekends at noon',
    '',
    'The task definition is used as a JSON-e template, with a context depending on how it is fired.  See',
    'https://docs.taskcluster.net/reference/core/taskcluster-hooks/docs/firing-hooks',
    'for more information.',
  ].join('\n'),
  name: 'HooksAPI',
  schemaPrefix:  'http://schemas.taskcluster.net/hooks/v1/',
});

// Export api
module.exports = api;

/** Get hook groups **/
api.declare({
  method:       'get',
  route:        '/hooks',
  name:         'listHookGroups',
  idempotent:   true,
  output:       'list-hook-groups-response.json',
  title:        'List hook groups',<commit_msg>fix API name to correspond to service name (hooks.taskcluster.net)<commit_after>var parser      = require('cron-parser');
var debug       = require('debug')('hooks:routes:v1');
var Promise     = require('promise');
var taskcluster = require('taskcluster-client');
var API         = require('taskcluster-lib-api');
var nextDate    = require('../src/nextdate');
var _           = require('lodash');
var Ajv         = require('ajv');

var api = new API({
  title:         'Hooks API Documentation',
  description:   [
    'Hooks are a mechanism for creating tasks in response to events.',
    '',
    'Hooks are identified with a `hookGroupId` and a `hookId`.',
    '',
    'When an event occurs, the resulting task is automatically created.  The',
    'task is created using the scope `assume:hook-id:<hookGroupId>/<hookId>`,',
    'which must have scopes to make the createTask call, including satisfying all',
    'scopes in `task.scopes`.  The new task has a `taskGroupId` equal to its',
    '`taskId`, as is the convention for decision tasks.',
    '',
    'Hooks can have a "schedule" indicating specific times that new tasks should',
    'be created.  Each schedule is in a simple cron format, per ',
    'https://www.npmjs.com/package/cron-parser.  For example:',
    ' * `[\'0 0 1 * * *\']` -- daily at 1:00 UTC',
    ' * `[\'0 0 9,21 * * 1-5\', \'0 0 12 * * 0,6\']` -- weekdays at 9:00 and 21:00 UTC, weekends at noon',
    '',
    'The task definition is used as a JSON-e template, with a context depending on how it is fired.  See',
    'https://docs.taskcluster.net/reference/core/taskcluster-hooks/docs/firing-hooks',
    'for more information.',
  ].join('\n'),
  name: 'hooks',
  schemaPrefix:  'http://schemas.taskcluster.net/hooks/v1/',
});

// Export api
module.exports = api;

/** Get hook groups **/
api.declare({
  method:       'get',
  route:        '/hooks',
  name:         'listHookGroups',
  idempotent:   true,
  output:       'list-hook-groups-response.json',
  title:        'List hook groups',
{'fraction_non_alphanumeric': 0.1512268402603906, 'fraction_numerical': 0.014021031547320982, 'mean_word_length': 2.935960591133005, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1107495', 'n_tokens_mistral': 1290, 'n_tokens_neox': 1254, 'n_words': 411}