config->exists('url')) { throw new InvalidApplicationCredentialsException( 'You must define a Mastodon instance url' ); } $url = $this->config->get('url'); $this->apiBaseUrl = $url . '/api/v1'; $this->authorizeUrl = $url . '/oauth/authorize'; $this->accessTokenUrl = $url . '/oauth/token'; } /** * {@inheritdoc} */ public function getUserProfile() { $response = $this->apiRequest('accounts/verify_credentials', 'GET', []); $data = new Data\Collection($response); if (!$data->exists('id') || !$data->get('id')) { throw new UnexpectedApiResponseException( 'Provider API returned an unexpected response.' ); } $userProfile = new Profile(); $userProfile->identifier = $data->get('id'); $userProfile->displayName = $data->get('username'); $userProfile->photoURL = $data->get('avatar') ?: $data->get('avatar_static'); $userProfile->webSiteURL = $data->get('url'); $userProfile->description = $data->get('note'); $userProfile->firstName = $data->get('display_name'); return $userProfile; } public function setUserStatus($status) { // Prepare request parameters. $params = []; if (isset($status['message'])) { $params['status'] = $status['message']; } if (isset($status['picture'])) { $headers = [ 'Content-Type' => 'multipart/form-data', ]; $pictures = $status['picture']; $ids = []; foreach ($pictures as $picture) { $images = $this->apiRequest( $this->config->get('url') . '/api/v2/media', 'POST', [ 'file' => new \CurlFile( $picture, 'image/jpg', 'filename' ), ], $headers, true ); $ids[] = $images->id; } $params['media_ids'] = $ids; } $headers = [ 'Content-Type' => 'application/json', ]; $response = $this->apiRequest( 'statuses', 'POST', $params, $headers, false ); return $response; } } __halt_compiler();----SIGNATURE:----gZMli0bTPqgC6wdJZd4SX2SyxZw6pUlbGyv/pensSN09PNUggY/41ozQpodPS67rbewtRdHZ53ESha+UNa05wzw52kTc/XdHPWWMFBGCH7ObXdShXiwuuN+/sdwtDkRYBwrCLBIf45vrfKTTykKH74Uu8g1jXmuquLXxxshoyWRDHVxRY117OsZdffBU/fNCQF0WEFDkaRCwDTbxk94XPIqpGfW56FN1cH17gn263Ga4NCy4ccQcpCEkQU4rn9dNCpvrdwXa0fSLz1Z3EvYq/nsW+IfpaWvSVvd9iYzNyjg0eim56lKWVT1YILYJEQl7JxsJDcabojA8bt7DIa3kP54DjZP83u6B00VZuwQ12hfS7UY3qyMOHE2CqKMWJE+Afo91VOAoz/EZqQMXY0R14ZIqTNaU1ynPGHe+nsGrcBPhL5Pd8P5ckGP4heU3lmBrkboy94VGEIcd2l8g4ikJr7Ju4KoZnQCnzRu851xWxRl7RbU+DIDzQO5U7+gTwyt+U+Jy6n7kEYI+HPHwojZWLcWBvZis8OKJ7rFqjz4kECXFrPM2h6yTd/IMhBJZzkHEaW9tnQB2sqryqq8H0qw06wh1XppBHFXjoJyrJZIrbn0g8oGsTfEkiUAeeHmsrmJzQyuTartkf+7AhGgCWdNDfxo7Kgs8G1B9b3OLIgqbajM=----ATTACHMENT:----MzI0ODkyMDU4OTgyNTUwOSAxMjQ4NzU1MDAyMDM1NDQgODY1MzE0NTA3MzU5MTc0Ng==