Skip to content

FakeCop/wykop-api-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

23 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

wykop.pl API Client (V3)

πŸ”Œ Laravel package

Wykop API (V3) Swagger Documentation


πŸš€ Fast-track

Download

composer require fakecop/wykop-client

Install

php artisan wykop-client:install

  • Config file will be added (wykop-client.php)
  • Service provider will be registered (WykopClientServiceProvider.php)
  • No migrations
  • No models
  • No resources

Set up environmental variables

WYKOP_API_URL=https://wykop.pl/api/v3
WYKOP_KEY=w123xxxxxxx
WYKOP_SECRET=98a7sd9a8sdxxxxxxxxxxxxxxxxxxx

Have fun!

WykopClient facade available
use FakeCop\WykopClient\Facades\WykopClient;

...

$data = WykopClient::getProfile('green_martin');

dd($data);

Example result:

array:1 [
  "data" => array:23 [
    "username" => "green_martin"
    "gender" => "m"
    "company" => false
    "avatar" => "https://wykop.pl/cdn/c3397992/green_martin_5rDzT7Nqab.jpg"
    ...

πŸ“œ Available actions

πŸ§‘ Profile actions

getProfile(string $username): array;  

getProfileShort(string $username): array;  

getProfileActions(string $username): array;  

getProfileEntriesAdded(string $username): array;  

getProfileEntriesVoted(string $username): array;  

getProfileEntriesCommented(string $username): array;  

getProfileLinksAdded(string $username): array;  

getProfileLinksPublished(string $username): array;  

getProfileLinksUp(string $username): array;  

getProfileLinksDown(string $username): array;  

getProfileLinksCommented(string $username): array;

πŸ”— Link actions

getLinkList(
    int $page = 1,
    int $limit = 25,
    ?LinkSort $sort = null,
    ?LinkType $type = null,
    ?string $category = null,
    ?string $bucket = null
): array; 

getLinkUrl(string $url): array; 

getLink(int $linkId): array; 

getLinkUpVotes(int $linkId, ActionType $type): array; 

getLinkRedirect(int $linkId): array;

getLinkCommentList(
    int $linkId,
    int $page = 1,
    int $limit = 25,
    ?CommentSort $sort = null,
    bool $ama = false
): array;

getLinkComment(int $linkId, int $commentId): array;

getLinkCommentComments(int $linkId, int $commentId, int $page = 1): array;

πŸ”₯ Hit actions

getHitLinks(int $year, int $month, HitSort $sort = HitSort::ALL): array;  

getHitEntries(int $year, int $month, HitSort $sort = HitSort::ALL): array;

πŸ” Search actions

getSearchAll(
    string $query,
    ?Carbon $dateFrom = null,
    ?Carbon $dateTo = null,
    SearchSort $sort = SearchSort::SCORE,
    SearchVote $votes = SearchVote::HUNDRED,
    array $domains = [],
    array $users = [],
    array $tags = [],
    ?string $category = null,
    ?string $bucket = null
): array;

getSearchLinks(
    string $query,
    ?Carbon $dateFrom = null,
    ?Carbon $dateTo = null,
    SearchSort $sort = SearchSort::SCORE,
    SearchVote $votes = SearchVote::HUNDRED,
    array $domains = [],
    array $users = [],
    array $tags = [],
    ?string $category = null,
    ?string $bucket = null,
    int $page = 1,
    int $limit = 25
): array;

getSearchEntries(
    string $query,
    ?Carbon $dateFrom = null,
    ?Carbon $dateTo = null,
    SearchSort $sort = SearchSort::SCORE,
    SearchVote $votes = SearchVote::HUNDRED,
    array $domains = [],
    array $users = [],
    array $tags = [],
    ?string $category = null,
    ?string $bucket = null,
    int $page = 1,
    int $limit = 25
): array;

getSearchUsers(
    string $query,
    SearchUsersSort $sort = SearchUsersSort::SCORE,
    array $users = [],
    int $page = 1
): array;

🚧 Available Enums

LinkSort

use FakeCop\WykopClient\Api\Requests\Contracts\LinkSort;

LinkSort::NEWEST;		    //	'newest'
LinkSort::ACTIVE;		    //	'active'
LinkSort::COMMENTED;        //  'commented'
LinkSort::DIGGED;		    //	'digged'

LinkType

use FakeCop\WykopClient\Api\Requests\Contracts\LinkType;

LinkType::HOMEPAGE;		//  'homepage'
LinkType::UPCOMING;		//  'upcoming'

CommentSort

use FakeCop\WykopClient\Api\Requests\Contracts\CommentSort;

CommentSort::NEWEST;		//  'newest'
CommentSort::OLDEST;		//  'oldest'
CommentSort::BEST;	        //  'best'

ActionType

use FakeCop\WykopClient\Api\Requests\Contracts\ActionType;

ActionType::UP;         //  'up'
ActionType::DOWN;       //  'down'

HitSort

use FakeCop\WykopClient\Api\Requests\Contracts\HitSort;

HitSort::ALL;		//	'all'
HitSort::DAY;		//	'day'
HitSort::WEEK;		//	'week'
HitSort::MONTH;		//	'month'
HitSort::YEAR;		//	'year'

SearchSort

use FakeCop\WykopClient\Api\Requests\Contracts\SearchSort;

SearchSort::SCORE;      //  'score'
SearchSort::POPULAR;    //  'popular'
SearchSort::COMMENTS;   //  'comments'
SearchSort::NEWEST;     //  'newest'

SearchVote

use FakeCop\WykopClient\Api\Requests\Contracts\SearchVote;

SearchVote::FIFTY           //  50
SearchVote::HUNDRED         //  100
SearchVote::FIVE_HUNDRED    //  500
SearchVote::THOUSAND;       //  1000

SearchUsersSort

use FakeCop\WykopClient\Api\Requests\Contracts\SearchUsersSort;

SearchUsersSort::SCORE          //  'score'
SearchUsersSort::NEWEST         //  'newest'