Skip to content

Commit

Permalink
Latest API Updates (#17)
Browse files Browse the repository at this point in the history
* Added description for person

* Update README.md

* Add MSC

* Add link to API explorer

* Fix alt text

* Rename path to search api so that RESTful and non-REST api's are not intermingled

* Add CORS headers

* Add cors headers to all requests - not just api

* Adds swagger2excel output
  * parser for openapi
  * excel output of openapi
  * docker build run excel generation

* Add description for contact

* Add person search HEAD request

* Remove 'old' file: DefaultAPI

* Adds relationship API #7

* Adds search_person_supported implementation and front-end awareness

* Remove ethnicity #12

* Rename api path /details/ to /detail/ for consistency #9

* Fix missing key on list

* Fix liniting errors

* Fix schema formatter crash on missing properties

Co-authored-by: Sara Guerreiro de Sousa <[email protected]>
Co-authored-by: Kaj Siebert <[email protected]>
  • Loading branch information
3 people authored Feb 28, 2020
1 parent 6d8f169 commit 46389a1
Show file tree
Hide file tree
Showing 36 changed files with 1,140 additions and 167 deletions.
57 changes: 0 additions & 57 deletions client/docs/api/DefaultApi.md

This file was deleted.

1 change: 0 additions & 1 deletion client/docs/api/Person.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ Name | Type | Description | Notes
**lastName** | **String** | |
**dateOfBirth** | **Date** | | [optional]
**gender** | **String** | The person&#x27;s gender. Leave blank for &#x27;unknown&#x27;. | [optional]
**ethnicity** | **String** | | [optional]
**address** | **String** | | [optional]
151 changes: 148 additions & 3 deletions client/docs/api/PersonApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ All URIs are relative to */*

Method | HTTP request | Description
------------- | ------------- | -------------
[**getPersonById**](PersonApi.md#getPersonById) | **GET** /api/person/details/{personId} | Find person by ID
[**getPersonServiceByTypeAndId**](PersonApi.md#getPersonServiceByTypeAndId) | **GET** /api/person/details/{personId}/service/{serviceType} | Find person by ID
[**getPersonServicesById**](PersonApi.md#getPersonServicesById) | **GET** /api/person/details/{personId}/service | Get a summary of the services a person has interacted with
[**getPersonById**](PersonApi.md#getPersonById) | **GET** /api/person/detail/{personId} | Find person by ID
[**getPersonRelated**](PersonApi.md#getPersonRelated) | **GET** /api/person/related/{personId}/ | Get related individuals
[**getPersonRelatedSupported**](PersonApi.md#getPersonRelatedSupported) | **HEAD** /api/person/related/{personId}/ | Is related person supported
[**getPersonServiceByTypeAndId**](PersonApi.md#getPersonServiceByTypeAndId) | **GET** /api/person/detail/{personId}/service/{serviceType} | Find person by ID
[**getPersonServicesById**](PersonApi.md#getPersonServicesById) | **GET** /api/person/detail/{personId}/service | Get a summary of the services a person has interacted with
[**searchPerson**](PersonApi.md#searchPerson) | **POST** /api/search/person | Search for a person
[**searchPersonSupported**](PersonApi.md#searchPersonSupported) | **HEAD** /api/search/person | Is person search supported

<a name="getPersonById"></a>
# **getPersonById**
Expand Down Expand Up @@ -58,6 +61,104 @@ Name | Type | Description | Notes
- **Content-Type**: Not defined
- **Accept**: application/json

<a name="getPersonRelated"></a>
# **getPersonRelated**
> [PersonWithRelationship] getPersonRelated(personId)
Get related individuals

Returns individuals related to the person

### Example
```javascript
import FamilyContext from 'family_context';
let defaultClient = FamilyContext.ApiClient.instance;

// Configure API key authorization: cookieAuth
let cookieAuth = defaultClient.authentications['cookieAuth'];
cookieAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//cookieAuth.apiKeyPrefix = 'Token';

let apiInstance = new FamilyContext.PersonApi();
let personId = "personId_example"; // String | ID of person

apiInstance.getPersonRelated(personId).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});

```

### Parameters

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**personId** | **String**| ID of person |

### Return type

[**[PersonWithRelationship]**](PersonWithRelationship.md)

### Authorization

[cookieAuth](../README.md#cookieAuth)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: application/json

<a name="getPersonRelatedSupported"></a>
# **getPersonRelatedSupported**
> getPersonRelatedSupported(personId)
Is related person supported

Tests whether the related person API is supported by this implementation. A return value of 200 indicates that the operation is supported. A 501 indicates that it is not supported, and any front-end applications should suppress the functionality.

### Example
```javascript
import FamilyContext from 'family_context';
let defaultClient = FamilyContext.ApiClient.instance;

// Configure API key authorization: cookieAuth
let cookieAuth = defaultClient.authentications['cookieAuth'];
cookieAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//cookieAuth.apiKeyPrefix = 'Token';

let apiInstance = new FamilyContext.PersonApi();
let personId = "personId_example"; // String | ID of person

apiInstance.getPersonRelatedSupported(personId).then(() => {
console.log('API called successfully.');
}, (error) => {
console.error(error);
});

```

### Parameters

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**personId** | **String**| ID of person |

### Return type

null (empty response body)

### Authorization

[cookieAuth](../README.md#cookieAuth)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: Not defined

<a name="getPersonServiceByTypeAndId"></a>
# **getPersonServiceByTypeAndId**
> ServiceDetail getPersonServiceByTypeAndId(personId, serviceType)
Expand Down Expand Up @@ -205,3 +306,47 @@ Name | Type | Description | Notes
- **Content-Type**: application/json
- **Accept**: application/json

<a name="searchPersonSupported"></a>
# **searchPersonSupported**
> searchPersonSupported()
Is person search supported

Tests whether the person search API is supported by this implementation. A return value of 200 indicates that the operation is supported. A 501 indicates that it is not supported, and any front-end applications should suppress the search functionality.

### Example
```javascript
import FamilyContext from 'family_context';
let defaultClient = FamilyContext.ApiClient.instance;

// Configure API key authorization: cookieAuth
let cookieAuth = defaultClient.authentications['cookieAuth'];
cookieAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//cookieAuth.apiKeyPrefix = 'Token';

let apiInstance = new FamilyContext.PersonApi();
apiInstance.searchPersonSupported().then(() => {
console.log('API called successfully.');
}, (error) => {
console.error(error);
});

```

### Parameters
This endpoint does not need any parameter.

### Return type

null (empty response body)

### Authorization

[cookieAuth](../README.md#cookieAuth)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: Not defined

13 changes: 13 additions & 0 deletions client/docs/api/PersonWithRelationship.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# FamilyContext.PersonWithRelationship

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **String** | |
**firstName** | **String** | |
**lastName** | **String** | |
**dateOfBirth** | **Date** | | [optional]
**gender** | **String** | The person&#x27;s gender. Leave blank for &#x27;unknown&#x27;. | [optional]
**address** | **String** | | [optional]
**relationship** | **String** | A description of the relationship. | [optional]
**relationshipToId** | **String** | The ID of the individual this relationship refers to | [optional]
1 change: 1 addition & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"@material-ui/icons": "^4.2.0",
"cross-fetch": "^3.0.4",
"react": "^16.10.1",
"react-addons-create-fragment": "^15.6.2",
"react-dom": "^16.10.1",
"react-redux": "^7.1.3",
"react-scripts": "3.2.0",
Expand Down
12 changes: 11 additions & 1 deletion client/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from "react";
import thunkMiddleware from "redux-thunk";
import { createLogger } from "redux-logger";
import { createStore, applyMiddleware } from "redux";
import { Provider } from "react-redux";
import {Provider, useDispatch} from "react-redux";

import {createMuiTheme} from "@material-ui/core/styles";
import { ThemeProvider } from '@material-ui/styles';
Expand All @@ -12,6 +12,9 @@ import rootReducer from "./reducers";
import Auth from "./components/authentication/auth";
import Router from "./Router"

import { checkPersonSearch } from "./actions/features";


const loggerMiddleware = createLogger();

const store = createStore(
Expand All @@ -30,9 +33,16 @@ const theme = createMuiTheme({
},
});

function Init() {
const dispatch = useDispatch();
dispatch(checkPersonSearch());
return (<></>);
}

function App() {
return (
<Provider store={store}>
<Init/>
<ThemeProvider theme={theme}>
<Auth>
<Router />
Expand Down
10 changes: 10 additions & 0 deletions client/src/actions/features.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { searchPersonSupported } from "../services/featureService";

export const SET_PERSON_SEARCH_SUPPORTED = "SET_PERSON_SEARCH_SUPPORTED";
export const checkPersonSearch = () => async dispatch => {
const supported = await searchPersonSupported();
return dispatch({
type: SET_PERSON_SEARCH_SUPPORTED,
supported: supported,
});
}
Loading

0 comments on commit 46389a1

Please sign in to comment.