@@ 10-43 (lines=34) @@ | ||
7 | /** |
|
8 | * @link https://dev.twitter.com/rest/reference/get/collections/entries |
|
9 | */ |
|
10 | class Entries extends BaseRequest |
|
11 | { |
|
12 | const METHOD = 'GET'; |
|
13 | ||
14 | const ENDPOINT = '/collections/entries.json'; |
|
15 | ||
16 | public function __construct(string $id) |
|
17 | { |
|
18 | parent::__construct(self::METHOD, self::ENDPOINT); |
|
19 | ||
20 | $this->parameters['id'] = $id; |
|
21 | } |
|
22 | ||
23 | public function amount(int $amount): Entries |
|
24 | { |
|
25 | $this->parameters['count'] = (string) $amount; |
|
26 | ||
27 | return $this; |
|
28 | } |
|
29 | ||
30 | public function minimumId(int $id): Entries |
|
31 | { |
|
32 | $this->parameters['min_position'] = (string) $id; |
|
33 | ||
34 | return $this; |
|
35 | } |
|
36 | ||
37 | public function maximumId(int $id): Entries |
|
38 | { |
|
39 | $this->parameters['max_position'] = (string) $id; |
|
40 | ||
41 | return $this; |
|
42 | } |
|
43 | } |
|
44 |
@@ 10-41 (lines=32) @@ | ||
7 | /** |
|
8 | * @link https://dev.twitter.com/rest/reference/get/collections/list |
|
9 | */ |
|
10 | abstract class Lists extends BaseRequest |
|
11 | { |
|
12 | const METHOD = 'GET'; |
|
13 | ||
14 | const ENDPOINT = '/collections/list.json'; |
|
15 | ||
16 | public function __construct() |
|
17 | { |
|
18 | parent::__construct(self::METHOD, self::ENDPOINT); |
|
19 | } |
|
20 | ||
21 | public function amount(int $amount): Lists |
|
22 | { |
|
23 | $this->parameters['count'] = (string) $amount; |
|
24 | ||
25 | return $this; |
|
26 | } |
|
27 | ||
28 | public function tweetId(int $tweetId): Lists |
|
29 | { |
|
30 | $this->parameters['tweet_id'] = (string) $tweetId; |
|
31 | ||
32 | return $this; |
|
33 | } |
|
34 | ||
35 | public function fromCursor(string $cursor): Lists |
|
36 | { |
|
37 | $this->parameters['cursor'] = $cursor; |
|
38 | ||
39 | return $this; |
|
40 | } |
|
41 | } |
|
42 |
@@ 10-48 (lines=39) @@ | ||
7 | /** |
|
8 | * @link https://dev.twitter.com/rest/reference/get/friendships/show |
|
9 | */ |
|
10 | class Show extends BaseRequest |
|
11 | { |
|
12 | const METHOD = 'GET'; |
|
13 | ||
14 | const ENDPOINT = '/friendships/show.json'; |
|
15 | ||
16 | public function __construct() |
|
17 | { |
|
18 | parent::__construct(self::METHOD, self::ENDPOINT); |
|
19 | } |
|
20 | ||
21 | public function sourceUserId(int $id): Show |
|
22 | { |
|
23 | $this->parameters['source_id'] = (string) $id; |
|
24 | ||
25 | return $this; |
|
26 | } |
|
27 | ||
28 | public function sourceScreenName(string $screenName): Show |
|
29 | { |
|
30 | $this->parameters['source_screen_name'] = $screenName; |
|
31 | ||
32 | return $this; |
|
33 | } |
|
34 | ||
35 | public function targetUserId(int $id): Show |
|
36 | { |
|
37 | $this->parameters['target_id'] = (string) $id; |
|
38 | ||
39 | return $this; |
|
40 | } |
|
41 | ||
42 | public function targetScreenName(string $screenName): Show |
|
43 | { |
|
44 | $this->parameters['target_screen_name'] = $screenName; |
|
45 | ||
46 | return $this; |
|
47 | } |
|
48 | } |
|
49 |
@@ 10-42 (lines=33) @@ | ||
7 | /** |
|
8 | * @link https://dev.twitter.com/rest/reference/get/users/search |
|
9 | */ |
|
10 | class Search extends BaseRequest |
|
11 | { |
|
12 | const METHOD = 'GET'; |
|
13 | const ENDPOINT = '/users/search.json'; |
|
14 | ||
15 | public function __construct($keywords) |
|
16 | { |
|
17 | parent::__construct(self::METHOD, self::ENDPOINT); |
|
18 | ||
19 | $this->parameters['q'] = $keywords; |
|
20 | } |
|
21 | ||
22 | public function page(int $page): Search |
|
23 | { |
|
24 | $this->parameters['page'] = (string) $page; |
|
25 | ||
26 | return $this; |
|
27 | } |
|
28 | ||
29 | public function amount(int $amount): Search |
|
30 | { |
|
31 | $this->parameters['count'] = (string) $amount; |
|
32 | ||
33 | return $this; |
|
34 | } |
|
35 | ||
36 | public function excludeEntities(): Search |
|
37 | { |
|
38 | $this->parameters['include_entities'] = 'false'; |
|
39 | ||
40 | return $this; |
|
41 | } |
|
42 | } |
|
43 |