UNPKG

2.53 kBJavaScriptView Raw
1/**
2 * @class APIBuilder.Metadata
3 * Collection of metadata objects used for field validation of the connector's
4 * configuration object.
5 *
6 * The {@link APIBuilder.Connector#fetchMetadata} method should return an object with its `fields`
7 * property set to an array of metadata objects used to validate the connector's configuration.
8 *
9 * APIBuilder.Connector.extend({
10 * fetchMetadata: function (cb) {
11 * cb(null, {
12 * fields: [
13 * APIBuilder.Metadata.Text({
14 * name: 'username',
15 * description: 'Username account',
16 * default: 'admin',
17 * required: true
18 * }),
19 * // more metadata objects...
20 * ]
21 * });
22 * },
23 * // more connector methods...
24 * });
25 */
26
27/**
28 * @class APIBuilderMetadataObject
29 * Basic metadata object.
30 * @pseudo
31 */
32/**
33 * @property {Any} default
34 * Default value for the field if undefined.
35 * Default is an empty string or zero depending on the metadata.
36 */
37/**
38 * @property {String} description
39 * Human-readable description of the field.
40 */
41/**
42 * @property {String} name
43 * Field name.
44 */
45/**
46 * @property {Boolean} required
47 * Set to `true` if the field is required. Default is false.
48 */
49/**
50 * @property {RegExp} validator
51 * Regular expression used to validate the field value.
52 */
53
54/**
55 * @class APIBuilder.Metadata.Checkbox
56 * @extends APIBuilderMetadataObject
57 * Metadata object used to evaluate a checkbox value. The validator property is not implemented.
58 */
59/**
60 * @constructor
61 * Creates a new metadata object.
62 * @param {Object} params Set any Metadata properties on the object.
63 */
64/**
65 * @property {Boolean} selected
66 * Indicates if the checkbox is selected or not. Default is false.
67 */
68
69/**
70 * @class APIBuilder.Metadata.NumField
71 * @extends APIBuilderMetadataObject
72 * Metadata object used to evaluate a floating point value. By default, the validator property
73 * is set to validate floating point value.
74 */
75/**
76 * @constructor
77 * Creates a new metadata object.
78 * @param {Object} params Set any Metadata properties on the object.
79 */
80
81/**
82 * @class APIBuilder.Metadata.Text
83 * @extends APIBuilderMetadataObject
84 * Metadata object used to evaluate a text value. The validator property is not implemented.
85 */
86/**
87 * @constructor
88 * Creates a new metadata object.
89 * @param {Object} params Set any Metadata properties on the object.
90 */