def get_stats_ctr_by_ids(offer_ids=None, app_ids=None, fm=None, to=None): path = '{0}/{1}'.format(resource_path, 'ctr-by-ids') ufm = convert.to_unixtime(fm, True) if fm else None uto = convert.to_unixtime(to, True) if to else None params = dict() dict_update_filled_params(params, **{ 'offer' : offer_ids, 'app' : app_ids, 'from' : ufm, 'to' : uto }) return map(stat_from_xml, get(path=path, params_dict=params))
def get_stats_audience(resource, offer_id=None, app_id=None, fm=None, to=None): path = '{0}/audience/{1}'.format(resource_path, resource) ufm = convert.to_unixtime(fm, True) if fm else None uto = convert.to_unixtime(to, True) if to else None params = dict() dict_update_filled_params(params, **{ 'offerId' : offer_id, 'appId' : app_id, 'from' : ufm, 'to' : uto }) return map(stat_from_xml, get(path=path, params_dict=params))
def get_stats_ctr(fm, to, trunc, **kwargs): path = '{0}/{1}'.format(resource_path, 'ctr') ufm = convert.to_unixtime(fm, True) uto = convert.to_unixtime(to, True) params = {'from' : ufm, 'to' : uto, 'trunc' : trunc} for key, value in kwargs.iteritems(): params[convert.to_camel_case(key)] = value return map(stat_from_xml, get(path=path, params_dict=params))
def get_performer(performer_id, **kwargs): path = '{0}/{1}'.format(resource_path, performer_id) return performer_from_xml(get(path=path, params_dict=kwargs))
def get_users_count(**kwargs): path = "{0}/{1}/{2}".format(resource_path, 'list', 'count') return count_from_xml(get(path=path, params_dict=kwargs))
def get_user_by_email(email, **kwargs): try: kwargs.update(dict(email=email)) return user_from_xml(get(path=resource_path, params_dict=kwargs)) except ResourceNotFound: return None
def get_cities(active_only=True): params_dict=dict(activeOnly=active_only) return map(city_from_xml, get(path=resource_path, params_dict=params_dict))
def get_apps_count(with_deleted=False, user_id=None): path = "{0}/{1}".format(resource_path, "count") params = dict(withDeleted=with_deleted) if user_id: params.update(userId=user_id) return count_from_xml(get(path=path, params_dict=params))
def get_actions_count(**kwargs): path = "{0}/{1}".format(resource_path, "count") return count_from_xml(get(path=path, params_dict=kwargs))
def get_account_transactions(account_id, offset=None, limit=None): path = '{0}/{1}/transactions'.format(resource_path, account_id) params = dict(accountId=account_id) dict_update_filled_params(params, offset=offset, limit=limit) return map(transaction_from_xml, get(path=path, params_dict=params))
def get_account_transactions_count(account_id): path = '{0}/{1}/transactions/count'.format(resource_path, account_id) params = dict(accountId=account_id) return count_from_xml(get(path=path, params_dict=params))
def api_get(params, secret, renderer=lambda x: x): params.update(sig=signed_params(params, secret)) return get(path=resource_path, params_dict=params, renderer=renderer)
def get_banner_size(size_id, **kwargs): path = "{0}/{1}".format(resource_path, size_id) return banner_size_from_xml(get(path=path, params_dict=kwargs))
def get_banner_sizes(active_only=True): params_dict = dict(activeOnly=active_only) return map(banner_size_from_xml, get(path=resource_path, params_dict=params_dict))
def get_settings(): return settings_from_xml(get(path=resource_path))
def get_app(app_id, **kwargs): path = "{0}/{1}".format(resource_path, app_id) return app_from_xml(get(path=path, params_dict=kwargs))
def get_apps(with_deleted=False, user_id=None, max_d=None, **kwargs): kwargs.update(withDeleted=with_deleted) shortcuts.dict_update_filled_params(kwargs, userId=user_id, maxD=max_d) return map(app_from_xml, get(path=resource_path, params_dict=kwargs))
def get_action(action_id, **kwargs): path = "{0}/{1}".format(resource_path, action_id) return action_from_xml(get(path=path, params_dict=kwargs))
def get_shows_range(fm, to, **kwargs): ufm = convert.to_unixtime(fm) uto = convert.to_unixtime(to) kwargs.update({"from": ufm, "to": uto}) return map(order_show_from_xml, get(path=resource_path, params_dict=kwargs))
def get_actions(**kwargs): return map(action_from_xml, get(path=resource_path, params_dict=kwargs))
def get_city(city_id, **kwargs): path = "{0}/{1}".format(resource_path, city_id) return city_from_xml(get(path=path, params_dict=kwargs))
def get_actions_range(fm, to, **kwargs): path = "{0}/{1}".format(resource_path, "range") ufm = convert.to_unixtime(fm) uto = convert.to_unixtime(to) kwargs.update({'from' : ufm, 'to' : uto}) return map(action_from_xml, get(path=path, params_dict=kwargs))
def get_order(order_id, **kwargs): path = "{0}/{1}".format(resource_path, order_id) return order_from_xml(get(path=path, params_dict=kwargs))
def get_orders(user_id=None, **kwargs): if user_id: kwargs.update(userId=user_id) return map(order_from_xml, get(path=resource_path, params_dict=kwargs))
def get_user_by_id(id, **kwargs): path = "{0}/{1}".format(resource_path, id) return user_from_xml(get(path=path, params_dict=kwargs))
def get_orders_count(user_id=None): path = "{0}/{1}".format(resource_path, "count") params = dict() if user_id: params.update(userId=user_id) return count_from_xml(get(path=path, params_dict=params))
def get_users(**kwargs): path = "{0}/{1}".format(resource_path, 'list') return map(user_from_xml, get(path=path, params_dict=kwargs))
def get_price_off_orders(): path = "{0}/price-off".format(resource_path) return map(order_from_xml, get(path=path))
def get_user_withdrawals(user_id): path = "{0}/{1}/developer-account/withdraws".format(resource_path, user_id) return map(withdrawal_from_xml, get(path=path))
def get_performers_count(): path = "{0}/{1}".format(resource_path, "count") return count_from_xml(get(path=path))