OpenADR 3 API client library. Spec-driven HTTP client built on Martian with the OpenAPI spec as the single source of truth.
Functions return raw HTTP responses by default. Use the coerced helpers (programs, events, vens, etc.) to get namespaced Clojure entities.
OpenADR 3 API client library. Spec-driven HTTP client built on Martian with the OpenAPI spec as the single source of truth. Functions return raw HTTP responses by default. Use the coerced helpers (programs, events, vens, etc.) to get namespaced Clojure entities.
(all-routes client)Returns vector of all route-name keywords.
Returns vector of all route-name keywords.
(authorized? client-scopes endpoint-scopes)Returns truthy if the client's scopes intersect with the endpoint's required scopes.
Returns truthy if the client's scopes intersect with the endpoint's required scopes.
(body response)Extract the :body from an HTTP response.
Extract the :body from an HTTP response.
(build-shared-http-client {:keys [connect-timeout-ms]
:or {connect-timeout-ms 5000}})Build a shared Java HttpClient with connection timeout. Reuse across requests to avoid per-request client creation.
Build a shared Java HttpClient with connection timeout. Reuse across requests to avoid per-request client creation.
(client-type client)Returns OpenADR3 client-type keyword, :ven or :bl
Returns OpenADR3 client-type keyword, :ven or :bl
(create-authentication-header token)Martian interceptor that adds a Bearer token to requests.
Martian interceptor that adds a Bearer token to requests.
(create-bl-client auth-token url)(create-bl-client auth-token url opts)Create an authenticated BL (Business Logic) client. Uses the embedded spec (default version 3.1.0). Pass opts map to override :spec-version, :http-client, or :user-agent.
Examples: (create-bl-client token url) (create-bl-client token url {:spec-version "3.0.1"}) (create-bl-client token url {:http-client hc}) (create-bl-client token url {:user-agent "my-app/1.0"})
Create an authenticated BL (Business Logic) client.
Uses the embedded spec (default version 3.1.0). Pass opts map to override
:spec-version, :http-client, or :user-agent.
Examples:
(create-bl-client token url)
(create-bl-client token url {:spec-version "3.0.1"})
(create-bl-client token url {:http-client hc})
(create-bl-client token url {:user-agent "my-app/1.0"})(create-event openapi-client event-request-body)Create a new event.
Create a new event.
(create-program openapi-client program-request-body)Create a new program.
Create a new program.
(create-report openapi-client report-request-body)Create a new report.
Create a new report.
(create-resource openapi-client resource-body)Create a resource for a VEN. Body should include :venID, :resourceName, and :objectType (VEN_RESOURCE_REQUEST or BL_RESOURCE_REQUEST). For BL requests, also include :clientID.
Create a resource for a VEN. Body should include :venID, :resourceName, and :objectType (VEN_RESOURCE_REQUEST or BL_RESOURCE_REQUEST). For BL requests, also include :clientID.
(create-subscription openapi-client subscription-request-body)Create a new subscription.
Create a new subscription.
(create-user-agent-header user-agent)Martian interceptor that sets the User-Agent header on requests.
Martian interceptor that sets the User-Agent header on requests.
(create-ven openapi-client ven-request-body)Create a new VEN.
Create a new VEN.
(create-ven-client auth-token url)(create-ven-client auth-token url opts)Create an authenticated VEN (Virtual End Node) client. Uses the embedded spec (default version 3.1.0). Pass opts map to override :spec-version, :http-client, or :user-agent.
Examples: (create-ven-client token url) (create-ven-client token url {:spec-version "3.0.1"}) (create-ven-client token url {:http-client hc}) (create-ven-client token url {:user-agent "my-app/1.0"})
Create an authenticated VEN (Virtual End Node) client.
Uses the embedded spec (default version 3.1.0). Pass opts map to override
:spec-version, :http-client, or :user-agent.
Examples:
(create-ven-client token url)
(create-ven-client token url {:spec-version "3.0.1"})
(create-ven-client token url {:http-client hc})
(create-ven-client token url {:user-agent "my-app/1.0"})(delete-event openapi-client event-id)Delete an event by ID.
Delete an event by ID.
(delete-program openapi-client program-id)Delete a program by ID.
Delete a program by ID.
(delete-report openapi-client report-id)Delete a report by ID.
Delete a report by ID.
(delete-resource openapi-client resource-id)Delete a resource by ID.
Delete a resource by ID.
(delete-subscription openapi-client subscription-id)Delete a subscription by ID.
Delete a subscription by ID.
(delete-ven openapi-client ven-id)Delete a VEN by ID.
Delete a VEN by ID.
(endpoint-scopes client endpoint)Returns set of OAuth2 scopes required for the given endpoint.
Returns set of OAuth2 scopes required for the given endpoint.
(event client event-id)Fetch and coerce an event by ID. Returns an Event entity.
Fetch and coerce an event by ID. Returns an Event entity.
(events client)Fetch and coerce all events. Returns a vector of Event entities.
Fetch and coerce all events. Returns a vector of Event entities.
(find-program-by-name client name)Find a program by name. Returns the first match, or nil if not found.
Find a program by name. Returns the first match, or nil if not found.
(find-ven-by-name client name)Find a VEN by name. Returns the first match, or nil if not found.
Find a VEN by name. Returns the first match, or nil if not found.
(get-auth-server openapi-client)GET auth server info.
GET auth server info.
(get-event-by-id openapi-client event-id)Get an event by its ID.
Get an event by its ID.
(get-handler martian route-kw)Returns the handler for the specified route-name keyword.
Returns the handler for the specified route-name keyword.
(get-mqtt-topics-program openapi-client program-id)Get MQTT topic names for a specific program.
Get MQTT topic names for a specific program.
(get-mqtt-topics-program-events openapi-client program-id)Get MQTT topic names for events on a specific program.
Get MQTT topic names for events on a specific program.
(get-mqtt-topics-ven openapi-client ven-id)Get MQTT topic names for a specific VEN.
Get MQTT topic names for a specific VEN.
(get-mqtt-topics-ven-events openapi-client ven-id)Get MQTT topic names for events targeted at a VEN.
Get MQTT topic names for events targeted at a VEN.
(get-mqtt-topics-ven-programs openapi-client ven-id)Get MQTT topic names for programs targeted at a VEN.
Get MQTT topic names for programs targeted at a VEN.
(get-mqtt-topics-ven-resources openapi-client ven-id)Get MQTT topic names for resources of a VEN.
Get MQTT topic names for resources of a VEN.
(get-notifiers openapi-client)List all notifiers.
List all notifiers.
(get-program-by-id openapi-client program-id)Get a program by its ID.
Get a program by its ID.
(get-programs openapi-client)Search all programs.
Search all programs.
(get-report-by-id openapi-client report-id)Get a report by its ID.
Get a report by its ID.
(get-reports openapi-client)Search all reports.
Search all reports.
(get-resource-by-id openapi-client resource-id)Get a resource by its ID.
Get a resource by its ID.
(get-subscription-by-id openapi-client subscription-id)Get a subscription by its ID.
Get a subscription by its ID.
(get-subscriptions openapi-client)Search all subscriptions.
Search all subscriptions.
(get-token openapi-client client-id client-secret)Fetch an OAuth2 token using client credentials.
Fetch an OAuth2 token using client credentials.
(get-unauthenticated-routes martian)Returns vector of route-names that require no authentication.
Returns vector of route-names that require no authentication.
(get-ven-by-id openapi-client ven-id)Get a VEN by its ID.
Get a VEN by its ID.
(hash-map-by f coll)Like group-by, but the mapping must be unique. Throws on duplicate keys.
Like group-by, but the mapping must be unique. Throws on duplicate keys.
(inject-http-client http-client)Martian interceptor that injects a shared HttpClient into every request.
Martian interceptor that injects a shared HttpClient into every request.
(program client program-id)Fetch and coerce a program by ID. Returns a Program entity.
Fetch and coerce a program by ID. Returns a Program entity.
(programs client)Fetch and coerce all programs. Returns a vector of Program entities.
Fetch and coerce all programs. Returns a vector of Program entities.
(read-openapi-spec filename)(read-openapi-spec filename interceptors)(read-openapi-spec filename interceptors url)(read-openapi-spec filename interceptors url http-client)Bootstrap a Martian client from an OpenAPI spec file. Returns a Martian instance with optional interceptors and API root URL. When http-client is provided, prepends an interceptor to inject it into every request, avoiding per-request HttpClient creation.
Bootstrap a Martian client from an OpenAPI spec file. Returns a Martian instance with optional interceptors and API root URL. When http-client is provided, prepends an interceptor to inject it into every request, avoiding per-request HttpClient creation.
(report client report-id)Fetch and coerce a report by ID. Returns a Report entity.
Fetch and coerce a report by ID. Returns a Report entity.
(reports client)Fetch and coerce all reports. Returns a vector of Report entities.
Fetch and coerce all reports. Returns a vector of Report entities.
Martian hato default interceptors with safe response coercion for error responses.
Martian hato default interceptors with safe response coercion for error responses.
(scopes client)Returns set of OpenADR client scopes.
Returns set of OpenADR client scopes.
(search-events openapi-client query-params)Search events with query parameters.
Search events with query parameters.
(search-programs openapi-client query-params)Search programs with query parameters (targets, skip, limit).
Search programs with query parameters (targets, skip, limit).
(search-reports openapi-client query-params)Search reports with query parameters.
Search reports with query parameters.
(search-subscriptions openapi-client query-params)Search subscriptions with query parameters.
Search subscriptions with query parameters.
(search-ven-resources openapi-client query-params)Search VEN resources with query parameters.
Search VEN resources with query parameters.
(search-vens openapi-client query-params)Search VENs with query parameters (targetType, targetValues, skip, limit, venName).
Search VENs with query parameters (targetType, targetValues, skip, limit, venName).
(spec-path)(spec-path version)Resolve a spec version string to a classpath resource name. Returns the resource name string (not a filesystem path) so that martian.file/local-resource can find it via clojure.java.io/resource. Throws if the version is unknown or the resource is not found.
Resolve a spec version string to a classpath resource name. Returns the resource name string (not a filesystem path) so that martian.file/local-resource can find it via clojure.java.io/resource. Throws if the version is unknown or the resource is not found.
Map of OA3 spec version string to classpath resource path.
Map of OA3 spec version string to classpath resource path.
(subscription client subscription-id)Fetch and coerce a subscription by ID. Returns a Subscription entity.
Fetch and coerce a subscription by ID. Returns a Subscription entity.
(subscriptions client)Fetch and coerce all subscriptions. Returns a vector of Subscription entities.
Fetch and coerce all subscriptions. Returns a vector of Subscription entities.
(success? response)True if the HTTP response has a 2xx status code.
True if the HTTP response has a 2xx status code.
(turn-off-exception-throwing)Martian interceptor that prevents Hato from throwing on non-2xx responses.
Martian interceptor that prevents Hato from throwing on non-2xx responses.
(update-event openapi-client event-id event-request-body)Update an existing event.
Update an existing event.
(update-program openapi-client program-id program-request-body)Update an existing program.
Update an existing program.
(update-report openapi-client report-id report-request-body)Update an existing report.
Update an existing report.
(update-resource openapi-client resource-id resource-request-body)Update an existing resource.
Update an existing resource.
(update-subscription openapi-client subscription-id subscription-request-body)Update an existing subscription.
Update an existing subscription.
(update-ven openapi-client ven-id ven-request-body)Update an existing VEN.
Update an existing VEN.
(ven client ven-id)Fetch and coerce a VEN by ID. Returns a Ven entity.
Fetch and coerce a VEN by ID. Returns a Ven entity.
(vens client)Fetch and coerce all VENs. Returns a vector of Ven entities.
Fetch and coerce all VENs. Returns a vector of Ven entities.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |