Skip to content

Commit

Permalink
Better support for the federation extension
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mohr committed Aug 28, 2024
1 parent 63f59d3 commit 2a14de7
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 1 deletion.
53 changes: 52 additions & 1 deletion openeo.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,12 @@ declare module OpenEO {
* @returns {Array.<Link>} Array of link objects (href, title, rel, type)
*/
links(): Array<Link>;
/**
* Returns list of backends in the federation.
*
* @returns {Array.<FederationBackend>} Array of backends
*/
listFederation(): Array<FederationBackend>;
/**
* Lists all supported features.
*
Expand Down Expand Up @@ -646,7 +652,7 @@ declare module OpenEO {
* @public
* @type {Array.<string>}
*/
public 'federation:missing': Array<string>;
public "federation:missing": Array<string>;
/**
* Returns the file types response as a JSON serializable representation of the data that is API compliant.
*
Expand Down Expand Up @@ -2635,6 +2641,10 @@ declare module OpenEO {
export type Collections = {
collections: Array<Collection>;
links: Array<Link>;
/**
* "federation:missing"] A list of backends from the federation that are missing in the response data.
*/
"federation:missing": Array<string>;
};
export type Collection = object<string, any>;
export type FileTypesAPI = {
Expand Down Expand Up @@ -2815,11 +2825,52 @@ declare module OpenEO {
* EXPERIMENTAL!
*/
namespaces: Array<string> | null;
/**
* "federation:missing"] A list of backends from the federation that are missing in the response data.
*/
"federation:missing": Array<string>;
};
/**
* An openEO processing chain.
*/
export type Process = object<string, any>;
/**
* An array of backends in the federation.
*/
export type FederationBackend = {
/**
* URL to the versioned API endpoint of the back-end.
*/
url: string;
/**
* Name of the back-end.
*/
title: string;
/**
* A description of the back-end and its specifics.
*/
description: string;
/**
* Current status of the back-ends (online or offline).
*/
status: string;
/**
* The time at which the status of the back-end was checked last, formatted as a RFC 3339 date-time.
*/
last_status_check: string;
/**
* If the `status` is `offline`: The time at which the back-end was checked and available the last time. Otherwise, this is equal to the property `last_status_check`. Formatted as a RFC 3339 date-time.
*/
last_successful_check: string;
/**
* Declares the back-end to be experimental.
*/
experimental: boolean;
/**
* Declares the back-end to be deprecated.
*/
deprecated: boolean;
};
/**
* An array, but enriched with additional details from an openEO API response.
*
Expand Down
9 changes: 9 additions & 0 deletions src/capabilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,15 @@ class Capabilities {
return Array.isArray(this.data.links) ? this.data.links : [];
}

/**
* Returns list of backends in the federation.
*
* @returns {Array.<FederationBackend>} Array of backends
*/
listFederation() {
return Array.isArray(this.data.federation) ? this.data.federation : [];
}

/**
* Lists all supported features.
*
Expand Down
17 changes: 17 additions & 0 deletions src/typedefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
* @type {object}
* @property {Array.<Collection>} collections
* @property {Array.<Link>} links
* @property {Array.<string>} ["federation:missing"] A list of backends from the federation that are missing in the response data.
*/

/**
Expand Down Expand Up @@ -184,6 +185,7 @@
* @property {Array.<Process>} processes
* @property {Array.<Link>} links
* @property {?Array.<string>} namespaces EXPERIMENTAL!
* @property {Array.<string>} ["federation:missing"] A list of backends from the federation that are missing in the response data.
*/

/**
Expand All @@ -193,6 +195,21 @@
* @type {object.<string, *>}
*/

/**
* An array of backends in the federation.
*
* @typedef FederationBackend
* @type {Object}

Check warning on line 202 in src/typedefs.js

View workflow job for this annotation

GitHub Actions / checks

Invalid JSDoc @type type "Object"; prefer: "object"

Check warning on line 202 in src/typedefs.js

View workflow job for this annotation

GitHub Actions / checks

Invalid JSDoc @type type "Object"; prefer: "object"
* @property {string} url URL to the versioned API endpoint of the back-end.
* @property {string} title Name of the back-end.
* @property {string} description A description of the back-end and its specifics.
* @property {string} status Current status of the back-ends (online or offline).
* @property {string} last_status_check The time at which the status of the back-end was checked last, formatted as a RFC 3339 date-time.
* @property {string} last_successful_check If the `status` is `offline`: The time at which the back-end was checked and available the last time. Otherwise, this is equal to the property `last_status_check`. Formatted as a RFC 3339 date-time.
* @property {boolean} experimental Declares the back-end to be experimental.
* @property {boolean} deprecated Declares the back-end to be deprecated.
*/

/**
* An array, but enriched with additional details from an openEO API response.
*
Expand Down

0 comments on commit 2a14de7

Please sign in to comment.