How to use the vkbottle.types.methods.access.APIAccessibility 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 / friends.py View on Github external
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(
            "friends.deleteList",
            params,
            response_model=responses.ok_response.OkResponseModel,
        )


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

    async def __call__(
        self, user_id: int, list_ids: typing.List = None
    ) -> responses.ok_response.OkResponse:
        """ friends.edit
        From Vk Docs: Edits the friend lists of the selected user.
        Access from user token(s)
        :param user_id: ID of the user whose friend list is to be edited.
        :param list_ids: IDs of the friend lists to which to add the user.
        """

        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
        }
github timoniq / vkbottle / vkbottle / types / methods / ads.py View on Github external
:param offset: Offset. Used in the same cases as 'limit' parameter.
        """

        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.getAdsLayout", params, response_model=responses.ads.GetAdsLayoutModel
        )


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

    async def __call__(
        self,
        account_id: int,
        ad_ids: str = None,
        campaign_ids: str = None,
        client_id: int = None,
        include_deleted: bool = None,
        limit: int = None,
        offset: int = None,
    ) -> responses.ads.GetAdsTargeting:
        """ ads.getAdsTargeting
        From Vk Docs: Returns ad targeting parameters.
        Access from user token(s)
        :param account_id: Advertising account ID.
        :param ad_ids: Filter by ads. Serialized JSON array with ad IDs. If the parameter is null, all ads will be shown.
github timoniq / vkbottle / vkbottle / types / methods / utils.py View on Github external
# Generated with love
from vkbottle.types import responses
from .access import APIAccessibility
from .method import BaseMethod


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

    async def __call__(self, url: str) -> responses.utils.CheckLink:
        """ utils.checkLink
        From Vk Docs: Checks whether a link is blocked in VK.
        Access from user, group, service token(s)
        :param url: Link to check (e.g., 'http://google.com').
        """

        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
github timoniq / vkbottle / vkbottle / types / methods / wall.py View on Github external
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(
            "wall.getReposts", params, response_model=responses.wall.GetRepostsModel
        )


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

    async def __call__(
        self, owner_id: int, post_id: int
    ) -> responses.ok_response.OkResponse:
        """ wall.openComments
        From Vk Docs: 
        Access from user, group token(s)
        :param owner_id: 
        :param post_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
github timoniq / vkbottle / vkbottle / types / methods / auth.py View on Github external
# Generated with love
from vkbottle.types import responses
from .access import APIAccessibility
from .method import BaseMethod


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

    async def __call__(
        self,
        phone: str,
        client_id: int = None,
        client_secret: str = None,
        auth_by_phone: bool = None,
    ) -> responses.ok_response.OkResponse:
        """ auth.checkPhone
        From Vk Docs: Checks a user's phone number for correctness.
        Access from user, open token(s)
        :param phone: Phone number.
        :param client_id: User ID.
        :param client_secret: 
        :param auth_by_phone: 
        """
github timoniq / vkbottle / vkbottle / types / methods / notes.py View on Github external
:param privacy_comment: 
        """

        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(
            "notes.add", params, response_model=responses.notes.AddModel
        )


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

    async def __call__(
        self,
        note_id: int,
        message: str,
        owner_id: int = None,
        reply_to: int = None,
        guid: str = None,
    ) -> responses.notes.CreateComment:
        """ notes.createComment
        From Vk Docs: Adds a new comment on a note.
        Access from user token(s)
        :param note_id: Note ID.
        :param owner_id: Note owner ID.
        :param reply_to: ID of the user to whom the reply is addressed (if the comment is a reply to another comment).
        :param message: Comment text.
github timoniq / vkbottle / vkbottle / types / methods / photos.py View on Github external
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.saveMarketPhoto",
            params,
            response_model=responses.photos.SaveMarketPhotoModel,
        )


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

    async def __call__(
        self, photo: str, server: int = None, hash: str = None
    ) -> responses.photos.SaveMessagesPhoto:
        """ photos.saveMessagesPhoto
        From Vk Docs: Saves a photo after being successfully uploaded. URL obtained with [vk.com/dev/photos.getMessagesUploadServer|photos.getMessagesUploadServer] method.
        Access from user, group token(s)
        :param photo: Parameter returned when the photo is [vk.com/dev/upload_files|uploaded to the server].
        :param server: 
        :param hash: 
        """

        params = {
            k if not k.endswith("_") else k[:-1]: v
            for k, v in {**locals(), **self.kwargs}.items()
github timoniq / vkbottle / vkbottle / api / api / util / token.py View on Github external
from vkbottle.types.methods.access import APIAccessibility
from abc import ABC, abstractmethod
import typing
import warnings


class AbstractTokenGenerator(ABC):
    tokens_type: APIAccessibility = APIAccessibility.OPEN

    async def __aenter__(self, *args, **kwargs):
        return await self.get_token(*args, **kwargs)

    def __repr__(self):
        return f"<{self.__class__.__qualname__} tokens_type={self.tokens_type} tokens_amount={self.__len__()}>"

    def __len__(self):
        tokens: typing.Optional[typing.Iterable[str]] = getattr(self, "tokens")
        if tokens is None:
            warnings.warn(
                f"Add property or name an attribute containing tokens '{self.__class__.__name__}.tokens'"
            )
            tokens = []
        return len(tokens)
github timoniq / vkbottle / vkbottle / types / methods / docs.py View on Github external
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(
            "docs.getMessagesUploadServer",
            params,
            response_model=responses.base.GetUploadServerModel,
        )


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

    async def __call__(self, owner_id: int) -> responses.docs.GetTypes:
        """ docs.getTypes
        From Vk Docs: Returns documents types available for current user.
        Access from user token(s)
        :param owner_id: ID of the user or community that owns the documents. Use a negative value to designate a community 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(
            "docs.getTypes", params, response_model=responses.docs.GetTypesModel
        )
github timoniq / vkbottle / vkbottle / types / methods / wall.py View on Github external
# Generated with love
import typing

from vkbottle.types import responses

from .access import APIAccessibility
from .method import BaseMethod


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

    async def __call__(
        self, owner_id: int, post_id: int
    ) -> responses.ok_response.OkResponse:
        """ wall.closeComments
        From Vk Docs: 
        Access from user, group token(s)
        :param owner_id: 
        :param post_id: 
        """

        params = {
            k if not k.endswith("_") else k[:-1]: v