-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathtest.php
More file actions
92 lines (76 loc) · 2.74 KB
/
test.php
File metadata and controls
92 lines (76 loc) · 2.74 KB
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
<?php
// Autoloader for Composer
require_once 'vendor/autoload.php';
// create the client through our builder
$builder = new Oneall\Client\Builder();
$sitePublicKey = '#PUBLIC_KEY#';
$sitePrivateKey = '#PRIVATE_KEY#';
$subDomain = '#SUBDOMAIN#';
$client = $builder->build('curl', $subDomain, $sitePublicKey, $sitePrivateKey, true, 'oneall.com');
$api = new \Oneall\OneallApi($client);
// pagination
$pagination = new Oneall\Api\Pagination(1, 10);
// ****************
// Connection API
// ****************
// List all connections
$connectionApi = $api->getConnectionApi();
$connectionApiResponse = $connectionApi->getAll($pagination);
print_r('<pre>');
print_r("================================== \n");
print_r("====== List all connections ====== \n\n");
print_r($connectionApiResponse->getBody());
print_r("\n\n================================== \n");
print_r("================================== \n\n\n\n\n\n");
print_r('</pre>');
// ****************
// Identity API
// ****************
// SHow all
$identityApi = $api->getIdentityApi();
$identityApiResponse = $identityApi->getAll($pagination);
print_r('<pre>');
print_r("================================== \n");
print_r("====== List all identities ====== \n\n");
print_r($identityApiResponse->getBody());
print_r("\n\n================================== \n");
print_r("================================== \n\n\n\n\n\n");
print_r('</pre>');
// ****************
// Providers API
// ****************
// List all provider
$providerApi = $api->getProviderApi();
$providerApiResponse = $providerApi->getAll($pagination);
print_r('<pre>');
print_r("================================== \n");
print_r("====== List all provider ====== \n\n");
print_r($providerApiResponse->getBody());
print_r("\n\n================================== \n");
print_r("================================== \n\n\n\n\n\n");
print_r('</pre>');
// ****************
// Twitter
// ****************
$provider = 'twitter';
// Twitter API
$twitterApi = $api->getProviderApi()->getProviderApi($provider);
$identity_token = "#IDENTITY_TOKEN#";
// Push a tweet
$twitterApiResponse = $twitterApi->pushTweet($identity_token, 'Hello');
print_r('<pre>');
print_r("================================== \n");
print_r("====== Push a tweet ====== \n\n");
print_r($twitterApiResponse->getBody());
print_r("\n\n================================== \n");
print_r("================================== \n\n\n\n\n\n");
print_r('</pre>');
// Get all tweets
$twitterApiResponse = $twitterApi->pullTweets($identity_token);
print_r('<pre>');
print_r("================================== \n");
print_r("====== Pull tweets ====== \n\n");
print_r($twitterApiResponse->getBody());
print_r("\n\n================================== \n");
print_r("================================== \n\n\n\n\n\n");
print_r('</pre>');