Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update SDK (Execute, Groups, AppWidgets, Messages) #85

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

PHP library for VK API interaction, includes OAuth 2.0 authorization and API methods. Full VK API features documentation can be found [here](http://vk.com/dev).

This library has been created using the VK API JSON Schema. It can be found [here](https://github.com/VKCOM/vk-api-schema). It uses VK API [version](https://vk.com/dev/versions) 5.101
This library has been created using the VK API JSON Schema. It can be found [here](https://github.com/VKCOM/vk-api-schema). It uses VK API [version](https://vk.com/dev/versions) 5.120

[![Packagist](https://img.shields.io/packagist/v/vkcom/vk-php-sdk.svg)](https://packagist.org/packages/vkcom/vk-php-sdk)

Expand All @@ -29,11 +29,11 @@ $vk = new VK\Client\VKApiClient();
Also you can initialize `VKApiClient` with different API version and different language like this:

```php
$vk = new VKApiClient('5.101');
$vk = new VKApiClient('5.120');
```

```php
$vk = new VKApiClient('5.101', VK\Client\Enums\VKLanguage::ENGLISH);
$vk = new VKApiClient('5.120', VK\Client\Enums\VKLanguage::ENGLISH);
```

## 4. Authorization
Expand Down Expand Up @@ -88,7 +88,7 @@ Then use this method to get the access token:
```php
$oauth = new VK\OAuth\VKOAuth();
$client_id = 1234567;
$client_secret = 'SDAScasd'
$client_secret = 'SDAScasd';
$redirect_uri = 'https://example.com/vk';
$code = 'CODE';

Expand Down
120 changes: 119 additions & 1 deletion src/VK/Actions/AppWidgets.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,129 @@ public function __construct(VKApiRequest $request) {
$this->request = $request;
}

/**
* Returns URL to upload an app widget photo.
*
* @param string $access_token
* @param array $params
* - @var string image_type: Type of image. Values: *'24x24',, *'50x50',, *'160x160',, *'160x240',, *'510x128'
* @throws VKClientException
* @throws VKApiException
* @throws VKApiCompileException Unable to compile code
* @throws VKApiRuntimeException Runtime error occurred during code invocation
* @return mixed
*/
public function getAppImageUploadServer($access_token, $params = []) {
return $this->request->post('appWidgets.getAppImageUploadServer', $access_token, $params);
}

/**
* Returns a collection of application images.
*
* @param string $access_token
* @param array $params
* - @var integer offset: Offset needed to return a specific subset of images.
* - @var integer count: Number of objects to return.
* - @var string image_type: Type of image. Values: *'24x24',, *'50x50',, *'160x160',, *'160x240',, *'510x128'
* @throws VKClientException
* @throws VKApiException
* @throws VKApiCompileException Unable to compile code
* @throws VKApiRuntimeException Runtime error occurred during code invocation
* @return mixed
*/
public function getAppImages($access_token, $params = []) {
return $this->request->post('appWidgets.getAppImages', $access_token, $params);
}

/**
* Returns the server address for community photo upload.
*
* @param string $access_token
* @param array $params
* - @var string image_type: Type of image. Values: *'24x24',, *'50x50',, *'160x160',, *'160x240',, *'510x128'
* @throws VKClientException
* @throws VKApiException
* @throws VKApiCompileException Unable to compile code
* @throws VKApiRuntimeException Runtime error occurred during code invocation
* @return mixed
*/
public function getGroupImageUploadServer($access_token, $params = []) {
return $this->request->post('appWidgets.getGroupImageUploadServer', $access_token, $params);
}

/**
* Returns a collection of application images.
*
* @param string $access_token
* @param array $params
* - @var integer offset: Offset needed to return a specific subset of images.
* - @var integer count: Number of objects to return.
* - @var string image_type: Type of image. Values: *'24x24',, *'50x50',, *'160x160',, *'160x240',, *'510x128'
* @throws VKClientException
* @throws VKApiException
* @throws VKApiCompileException Unable to compile code
* @throws VKApiRuntimeException Runtime error occurred during code invocation
* @return mixed
*/
public function getGroupImages($access_token, $params = []) {
return $this->request->post('appWidgets.getGroupImages', $access_token, $params);
}

/**
* Returns a collection of application images by id.
*
* @param string $access_token
* @param array $params
* - @var array[string] images: List of images ID
* @throws VKClientException
* @throws VKApiException
* @throws VKApiCompileException Unable to compile code
* @throws VKApiRuntimeException Runtime error occurred during code invocation
* @return mixed
*/
public function getGroupImagesById($access_token, $params = []) {
return $this->request->post('appWidgets.getGroupImagesById', $access_token, $params);
}

/**
* Saves app photos after successful uploading.
*
* @param string $access_token
* @param array $params
* - @var string hash: Parameter returned when photos are [vk.com/dev/upload_files|uploaded to server].
* - @var string image: Parameter returned when photos are [vk.com/dev/upload_files|uploaded to server].
* @throws VKClientException
* @throws VKApiException
* @throws VKApiCompileException Unable to compile code
* @throws VKApiRuntimeException Runtime error occurred during code invocation
* @return mixed
*/
public function saveAppImage($access_token, $params = []) {
return $this->request->post('appWidgets.saveAppImage', $access_token, $params);
}

/**
* Saves app photos into community after successful uploading.
*
* @param string $access_token
* @param array $params
* - @var string hash: Parameter returned when photos are [vk.com/dev/upload_files|uploaded to server].
* - @var string image: Parameter returned when photos are [vk.com/dev/upload_files|uploaded to server].
* @throws VKClientException
* @throws VKApiException
* @throws VKApiCompileException Unable to compile code
* @throws VKApiRuntimeException Runtime error occurred during code invocation
* @return mixed
*/
public function saveGroupImage($access_token, $params = []) {
return $this->request->post('appWidgets.saveGroupImage', $access_token, $params);
}

/**
* Allows to update community app widget
*
* @param string $access_token
* @param array $params
* @param array $params
* - @var string code
* - @var AppWidgetsType type
* @throws VKClientException
Expand Down
14 changes: 7 additions & 7 deletions src/VK/Actions/Apps.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function deleteAppRequests($access_token) {
* Returns applications data.
*
* @param string $access_token
* @param array $params
* @param array $params
* - @var integer app_id: Application ID
* - @var array[string] app_ids: List of application ID
* - @var AppsPlatform platform: platform. Possible values: *'ios' — iOS,, *'android' — Android,, *'winphone' — Windows Phone,, *'web' — приложения на vk.com. By default: 'web'.
Expand All @@ -65,7 +65,7 @@ public function get($access_token, array $params = []) {
* Returns a list of applications (apps) available to users in the App Catalog.
*
* @param string $access_token
* @param array $params
* @param array $params
* - @var AppsSort sort: Sort order: 'popular_today' — popular for one day (default), 'visitors' — by visitors number , 'create_date' — by creation date, 'growth_rate' — by growth rate, 'popular_week' — popular for one week
* - @var integer offset: Offset required to return a specific subset of apps.
* - @var integer count: Number of apps to return.
Expand All @@ -89,7 +89,7 @@ public function getCatalog($access_token, array $params = []) {
* Creates friends list for requests and invites in current app.
*
* @param string $access_token
* @param array $params
* @param array $params
* - @var boolean extended
* - @var integer count: List size.
* - @var integer offset
Expand All @@ -107,7 +107,7 @@ public function getFriendsList($access_token, array $params = []) {
* Returns players rating in the game.
*
* @param string $access_token
* @param array $params
* @param array $params
* - @var AppsType type: Leaderboard type. Possible values: *'level' — by level,, *'points' — by mission points,, *'score' — by score ().
* - @var boolean global: Rating type. Possible values: *'1' — global rating among all players,, *'0' — rating among user friends.
* - @var boolean extended: 1 — to return additional info about users
Expand All @@ -123,7 +123,7 @@ public function getLeaderboard($access_token, array $params = []) {
* Returns scopes for auth
*
* @param string $access_token
* @param array $params
* @param array $params
* - @var AppsType type
* @throws VKClientException
* @throws VKApiException
Expand All @@ -137,7 +137,7 @@ public function getScopes($access_token, array $params = []) {
* Returns user score in app
*
* @param string $access_token
* @param array $params
* @param array $params
* - @var integer user_id
* @throws VKClientException
* @throws VKApiException
Expand All @@ -151,7 +151,7 @@ public function getScore($access_token, array $params = []) {
* Sends a request to another user in an app that uses VK authorization.
*
* @param string $access_token
* @param array $params
* @param array $params
* - @var integer user_id: id of the user to send a request
* - @var string text: request text
* - @var AppsType type: request type. Values: 'invite' – if the request is sent to a user who does not have the app installed,, 'request' – if a user has already installed the app
Expand Down
144 changes: 144 additions & 0 deletions src/VK/Actions/Groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,23 @@ public function create($access_token, array $params = []) {
return $this->request->post('groups.create', $access_token, $params);
}

/**
* Delete community address.
*
* @param string $access_token
* @param array $params
* - @var integer group_id: Group ID
* - @var integer address_id: Address ID
* @throws VKClientException
* @throws VKApiException
* @throws VKApiAccessGroupsException Access to the groups list is denied due to the user's privacy settings
* @throws VKApiNotFoundException Not found
* @return mixed
*/
public function deleteAddress($access_token, array $params = []) {
return $this->request->post('groups.deleteAddress', $access_token, $params);
}

/**
* @param string $access_token
* @param array $params
Expand Down Expand Up @@ -597,6 +614,21 @@ public function getMembers($access_token, array $params = []) {
return $this->request->post('groups.getMembers', $access_token, $params);
}

/**
* Returns online status of community.
*
* @param string $access_token
* @param array $params
* - @var integer group_id: ID of the community.
* @throws VKClientException
* @throws VKApiException
* @throws VKApiParamGroupIdException Invalid group id
* @return mixed
*/
public function getOnlineStatus($access_token, array $params = []) {
return $this->request->post('groups.getOnlineStatus', $access_token, $params);
}

/**
* Returns a list of requests to the community.
*
Expand Down Expand Up @@ -628,6 +660,20 @@ public function getSettings($access_token, array $params = []) {
return $this->request->post('groups.getSettings', $access_token, $params);
}

/**
* Returns list of community tags.
*
* @param string $access_token
* @param array $params
* - @var integer group_id: Community ID.
* @throws VKClientException
* @throws VKApiException
* @return mixed
*/
public function getTagList($access_token, array $params = []) {
return $this->request->post('groups.getTagList', $access_token, $params);
}

/**
* @param string $access_token
* @throws VKClientException
Expand Down Expand Up @@ -866,6 +912,104 @@ public function setLongPollSettings($access_token, array $params = []) {
return $this->request->post('groups.setLongPollSettings', $access_token, $params);
}

/**
* Sets community settings
*
* @param string $access_token
* @param array $params
* - @var integer group_id: Community ID.
* - @var boolean messages: Sets whether messages is enabled ('0' — disabled, '1' — enabled).
* - @var boolean bots_capabilities: Sets whether bots capabilities is enabled ('0' — disabled, '1' — enabled).
* - @var boolean bots_start_button: Start button ('0' — disabled, '1' — enabled).
* - @var boolean bots_add_to_chat: Users can add bots to conversations ('0' — disabled, '1' — enabled).
* @throws VKClientException
* @throws VKApiException
* @return mixed
*/
public function setSettings($access_token, array $params = []) {
return $this->request->post('groups.setSettings', $access_token, $params);
}

/**
* Set or update user note
*
* @param string $access_token
* @param array $params
* - @var integer group_id: Community ID.
* - @var integer user_id: User ID.
* - @var string note: Note text.
* @throws VKClientException
* @throws VKApiException
* @return mixed
*/
public function setUserNote($access_token, array $params = []) {
return $this->request->post('groups.setUserNote', $access_token, $params);
}

/**
* Add new tag to community
*
* @param string $access_token
* @param array $params
* - @var integer group_id: Community ID.
* - @var string tag_name: Name of tag.
* - @var string tag_color: Color of tag.
* @throws VKClientException
* @throws VKApiException
* @return mixed
*/
public function tagAdd($access_token, array $params = []) {
return $this->request->post('groups.tagAdd', $access_token, $params);
}

/**
* Bind and unbind community's tags to conversations.
*
* @param string $access_token
* @param array $params
* - @var integer group_id: Community ID.
* - @var integer tag_id: Tag ID.
* - @var integer user_id: User ID.
* - @var string act: Tag Action. Values: *'bind',, *'unbind'
* @throws VKClientException
* @throws VKApiException
* @return mixed
*/
public function tagBind($access_token, array $params = []) {
return $this->request->post('groups.tagBind', $access_token, $params);
}

/**
* Delete tag of community
*
* @param string $access_token
* @param array $params
* - @var integer group_id: Community ID.
* - @var integer tag_id: Tag ID.
* @throws VKClientException
* @throws VKApiException
* @return mixed
*/
public function tagDelete($access_token, array $params = []) {
return $this->request->post('groups.tagDelete', $access_token, $params);
}

/**
* Update tag of community
*
* @param string $access_token
* @param array $params
* - @var integer group_id: Community ID.
* - @var integer tag_id: Tag ID.
* - @var string tag_name: Tag Name.
* @throws VKClientException
* @throws VKApiException
* @return mixed
*/
public function tagUpdate($access_token, array $params = []) {
return $this->request->post('groups.tagUpdate', $access_token, $params);
}

/**
* @param string $access_token
* @param array $params
Expand Down
Loading