UNPKG

1.7 kBJavaScriptView Raw
1'use strict';
2
3var akamai = require('../akamai');
4
5var objects = [
6 'http://www.example.com/somewhere',
7 'http://www.example.com/cool'
8];
9
10// Example 1
11// ---------
12
13akamai.purge.staging.uri('myusername@example.com', 'secretpassword', objects).then(function (response) {
14 console.log(response);
15}).catch(function (err) {
16 console.log(err.toString());
17 console.log(err.body);
18});
19
20// ==
21
22akamai.purge('myusername@example.com', 'secretpassword', objects, {
23 type: 'arl',
24 domain: 'staging'
25}).then(function (response) {
26 console.log(response);
27}).catch(function (err) {
28 console.log(err.toString());
29 console.log(err.body);
30});
31
32
33// Example 2
34// ---------
35
36akamai.remove.production.cpcode('myusername@example.com', 'secretpassword', objects).then(function (response) {
37 console.log(response);
38}).catch(function (err) {
39 console.log(err.toString());
40 console.log(err.body);
41});
42
43// ==
44
45akamai.purge('myusername@example.com', 'secretpassword', objects, {
46 type: 'cpcode',
47 action: 'remove',
48 domain: 'production'
49}).then(function (response) {
50 console.log(response);
51}).catch(function (err) {
52 console.log(err.toString());
53 console.log(err.body);
54});
55
56
57// Example 3
58// ---------
59
60akamai.invalidate.production.url('myusername@example.com', 'secretpassword', objects).then(function (response) {
61 console.log(response);
62}).catch(function (err) {
63 console.log(err.toString());
64 console.log(err.body);
65});
66
67// ==
68
69akamai.purge('myusername@example.com', 'secretpassword', objects, {
70 type: 'arl',
71 action: 'invalidate',
72 domain: 'production'
73}).then(function (response) {
74 console.log(response);
75}).catch(function (err) {
76 console.log(err.toString());
77 console.log(err.body);
78});
\No newline at end of file