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

33 lines
809 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(
not_empty, isodate, ignore_missing, json_list_or_string, default
):
return {
"start_date": [not_empty, isodate],
"end_date": [not_empty, isodate],
"category": [not_empty],
"action": [not_empty],
"label": [ignore_missing, not_empty],
"dimensions": [
default("ga:eventCategory,ga:eventAction,ga:eventLabel"),
json_list_or_string,
],
"metrics": [
default("ga:totalEvents,ga:uniqueEvents,ga:eventValue"),
json_list_or_string,
],
}