-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Graph QL Info #3
Comments
Thanks for this, Matt!
I was able to render the Form Component (wahooo!) and so I just put some
placeholder stuff there for now. I pushed that up so you should see it
working if you pull down.
Tried to play around with the graphql query within the Form component but
couldn't quite get it down to the service level again. I will keep trying,
but we're getting closer.
Thanks ya'll!
…On Thu, Apr 12, 2018 at 8:12 PM, Matt Armstrong-Totten < ***@***.***> wrote:
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
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`.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#3>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/ANAHSnlaNQBk_AEFh-Z2ijnKWSo9IRkTks5tn-1sgaJpZM4TSrCx>
.
|
Thinking through media uploads, I think it might be easier to upload to a service like Dropbox then reference the URL through the API. Does this seem reasonable to anybody else? I know it adds a layer of complexity, but I foresee major problems trying to upload an image as a field in a graphql query. Dropbox has a free version with an API that I've used a bit. Before I go barking up that tree too much I wanted to see what everybody thinks. |
I actually don't have any experience with handling media uploads. Does Apollo Upload Server seem helpful? Or is the difficulty in passing the file on after the GraphQL server? |
Personally, I feel like if you're confident that using Dropbox will be quicker to implement, we might as well do it. We can suggest alternatives with our project submission. |
Apollo-upload-server looks like exactly what we need. I'm going to play around with that some this weekend.
I'll keep everybody posted on what I end up doing. I won't have much time to look into it until tonight.
-------- Original message --------From: Matt Batman <[email protected]> Date: 4/13/18 12:11 PM (GMT-05:00) To: CivicCode/uReport-client <[email protected]> Cc: Matt Armstrong-Totten <[email protected]>, Author <[email protected]> Subject: Re: [CivicCode/uReport-client] Graph QL Info (#3)
I actually don't have any experience with handling media uploads.
Does Apollo Upload Server seem helpful? Or is the difficulty in passing the file on after the GraphQL server?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/CivicCode/uReport-client","title":"CivicCode/uReport-client","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/CivicCode/uReport-client"}},"updates":{"snippets":[{"icon":"PERSON","message":"@mattbatman in #3: I actually don't have any experience with handling media uploads.\r\n\r\nDoes [Apollo Upload Server](https://github.com/jaydenseric/apollo-upload-server) seem helpful? Or is the difficulty in passing the file on after the GraphQL server?"}],"action":{"name":"View Issue","url":"#3 (comment)"}}}
|
The |
Yup, it looks like I forgot them. I'm working on the media upload bit but I will fix this in the next little bit. Is it a roadblock for you right now? If so I can have it working in the next 15 min. |
There's plenty of other things to do in the meantime. |
Alright, just wanted to say that the description and order have been added to the GraphQL query. I've mentioned it elsewhere, but the media upload portion is set in parameter media_url. This can be posted to the mutation and will associate the image with the request being submitted. I believe that everything should be ready to go on the server. Please let me know if it is behaving unexpectedly and we can get that nailed down before tomorrow. |
Service List query
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.
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.
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:
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:
The text was updated successfully, but these errors were encountered: