Skip to content
This repository has been archived by the owner on Dec 30, 2020. It is now read-only.

Latest commit

 

History

History
228 lines (172 loc) · 5.23 KB

boards.md

File metadata and controls

228 lines (172 loc) · 5.23 KB

Boards

User boards

Get all user's boards:

$boards = $bot->boards->forUser($username);

Current user boards

Get all current logged-in user's boards.

$boards = $bot->boards->forMe();

Board info

Get full board info by boardName and userName. Here you can get board id, for further functions (for example, pin creating or following boards):

$info = $bot->boards->info($username, $board);

Create

Create a new board:

// Create a public board
$bot->boards->create('Name', 'Description');

// Create a private board
$bot->boards->createPrivate('Name', 'Description');

Update

Update a board by id:

$bot->boards->update($boardId, ['name' => 'New title', 'description' => 'New description']);

You can pass more options in update: 'privacy' - is public by default and 'category' - is other by default:

$bot->boards->update($boardId, [
    'name'        => 'New title',
    'description' => 'New description',
    'privacy'     => 'secret',
    'category'    => 'sports',
]);

Delete

Delete a board by id:

$bot->boards->delete($boardId);

Follow/unfollow

Follow/unfollow board by id:

$bot->boards->follow($boardId);
$bot->boards->unfollow($boardId);

Board pins

Get all pins for board by id (returns Pagination object):

foreach ($bot->boards->pins($boardId) as $pin) {
    // ...
}

Board followers

Get board followers. Uses pinterest api pagination (returns Pagination object):

foreach($bot->boards->followers($boardId) as $follower) {
	// ...
}

Title suggestions

When you repin, Pinterest suggests you some board titles for it. You can get these suggestions for pin by its id:

$suggestions = $bot->boards->titleSuggestionsFor($pinId);

Send via message/email

Send board with message or by email:

// Send board with message
$bot->boards->sendWithMessage($boardId, 'Message', $userId); // To a user
$bot->boards->sendWithMessage($boardId, 'Message', [$userId1, $userId2]); // To many yusers

// Send board by email
$bot->boards->sendWithEmail($boardId, 'Message', '[email protected]'); // One email
$bot->boards->sendWithEmail($boardId, 'Message', ['[email protected]', '[email protected]']); // many

Board Sections

Get list for board

Every board can have several sections. Get a list of sections for a specified boardId. Returns an array of sections data.

$sections = $bot->boardSections->forBoard($boardId);

Create section

Create a section for a board:

$bot->boardSections->create($boardId, 'Section name');

Update section

Update a section's name. You need a section id, which can be retrieved by calling $bot->boardSections->forBoard($boardId):

$bot->boardSections->update($sectionId, 'New section name');

Delete section

Delete a section. You need a section id, which can be retrieved by calling $bot->boardSections->forBoard($boardId)

$bot->boardSections->delete($sectionId);

Invites

Get active invites

Get all your active boards invites:

$invites = $bot->boards->invites();

Get invites for a board

Get invites for a specified board, including accepted and declined invites (returns Pagination object):

foreach($bot->boards->invitesFor($boardId) as $invite) {
   // loop through invites
}

Invite someone to board

Invite someone to your board:

// to a user by email
$bot->boards->sendInvite($boardId, '[email protected]');

// to a user by user id
$bot->boards->sendInvite($boardId, $userId);

// to users by email
$bot->boards->sendInvite($boardId, ['[email protected]', '[email protected]']);
// to users by user id
$bot->boards->sendInvite($boardId, [$user1Id, $user2Id]);

Accept invite

Accept an invite to a board:

$bot->boards->acceptInvite($boardId);

Ignore invite

Ignore an invite to a board:

$bot->boards->ignoreInvite($boardId);

Delete invite

Delete invite. Removes from the board collaborators, requires an id of the user, you want to remove from the board:

$bot->boards->deleteInvite($boardId, $userId);
// also you can ban a user specifying third argument as true
$bot->boards->deleteInvite($boardId, $userId, true);

Leave board

Leave a board you have been invited to:

$bot->boards->leave($boardId);