partial implementation of v3 api

This commit is contained in:
2024-12-21 08:18:26 +00:00
parent f77bed5979
commit 1c36cdb7d5
69 changed files with 1387 additions and 257 deletions
+8 -1
View File
@@ -85,4 +85,11 @@ tests/cases/user/axios-src/axios-src
tests/cases/user/prettier/prettier
.eslintcache
*v8.log
**/*.env
**/*.env
getmember.json
getMembers.ts
members.json
getMember.ts
getIncident.ts
+6
View File
@@ -1,6 +1,12 @@
# d4h-typescript
Typescript library for accessing D4H
## Documentation
Typedoc Generated Documentation available at:
```https://chewbaccalakis.github.io/d4h-typescript/modules.html```
## How to Consume
This library is not in NPM. As a result, you need to add it to your project locally. To do so, you have three options:
1. Add the repository to the consuming repository as a Git submodule.
+1 -1
View File
@@ -1 +1 @@
window.hierarchyData = "eJyrVirKzy8pVrKKjtVRKkpNy0lNLsnMzytWsqqurQUAmx4Kpg=="
window.hierarchyData = "eJyrVirKzy8pVrKKjtVRKkpNy0lNLsnMzwMKVNfWAgCbHgqm"
+1 -1
View File
@@ -1 +1 @@
window.navigationData = "eJyV019LwzAUBfDvcp+LYwNF+jp0CMpguifxIUvuXDD/SG7AMfzuY1ZdU0PSPZ9zfk1a+noAwk+CFuYxkNX3EpV42TuEBhyjHbSAJuowGcRXO9IKGviQRkB7+9X8OQK3LCo677liIWCY/ATpcjrrb3sPOe+lIfRbxjE5RMrMrm/yzNoJRljDulaJvNPo39Hw/dwaYpyy4rB0CRhGiaFELpAW3kYXlo6kNXlxWKqAT6g36CtgUhoF1o6Ytork6TJ55pSUpg+GS4Em/y1/wzHAygZCX2S6SgnrrpxFuqg+fiZGMf9O+4Wx0CPboKpq3606WfgR+4X/0NsRsoKY5w=="
window.navigationData = "eJyV1l1P2zAUBuD/kms0tA4Q4q5A+ZCK2FrQLtCETuNTatUfme0A1cR/n4fX1inOsbl+Xz9xbKfuw5/K4aurTqqz1jotLzgKdrdqsNqrGnALH6Bqpd3fib8snBS+s+SKVSfHb3sbh+EcWuG242sB1qLd/x90R34dxGOHjBm09lrN9XY8Vw7NHGpPRHmXGRwexYziEkRaeI+owdGLJoUoL2TuGwYOc1ho5ckblDM0UweutYQZ1yh0JIGL3gXfpCTxu+WNROXGugbHtUpTuy2KvEQXdsreNv+66Tf90MqQl0a3TU7slDLgtao586+UIXdqGTTs3PAFDMvNNVEtwosWIlEtwovYz4BlEy2c448WBJ/zcAQzcKpL8et9TnrrsAQgP6Td0mfAU62XEsyyCF6XSx5w+6LQkOp7o4SaaOsyVqiUYHfwREo+pxhyI0o2IJzN5PAQ5QeHz5sgQoGC5PZTTjpRnp9P0VlKV/M4ca+V3mhxbwwzTP8R+NDKk8Q9Hhco6PtCK+y9bTcpSRh/45nVSKJ5QlWvzrRyUKd/c3q6FN/5zUuinQZFTdDq1tTpFVuHNOC4QTZBsD1z6TRISoueefiAGjjFWitWuuC9beoRP9E7aHqPRZRTzPnB1ePpcDp6vJ+Mt84zGA4z4Zk47zrfBm+//gKy3ChR"
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+3 -1
View File
@@ -1,4 +1,6 @@
<!DOCTYPE html><html class="default" lang="en" data-base="."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>d4h-typescript</title><meta name="description" content="Documentation for d4h-typescript"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="assets/style.css"/><link rel="stylesheet" href="assets/highlight.css"/><script defer src="assets/main.js"></script><script async src="assets/icons.js" id="tsd-icons-script"></script><script async src="assets/search.js" id="tsd-search-script"></script><script async src="assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="index.html" class="title">d4h-typescript</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><h1>d4h-typescript</h1></div><div class="tsd-panel tsd-typography"><a id="d4h-typescript" class="tsd-anchor"></a><h1 class="tsd-anchor-link">d4h-typescript<a href="#d4h-typescript" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h1><p>Typescript library for accessing D4H</p>
<a id="documentation" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Documentation<a href="#documentation" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><p>Typedoc Generated Documentation available at:</p>
<p><code>https://chewbaccalakis.github.io/d4h-typescript/modules.html</code></p>
<a id="how-to-consume" class="tsd-anchor"></a><h2 class="tsd-anchor-link">How to Consume<a href="#how-to-consume" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><p>This library is not in NPM. As a result, you need to add it to your project locally. To do so, you have three options:</p>
<ol>
<li>Add the repository to the consuming repository as a Git submodule.</li>
@@ -25,4 +27,4 @@
</ul>
<p>Build simply builds the test project, while launch both builds and runs it. If you've made changes to lib, be sure to build there first.</p>
<p>Before launching, you should setup environment variables. <code>sample.env</code> shows you what variables are necessary. Copy the contents to a new file, <code>.env</code>, in the same folder and populate it appropriately.</p>
</div></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#d4h-typescript"><span>d4h-<wbr/>typescript</span></a><ul><li><a href="#how-to-consume"><span>How to <wbr/>Consume</span></a></li><li><a href="#structure"><span>Structure</span></a></li><li><ul><li><a href="#lib"><span>lib</span></a></li><li><a href="#test"><span>test</span></a></li></ul></li></ul></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="modules.html">d4h-typescript</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
</div></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#d4h-typescript"><span>d4h-<wbr/>typescript</span></a><ul><li><a href="#documentation"><span>Documentation</span></a></li><li><a href="#how-to-consume"><span>How to <wbr/>Consume</span></a></li><li><a href="#structure"><span>Structure</span></a></li><li><ul><li><a href="#lib"><span>lib</span></a></li><li><a href="#test"><span>test</span></a></li></ul></li></ul></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="modules.html">d4h-typescript</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -1,2 +1,2 @@
<!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>GetMemberOptions | d4h-typescript</title><meta name="description" content="Documentation for d4h-typescript"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">d4h-typescript</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">d4h-typescript</a></li><li><a href="GetMemberOptions.html">GetMemberOptions</a></li></ul><h1>Interface GetMemberOptions</h1></div><div class="tsd-signature"><span class="tsd-signature-keyword">interface</span> <span class="tsd-kind-interface">GetMemberOptions</span> <span class="tsd-signature-symbol">{</span><br/>    <a class="tsd-kind-property" href="GetMemberOptions.html#includedetails">includeDetails</a><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">;</span><br/><span class="tsd-signature-symbol">}</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/Chewbaccalakis/d4h-typescript/blob/dd48271f8ac271a5dd760588b1910d82af7b3a3d/lib/src/d4h.ts#L11">d4h.ts:11</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="GetMemberOptions.html#includedetails" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>include<wbr/>Details?</span></a>
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Properties"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Properties</h2></summary><section><section class="tsd-panel tsd-member"><a id="includedetails" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Optional</code><span>include<wbr/>Details</span><a href="#includedetails" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">includeDetails</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/Chewbaccalakis/d4h-typescript/blob/dd48271f8ac271a5dd760588b1910d82af7b3a3d/lib/src/d4h.ts#L12">d4h.ts:12</a></li></ul></aside></section></section></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Properties"><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Properties</summary><div><a href="#includedetails" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>include<wbr/>Details</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">d4h-typescript</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
<!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>GetMemberOptions | d4h-typescript</title><meta name="description" content="Documentation for d4h-typescript"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">d4h-typescript</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">d4h-typescript</a></li><li><a href="GetMemberOptions.html">GetMemberOptions</a></li></ul><h1>Interface GetMemberOptions</h1></div><div class="tsd-signature"><span class="tsd-signature-keyword">interface</span> <span class="tsd-kind-interface">GetMemberOptions</span> <span class="tsd-signature-symbol">{</span><br/>    <a class="tsd-kind-property" href="GetMemberOptions.html#includedetails">includeDetails</a><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">;</span><br/><span class="tsd-signature-symbol">}</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/Chewbaccalakis/d4h-typescript/blob/7ff771b118bdf7a4176edc8460dc3f886515660f/lib/src/d4h.ts#L19">d4h.ts:19</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="GetMemberOptions.html#includedetails" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>include<wbr/>Details?</span></a>
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Properties"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Properties</h2></summary><section><section class="tsd-panel tsd-member"><a id="includedetails" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Optional</code><span>include<wbr/>Details</span><a href="#includedetails" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">includeDetails</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/Chewbaccalakis/d4h-typescript/blob/7ff771b118bdf7a4176edc8460dc3f886515660f/lib/src/d4h.ts#L20">d4h.ts:20</a></li></ul></aside></section></section></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Properties"><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Properties</summary><div><a href="#includedetails" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>include<wbr/>Details</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">d4h-typescript</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+8 -5
View File
@@ -1,9 +1,12 @@
import D4H from './src/d4h'
export default D4H
export * from './src/customField'
export * from './src/types/customField'
export * from './src/d4h'
export * from './src/emergencyContacts'
export * from './src/group'
export * from './src/member'
export * from './src/events'
export * from './src/types/group'
export * from './src/types/member'
export * from './src/types/qualification'
export * from './src/types/incident'
export * from './src/types/animal'
export * from './src/types/events'
+71
View File
@@ -0,0 +1,71 @@
import D4HRequest from '../d4hRequest'
import { EntityType } from '../entity'
import type { Animal } from '../types/animal'
import { GetAnimalsOptions, D4H_BASE_URL } from '../d4h'
export class animalsApi {
static async getAnimal(request: D4HRequest, context: string, contextId: number, animalId: number | 'me'): Promise<Animal> {
const url = new URL(`${D4H_BASE_URL}/${context}/${contextId}/animals/${animalId}`)
const animal = await request.getAsync<Animal>(url)
if (!animal) {
throw new Error('Animal data not found or improperly formatted.')
}
animal.entityType = EntityType.Animal
return animal
}
static async getAnimals(request: D4HRequest, context: string, contextId: number, options?: GetAnimalsOptions): Promise<Animal[]> {
const url = new URL(`${D4H_BASE_URL}/${context}/${contextId}/animals`)
if (options !== undefined) {
const optionsList = url.searchParams
if (options.handler_member_id !== undefined) {
optionsList.append('handler_member_id', options.handler_member_id.toString())
}
if (options.id !== undefined) {
optionsList.append('id', options.id.toString())
}
if (options.order !== undefined) {
optionsList.append('order', options.order)
}
if (options.page !== undefined) {
optionsList.append('page', options.page.toString())
}
if (options.size !== undefined) {
optionsList.append('size', options.size.toString())
}
if (options.sort !== undefined) {
if (Array.isArray(options.sort)) {
options.sort.forEach(sortField => optionsList.append('sort', sortField))
} else {
optionsList.append('sort', options.sort)
}
}
if (options.status !== undefined) {
optionsList.append('status', options.status)
}
if (options.team_id !== undefined) {
optionsList.append('team_id', options.team_id.toString())
}
}
const animals = await request.getManyAsync<Animal>(url)
animals.forEach(m => m.entityType = EntityType.Animal)
return animals
}
}
+74
View File
@@ -0,0 +1,74 @@
import D4HRequest from '../d4hRequest'
import { EntityType } from '../entity'
import type { memberGroup } from '../types/group'
import { GetMemberGroupsOptions, D4H_BASE_URL } from '../d4h'
export class groupsApi {
static async getMemberGroup(
request: D4HRequest,
context: string,
contextId: number,
groupId: number,
): Promise<memberGroup> {
const url = new URL(`${D4H_BASE_URL}/${context}/${contextId}/member-groups/${groupId}`)
const group = await request.getAsync<memberGroup>(url)
if (!group) {
throw new Error('Group data not found or improperly formatted.')
}
group.entityType = EntityType.memberGroup
return group
}
static async getMemberGroups(
request: D4HRequest,
context: string,
contextId: number,
options?: GetMemberGroupsOptions
): Promise<memberGroup[]> {
const url = new URL(`${D4H_BASE_URL}/${context}/${contextId}/member-groups`)
if (options !== undefined) {
const optionsList = url.searchParams
if (options.id !== undefined) {
optionsList.append('id_tag', options.id.toString())
}
if (options.order !== undefined) {
optionsList.append('order', options.order)
}
if (options.page !== undefined) {
optionsList.append('page', options.page.toString())
}
if (options.size !== undefined) {
optionsList.append('size', options.size.toString())
}
if (options.sort !== undefined) {
if (Array.isArray(options.sort)) {
options.sort.forEach((sortField) => optionsList.append('sort', sortField))
} else {
optionsList.append('sort', options.sort)
}
}
if (options.team_id !== undefined) {
optionsList.append('team_id', options.team_id.toString())
}
if (options.title !== undefined) {
optionsList.append('title', options.title)
}
}
const groups = await request.getManyAsync<memberGroup>(url)
groups.forEach((m) => (m.entityType = EntityType.memberGroup))
return groups
}
}
+97
View File
@@ -0,0 +1,97 @@
import D4HRequest from '../d4hRequest'
import { EntityType } from '../entity'
import type { Member } from '../types/member'
import { GetMemberOptions, GetMembersOptions, D4H_BASE_URL } from '../d4h'
export class membersApi {
static async getMember(
request: D4HRequest,
context: string,
contextId: number,
id: number | 'me',
options?: GetMemberOptions
): Promise<Member> {
const url = new URL(`${D4H_BASE_URL}/${context}/${contextId}/members/${id}`)
if (options !== undefined) {
const optionsList = url.searchParams
if (options.includeDetails !== undefined) {
optionsList.append('include_details', 'true')
}
}
const member = await request.getAsync<Member>(url)
if (!member) {
throw new Error('Member data not found or improperly formatted.')
}
member.entityType = EntityType.Member
return member
}
static async getMembers(
request: D4HRequest,
context: string,
contextId: number,
options?: GetMembersOptions
): Promise<Member[]> {
const url = new URL(`${D4H_BASE_URL}/${context}/${contextId}/members`)
if (options !== undefined) {
const optionsList = url.searchParams
if (options.deleted !== undefined) {
optionsList.append('deleted', options.deleted.toString())
}
if (options.id_tag !== undefined) {
optionsList.append('id_tag', options.id_tag)
}
if (options.name !== undefined) {
optionsList.append('name', options.name)
}
if (options.order !== undefined) {
optionsList.append('order', options.order)
}
if (options.page !== undefined) {
optionsList.append('page', options.page.toString())
}
if (options.size !== undefined) {
optionsList.append('size', options.size.toString())
}
if (options.sort !== undefined) {
if (Array.isArray(options.sort)) {
options.sort.forEach((sortField) => optionsList.append('sort', sortField))
} else {
optionsList.append('sort', options.sort)
}
}
if (options.statuses !== undefined) {
options.statuses.forEach((status) => {
if (status !== null) {
optionsList.append('statuses', status.toString())
} else {
optionsList.append('statuses', 'null')
}
})
}
if (options.team_id !== undefined) {
optionsList.append('team_id', options.team_id.toString())
}
}
const members = await request.getManyAsync<Member>(url)
members.forEach((m) => (m.entityType = EntityType.Member))
return members
}
}
+213
View File
@@ -0,0 +1,213 @@
import D4HRequest from '../d4hRequest'
import { EntityType } from '../entity'
import type { Qualification, MemberAwards } from '../types/qualification'
import { D4H_BASE_URL, GetQualificationOptions, GetMemberAwardsOptions } from '../d4h'
export class qualificationsApi {
static async getMemberQualification(request: D4HRequest, context: string, contextId: number, qualificationId: number | 'me'): Promise<Qualification> {
const url = new URL(`${D4H_BASE_URL}/${context}/${contextId}/member-qualifications/${qualificationId}`)
const qualification = await request.getAsync<Qualification>(url)
if (!qualification) {
throw new Error('Qualification data not found or improperly formatted.')
}
qualification.entityType = EntityType.Incident
return qualification
}
static async getMemberQualifications(request: D4HRequest, context: string, contextId: number, options?: GetQualificationOptions): Promise<Qualification[]> {
const url = new URL(`${D4H_BASE_URL}/${context}/${contextId}/member-qualifications`)
if (options !== undefined) {
const optionsList = url.searchParams
if (options.exclude_org_data !== undefined) {
optionsList.append('exclude_org_data', options.exclude_org_data.toString())
}
if (options.exclude_teams_data !== undefined) {
optionsList.append('exclude_teams_data', options.exclude_teams_data.toString())
}
if (options.order !== undefined) {
optionsList.append('order', options.order)
}
if (options.page !== undefined) {
optionsList.append('page', options.page.toString())
}
if (options.size !== undefined) {
optionsList.append('size', options.size.toString())
}
if (options.sort !== undefined) {
if (Array.isArray(options.sort)) {
options.sort.forEach(sortField => optionsList.append('sort', sortField))
} else {
optionsList.append('sort', options.sort)
}
}
if (options.title !== undefined) {
optionsList.append('title', options.title)
}
}
return request.getManyAsync(url)
}
static async getAnimalQualification(request: D4HRequest, context: string, contextId: number, qualificationId: number): Promise<Qualification> {
const url = new URL(`${D4H_BASE_URL}/${context}/${contextId}/animal-qualifications/${qualificationId}`)
const qualification = await request.getAsync<Qualification>(url)
if (!qualification) {
throw new Error('Qualification data not found or improperly formatted.')
}
qualification.entityType = EntityType.Qualification
return qualification
}
static async getAnimalQualifications(request: D4HRequest, context: string, contextId: number, options?: GetQualificationOptions): Promise<Qualification[]> {
const url = new URL(`${D4H_BASE_URL}/${context}/${contextId}/animal-qualifications`)
if (options !== undefined) {
const optionsList = url.searchParams
if (options.exclude_org_data !== undefined) {
optionsList.append('exclude_org_data', options.exclude_org_data.toString())
}
if (options.exclude_teams_data !== undefined) {
optionsList.append('exclude_teams_data', options.exclude_teams_data.toString())
}
if (options.order !== undefined) {
optionsList.append('order', options.order)
}
if (options.page !== undefined) {
optionsList.append('page', options.page.toString())
}
if (options.size !== undefined) {
optionsList.append('size', options.size.toString())
}
if (options.sort !== undefined) {
if (Array.isArray(options.sort)) {
options.sort.forEach(sortField => optionsList.append('sort', sortField))
} else {
optionsList.append('sort', options.sort)
}
}
if (options.title !== undefined) {
optionsList.append('title', options.title)
}
}
return request.getManyAsync(url)
}
static async getHandlerQualification(request: D4HRequest, context: string, contextId: number, qualificationId: number): Promise<Qualification> {
const url = new URL(`${D4H_BASE_URL}/${context}/${contextId}/handler-qualifications/${qualificationId}`)
const qualification = await request.getAsync<Qualification>(url)
if (!qualification) {
throw new Error('Qualification data not found or improperly formatted.')
}
qualification.entityType = EntityType.Qualification
return qualification
}
static async getHandlerQualifications(request: D4HRequest, context: string, contextId: number, options?: GetQualificationOptions): Promise<Qualification[]> {
const url = new URL(`${D4H_BASE_URL}/${context}/${contextId}/handler-qualifications`)
if (options !== undefined) {
const optionsList = url.searchParams
if (options.exclude_org_data !== undefined) {
optionsList.append('exclude_org_data', options.exclude_org_data.toString())
}
if (options.exclude_teams_data !== undefined) {
optionsList.append('exclude_teams_data', options.exclude_teams_data.toString())
}
if (options.order !== undefined) {
optionsList.append('order', options.order)
}
if (options.page !== undefined) {
optionsList.append('page', options.page.toString())
}
if (options.size !== undefined) {
optionsList.append('size', options.size.toString())
}
if (options.sort !== undefined) {
if (Array.isArray(options.sort)) {
options.sort.forEach(sortField => optionsList.append('sort', sortField))
} else {
optionsList.append('sort', options.sort)
}
}
if (options.title !== undefined) {
optionsList.append('title', options.title)
}
}
return request.getManyAsync(url)
}
static async getMemberAwards(request: D4HRequest, context: string, contextId: number, options?: GetMemberAwardsOptions): Promise<MemberAwards[]> {
const url = new URL(`${D4H_BASE_URL}/${context}/${contextId}/member-qualification-awards`)
if (options !== undefined) {
const optionsList = url.searchParams
if (options.exclude_org_data !== undefined) {
optionsList.append('exclude_org_data', options.exclude_org_data.toString())
}
if (options.exclude_teams_data !== undefined) {
optionsList.append('exclude_teams_data', options.exclude_teams_data.toString())
}
if (options.member_id !== undefined) {
optionsList.append('member_id', options.member_id.toString())
}
if (options.order !== undefined) {
optionsList.append('order', options.order)
}
if (options.page !== undefined) {
optionsList.append('page', options.page.toString())
}
if (options.qualification_id !== undefined) {
optionsList.append('qualification_id', options.qualification_id.toString())
}
if (options.size !== undefined) {
optionsList.append('size', options.size.toString())
}
if (options.sort !== undefined) {
if (Array.isArray(options.sort)) {
options.sort.forEach(sortField => optionsList.append('sort', sortField))
} else {
optionsList.append('sort', options.sort)
}
}
}
const awards = await request.getManyAsync<MemberAwards>(url)
awards.forEach((m) => (m.entityType = EntityType.Award))
return awards
}
}
+262 -69
View File
@@ -1,21 +1,46 @@
import { CustomFieldUpdate } from './customField'
import { CustomFieldUpdate } from './types/customField'
import D4HRequest from './d4hRequest'
import { EmergencyContacts } from './emergencyContacts'
import { Entity, EntityType } from './entity'
import type { Group } from './group'
import type { Member, MemberUpdate } from './member'
import type { memberGroup } from './types/group'
import type { Member, MemberUpdate } from './types/member'
import type { Qualification, MemberAwards } from './types/qualification'
import type { Incident } from './types/incident'
import type { Animal } from './types/animal'
import { membersApi } from './api/membersApi'
import { animalsApi } from './api/animalsApi'
import { qualificationsApi } from './api/qualificationsApi'
import { groupsApi } from './api/groupsApi'
const D4H_FETCH_LIMIT = 250
const D4H_BASE_URL = 'https://api.d4h.org/v2'
const D4H_BASE_URL = 'https://api.team-manager.us.d4h.com/v3' // Multiple API endpoints now, probably should handle multiple
export { D4H_BASE_URL }
export interface GetMemberOptions {
includeDetails?: boolean;
}
export interface GetMembersOptions {
groupId?: number;
includeCustomFields?: boolean;
includeDetails?: boolean;
deleted?: boolean; // default: false
id_tag?: string;
name?: string;
order?: 'asc' | 'desc'; // default: 'asc'
page?: number;
size?: number;
sort?: string | string[]; // default: 'id'
statuses?: (number | null)[]; // list of ids or null
team_id?: number; // the numeric identifier for a team resource
}
export interface GetAnimalsOptions {
handler_member_id?: number | number[];
id?: number | number[];
order?: 'asc' | 'desc'; // default: 'asc'
page?: number;
size?: number;
sort?: string | string[]; // default: 'id'
status?: string; // list of ids or null
team_id?: number; // the numeric identifier for a team resource
}
export interface GetGroupsOptions {
@@ -23,6 +48,55 @@ export interface GetGroupsOptions {
title?: string;
}
export interface GetIncidentOptions {
after?: string;
before?: string;
deleted?: boolean; // default: 'false'
ends_before?: string;
id?: number | number[];
order?: 'asc' | 'desc'; // default: 'asc'
page?: number;
published?: boolean;
reference?: string;
size?: number;
sort?: string | string[]; // default: 'id'
starts_after?: string;
tag_bundle_id?: number;
tag_id?: number;
team_id?: number;
}
export interface GetQualificationOptions {
exclude_org_data?: boolean; // default: false
exclude_teams_data?: boolean; // default: false
order?: 'asc' | 'desc'; // default: 'asc'
page?: number;
size?: number;
sort?: string | string[]; // default: 'id'
title?: string;
}
export interface GetMemberAwardsOptions {
exclude_org_data?: boolean; // default: false
exclude_teams_data?: boolean; // default: false
member_id?: number | 'me';
order?: 'asc' | 'desc'; // default: 'asc'
page?: number;
qualification_id?: number;
size?: number;
sort?: string | string[]; // default: 'id'
}
export interface GetMemberGroupsOptions {
id: number;
order?: 'asc' | 'desc'; // default: 'asc'
page?: number;
size?: number;
sort?: string | string[]; // default: 'id'
team_id?: number | number[];
title?: string;
}
export default class D4H {
private readonly _request: D4HRequest
@@ -34,110 +108,229 @@ export default class D4H {
/**************** MEMBERS *******************/
/********************************************/
async getMemberAsync(id: number, options?: GetMemberOptions): Promise<Member> {
const url = new URL(`${D4H_BASE_URL}/team/members/${id}`)
if (options !== undefined) {
const optionsList = url.searchParams
if (options.includeDetails !== undefined) {
optionsList.append('include_details', 'true')
}
}
const member = await this._request.getAsync<Member>(url)
member.type = EntityType.Member
return member
async getMember(
context: string,
contextId: number,
id: number | 'me',
options?: GetMemberOptions
): Promise<Member> {
return membersApi.getMember(this._request, context, contextId, id, options)
}
async getMembersAsync(options?: GetMembersOptions): Promise<Member[]> {
const url = new URL(`${D4H_BASE_URL}/team/members`)
if (options !== undefined) {
const optionsList = url.searchParams
if (options.groupId !== undefined) {
optionsList.append('group_id', options.groupId.toString())
}
if (options.includeDetails !== undefined) {
optionsList.append('include_details', 'true')
}
if (options.includeCustomFields !== undefined) {
optionsList.append('include_custom_fields', 'true')
}
}
const members = await this._request.getManyAsync<Member>(url)
members.forEach(m => m.type = EntityType.Member)
return members
async getMembers(
context: string,
contextId: number,
options?: GetMembersOptions
): Promise<Member[]> {
return membersApi.getMembers(this._request, context, contextId, options)
}
updateMemberAsync(id: number, updates: MemberUpdate): Promise<void> {
updateMember(context: string, contextId: number, id: number, updates: MemberUpdate): Promise<void> {
// If no updates, no need to actually make a request. Exit early.
if (Object.getOwnPropertyNames(updates).length === 0) {
return Promise.resolve()
}
const url = new URL(`${D4H_BASE_URL}/team/members/${id}`)
const url = new URL(`${D4H_BASE_URL}/${context}/${contextId}/members/${id}`)
return this._request.putAsync(url, updates)
}
/********************************************/
/**************** ANIMALS *******************/
/********************************************/
async getAnimal(
context: string,
contextId: number,
id: number | 'me',
): Promise<Animal> {
return animalsApi.getAnimal(this._request, context, contextId, id)
}
async getAnimals(
context: string,
contextId: number,
options?: GetAnimalsOptions
): Promise<Animal[]> {
return animalsApi.getAnimals(this._request, context, contextId, options)
}
/********************************************/
/*********** EMERGENCY CONTACTS *************/
/********************************************/
getEmergencyContacts(memberId: number): Promise<EmergencyContacts> {
const url = new URL(`${D4H_BASE_URL}/team/members/${memberId}/emergency`)
return this._request.getAsync(url)
}
updateEmergencyContacts(memberId: number, emergencyContacts: EmergencyContacts): Promise<EmergencyContacts> {
const url = new URL(`${D4H_BASE_URL}/team/members/${memberId}/emergency`)
return this._request.putAsync(url, emergencyContacts)
}
// Emergency Contacts no longer have specific endpoint
/********************************************/
/***************** GROUPS *******************/
/********************************************/
getGroupAsync(id: number): Promise<Group> {
const url = new URL(`${D4H_BASE_URL}/team/groups/${id}`)
return this._request.getAsync<Group>(url)
async getMemberGroup(
context: string,
contextId: number,
groupId: number,
): Promise<memberGroup> {
return groupsApi.getMemberGroup(this._request, context, contextId, groupId)
}
getGroupsAsync(options?: GetGroupsOptions): Promise<Group[]> {
const url = new URL(`${D4H_BASE_URL}/team/groups`)
async getMemberGroups(
context: string,
contextId: number,
options?: GetMemberGroupsOptions
): Promise<memberGroup[]> {
return groupsApi.getMemberGroups(this._request, context, contextId, options)
}
/********************************************/
/**************** INCIDENTS *****************/
/********************************************/
async getIncident(context: string, contextId: number, activityId: number): Promise<Incident> {
const url = new URL(`${D4H_BASE_URL}/${context}/${contextId}/incidents/${activityId}`)
const incident = await this._request.getAsync<Incident>(url)
if (!incident) {
throw new Error('Incident data not found or improperly formatted.')
}
incident.entityType = EntityType.Incident
return incident
}
async getIncidents(context: string, contextId: number, options?: GetIncidentOptions): Promise<Incident[]> {
const url = new URL(`${D4H_BASE_URL}/${context}/${contextId}/incidents`)
if (options !== undefined) {
const optionsList = url.searchParams
if (options.memberId !== undefined) {
optionsList.append('member_id', options.memberId.toString())
if (options.after !== undefined) {
optionsList.append('after', options.after)
}
if (options.title !== undefined) {
optionsList.append('title', options.title)
if (options.before !== undefined) {
optionsList.append('before', options.before)
}
if (options.deleted !== undefined) {
optionsList.append('order', options.deleted.toString())
}
if (options.ends_before !== undefined) {
optionsList.append('ends_before', options.ends_before)
}
if (options.id !== undefined) {
optionsList.append('id', options.id.toString())
}
if (options.order !== undefined) {
optionsList.append('order', options.order)
}
if (options.page !== undefined) {
optionsList.append('page', options.page.toString())
}
if (options.published !== undefined) {
optionsList.append('published', options.published.toString())
}
if (options.reference !== undefined) {
optionsList.append('reference', options.reference)
}
if (options.size !== undefined) {
optionsList.append('size', options.size.toString())
}
if (options.sort !== undefined) {
if (Array.isArray(options.sort)) {
options.sort.forEach(sortField => optionsList.append('sort', sortField))
} else {
optionsList.append('sort', options.sort)
}
}
if (options.starts_after !== undefined) {
optionsList.append('starts_after', options.starts_after)
}
if (options.tag_bundle_id !== undefined) {
optionsList.append('tag_bundle_id', options.tag_bundle_id.toString())
}
if (options.tag_id !== undefined) {
optionsList.append('tag_id', options.tag_id.toString())
}
if (options.team_id !== undefined) {
optionsList.append('team_id', options.team_id.toString())
}
}
return this._request.getManyAsync(url)
}
/********************************************/
/************* QUALIFICATIONS ***************/
/********************************************/
async getMemberQualification(
context: string,
contextId: number,
id: number | 'me',
): Promise<Qualification> {
return qualificationsApi.getMemberQualification(this._request, context, contextId, id)
}
async getMemberQualifications(
context: string,
contextId: number,
options?: GetQualificationOptions
): Promise<Qualification[]> {
return qualificationsApi.getMemberQualifications(this._request, context, contextId, options)
}
async getAnimalQualification(
context: string,
contextId: number,
id: number,
): Promise<Qualification> {
return qualificationsApi.getAnimalQualification(this._request, context, contextId, id)
}
async getAnimalQualifications(
context: string,
contextId: number,
options?: GetQualificationOptions
): Promise<Qualification[]> {
return qualificationsApi.getAnimalQualifications(this._request, context, contextId, options)
}
async getHandlerQualification(
context: string,
contextId: number,
id: number,
): Promise<Qualification> {
return qualificationsApi.getHandlerQualification(this._request, context, contextId, id)
}
async getHandlerQualifications(
context: string,
contextId: number,
options?: GetQualificationOptions
): Promise<Qualification[]> {
return qualificationsApi.getHandlerQualifications(this._request, context, contextId, options)
}
async getMemberAwards(
context: string,
contextId: number,
options?: GetMemberAwardsOptions
): Promise<MemberAwards[]> {
return qualificationsApi.getMemberAwards(this._request, context, contextId, options)
}
/********************************************/
/************** CUSTOM FIELDS ***************/
/********************************************/
updateCustomFields(entity: Entity, updates: CustomFieldUpdate[], onlyMemberEditOwn: boolean): Promise<void> {
// If no updates, no need to actually make a request. Exit early.
if (updates.length === 0) {
return Promise.resolve()
}
const url = new URL(`${D4H_BASE_URL}/team/custom-fields/${entity.type}/${entity.id}`)
const url = new URL(`${D4H_BASE_URL}/team/custom-fields/${entity.entityType}/${entity.id}`)
// From the documentation:
// https://api.d4h.org/v2/documentation#operation/putTeamCustomfieldsEntity_typeEntity_id
@@ -187,4 +380,4 @@ export default class D4H {
return this._request.putAsync(url, { fields: updates })
}
}
}
+30 -24
View File
@@ -1,12 +1,12 @@
interface D4HResponse<DataType> {
statusCode: number
data: DataType
status: number
data?: DataType
}
interface D4HError {
error: string
message: string
statusCode: number
statusText: string
status: number
}
enum HttpMethod {
@@ -46,39 +46,45 @@ export default class D4HRequest {
const rawResponse = await fetch(url.toString(), options)
const response = await rawResponse.json() as D4HResponse<TResponse> & D4HError
if (response.statusCode !== 200) {
const d4hError = response as D4HError
throw new Error(`${d4hError.statusCode}: ${d4hError.error}: ${d4hError.message}`)
if (rawResponse.status !== 200) { // error handling may need to be updated
console.log(rawResponse)
throw new Error(`${rawResponse.status} : ${rawResponse.statusText}`)
}
return response.data
return response as TResponse
}
async getAsync<DataType>(url: URL): Promise<DataType> {
return this.requestAsync<never, DataType>(url, HttpMethod.Get)
}
async getManyAsync<DataType>(url: URL): Promise<DataType[]> {
async getManyAsync<DataType>(url: URL, paginate: boolean = false): Promise<DataType[]> {
let results: DataType[] = []
let offset = 0
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, no-constant-condition
while (true) {
const urlWithOffset = new URL(url)
urlWithOffset.searchParams.append('offset', offset.toString())
urlWithOffset.searchParams.append('limit', this._fetchLimit.toString())
const newResults = await this.getAsync<DataType[]>(urlWithOffset)
results = results.concat(newResults)
offset += this._fetchLimit
if (newResults.length < this._fetchLimit) {
break
if (paginate) {
let offset = 0
// Pagination loop
while (true) {
const urlWithOffset = new URL(url)
urlWithOffset.searchParams.append('offset', offset.toString())
urlWithOffset.searchParams.append('limit', this._fetchLimit.toString())
const newResults = await this.getAsync<DataType[]>(urlWithOffset)
results = results.concat(newResults)
offset += this._fetchLimit
if (newResults.length < this._fetchLimit) {
break
}
}
} else {
// Fetch without pagination
const newResults = await this.getAsync<DataType[]>(url)
results = results.concat(newResults)
}
return results
}
+7 -2
View File
@@ -1,9 +1,9 @@
import { CustomField } from './customField'
import { CustomField } from './types/customField'
export interface Entity {
custom_fields?: CustomField[];
id: number;
type: EntityType;
entityType: EntityType;
}
// EntityType must be one of:
@@ -13,4 +13,9 @@ export interface Entity {
// Only the ones actively in use are implemented.
export enum EntityType {
Member = 'member',
memberGroup = 'membergroup',
Incident = 'incident',
Qualification = 'qualification',
Award = 'award',
Animal = 'animal'
}
-5
View File
@@ -1,5 +0,0 @@
export interface Group {
bundle: string
id: number
title: string
}
-62
View File
@@ -1,62 +0,0 @@
import { EmergencyContact } from './emergencyContacts'
import { Entity } from './entity'
export interface MemberStatus {
id: number
type: string
value: string
label: MemberStatusLabel | null
}
export interface MemberStatusLabel {
id: number
value: string
}
export interface Member extends Entity {
address: string
email: string | null
emergency_contacts: EmergencyContact[]
group_ids: number[] | null
homephone: string
joined_at: string
mobilephone: string
name: string
notes: string | null
position: string
ref: string
status: MemberStatus
workphone: string
}
export interface MemberUpdate {
name?: string | null
ref?: string | null
id_tag?: string | null
status_id?: number
status_custom_id?: number
retired_reason_id?: number
date_leave?: Date
date_join?: Date
position?: string | null
role_id?: number
cost_per_hour?: number
cost_per_use?: number
address_street?: string | null
address_city?: string | null
address_region?: string | null
address_postcode?: string | null
address_country?: string | null
lat?: number
lng?: number
gridref?: string | null
location_bookmark_id?: number
email?: string | null
phone_mobile?: string | null
phone_home?: string | null
phone_work?: string | null
pager?: string | null
pager_email?: string | null
address?: string | null
notes?: string | null
}
+18
View File
@@ -0,0 +1,18 @@
import { Entity } from '../entity'
export interface Animal extends Entity {
id: number;
name: string;
breed: string;
type: string;
countRollingHours: number;
ref: string;
notes: string;
status: string;
resourceType: string;
bornAt: string;
joinedAt: string;
leftAt: string | null;
createdAt: string;
updatedAt: string;
}
@@ -1,14 +1,3 @@
export interface Incident {
id: number,
ref_desc: string,
date: string,
enddate?: string,
description?: string,
lat?: number,
lng?: number,
tags?: string[],
}
export interface IncidentRoster {
id: number,
status: string,
+11
View File
@@ -0,0 +1,11 @@
import { Entity } from '../entity'
export interface memberGroup extends Entity{
id: number;
title: string;
deprecatedBundle: string;
membershipResourceType: string;
resourceType: string;
createdAt: string;
updatedAt: string;
}
+72
View File
@@ -0,0 +1,72 @@
import { Entity } from '../entity'
export interface IncidentOwner {
resourceType: string;
id: number;
}
export interface IncidentLocation {
type: string;
coordinates: [number, number];
}
export interface WeatherInfo {
symbol: string | null;
symbolDate: string | null;
temperature: number | null;
}
export interface AddressInfo {
postCode: string;
region: string;
street: string;
town: string;
country: string;
}
export interface IncidentLocationBookmark {
id: number | null;
resourceType: string;
}
export interface IncidentTag {
id: number;
resourceType: string;
}
export interface Incident extends Entity{
id: number;
owner: IncidentOwner;
resourceType: string;
reference: string;
referenceDescription: string;
bearing: number;
coordinator: string | null;
countAttendance: number;
countGuests: number;
createdAt: string;
createdOrPublishedAt: string;
description: string;
descriptionDeprecated: string;
distance: number;
night: boolean;
percAttendance: number;
plan: string | null;
planDeprecated: string | null;
published: boolean;
approved: boolean;
shared: boolean;
trackingNumber: string | null;
updatedAt: string;
startsAt: string;
endsAt: string;
weather: WeatherInfo;
weatherPressure: number | null;
weatherCloudCover: number | null;
address: AddressInfo;
location: IncidentLocation;
locationBookmark: IncidentLocationBookmark;
fullTeam: boolean;
selfCoordinator: boolean;
tags: IncidentTag[];
}
+156
View File
@@ -0,0 +1,156 @@
import { Entity } from '../entity'
export interface MemberStatus {
id: number
type: string
value: string
label: MemberStatusLabel | null
}
export interface MemberStatusLabel {
id: number
value: string
}
export interface CustomMemberStatus {
id: number | null
resourceType: string
}
export interface EquipmentLocation {
id: number | null
resourceType: string
}
export interface EmailInfo {
value: string
verified: boolean
}
export interface PhoneInfo {
phone: string
verified?: boolean
}
export interface PrimaryEmergencyContact {
name: string
primaryPhone: string
secondaryPhone: string
relation: string
}
export interface SecondaryEmergencyContact {
name: string
primaryPhone: string
secondaryPhone: string
relation: string
}
export interface RetiredReason {
id: number | null
resourceType: string
}
export interface Role {
id: number | null
resourceType: string
}
export interface MemberLocationBookmark {
id: number | null
resourceType: string
}
export interface Location {
type: string
coordinates: [number, number]
}
export interface Member extends Entity {
id: number
name: string
ref: string
status: string
position: string
createdAt: string
updatedAt: string
startsAt: string | null
endsAt: string | null
lastLogin: string | null
weeklyDayOfWeek: number
weeklyDayOfWeekUtc: number
weeklyHourOfDay: number
weeklyHourOfDayUtc: number
email: EmailInfo
home: PhoneInfo
mobile: PhoneInfo
work: PhoneInfo
pager: PhoneInfo
notes: string | null
permission: number
credits: number
defaultDuty: string
defaultEquipmentLocation: EquipmentLocation
customStatus: CustomMemberStatus
location: Location
locationBookmark: MemberLocationBookmark
retiredReason: RetiredReason
role: Role
primaryEmergencyContact: PrimaryEmergencyContact
secondaryEmergencyContact: SecondaryEmergencyContact
alertActivityApproval: boolean
alertAllQualifications: boolean
alertGear: boolean
alertQualifications: boolean
chatAutosubscribe: boolean
chatDailyDigest: boolean
contactUpdateMail: boolean
weeklyMail: boolean
deprecatedAddress: string | null
icalSecret: string | null
costPerHour: number | null
costPerUse: number | null
countReportingEvent: number
countReportingExercise: number
countReportingHours: number
countReportingIncident: number
countRollingHours: number
countRollingHoursEvent: number
countRollingHoursExercise: number
countRollingHoursIncident: number
percReportingEvent: number
percReportingExercise: number
percReportingIncident: number
percRollingEvent: number
percRollingExercise: number
percRollingIncident: number
signedTandC: string | null
teamAgreementSigned: string | null
}
export interface MemberUpdate {
name?: string | null
ref?: string | null
id_tag?: string | null
status_id?: number
status_custom_id?: number
retired_reason_id?: number
date_leave?: Date
date_join?: Date
position?: string | null
role_id?: number
cost_per_hour?: number
cost_per_use?: number
lat?: number
lng?: number
gridref?: string | null
location_bookmark_id?: number
email?: string | null
phone_mobile?: string | null
phone_home?: string | null
phone_work?: string | null
pager?: string | null
pager_email?: string | null
address?: string | null
notes?: string | null
}
+32
View File
@@ -0,0 +1,32 @@
import { Entity } from '../entity'
export interface Resource {
resourceType: string;
id: number;
}
export interface Qualification extends Entity {
id: number,
cost: number | null,
createdAt: string,
description: string,
expiredCost: null,
reminderDays: number,
title: string,
updatedAt: string,
resourceType: string,
deprecatedBundle: string,
expiresMonthsDefault: number | null,
}
export interface MemberAwards extends Entity {
id: number;
createdAt: string;
updatedAt: string;
resourceType: string;
startsAt: string | null;
endsAt: string | null;
owner: Resource;
member: Resource;
qualification: Resource;
}
+9 -3
View File
@@ -31,7 +31,9 @@ let main = async function() {
if (testGetMembers) {
try {
const members = await api.getMembersAsync(getMembersOptions)
const context = 'team'
const contextId = 1234
const members = await api.getMembersAsync(context, contextId, getMembersOptions)
console.log(`Retrieved ${members.length} members.`)
} catch (err) {
console.log(JSON.stringify(err))
@@ -41,7 +43,9 @@ let main = async function() {
if (testGetGroups) {
try {
const groups = await api.getGroupsAsync()
const context = 'team'
const contextId = 1234
const groups = await api.getGroupsAsync(context, contextId)
console.log(`Retrieved ${groups.length} groups.`)
} catch (err) {
console.log(JSON.stringify(err))
@@ -51,8 +55,10 @@ let main = async function() {
if (testGetMember) {
try {
const context = 'team'
const contextId = 1234
const memberId = 103636
const member = await api.getMemberAsync(memberId, { includeDetails: true })
const member = await api.getMemberAsync(context, contextId, memberId, { includeDetails: true })
console.log(`Retrieved single member: ${member.name}`)
// Only execute update code on an instance where that's OK.