How to use the vkbottle.types.methods.method.BaseMethod function in vkbottle

To help you get started, we’ve selected a few vkbottle examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github timoniq / vkbottle / vkbottle / types / methods / ads.py View on Github external
Access from user token(s)
        :param account_id: Advertising account ID.
        :param ids: Serialized JSON array with ad IDs.
        """

        params = {
            k if not k.endswith("_") else k[:-1]: v
            for k, v in {**locals(), **self.kwargs}.items()
            if k not in ["self"] and v is not None
        }
        return await self.request(
            "ads.deleteAds", params, response_model=responses.ads.DeleteAdsModel
        )


class AdsDeleteCampaigns(BaseMethod):
    kwargs: dict = {}
    access_token_type: APIAccessibility = [APIAccessibility.USER]

    async def __call__(
        self, account_id: int, ids: str
    ) -> responses.ads.DeleteCampaigns:
        """ ads.deleteCampaigns
        From Vk Docs: Archives advertising campaigns.
        Access from user token(s)
        :param account_id: Advertising account ID.
        :param ids: Serialized JSON array with IDs of deleted campaigns.
        """

        params = {
            k if not k.endswith("_") else k[:-1]: v
            for k, v in {**locals(), **self.kwargs}.items()
github timoniq / vkbottle / vkbottle / types / methods / fave.py View on Github external
From Vk Docs: Adds a link to user faves.
        Access from user token(s)
        :param link: Link URL.
        """

        params = {
            k if not k.endswith("_") else k[:-1]: v
            for k, v in {**locals(), **self.kwargs}.items()
            if k not in ["self"] and v is not None
        }
        return await self.request(
            "fave.addLink", params, response_model=responses.ok_response.OkResponseModel
        )


