A NodeJS wrapper around Tainan Open 1999 API.
Install module via NPM
$ npm install tainan-open-1999
Or, using yarn
$ yarn
A simple example for request a case of car illegal parking report on Tainan Open 1999.
const tainanOpen1999 = require('tainan-open-1999')
tainanOpen1999.getCase('UN201704030185', (err, data) => {
if (err) {
return console.error(error)
}
console.log(data)
})The output,
{
caseId: 'UN201704030185',
status: '已完工',
district: '東區',
serviceName: '違規停車',
subjectName: '違規停車',
agency: '臺南市政府警察局勤務指揮中心',
description: '東區崇德路,介於林森路一段與監理站間 違停',
address: '東區崇德路',
latitude: null,
longitude: null,
createAt: '2017-04-03 19:27:00',
updateAt: '2017-04-04 02:08:22',
pictures: []
}The responsed resources are preprocessed by wrapping a proper object structure for usage. Those objects below will be mentioned in the entire document..
caseId: A string the case IDstatus: A number of the case status code,0for unprocessed,1for processeddistrict: A string of Tainan City administrative districtserviceName: A string of the service namesubjectName: A string of the subject nameagency: A string of the agencydescription: A string of the case descriptionaddress: A string of the addresslatitude: A string of the latitudelongitude: A string of the longitudecreateAt: A string of time (YYYY-MM-DD hh:mm:ss)updateAt: A string of time (YYYY-MM-DD hh:mm:ss)pictures: An array of<Object:Picture>
fileName: A string of the image file namedescription: A string of the image descriptionbase64: A string of the image base64 encode
code: A string of the service codename: A string of the service namesubjects: An array of<Object:Subject>
code: A string of the subject codename: A string of the subject name
All the methods of resource request are asynchronously handled by the given callback function.
method(...argus, (err, data) => {
// access the resource
})
The callback function gets passed two arguments. The first argument returned the error message when failed. The second argument returned the data when succeeded.
Those options below are reuqired:
serviceName: A string of the service namesubjectName: A string of the subject namedistrict: A string of the districtaddress: A string of the addressdescription: A string of the descriptionreporterName: A string of the reporter namereporterPhoneNumber: A string of the reporter number
Others are optional:
reporterEmail: A string of reporter emaillatitude: A string of latitudelongitude: A string of longtitudepictures: An array of<Object:Picture>
The return data argument of the callback:
caseId: A string of the case ID
caseId: A string of case ID
The returned data argument of the callback:
<Object:Case>
Those options below are reuqired:
startFrom: A string of time (YYYY-MM-DD hh:mm:ss)endTo: A string of time (YYYY-MM-DD hh:mm:ss)
Others are optional:
serviceName: A string or an array of service name
The returned data argument of the callback:
num: A number of entry countcases: An array of<Object:Case>
caseIds: An array of case ID string
The returned data argument of the callback:
num: A number of entry countcases: An array of<Object:Case>
The returned data argument of the callback:
num: A number of entry countservices: An array of<Object:Service>