PHP code example of codebar-ag / laravel-beekeeper
1. Go to this page and download the library: Download codebar-ag/laravel-beekeeper library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use CodebarAg\LaravelBeekeeper\Connectors\BeekeeperConnector;
// Using the env variables
$connector = new BeekeeperConnector;
// Passing the credentials manually
$connector = new BeekeeperConnector(
apiToken: $yourApiToken,
endpointPrefix: 'foobar.us',
);
use CodebarAg\LaravelBeekeeper\Requests\GetStatusOfAuthenticatedUserRequest;
$response = $connector->send(new GetStatusOfAuthenticatedUserRequest);
use CodebarAg\LaravelBeekeeper\Requests\DeleteAnArtifact;
$response = $connector->send(new DeleteAnArtifact(
artifactId: '12345678-abcd-efgh-9012-de00edbf7b0b'
));
// Returns a 204 No Content response on success
use CodebarAg\LaravelBeekeeper\Requests\CreateAPostInAGivenStream;
// Basic post creation
$response = $connector->send(new CreateAPostInAGivenStream(
streamId: '6002',
text: 'Please indicate your preferred dates for next team event in the poll below. Thanks!'
));
// Advanced post with all options
$fileData = [
'updated' => '2016-10-07T12:49:21',
'name' => 'fair_play_rules.pdf',
'created' => '2016-10-07T12:49:21',
'url' => 'https://mytenant.beekeeper.io/file/665987/original/fair_play_rules.pdf',
'userid' => '5cb9v45d-8i78-4v65-b5fd-81cgfac3ef17',
'height' => 619,
'width' => 700,
'duration' => 315,
'key' => 'f4fdaab0-d198-49b4-b1cc-dd85572d72f1',
'media_type' => 'image/png',
'usage_type' => 'attachment_image',
'id' => 66598,
'size' => 85
];
$response = $connector->send(new CreateAPostInAGivenStream(
streamId: '6002',
text: 'Please indicate your preferred dates for next team event in the poll below. Thanks!',
html: '<p>Please <b>indicate</b> your preferred dates below.</p><p>Thanks!</p>',
title: 'Hello guys!',
labels: ['food', 'poll', 'events'],
sticky: true,
locked: true,
reactionsDisabled: true,
scheduledAt: '2019-08-24T14:15:22',
files: [$fileData],
media: [$fileData],
options: [
['text' => 'This Friday'],
['text' => 'Monday next week']
],
expand: ['user', 'stream']
));
$post = $response->dto(); // Returns a Post DTO
use CodebarAg\LaravelBeekeeper\Enums\Artifacts\Type;
use CodebarAg\LaravelBeekeeper\Enums\Artifacts\Sort;
// Artifact types
Type::FOLDER
Type::FILE
// Sorting options
Sort::NAME_ASC
Sort::NAME_DESC
Sort::CREATED_ASC
Sort::CREATED_DESC
use CodebarAg\LaravelBeekeeper\Enums\Files\Status;
use CodebarAg\LaravelBeekeeper\Enums\Files\UsageType;
// File status
Status::PROCESSING
Status::READY
Status::ERROR
// Usage types
UsageType::ATTACHMENT_IMAGE
UsageType::ATTACHMENT_FILE
UsageType::ATTACHMENT_VIDEO
UsageType::AVATAR
UsageType::COVER_IMAGE
UsageType::LOGO
// ... and more