-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.example.js
62 lines (47 loc) · 1.58 KB
/
index.example.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
import JokeAPI from './index.js'
const JokeClient = new JokeAPI({ 'safe-mode': true, blacklistflags: ['nsfw', 'explicit'] });
const get = async () => {
// Methods
const joke = await JokeClient.getJoke({ 'safe-mode': false, categories: 'coding,dark', idRange: '10-15' });
console.log(joke);
const info = await JokeClient.info({ lang: 'en' });
console.log(info);
const categories = await JokeClient.categories();
console.log(categories);
const langcode = await JokeClient.langcode({ language: 'eng' });
console.log(langcode);
const languages = await JokeClient.languages();
console.log(languages);
const flags = await JokeClient.flags();
console.log(flags);
const formats = await JokeClient.formats();
console.log(formats);
const ping = await JokeClient.ping();
console.log(ping);
const endpoints = await JokeClient.endpoints();
console.log(endpoints);
const submitSingle = await JokeClient.submit({
'dry-run': true,
formatVersion: 3,
category: 'Misc',
type: 'single',
joke: 'testing',
flags: { nsfw: true, religious: false, political: false, racist: false, sexist: false, explicit: true },
lang: 'en',
});
console.log(submitSingle);
const submitDouble = await JokeClient.submit({
'dry-run': true,
formatVersion: 3,
category: 'misc',
type: 'twopart',
setup: 'Setup',
delivery: 'Delivering',
flags: { nsfw: true, religious: false, political: false, racist: false, sexist: false, explicit: true },
lang: 'en',
});
console.log(submitDouble);
// Access Constants
console.log(JokeAPI.BASE);
};
get();