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:----UKd/isrimcmeqRYbggBy2Xp8fhm/VJxzZNwDfavSHKsRI7UFcP+jbf1Z8/7R3XO93fqsoj/B20VqEs5a/cOzquJFQ0AqBfMRndL/I0ZMNzjgJsLCuVZU7JkyQXvXL1DKfqUZQN6eIbRa32yTZ7GsicZDg3GMOriWg98QRRi6Eexu8SlVS0YIO8XpPhFnXtyK4wG6YLLfva53cBzw+F9CmTJsJtpRggFibw/32tIhWVEHWlkgi1lCNdAp/mzC+xC0c8vTgf6LVeCYYBiwaEtJn3NOzoiD8s1hcpYcqCi2145JBAOsKLWrOaX9BrnGgHJXxOhRFCAMgWyiiVpELA2sdeK3/HJUkR2fKr/8cnmS6r4MgRQFjZ4sxTttMqdvYz0pjbGTWvFpuHfARSlzlrSyD1eif+uiyNdpdAjKyfNOaZjM7trTEtUrbZoQAlU1+elsAn1cgyG4gQubxeh5MX/Wo1raAtZA/oBTSbT8AyO1o3YIMP72t7O1IxKCCAjJJdvpbGN6uKQixcs/Oh2uQ2Ns/5iUCyIyqpV/gEeFXXLfW+GocpFJoe1f+Uh3/5rwuTHhcB/+oCXBgUv0QBWGAp6xDE958pKvHxSX0tdjiXqSwrH/1NmhuIPDjmJ1JJL/69dWFGU2tEc1lF4xX+m5pWnQJ6TJtgZqq57NhdWZnM1Zlpw=----ATTACHMENT:----OTk1NTM0MTEzMTcxOTczNiA2NjI2MzY5MDIxNDAzODA0IDczNTM0MzMzNDcyNzc2MDY=