-
Notifications
You must be signed in to change notification settings - Fork 14
/
index.js
51 lines (46 loc) · 1.14 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
'use strict'
/**
* Abstract base class for captcha solver providers.
*/
class CaptchaSolverProvider {
/**
* Provider name.
*
* @member {string}
*/
get name () {
throw new Error('provider must override "name"')
}
/**
* Set containing task types supported by this provider.
*
* @member {Set<string>}
*/
get supportedTaskTypes () {
throw new Error('provider must override "supportedTaskTypes"')
}
/**
* Creates a new captcha solving task.
*
* @param {object} opts - Options
* @param {string} opts.type - Type of captcha to solve
* @param {string} opts.image - Captcha image to process
*
* @return {Promise<string>} Unique task identifier
*/
async createTask (opts) {
throw new Error('provider must override "createTask"')
}
/**
* Fetches the result of a previously created captcha solving task.
*
* @param {string} taskId - Unique task identifier
* @param {object} [opts] - Options
*
* @return {Promise<object>}
*/
async getTaskResult (taskId, opts) {
throw new Error('provider must override "getTaskResult"')
}
}
module.exports = CaptchaSolverProvider