Liking cljdoc? Tell your friends :D

goog.workspace.reports

Clojure wrapper for the Google Admin SDK Reports API.

Provides idiomatic Clojure functions for retrieving Workspace usage metrics (per-user, per-customer, per-entity) and audit-log activities.

Auth: use csl/scoped-delegated-credentials with the appropriate scope and a super-admin impersonation target:

  • ReportsScopes/ADMIN_REPORTS_USAGE_READONLY (usage reports)
  • ReportsScopes/ADMIN_REPORTS_AUDIT_READONLY (audit activities)

All list functions return {:data [...] :next-page-token "..."}. :next-page-token is absent when there are no further pages.

Reports API data lag: usage metrics lag by 1–3 days on Google's side. Callers must query today - 3 or earlier; querying a too-recent date returns an empty response.

All functions return {:data ...} on success or {:error ...} on failure.

Clojure wrapper for the Google Admin SDK Reports API.

Provides idiomatic Clojure functions for retrieving Workspace usage
metrics (per-user, per-customer, per-entity) and audit-log activities.

Auth: use csl/scoped-delegated-credentials with the appropriate scope
and a super-admin impersonation target:
- ReportsScopes/ADMIN_REPORTS_USAGE_READONLY  (usage reports)
- ReportsScopes/ADMIN_REPORTS_AUDIT_READONLY  (audit activities)

All list functions return {:data [...] :next-page-token "..."}.
:next-page-token is absent when there are no further pages.

Reports API data lag: usage metrics lag by 1–3 days on Google's side.
Callers must query `today - 3` or earlier; querying a too-recent date
returns an empty response.

All functions return {:data ...} on success or {:error ...} on failure.
raw docstring

get-customer-usage-reportclj

(get-customer-usage-report client date & [opts])

Tenant-aggregate Workspace usage report for the given date.

date is an ISO date string ("yyyy-MM-dd"). The Reports API has a 1–3 day data lag.

opts:

  • :customer-id — limit to a specific customer (defaults to caller's)
  • :page-token — token from a previous response
  • :parameters — comma-separated metric names
  • :fields — partial response field mask string
Tenant-aggregate Workspace usage report for the given date.

`date` is an ISO date string ("yyyy-MM-dd"). The Reports API has a
1–3 day data lag.

opts:
- :customer-id — limit to a specific customer (defaults to caller's)
- :page-token  — token from a previous response
- :parameters  — comma-separated metric names
- :fields      — partial response field mask string
raw docstring

get-entity-usage-reportclj

(get-entity-usage-report client entity-type entity-key date & [opts])

Per-entity Workspace usage report for the given date.

entity-type is the Workspace entity (e.g. "gplus_communities"). entity-key is an entity id or "all". date is an ISO date string ("yyyy-MM-dd"). The Reports API has a 1–3 day data lag.

opts:

  • :customer-id — limit to a specific customer (defaults to caller's)
  • :filters — Google parameter filter expression
  • :max-results — page size (1..1000)
  • :page-token — token from a previous response
  • :parameters — comma-separated metric names
  • :fields — partial response field mask string
Per-entity Workspace usage report for the given date.

`entity-type` is the Workspace entity (e.g. "gplus_communities").
`entity-key` is an entity id or "all". `date` is an ISO date string
("yyyy-MM-dd"). The Reports API has a 1–3 day data lag.

opts:
- :customer-id — limit to a specific customer (defaults to caller's)
- :filters     — Google parameter filter expression
- :max-results — page size (1..1000)
- :page-token  — token from a previous response
- :parameters  — comma-separated metric names
- :fields      — partial response field mask string
raw docstring

get-user-usage-reportclj

(get-user-usage-report client user-key date & [opts])

Per-user Workspace usage report for the given date.

user-key accepts an email, user id, or "all" for tenant-wide data. date is an ISO date string ("yyyy-MM-dd"). The Reports API has a 1–3 day data lag — query today - 3 or earlier or expect an empty response.

opts:

  • :customer-id — limit to a specific customer (defaults to caller's)
  • :filters — Google parameter filter expression
  • :max-results — page size (1..1000; default 1000)
  • :org-unit-id — limit to users in this OU
  • :page-token — token from a previous response
  • :parameters — comma-separated metric names, e.g. "gmail:num_emails_received,drive:num_drive_files"
  • :group-id-filter — limit to users in these groups
  • :fields — partial response field mask string
Per-user Workspace usage report for the given date.

`user-key` accepts an email, user id, or "all" for tenant-wide data.
`date` is an ISO date string ("yyyy-MM-dd"). The Reports API has a
1–3 day data lag — query `today - 3` or earlier or expect an empty
response.

opts:
- :customer-id     — limit to a specific customer (defaults to caller's)
- :filters         — Google parameter filter expression
- :max-results     — page size (1..1000; default 1000)
- :org-unit-id     — limit to users in this OU
- :page-token      — token from a previous response
- :parameters      — comma-separated metric names, e.g.
                     "gmail:num_emails_received,drive:num_drive_files"
- :group-id-filter — limit to users in these groups
- :fields          — partial response field mask string
raw docstring

list-activitiesclj

(list-activities client user-key application-name & [opts])

List audit-log activities for the given user and application.

user-key accepts an email, user id, or "all". application-name is the Workspace application (e.g. "admin", "drive", "login", "token").

opts:

  • :actor-ip-address — filter by actor IP
  • :customer-id — limit to a specific customer
  • :end-time — RFC 3339 timestamp upper bound (exclusive)
  • :event-name — filter by event name
  • :filters — Google parameter filter expression
  • :group-id-filter — limit to users in these groups
  • :max-results — page size (1..1000)
  • :org-unit-id — limit to users in this OU
  • :page-token — token from a previous response
  • :start-time — RFC 3339 timestamp lower bound (inclusive)
  • :fields — partial response field mask string
List audit-log activities for the given user and application.

`user-key` accepts an email, user id, or "all". `application-name`
is the Workspace application (e.g. "admin", "drive", "login",
"token").

opts:
- :actor-ip-address — filter by actor IP
- :customer-id      — limit to a specific customer
- :end-time         — RFC 3339 timestamp upper bound (exclusive)
- :event-name       — filter by event name
- :filters          — Google parameter filter expression
- :group-id-filter  — limit to users in these groups
- :max-results      — page size (1..1000)
- :org-unit-id      — limit to users in this OU
- :page-token       — token from a previous response
- :start-time       — RFC 3339 timestamp lower bound (inclusive)
- :fields           — partial response field mask string
raw docstring

reports-clientclj

(reports-client credentials)
(reports-client credentials opts)

Build an authenticated Admin SDK Reports client.

credentials — a com.google.auth.oauth2.GoogleCredentials instance, typically from csl/scoped-delegated-credentials with a super-admin impersonation target.

opts (optional):

  • :read-timeout-ms per-client default read timeout (default 120000 / 120s)
  • :connect-timeout-ms per-client default connect timeout (default 30000 / 30s)

Per-request opts on individual call sites override the client-level defaults.

Build an authenticated Admin SDK Reports client.

credentials — a com.google.auth.oauth2.GoogleCredentials instance, typically
from csl/scoped-delegated-credentials with a super-admin impersonation target.

opts (optional):
- :read-timeout-ms     per-client default read timeout (default 120000 / 120s)
- :connect-timeout-ms  per-client default connect timeout (default 30000 / 30s)

Per-request opts on individual call sites override the client-level defaults.
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close