Client.php 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?php
  2. /**
  3. * This file is part of the apiadmin/tiktok.
  4. */
  5. namespace App\Libs\TikTok\OpenPlatform\UserData;
  6. use App\Libs\TikTok\Kernel\BaseClient;
  7. use App\Libs\TikTok\Kernel\Exceptions\HttpException;
  8. use App\Libs\TikTok\Kernel\Exceptions\InvalidConfigException;
  9. use App\Libs\TikTok\Kernel\Support\Collection;
  10. use GuzzleHttp\Exception\GuzzleException;
  11. use Psr\Http\Message\ResponseInterface;
  12. /**
  13. * Class Client.
  14. *
  15. * @author zhaoxiang <zhaoxiang051405@gmail.com>
  16. */
  17. class Client extends BaseClient {
  18. protected $postAccessToken = false;
  19. /**
  20. * 获取用户视频情况
  21. * @param int $date_type
  22. * @return array|Collection|object|ResponseInterface|string
  23. * @throws HttpException
  24. * @throws InvalidConfigException
  25. * @throws GuzzleException
  26. */
  27. public function item(int $date_type = 7) {
  28. return $this->httpGet('data/external/user/item/', ['date_type' => $date_type]);
  29. }
  30. /**
  31. * 获取用户粉丝数
  32. * @param int $date_type
  33. * @return array|Collection|object|ResponseInterface|string
  34. * @throws GuzzleException
  35. * @throws HttpException
  36. * @throws InvalidConfigException
  37. */
  38. public function fans(int $date_type = 7) {
  39. return $this->httpGet('data/external/user/fans/', ['date_type' => $date_type]);
  40. }
  41. /**
  42. * 获取用户点赞数
  43. * @param int $date_type
  44. * @return array|Collection|object|ResponseInterface|string
  45. * @throws GuzzleException
  46. * @throws HttpException
  47. * @throws InvalidConfigException
  48. */
  49. public function like(int $date_type = 7) {
  50. return $this->httpGet('data/external/user/like/', ['date_type' => $date_type]);
  51. }
  52. /**
  53. * 获取用户评论数
  54. * @param int $date_type
  55. * @return array|Collection|object|ResponseInterface|string
  56. * @throws GuzzleException
  57. * @throws HttpException
  58. * @throws InvalidConfigException
  59. */
  60. public function comment(int $date_type = 7) {
  61. return $this->httpGet('data/external/user/comment/', ['date_type' => $date_type]);
  62. }
  63. /**
  64. * 获取用户分享数
  65. * @param int $date_type
  66. * @return array|Collection|object|ResponseInterface|string
  67. * @throws GuzzleException
  68. * @throws HttpException
  69. * @throws InvalidConfigException
  70. */
  71. public function share(int $date_type = 7) {
  72. return $this->httpGet('data/external/user/share/', ['date_type' => $date_type]);
  73. }
  74. /**
  75. * 获取用户主页访问数
  76. * @param int $date_type
  77. * @return array|Collection|object|ResponseInterface|string
  78. * @throws GuzzleException
  79. * @throws HttpException
  80. * @throws InvalidConfigException
  81. */
  82. public function profile(int $date_type = 7) {
  83. return $this->httpGet('data/external/user/profile/', ['date_type' => $date_type]);
  84. }
  85. }