Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async def __call__(
self,
owner_id: int,
item_id: int,
message: str = None,
attachments: typing.List = None,
from_group: bool = None,
reply_to_comment: int = None,
sticker_id: int = None,
guid: str = None,
) -> responses.market.CreateComment:
""" market.createComment
From Vk Docs: Creates a new comment for an item.
Access from user token(s)
:param owner_id: ID of an item owner community.
:param item_id: Item ID.
:param message: Comment text (required if 'attachments' parameter is not specified)
:param attachments: Comma-separated list of objects attached to a comment. The field is submitted the following way: , "'_,_'", , '' - media attachment type: "'photo' - photo, 'video' - video, 'audio' - audio, 'doc' - document", , '' - media owner id, '' - media attachment id, , For example: "photo100172_166443618,photo66748_265827614",
:param from_group: '1' - comment will be published on behalf of a community, '0' - on behalf of a user (by default).
:param reply_to_comment: ID of a comment to reply with current comment to.
:param sticker_id: Sticker ID.
:param guid: Random value to avoid resending one comment.
"""
params = {
k if not k.endswith("_") else k[:-1]: v
for k, v in {**locals(), **self.kwargs}.items()
:param attachments: Comma-separated list of objects attached to a comment. The field is submitted the following way: , "'_,_'", , '' - media attachment type: "'photo' - photo, 'video' - video, 'audio' - audio, 'doc' - document", , '' - media owner id, '' - media attachment id, , For example: "photo100172_166443618,photo66748_265827614",
:param from_group: '1' - comment will be published on behalf of a community, '0' - on behalf of a user (by default).
:param reply_to_comment: ID of a comment to reply with current comment to.
:param sticker_id: Sticker ID.
:param guid: Random value to avoid resending one 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(
"market.createComment",
params,
response_model=responses.market.CreateCommentModel,
)
:param tags: Comma-separated tag IDs list.
:param sort:
:param rev: '0' — do not use reverse order, '1' — use reverse order
:param offset: Offset needed to return a specific subset of results.
:param count: Number of items to return.
:param extended: '1' – to return additional fields: 'likes, can_comment, car_repost, photos'. By default: '0'.
:param status:
"""
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(
"market.search", params, response_model=responses.market.SearchModel
)
""" market.deleteComment
From Vk Docs: Deletes an item's comment
Access from user token(s)
:param owner_id: identifier of an item owner community, "Note that community id in the 'owner_id' parameter should be negative number. For example 'owner_id'=-1 matches the [vk.com/apiclub|VK API] community "
: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(
"market.deleteComment",
params,
response_model=responses.market.DeleteCommentModel,
)
async def __call__(
self,
owner_id: int,
album_id: int = None,
count: int = None,
offset: int = None,
extended: bool = None,
) -> responses.market.Get:
""" market.get
From Vk Docs: Returns items list for a community.
Access from user token(s)
:param owner_id: ID of an item owner community, "Note that community id in the 'owner_id' parameter should be negative number. For example 'owner_id'=-1 matches the [vk.com/apiclub|VK API] community "
:param album_id:
:param count: Number of items to return.
:param offset: Offset needed to return a specific subset of results.
:param extended: '1' – method will return additional fields: 'likes, can_comment, car_repost, photos'. These parameters are not returned by default.
"""
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(
async def __call__(
self, owner_id: int, album_ids: typing.List
) -> responses.market.GetAlbumById:
""" market.getAlbumById
From Vk Docs: Returns items album's data
Access from user token(s)
:param owner_id: identifier of an album owner community, "Note that community id in the 'owner_id' parameter should be negative number. For example 'owner_id'=-1 matches the [vk.com/apiclub|VK API] community "
:param album_ids: collections identifiers to obtain data from
"""
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(
"market.getAlbumById",
params,
response_model=responses.market.GetAlbumByIdModel,
""" market.getAlbumById
From Vk Docs: Returns items album's data
Access from user token(s)
:param owner_id: identifier of an album owner community, "Note that community id in the 'owner_id' parameter should be negative number. For example 'owner_id'=-1 matches the [vk.com/apiclub|VK API] community "
:param album_ids: collections identifiers to obtain data from
"""
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(
"market.getAlbumById",
params,
response_model=responses.market.GetAlbumByIdModel,
)
async def __call__(
self,
owner_id: int,
album_id: int = None,
q: str = None,
price_from: int = None,
price_to: int = None,
tags: typing.List = None,
sort: int = None,
rev: int = None,
offset: int = None,
count: int = None,
extended: bool = None,
status: int = None,
) -> responses.market.Search:
""" market.search
From Vk Docs: Searches market items in a community's catalog
Access from user token(s)
:param owner_id: ID of an items owner community.
:param album_id:
:param q: Search query, for example "pink slippers".
:param price_from: Minimum item price value.
:param price_to: Maximum item price value.
:param tags: Comma-separated tag IDs list.
:param sort:
:param rev: '0' — do not use reverse order, '1' — use reverse order
:param offset: Offset needed to return a specific subset of results.
:param count: Number of items to return.
:param extended: '1' – to return additional fields: 'likes, can_comment, car_repost, photos'. By default: '0'.
:param status:
"""
From Vk Docs: Returns items list for a community.
Access from user token(s)
:param owner_id: ID of an item owner community, "Note that community id in the 'owner_id' parameter should be negative number. For example 'owner_id'=-1 matches the [vk.com/apiclub|VK API] community "
:param album_id:
:param count: Number of items to return.
:param offset: Offset needed to return a specific subset of results.
:param extended: '1' – method will return additional fields: 'likes, can_comment, car_repost, photos'. These parameters are not returned by default.
"""
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(
"market.get", params, response_model=responses.market.GetModel
)
self, item_ids: typing.List, extended: bool = None
) -> responses.market.GetById:
""" market.getById
From Vk Docs: Returns information about market items by their ids.
Access from user token(s)
:param item_ids: Comma-separated ids list: {user id}_{item id}. If an item belongs to a community -{community id} is used. " 'Videos' value example: , '-4363_136089719,13245770_137352259'"
:param extended: '1' – to return additional fields: 'likes, can_comment, car_repost, photos'. By default: '0'.
"""
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(
"market.getById", params, response_model=responses.market.GetByIdModel
)