-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Service List query
query {
serviceList {
service_code,
service_name,
description,
metadata,
type,
keywords,
group
}
}Service Definition Query
This query is required if in the above query metadata === true. The (service_code:${foo}) should be replaced with the service_code from the query above.
query {
serviceDefinition(service_code: 37){
variable,
code,
datatype,
required,
datatype_description,
values {
key,
name
}
}
}Service Requests Query
While likely not required by this project, this returns all the requests that have been made. Eventually if we were to implement users and/or keeping track of issues, it would be through this query and a list of service_request_ids for a user.
query {
serviceRequests {
service_request_id,
status,
status_notes,
service_name,
service_code,
description,
agency_responsible,
service_notice,
requested_datetime
}
}Post Service Request
This is used to post the request. There are a number of parameters to the query, and the final request is returned (can be used to verify it was successful).
Required fields:
- service_code
- EITHER:
- lat & long
- or
- address_string
- lat & long
mutation {
postServiceRequest (
service_code: $service_code,
lat: $lat,
long: $long,
address_string: $address_string,
email: $email,
device_id: $device_id,
account_id: $account_id,
first_name: $first_name,
last_name: $last_name
) {
service_request_id,
status,
status_notes,
service_name,
service_code,
description,
agency_responsible,
service_notice,
requested_datetime,
updated_datetime,
expected_datetime,
address,
address_id,
zipcode,
lat,
long,
media_url
}
}TODO
I still need to handle two more parameters in the POST: media and attributes. Media is going to be hard to load through a graphql query, so hopefully there's some libraries out there for that or I'll have to really rethink things. The other relates to the attibutes from the service definition query. According to the API docs:
This takes the form of attribute[code]=value where multiple code/value pairs can be specified as well as multiple values for the same code in the case of a multivaluelist datatype (attribute[code1][]=value1&attribute[code1][]=value2&attribute[code1][]=value3) - see example.
This is only required if the service_code requires a service definition with required fields`.