def citizens_post(body): # noqa: E501 """Create a new citizen A new citizen will be created in the database and assigned a unique id. The `name` and `phone_number` are required to make use of the subsidy service. The `phone_number` must be unique per citizen. # noqa: E501 :param body: citizen to add :type body: dict | bytes :rtype: Citizen """ if connexion.request.is_json: body = Citizen.from_dict(connexion.request.get_json()) # noqa: E501 response = service.citizens.create(body.to_dict()) return Citizen.from_dict(response)
def citizens_post(body): # noqa: E501 """Create a new citizen # noqa: E501 :param body: citizen to add :type body: dict | bytes :rtype: Citizen """ if connexion.request.is_json: body = Citizen.from_dict(connexion.request.get_json()) # noqa: E501 response = service.citizens.create(body.to_dict()) return Citizen.from_dict(response)
def citizens_id_put(id, body): # noqa: E501 """Re-upload a citizen's information # noqa: E501 :param id: :type id: str :param body: citizen details :type body: dict | bytes :rtype: Citizen """ if connexion.request.is_json: body = Citizen.from_dict(connexion.request.get_json()) # noqa: E501 response = service.citizens.replace(id, body.to_dict()) return Citizen.from_dict(response)
def citizens_id_patch(id, body): # noqa: E501 """Edit a citizen's information # noqa: E501 :param id: :type id: str :param body: citizen properties to be updated :type body: dict | bytes :rtype: Citizen """ if connexion.request.is_json: body = Citizen.from_dict(connexion.request.get_json()) # noqa: E501 response = service.citizens.update(id, body.to_dict()) return Citizen.from_dict(response)
def citizens_id_get(id): # noqa: E501 """Returns a specific citizen Get the information for a single citizen Currently no additional information is available compared to the list view. # noqa: E501 :param id: :type id: str :rtype: Citizen """ response = service.citizens.read(id) return Citizen.from_dict(response)
def citizens_id_get(id): # noqa: E501 """Returns a specific citizen # noqa: E501 :param id: :type id: str :rtype: Citizen """ response = service.citizens.read(id) return Citizen.from_dict(response)
def test_citizens_post(self): """Test case for citizens_post Create a new citizen """ body = Citizen() response = self.client.open( '/v1/citizens', method='POST', data=json.dumps(body), content_type='application/nl.kpmg.v1.citizen+json') self.assert200(response, 'Response body is : ' + response.data.decode('utf-8'))
def test_citizens_id_put(self): """Test case for citizens_id_put Re-upload a citizen's information """ body = Citizen() response = self.client.open( '/v1/citizens/{id}'.format(id='id_example'), method='PUT', data=json.dumps(body), content_type='application/nl.kpmg.v1.citizen+json') self.assert200(response, 'Response body is : ' + response.data.decode('utf-8'))