class FaveAddPage(BaseMethod):
    kwargs: dict = {}
    access_token_type: APIAccessibility = [APIAccessibility.USER]

    async def __call__(
        self, user_id: int = None, group_id: int = None
    ) -> responses.ok_response.OkResponse:
        """ fave.addPage
        From Vk Docs: 
        Access from user token(s)
        :param user_id: 
        :param group_id: 
        """

        params = {
            k if not k.endswith("_") else k[:-1]: v
            for k, v in {**locals(), **self.kwargs}.items()
github timoniq / vkbottle / vkbottle / types / methods / likes.py View on Github external
# Generated with love
from vkbottle.types import responses
from .access import APIAccessibility
from .method import BaseMethod


class LikesAdd(BaseMethod):
    kwargs: dict = {}
    access_token_type: APIAccessibility = [APIAccessibility.USER]

    async def __call__(
        self, type: str, item_id: int, owner_id: int = None, access_key: str = None
    ) -> responses.likes.Add:
        """ likes.add
        From Vk Docs: Adds the specified object to the 'Likes' list of the current user.
        Access from user token(s)
        :param type: Object type: 'post' — post on user or community wall, 'comment' — comment on a wall post, 'photo' — photo, 'audio' — audio, 'video' — video, 'note' — note, 'photo_comment' — comment on the photo, 'video_comment' — comment on the video, 'topic_comment' — comment in the discussion, 'sitepage' — page of the site where the [vk.com/dev/Like|Like widget] is installed
        :param owner_id: ID of the user or community that owns the object.
        :param item_id: Object ID.
        :param access_key: Access key required for an object owned by a private entity.
        """

        params = {
github timoniq / vkbottle / vkbottle / types / methods / messages.py View on Github external
:param group_id: Group ID (for group messages with group access token)
        """

        params = {
            k if not k.endswith("_") else k[:-1]: v
            for k, v in {**locals(), **self.kwargs}.items()
            if k not in ["self"] and v is not None
        }
        return await self.request(
            "messages.markAsImportantConversation",
            params,
            response_model=responses.ok_response.OkResponseModel,
        )


class MessagesMarkAsRead(BaseMethod):
    kwargs: dict = {}
    access_token_type: APIAccessibility = [
        APIAccessibility.USER,
        APIAccessibility.GROUP,
    ]

    async def __call__(
        self,
        message_ids: typing.List = None,
        peer_id: int = None,
        start_message_id: int = None,
        group_id: int = None,
    ) -> responses.ok_response.OkResponse:
        """ messages.markAsRead
        From Vk Docs: Marks messages as read.
        Access from user, group token(s)
github timoniq / vkbottle / vkbottle / types / methods / board.py View on Github external
:param comment_id: Comment ID.
        """

        params = {
            k if not k.endswith("_") else k[:-1]: v
            for k, v in {**locals(), **self.kwargs}.items()
            if k not in ["self"] and v is not None
        }
        return await self.request(
            "board.restoreComment",
            params,
            response_model=responses.ok_response.OkResponseModel,
        )


class BoardUnfixTopic(BaseMethod):
    kwargs: dict = {}
    access_token_type: APIAccessibility = [APIAccessibility.USER]

    async def __call__(
        self, group_id: int, topic_id: int
    ) -> responses.ok_response.OkResponse:
        """ board.unfixTopic
        From Vk Docs: Unpins a pinned topic from the top of a community's discussion board.
        Access from user token(s)
        :param group_id: ID of the community that owns the discussion board.
        :param topic_id: Topic ID.
        """

        params = {
            k if not k.endswith("_") else k[:-1]: v
            for k, v in {**locals(), **self.kwargs}.items()
github timoniq / vkbottle / vkbottle / types / methods / board.py View on Github external
:param comment_id: Comment ID.
        """

        params = {
            k if not k.endswith("_") else k[:-1]: v
            for k, v in {**locals(), **self.kwargs}.items()
            if k not in ["self"] and v is not None
        }
        return await self.request(
            "board.deleteComment",
            params,
            response_model=responses.ok_response.OkResponseModel,
        )


class BoardDeleteTopic(BaseMethod):
    kwargs: dict = {}
    access_token_type: APIAccessibility = [APIAccessibility.USER]

    async def __call__(
        self, group_id: int, topic_id: int
    ) -> responses.ok_response.OkResponse:
        """ board.deleteTopic
        From Vk Docs: Deletes a topic from a community's discussion board.
        Access from user token(s)
        :param group_id: ID of the community that owns the discussion board.
        :param topic_id: Topic ID.
        """

        params = {
            k if not k.endswith("_") else k[:-1]: v
            for k, v in {**locals(), **self.kwargs}.items()
github timoniq / vkbottle / vkbottle / types / methods / messages.py View on Github external
:param group_id: Group ID
        """

        params = {
            k if not k.endswith("_") else k[:-1]: v
            for k, v in {**locals(), **self.kwargs}.items()
            if k not in ["self"] and v is not None
        }
        return await self.request(
            "messages.getInviteLink",
            params,
            response_model=responses.messages.GetInviteLinkModel,
        )


class MessagesGetLastActivity(BaseMethod):
    kwargs: dict = {}
    access_token_type: APIAccessibility = [APIAccessibility.USER]

    async def __call__(self, user_id: int) -> responses.messages.GetLastActivity:
        """ messages.getLastActivity
        From Vk Docs: Returns a user's current status and date of last activity.
        Access from user token(s)
        :param user_id: User ID.
        """

        params = {
            k if not k.endswith("_") else k[:-1]: v
            for k, v in {**locals(), **self.kwargs}.items()
            if k not in ["self"] and v is not None
        }
        return await self.request(
github timoniq / vkbottle / vkbottle / types / methods / account.py View on Github external
:param value: New value for the key in a [vk.com/dev/push_settings|special format].
        """

        params = {
            k if not k.endswith("_") else k[:-1]: v
            for k, v in {**locals(), **self.kwargs}.items()
            if k not in ["self"] and v is not None
        }
        return await self.request(
            "account.setPushSettings",
            params,
            response_model=responses.ok_response.OkResponseModel,
        )


class AccountSetSilenceMode(BaseMethod):
    kwargs: dict = {}
    access_token_type: APIAccessibility = [APIAccessibility.USER]

    async def __call__(
        self,
        device_id: str = None,
        time: int = None,
        peer_id: int = None,
        sound: int = None,
    ) -> responses.ok_response.OkResponse:
        """ account.setSilenceMode
        From Vk Docs: Mutes push notifications for the set period of time.
        Access from user token(s)
        :param device_id: Unique device ID.
        :param time: Time in seconds for what notifications should be disabled. '-1' to disable forever.
        :param peer_id: Destination ID. "For user: 'User ID', e.g. '12345'. For chat: '2000000000' + 'Chat ID', e.g. '2000000001'. For community: '- Community ID', e.g. '-12345'. "
github timoniq / vkbottle / vkbottle / types / methods / photos.py View on Github external
:param photo: Parameter returned when photos are [vk.com/dev/upload_files|uploaded to server].
        """

        params = {
            k if not k.endswith("_") else k[:-1]: v
            for k, v in {**locals(), **self.kwargs}.items()
            if k not in ["self"] and v is not None
        }
        return await self.request(
            "photos.saveOwnerCoverPhoto",
            params,
            response_model=responses.photos.SaveOwnerCoverPhotoModel,
        )


class PhotosSaveOwnerPhoto(BaseMethod):
    kwargs: dict = {}
    access_token_type: APIAccessibility = [APIAccessibility.USER]

    async def __call__(
        self, server: str = None, hash: str = None, photo: str = None
    ) -> responses.photos.SaveOwnerPhoto:
        """ photos.saveOwnerPhoto
        From Vk Docs: Saves a profile or community photo. Upload URL can be got with the [vk.com/dev/photos.getOwnerPhotoUploadServer|photos.getOwnerPhotoUploadServer] method.
        Access from user token(s)
        :param server: parameter returned after [vk.com/dev/upload_files|photo upload].
        :param hash: parameter returned after [vk.com/dev/upload_files|photo upload].
        :param photo: parameter returned after [vk.com/dev/upload_files|photo upload].
        """

        params = {
            k if not k.endswith("_") else k[:-1]: v
github timoniq / vkbottle / vkbottle / types / methods / video.py View on Github external
:param count: Number of video albums to return.
        :param extended: '1' — to return additional information about album privacy settings for the current user
        :param need_system: 
        """

        params = {
            k if not k.endswith("_") else k[:-1]: v
            for k, v in {**locals(), **self.kwargs}.items()
            if k not in ["self"] and v is not None
        }
        return await self.request(
            "video.getAlbums", params, response_model=responses.video.GetAlbumsModel
        )


class VideoGetAlbumsByVideo(BaseMethod):
    kwargs: dict = {}
    access_token_type: APIAccessibility = [APIAccessibility.USER]

    async def __call__(
        self,
        owner_id: int,
        target_id: int = None,
        video_id: int = None,
        extended: bool = None,
    ) -> responses.video.GetAlbumsByVideo:
        """ video.getAlbumsByVideo
        From Vk Docs: 
        Access from user token(s)
        :param target_id: 
        :param owner_id: 
        :param video_id: