@@ -3,18 +3,18 @@ |
||
3 | 3 | |
4 | 4 | class GetKarma extends AbstractRequest { |
5 | 5 | |
6 | - function getApiEndPoint() |
|
7 | - { |
|
8 | - return '/v2/users/karma'; |
|
9 | - } |
|
10 | - function getPayload() |
|
11 | - { |
|
12 | - return array( |
|
13 | - ); |
|
14 | - } |
|
15 | - function getMethod() |
|
16 | - { |
|
17 | - return 'GET'; |
|
18 | - } |
|
6 | + function getApiEndPoint() |
|
7 | + { |
|
8 | + return '/v2/users/karma'; |
|
9 | + } |
|
10 | + function getPayload() |
|
11 | + { |
|
12 | + return array( |
|
13 | + ); |
|
14 | + } |
|
15 | + function getMethod() |
|
16 | + { |
|
17 | + return 'GET'; |
|
18 | + } |
|
19 | 19 | } |
20 | 20 |
@@ -2,51 +2,51 @@ |
||
2 | 2 | |
3 | 3 | class Location{ |
4 | 4 | |
5 | - public $cityName; |
|
6 | - |
|
7 | - public $lat; |
|
8 | - |
|
9 | - public $lng; |
|
10 | - |
|
11 | - public function getCityName() |
|
12 | - { |
|
13 | - return $this->cityName; |
|
14 | - } |
|
15 | - |
|
16 | - public function setCityName($cityName) |
|
17 | - { |
|
18 | - $this->cityName = $cityName; |
|
19 | - } |
|
20 | - |
|
21 | - public function getLat() |
|
22 | - { |
|
23 | - return $this->lat; |
|
24 | - } |
|
25 | - |
|
26 | - public function setLat($lat) |
|
27 | - { |
|
28 | - $this->lat = $lat; |
|
29 | - } |
|
30 | - |
|
31 | - public function getLng() |
|
32 | - { |
|
33 | - return $this->lng; |
|
34 | - } |
|
35 | - |
|
36 | - public function setLng($lng) |
|
37 | - { |
|
38 | - $this->lng = $lng; |
|
39 | - } |
|
40 | - public function toArray(){ |
|
41 | - return array( |
|
42 | - "city" => $this->getCityName(), |
|
43 | - "country" => 'DE', |
|
44 | - "loc_accuracy" => '0.0', |
|
45 | - "loc_coordinates" => array( |
|
46 | - "lat" => $this->getLat(), |
|
47 | - "lng" => $this->getLng(), |
|
48 | - ), |
|
49 | - "name" => $this->getCityName() |
|
50 | - ); |
|
51 | - } |
|
5 | + public $cityName; |
|
6 | + |
|
7 | + public $lat; |
|
8 | + |
|
9 | + public $lng; |
|
10 | + |
|
11 | + public function getCityName() |
|
12 | + { |
|
13 | + return $this->cityName; |
|
14 | + } |
|
15 | + |
|
16 | + public function setCityName($cityName) |
|
17 | + { |
|
18 | + $this->cityName = $cityName; |
|
19 | + } |
|
20 | + |
|
21 | + public function getLat() |
|
22 | + { |
|
23 | + return $this->lat; |
|
24 | + } |
|
25 | + |
|
26 | + public function setLat($lat) |
|
27 | + { |
|
28 | + $this->lat = $lat; |
|
29 | + } |
|
30 | + |
|
31 | + public function getLng() |
|
32 | + { |
|
33 | + return $this->lng; |
|
34 | + } |
|
35 | + |
|
36 | + public function setLng($lng) |
|
37 | + { |
|
38 | + $this->lng = $lng; |
|
39 | + } |
|
40 | + public function toArray(){ |
|
41 | + return array( |
|
42 | + "city" => $this->getCityName(), |
|
43 | + "country" => 'DE', |
|
44 | + "loc_accuracy" => '0.0', |
|
45 | + "loc_coordinates" => array( |
|
46 | + "lat" => $this->getLat(), |
|
47 | + "lng" => $this->getLng(), |
|
48 | + ), |
|
49 | + "name" => $this->getCityName() |
|
50 | + ); |
|
51 | + } |
|
52 | 52 | } |
@@ -4,25 +4,25 @@ discard block |
||
4 | 4 | { |
5 | 5 | public $lastPostId; |
6 | 6 | |
7 | - /** |
|
8 | - * @var Location |
|
9 | - */ |
|
10 | - public $location; |
|
11 | - public $url; |
|
7 | + /** |
|
8 | + * @var Location |
|
9 | + */ |
|
10 | + public $location; |
|
11 | + public $url; |
|
12 | 12 | |
13 | 13 | |
14 | - function setUrl ($url) |
|
15 | - { |
|
16 | - $this->url = $url; |
|
17 | - } |
|
14 | + function setUrl ($url) |
|
15 | + { |
|
16 | + $this->url = $url; |
|
17 | + } |
|
18 | 18 | |
19 | - function getUrl () |
|
20 | - { |
|
21 | - return $this->url; |
|
22 | - } |
|
19 | + function getUrl () |
|
20 | + { |
|
21 | + return $this->url; |
|
22 | + } |
|
23 | 23 | |
24 | - function setLastPostId ($lastPostId) |
|
25 | - { |
|
24 | + function setLastPostId ($lastPostId) |
|
25 | + { |
|
26 | 26 | $this->lastPostId = $lastPostId; |
27 | 27 | } |
28 | 28 | |
@@ -31,38 +31,38 @@ discard block |
||
31 | 31 | return $this->lastPostId; |
32 | 32 | } |
33 | 33 | |
34 | - function getApiEndPoint() |
|
35 | - { |
|
36 | - $apiEndPoint = $this->getUrl(); |
|
34 | + function getApiEndPoint() |
|
35 | + { |
|
36 | + $apiEndPoint = $this->getUrl(); |
|
37 | 37 | |
38 | - if ($this->getLastPostId() != "") { |
|
38 | + if ($this->getLastPostId() != "") { |
|
39 | 39 | $apiEndPoint = $this->getUrl() . '?after=' . $this->getLastPostId(); |
40 | 40 | } |
41 | - return $apiEndPoint; |
|
42 | - } |
|
43 | - function getPayload() |
|
44 | - { |
|
45 | - if($this->version == 'v3') |
|
46 | - { |
|
47 | - $this->location = new Location(); |
|
48 | - $this->location->setLat(52.520006); |
|
49 | - $this->location->setLng(13.404954); |
|
50 | - $this->location->setCityName('Berlin'); |
|
41 | + return $apiEndPoint; |
|
42 | + } |
|
43 | + function getPayload() |
|
44 | + { |
|
45 | + if($this->version == 'v3') |
|
46 | + { |
|
47 | + $this->location = new Location(); |
|
48 | + $this->location->setLat(52.520006); |
|
49 | + $this->location->setLng(13.404954); |
|
50 | + $this->location->setCityName('Berlin'); |
|
51 | 51 | |
52 | 52 | |
53 | - return array( |
|
54 | - "location" => $this->location->toArray(), |
|
55 | - "stickies" => 'false', |
|
56 | - ); |
|
57 | - } |
|
58 | - else |
|
59 | - { |
|
60 | - return array( |
|
61 | - ); |
|
62 | - } |
|
63 | - } |
|
64 | - function getMethod() |
|
65 | - { |
|
66 | - return 'GET'; |
|
67 | - } |
|
53 | + return array( |
|
54 | + "location" => $this->location->toArray(), |
|
55 | + "stickies" => 'false', |
|
56 | + ); |
|
57 | + } |
|
58 | + else |
|
59 | + { |
|
60 | + return array( |
|
61 | + ); |
|
62 | + } |
|
63 | + } |
|
64 | + function getMethod() |
|
65 | + { |
|
66 | + return 'GET'; |
|
67 | + } |
|
68 | 68 | } |
@@ -1,20 +1,20 @@ |
||
1 | 1 | <?php |
2 | 2 | class Downvote extends AbstractRequest |
3 | 3 | { |
4 | - public $postId; |
|
4 | + public $postId; |
|
5 | 5 | |
6 | - function getApiEndPoint() |
|
7 | - { |
|
8 | - return '/v2/posts/' . $this->postId . '/downvote'; |
|
9 | - } |
|
10 | - function getPayload() |
|
11 | - { |
|
12 | - return array( |
|
13 | - ); |
|
14 | - } |
|
15 | - function getMethod() |
|
16 | - { |
|
17 | - return 'PUT'; |
|
18 | - } |
|
6 | + function getApiEndPoint() |
|
7 | + { |
|
8 | + return '/v2/posts/' . $this->postId . '/downvote'; |
|
9 | + } |
|
10 | + function getPayload() |
|
11 | + { |
|
12 | + return array( |
|
13 | + ); |
|
14 | + } |
|
15 | + function getMethod() |
|
16 | + { |
|
17 | + return 'PUT'; |
|
18 | + } |
|
19 | 19 | } |
20 | 20 |
@@ -1,53 +1,53 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | class CreateUser extends AbstractRequest { |
4 | - /** |
|
5 | - * @var Location |
|
6 | - */ |
|
7 | - private $location; |
|
8 | - private $deviceUid; |
|
9 | - /** |
|
10 | - * @return Location |
|
11 | - */ |
|
12 | - private function getLocation() |
|
13 | - { |
|
14 | - return $this->location; |
|
15 | - } |
|
16 | - /** |
|
17 | - * @param Location $location |
|
18 | - */ |
|
19 | - public function setLocation(Location $location) |
|
20 | - { |
|
21 | - $this->location = $location; |
|
22 | - } |
|
23 | - private function getDeviceUid() |
|
24 | - { |
|
4 | + /** |
|
5 | + * @var Location |
|
6 | + */ |
|
7 | + private $location; |
|
8 | + private $deviceUid; |
|
9 | + /** |
|
10 | + * @return Location |
|
11 | + */ |
|
12 | + private function getLocation() |
|
13 | + { |
|
14 | + return $this->location; |
|
15 | + } |
|
16 | + /** |
|
17 | + * @param Location $location |
|
18 | + */ |
|
19 | + public function setLocation(Location $location) |
|
20 | + { |
|
21 | + $this->location = $location; |
|
22 | + } |
|
23 | + private function getDeviceUid() |
|
24 | + { |
|
25 | 25 | return $this->deviceUid; |
26 | 26 | } |
27 | 27 | public function setDeviceUid($deviceUid) |
28 | - { |
|
28 | + { |
|
29 | 29 | $this->deviceUid = $deviceUid; |
30 | 30 | } |
31 | - private function generateDeviceUid() |
|
32 | - { |
|
33 | - return $this->random_str(64, 'abcdef0123456789'); |
|
34 | - } |
|
31 | + private function generateDeviceUid() |
|
32 | + { |
|
33 | + return $this->random_str(64, 'abcdef0123456789'); |
|
34 | + } |
|
35 | 35 | |
36 | - private function random_str($length, $keyspace = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') |
|
37 | - { |
|
38 | - $str = ''; |
|
39 | - $max = mb_strlen($keyspace, '8bit') - 1; |
|
40 | - for ($i = 0; $i < $length; ++$i) { |
|
41 | - $str .= $keyspace[rand(0, $max)]; |
|
42 | - } |
|
43 | - return $str; |
|
44 | - } |
|
45 | - public function getApiEndPoint() |
|
46 | - { |
|
47 | - return '/v2/users'; |
|
48 | - } |
|
49 | - public function getPayload() |
|
50 | - { |
|
36 | + private function random_str($length, $keyspace = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') |
|
37 | + { |
|
38 | + $str = ''; |
|
39 | + $max = mb_strlen($keyspace, '8bit') - 1; |
|
40 | + for ($i = 0; $i < $length; ++$i) { |
|
41 | + $str .= $keyspace[rand(0, $max)]; |
|
42 | + } |
|
43 | + return $str; |
|
44 | + } |
|
45 | + public function getApiEndPoint() |
|
46 | + { |
|
47 | + return '/v2/users'; |
|
48 | + } |
|
49 | + public function getPayload() |
|
50 | + { |
|
51 | 51 | if(!isset($this->deviceUid)) |
52 | 52 | { |
53 | 53 | $this->setDeviceUid($this->generateDeviceUid()); |
@@ -58,9 +58,9 @@ discard block |
||
58 | 58 | "client_id" => self::CLIENTID, |
59 | 59 | "device_uid" => $this->getDeviceUid(), |
60 | 60 | ); |
61 | - } |
|
62 | - public function getMethod() |
|
63 | - { |
|
64 | - return 'POST'; |
|
65 | - } |
|
61 | + } |
|
62 | + public function getMethod() |
|
63 | + { |
|
64 | + return 'POST'; |
|
65 | + } |
|
66 | 66 | } |
@@ -3,37 +3,37 @@ |
||
3 | 3 | |
4 | 4 | class SetLocation extends AbstractRequest { |
5 | 5 | /** |
6 | - * @var Location |
|
7 | - */ |
|
8 | - public $location; |
|
9 | - /** |
|
10 | - * @return Location |
|
11 | - */ |
|
12 | - public function getLocation() |
|
13 | - { |
|
14 | - return $this->location; |
|
15 | - } |
|
16 | - /** |
|
17 | - * @param Location $location |
|
18 | - */ |
|
19 | - public function setLocation($location) |
|
20 | - { |
|
21 | - $this->location = $location; |
|
22 | - } |
|
6 | + * @var Location |
|
7 | + */ |
|
8 | + public $location; |
|
9 | + /** |
|
10 | + * @return Location |
|
11 | + */ |
|
12 | + public function getLocation() |
|
13 | + { |
|
14 | + return $this->location; |
|
15 | + } |
|
16 | + /** |
|
17 | + * @param Location $location |
|
18 | + */ |
|
19 | + public function setLocation($location) |
|
20 | + { |
|
21 | + $this->location = $location; |
|
22 | + } |
|
23 | 23 | |
24 | - function getApiEndPoint() |
|
25 | - { |
|
26 | - return '/v2/users/location'; |
|
27 | - } |
|
28 | - function getPayload() |
|
29 | - { |
|
30 | - return array( |
|
24 | + function getApiEndPoint() |
|
25 | + { |
|
26 | + return '/v2/users/location'; |
|
27 | + } |
|
28 | + function getPayload() |
|
29 | + { |
|
30 | + return array( |
|
31 | 31 | "location" => $this->getLocation()->toArray(), |
32 | - ); |
|
33 | - } |
|
34 | - function getMethod() |
|
35 | - { |
|
36 | - return 'PUT'; |
|
37 | - } |
|
32 | + ); |
|
33 | + } |
|
34 | + function getMethod() |
|
35 | + { |
|
36 | + return 'PUT'; |
|
37 | + } |
|
38 | 38 | } |
39 | 39 |
@@ -1,21 +1,21 @@ |
||
1 | 1 | <?php |
2 | 2 | class Upvote extends AbstractRequest { |
3 | 3 | |
4 | - public $postId; |
|
4 | + public $postId; |
|
5 | 5 | |
6 | - function getApiEndPoint() |
|
7 | - { |
|
8 | - return '/v2/posts/' . $this->postId . '/upvote'; |
|
9 | - } |
|
10 | - function getPayload() |
|
11 | - { |
|
12 | - return array( |
|
6 | + function getApiEndPoint() |
|
7 | + { |
|
8 | + return '/v2/posts/' . $this->postId . '/upvote'; |
|
9 | + } |
|
10 | + function getPayload() |
|
11 | + { |
|
12 | + return array( |
|
13 | 13 | // "reason_code" => -1, |
14 | - ); |
|
15 | - } |
|
16 | - function getMethod() |
|
17 | - { |
|
18 | - return 'PUT'; |
|
19 | - } |
|
14 | + ); |
|
15 | + } |
|
16 | + function getMethod() |
|
17 | + { |
|
18 | + return 'PUT'; |
|
19 | + } |
|
20 | 20 | } |
21 | 21 |
@@ -2,22 +2,22 @@ |
||
2 | 2 | class PostCaptcha extends AbstractRequest |
3 | 3 | { |
4 | 4 | public $captchaKey; |
5 | - public $captchaSolution; |
|
5 | + public $captchaSolution; |
|
6 | 6 | |
7 | - function getApiEndPoint() |
|
8 | - { |
|
9 | - return '/v3/user/verification/imageCaptcha/'; |
|
10 | - } |
|
11 | - function getPayload() |
|
12 | - { |
|
13 | - return array( |
|
14 | - 'key' => $this->captchaKey, |
|
15 | - 'answer' => $this->captchaSolution, |
|
16 | - ); |
|
17 | - } |
|
18 | - function getMethod() |
|
19 | - { |
|
20 | - return 'POST'; |
|
21 | - } |
|
7 | + function getApiEndPoint() |
|
8 | + { |
|
9 | + return '/v3/user/verification/imageCaptcha/'; |
|
10 | + } |
|
11 | + function getPayload() |
|
12 | + { |
|
13 | + return array( |
|
14 | + 'key' => $this->captchaKey, |
|
15 | + 'answer' => $this->captchaSolution, |
|
16 | + ); |
|
17 | + } |
|
18 | + function getMethod() |
|
19 | + { |
|
20 | + return 'POST'; |
|
21 | + } |
|
22 | 22 | } |
23 | 23 |
@@ -2,18 +2,18 @@ |
||
2 | 2 | class GetUserConfig extends AbstractRequest |
3 | 3 | { |
4 | 4 | |
5 | - function getApiEndPoint() |
|
6 | - { |
|
7 | - return '/v3/user/config/'; |
|
8 | - } |
|
9 | - function getPayload() |
|
10 | - { |
|
11 | - return array( |
|
12 | - ); |
|
13 | - } |
|
14 | - function getMethod() |
|
15 | - { |
|
16 | - return 'GET'; |
|
17 | - } |
|
5 | + function getApiEndPoint() |
|
6 | + { |
|
7 | + return '/v3/user/config/'; |
|
8 | + } |
|
9 | + function getPayload() |
|
10 | + { |
|
11 | + return array( |
|
12 | + ); |
|
13 | + } |
|
14 | + function getMethod() |
|
15 | + { |
|
16 | + return 'GET'; |
|
17 | + } |
|
18 | 18 | } |
19 | 19 |