1 [ 2 { 3 "namespace": "enums", 4 "description": "The enums API.", 5 "types": [ 6 { 7 "id": "Enumeration", 8 "type": "string", 9 "enum": ["one", "two", "three"] 10 }, 11 { 12 "id": "EnumType", 13 "type": "object", 14 "properties": { 15 "type": { 16 "type": "string", 17 "enum": ["one", "two", "three"] 18 } 19 } 20 }, 21 { 22 "id": "HasEnumeration", 23 "type": "object", 24 "properties": { 25 "enumeration": { 26 "$ref": "Enumeration" 27 }, 28 "optional_enumeration": { 29 "$ref": "Enumeration", 30 "optional": true 31 } 32 } 33 }, 34 { 35 "id": "InlineAndReferenceEnum", 36 "type": "object", 37 "properties": { 38 "inline_enum": { 39 "type": "string", 40 "enum": ["test1", "test2", "test3"] 41 }, 42 "reference_enum": { 43 "$ref": "Enumeration" 44 } 45 } 46 }, 47 { 48 "id": "OptionalEnumType", 49 "type": "object", 50 "properties": { 51 "type": { 52 "type": "string", 53 "enum": ["one", "two", "three"], 54 "optional": true 55 } 56 } 57 } 58 ], 59 "functions": [ 60 { 61 "name": "takesEnum", 62 "type": "function", 63 "description": "Takes an enum as its parameter.", 64 "parameters": [ 65 { 66 "name": "state", 67 "type": "string", 68 "enum": ["foo", "bar", "baz"] 69 }, 70 { 71 "name": "callback", 72 "type": "function", 73 "parameters": [] 74 } 75 ] 76 }, 77 { 78 "name": "takesEnumArray", 79 "type": "function", 80 "description": "Takes an enum array as its parameter.", 81 "parameters": [ 82 { 83 "name": "values", 84 "type": "array", 85 "items": { 86 "type": "string", 87 "enum": ["foo", "bar", "baz"] 88 } 89 }, 90 { 91 "name": "callback", 92 "type": "function", 93 "parameters": [] 94 } 95 ] 96 }, 97 { 98 "name": "takesEnumAsType", 99 "type": "function", 100 "description": "Takes an enum type as its parameter.", 101 "parameters": [ 102 { 103 "name": "enumeration", 104 "$ref": "Enumeration" 105 }, 106 { 107 "name": "callback", 108 "type": "function", 109 "parameters": [] 110 } 111 ] 112 }, 113 { 114 "name": "takesEnumArrayAsType", 115 "type": "function", 116 "description": "Takes an enum type array as its parameter.", 117 "parameters": [ 118 { 119 "name": "values", 120 "type": "array", 121 "items": { 122 "$ref": "Enumeration" 123 } 124 }, 125 { 126 "name": "callback", 127 "type": "function", 128 "parameters": [] 129 } 130 ] 131 }, 132 { 133 "name": "returnsEnum", 134 "type": "function", 135 "description": "Returns an enum through the callback", 136 "parameters": [ 137 { 138 "name": "callback", 139 "type": "function", 140 "parameters": [ 141 { 142 "name": "state", 143 "type": "string", 144 "enum": ["foo", "bar", "baz"] 145 } 146 ] 147 } 148 ] 149 }, 150 { 151 "name": "returnsEnumAsType", 152 "type": "function", 153 "description": "Returns an enum through the callback", 154 "parameters": [ 155 { 156 "name": "callback", 157 "type": "function", 158 "parameters": [ 159 { 160 "name": "enumeration", 161 "$ref": "Enumeration" 162 } 163 ] 164 } 165 ] 166 }, 167 { 168 "name": "returnsTwoEnums", 169 "type": "function", 170 "description": "Returns two enums through the callback", 171 "parameters": [ 172 { 173 "name": "callback", 174 "type": "function", 175 "parameters": [ 176 { 177 "name": "firstState", 178 "type": "string", 179 "enum": ["foo", "bar", "baz"] 180 }, 181 { 182 "name": "secondState", 183 "type": "string", 184 "enum": ["spam", "ham", "eggs"] 185 } 186 ] 187 } 188 ] 189 }, 190 { 191 "name": "takesOptionalEnum", 192 "type": "function", 193 "description": "Takes an enum as its parameter.", 194 "parameters": [ 195 { 196 "name": "state", 197 "type": "string", 198 "enum": ["foo", "bar", "baz"], 199 "optional": true 200 }, 201 { 202 "name": "callback", 203 "type": "function", 204 "parameters": [] 205 } 206 ] 207 }, 208 { 209 "name": "takesMultipleOptionalEnums", 210 "type": "function", 211 "description": "Takes two enums as parameters.", 212 "parameters": [ 213 { 214 "name": "state", 215 "type": "string", 216 "enum": ["foo", "bar", "baz"], 217 "optional": true 218 }, 219 { 220 "name": "type", 221 "type": "string", 222 "enum": ["foo", "ding", "dong"], 223 "optional": true 224 }, 225 { 226 "name": "callback", 227 "type": "function", 228 "parameters": [] 229 } 230 ] 231 } 232 ], 233 "events": [ 234 { 235 "name": "onEnumFired", 236 "type": "function", 237 "description": "Fired when an enum is ready.", 238 "parameters": [ 239 { 240 "name": "someEnum", 241 "type": "string", 242 "enum": ["foo", "bar", "baz"] 243 } 244 ] 245 }, 246 { 247 "name": "onTwoEnumsFired", 248 "type": "function", 249 "description": "Fired when two enums are ready.", 250 "parameters": [ 251 { 252 "name": "firstEnum", 253 "type": "string", 254 "enum": ["foo", "bar", "baz"] 255 }, 256 { 257 "name": "secondEnum", 258 "type": "string", 259 "enum": ["spam", "ham", "eggs"] 260 } 261 ] 262 } 263 ] 264 } 265 ] 266