Skip to content

Commit 3469001

Browse files
committed
add dist files
1 parent d00ebac commit 3469001

File tree

4 files changed

+159
-0
lines changed

4 files changed

+159
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const json = `{
2+
"meta": {
3+
"next": "dW5kZWZpbmVkOjQwOTczNTgxNTg=",
4+
"previous": "null",
5+
"perPage": 49
6+
}
7+
}
8+
`
9+
10+
export {json}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
const js = `const https = require('https')
2+
3+
const use_cursor = true;
4+
const perPage = 50;
5+
const options = {
6+
hostname: 'api.paystack.co',
7+
port: 443,
8+
path: `/transaction?use_cursor=${use_cursor}&perPage=${perPage}`,
9+
method: 'GET',
10+
headers: {
11+
Authorization: 'Bearer YOUR_SECRET_KEY'
12+
}
13+
}
14+
15+
https.request(options, res => {
16+
let data = ''
17+
18+
res.on('data', (chunk) => {
19+
data += chunk
20+
});
21+
22+
res.on('end', () => {
23+
console.log(JSON.parse(data))
24+
})
25+
}).on('error', error => {
26+
console.error(error)
27+
})`
28+
29+
const php = `<?php
30+
$use_cursor = true;
31+
$perPage = 50;
32+
$curl = curl_init();
33+
34+
curl_setopt_array($curl, array(
35+
CURLOPT_URL => "https://api.paystack.co/transaction?use_cursor=$use_cursor&perPage=$perPage",
36+
CURLOPT_RETURNTRANSFER => true,
37+
CURLOPT_ENCODING => "",
38+
CURLOPT_MAXREDIRS => 10,
39+
CURLOPT_TIMEOUT => 30,
40+
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
41+
CURLOPT_CUSTOMREQUEST => "GET",
42+
CURLOPT_HTTPHEADER => array(
43+
"Authorization: Bearer YOUR_SECRET_KEY",
44+
"Cache-Control: no-cache",
45+
),
46+
));
47+
48+
$response = curl_exec($curl);
49+
$err = curl_error($curl);
50+
51+
curl_close($curl);
52+
53+
if ($err) {
54+
echo "cURL Error #:" . $err;
55+
} else {
56+
echo $response;
57+
}
58+
?>`
59+
60+
const sh = `#!/bin/sh
61+
use_cursor="true"
62+
perPage="50"
63+
url="https://api.paystack.co/transaction?use_cursor=$use_cursor&perPage=$perPage"
64+
authorization="Authorization: Bearer YOUR_SECRET_KEY"
65+
66+
curl "$url" -H "$authorization" -X GET`
67+
68+
export {js, php, sh}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const json = `{
2+
"meta": {
3+
"total": 7316,
4+
"total_volume": 397800,
5+
"skipped": 0,
6+
"perPage": 50,
7+
"page": 1,
8+
"pageCount": 147
9+
}
10+
}
11+
`
12+
13+
export {json}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
const js = `const https = require('https')
2+
3+
const page = 1;
4+
const perPage = 50;
5+
const options = {
6+
hostname: 'api.paystack.co',
7+
port: 443,
8+
path: `/transaction?page=${page}&perPage=${perPage}`,
9+
method: 'GET',
10+
headers: {
11+
Authorization: 'Bearer SECRET_KEY'
12+
}
13+
}
14+
15+
https.request(options, res => {
16+
let data = ''
17+
18+
res.on('data', (chunk) => {
19+
data += chunk
20+
});
21+
22+
res.on('end', () => {
23+
console.log(JSON.parse(data))
24+
})
25+
}).on('error', error => {
26+
console.error(error)
27+
})`
28+
29+
const php = `<?php
30+
$page = 1;
31+
$perPage = 50;
32+
$curl = curl_init();
33+
34+
curl_setopt_array($curl, array(
35+
CURLOPT_URL => "https://api.paystack.co/transaction?page=$page&perPage=$perPage",
36+
CURLOPT_RETURNTRANSFER => true,
37+
CURLOPT_ENCODING => "",
38+
CURLOPT_MAXREDIRS => 10,
39+
CURLOPT_TIMEOUT => 30,
40+
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
41+
CURLOPT_CUSTOMREQUEST => "GET",
42+
CURLOPT_HTTPHEADER => array(
43+
"Authorization: Bearer SECRET_KEY",
44+
"Cache-Control: no-cache",
45+
),
46+
));
47+
48+
$response = curl_exec($curl);
49+
$err = curl_error($curl);
50+
51+
curl_close($curl);
52+
53+
if ($err) {
54+
echo "cURL Error #:" . $err;
55+
} else {
56+
echo $response;
57+
}
58+
?>`
59+
60+
const sh = `#!/bin/sh
61+
page="1"
62+
perPage="50"
63+
url="https://api.paystack.co/transaction?page=$page&perPage=$perPage"
64+
authorization="Authorization: Bearer YOUR_SECRET_KEY"
65+
66+
curl "$url" -H "$authorization" -X GET`
67+
68+
export {js, php, sh}

0 commit comments

Comments
 (0)