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, account_id: int) -> responses.ads.GetOfficeUsers:
""" ads.getOfficeUsers
From Vk Docs: Returns a list of managers and supervisors of advertising account.
Access from user token(s)
:param account_id: Advertising account 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(
"ads.getOfficeUsers",
params,
response_model=responses.ads.GetOfficeUsersModel,
)
async def __call__(
self, account_id: int, client_id: int = None, extended: bool = None
) -> responses.ads.GetTargetGroups:
""" ads.getTargetGroups
From Vk Docs: Returns a list of target groups.
Access from user token(s)
:param account_id: Advertising account ID.
:param client_id: 'Only for advertising agencies.', ID of the client with the advertising account where the group will be created.
:param extended: '1' — to return pixel code.
"""
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.getTargetGroups",
params,
async def __call__(self, account_id: int) -> responses.ads.GetClients:
""" ads.getClients
From Vk Docs: Returns a list of advertising agency's clients.
Access from user token(s)
:param account_id: Advertising account 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(
"ads.getClients", params, response_model=responses.ads.GetClientsModel
)
""" ads.getRejectionReason
From Vk Docs: Returns a reason of ad rejection for pre-moderation.
Access from user token(s)
:param account_id: Advertising account ID.
:param ad_id: Ad 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(
"ads.getRejectionReason",
params,
response_model=responses.ads.GetRejectionReasonModel,
)
async def __call__(self, account_id: int, data: str) -> responses.ads.UpdateAds:
""" ads.updateAds
From Vk Docs: Edits ads.
Access from user token(s)
:param account_id: Advertising account ID.
:param data: Serialized JSON array of objects that describe changes in ads. Description of 'ad_edit_specification' objects see below.
"""
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.updateAds", params, response_model=responses.ads.UpdateAdsModel
)
async def __call__(self, lang: str = None) -> responses.ads.GetCategories:
""" ads.getCategories
From Vk Docs: Returns a list of possible ad categories.
Access from user token(s)
:param lang: Language. The full list of supported languages is [vk.com/dev/api_requests|here].
"""
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.getCategories", params, response_model=responses.ads.GetCategoriesModel
)
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.GetAds:
""" ads.getAds
From Vk Docs: Returns number of ads.
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.
:param campaign_ids: Filter by advertising campaigns. Serialized JSON array with campaign IDs. If the parameter is null, ads of all campaigns will be shown.
:param client_id: 'Available and required for advertising agencies.' ID of the client ads are retrieved from.
:param include_deleted: Flag that specifies whether archived ads shall be shown: *0 — show only active ads,, *1 — show all ads.
:param limit: Limit of number of returned ads. Used only if ad_ids parameter is null, and 'campaign_ids' parameter contains ID of only one campaign.
: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
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.GetAdsLayout:
""" ads.getAdsLayout
From Vk Docs: Returns descriptions of ad layouts.
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.
:param campaign_ids: Filter by advertising campaigns. Serialized JSON array with campaign IDs. If the parameter is null, ads of all campaigns will be shown.
:param client_id: 'For advertising agencies.' ID of the client ads are retrieved from.
:param include_deleted: Flag that specifies whether archived ads shall be shown. *0 — show only active ads,, *1 — show all ads.
:param limit: Limit of number of returned ads. Used only if 'ad_ids' parameter is null, and 'campaign_ids' parameter contains ID of only one campaign.
: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
async def __call__(self, account_id: int, ids: str) -> responses.ads.DeleteAds:
""" ads.deleteAds
From Vk Docs: Archives ads.
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
)
""" ads.updateCampaigns
From Vk Docs: Edits advertising campaigns.
Access from user token(s)
:param account_id: Advertising account ID.
:param data: Serialized JSON array of objects that describe changes in campaigns. Description of 'campaign_mod' objects see below.
"""
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.updateCampaigns",
params,
response_model=responses.ads.UpdateCampaignsModel,
)