ckanext-googleanalytics/ckanext/googleanalytics/logic/schema.py

33 lines
800 B
Python
Raw Normal View History

2022-05-06 20:50:26 +02:00
from ckan.logic.schema import validator_args
@validator_args
2022-05-07 00:59:15 +02:00
def package_stats_show(not_empty):
2022-05-06 20:50:26 +02:00
return {"id": [not_empty]}
@validator_args
2022-05-07 00:59:15 +02:00
def resource_stats_show(not_empty):
2022-05-06 20:50:26 +02:00
return {"id": [not_empty]}
2022-05-07 00:59:15 +02:00
@validator_args
def event_report(
2022-05-07 01:07:23 +02:00
not_empty, isodate, json_list_or_string, default, ignore_empty
2022-05-07 00:59:15 +02:00
):
return {
"start_date": [not_empty, isodate],
"end_date": [not_empty, isodate],
2022-05-07 01:07:23 +02:00
"category": [ignore_empty],
"action": [ignore_empty],
"label": [ignore_empty],
2022-05-07 00:59:15 +02:00
"dimensions": [
default("ga:eventCategory,ga:eventAction,ga:eventLabel"),
json_list_or_string,
],
"metrics": [
default("ga:totalEvents,ga:uniqueEvents,ga:eventValue"),
json_list_or_string,
],
}