-
Notifications
You must be signed in to change notification settings - Fork 8
/
schema.js
102 lines (94 loc) · 2.42 KB
/
schema.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/**
* @brief The JSON schema for the objects in this package that will be validated using JSON schema validators.
*/
/**
* Epoch time in milliseconds (64-bit value).
*/
const epochTime = {
"id": "/EpochTime",
"type": "integer",
"minimum": 0,
"maximum": 9223372036854775807,
};
/**
* @brief Defines the structure of the options object that is accepted by this package.
*/
const packageOptions = {
"id": "/PackageOptions",
"type": "object",
"properties": {
"clientId": {"type": "string", "minLength": 1, "maxLength": 32},
"clientSecret": {"type": "string", "minLength": 1, "maxLength": 16},
"redirectUri": {"type": "string", "format": "uri"},
"apiUri": {"type": "string", "format": "uri"},
},
"required": [
"clientId",
"clientSecret",
"redirectUri",
"apiUri"
]
};
/**
* @brief Defines an OAuth object that is returned by the Dexcom OAuth system.
*/
const dexcomOAuthToken = {
"id": "/DexcomOAuthToken",
"type": "object",
"properties": {
"access_token": {"type": "string", "minLength": 1, "maxLength": 1024},
"expires_in": {"type": "integer", "minimum": 0, "maximum": 7200},
"token_type": {"type": "string", "minLength": 1, "maxLength": 6},
"refresh_token": {"type": "string", "minLength": 1, "maxLength": 1024},
},
"required": [
"access_token",
"expires_in",
"token_type",
"refresh_token"
]
};
/**
* @brief Defines the OAuth token object that clients pass to this package in order to access the Dexcom platform.
*/
const oauthTokens = {
"id": "/OAuthTokens",
"type": "object",
"properties": {
"timestamp": {"$ref": "/EpochTime"},
"dexcomOAuthToken": {"$ref": "/DexcomOAuthToken"},
},
"required": [
"timestamp",
"dexcomOAuthToken"
]
};
/**
* @brief Defines the list of valid sandbox authentication codes.
*/
const sandboxAuthCodes = {
"id": "/SandboxAuthCode",
"type": "string",
"enum": [
"authcode1",
"authcode2",
"authcode3",
"authcode4",
"authcode5",
"authcode6",
"SandboxUser1",
"SandboxUser2",
"SandboxUser3",
"SandboxUser4",
"SandboxUser5",
"SandboxUser6"
]
};
//**************
//* Public API *
//**************
exports.epochTime = epochTime;
exports.packageOptions = packageOptions;
exports.dexcomOAuthToken = dexcomOAuthToken;
exports.oauthTokens = oauthTokens;
exports.sandboxAuthCodes = sandboxAuthCodes;