Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
}
: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.
# 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
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
# 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:
"""
: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.
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()
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)
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
)
# 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