README Show graphql syntax used
In your readme, it would be helpful to see the graphql sybtax that the adapters are trying to use. This will help out understand how to use for our needs.
Something like this
query
{
Media(search: "Dragonball") {
title {
userPreferred
},
description
}
}
Hey @jrock2004 Sounds good. Do you mean incoming or outgoing? Or both?
I am just confused how I would create my models and adapters to match the graphql syntax like above
Also, is this only supported for ruby? All your docs are in ruby code
I am just confused how I would create my models and adapters to match the graphql syntax like above.
You can set up your ember models as normal and just make sure that both your adapter and serializer are exporting the grapqhl versions. From there the addon will auto generate the correct graph query to send to the backend and parse the response to feed it in the ember-data.
Also, is this only supported for ruby? All your docs are in ruby code.
It should support any graphql backend.
Here's an example from our code base.
models/comment.js
import DS from 'ember-data';
const { attr, belongsTo } = DS;
export default DS.Model.extend({
body: attr('string'),
createdAt: attr('date'),
important: attr('boolean', { defaultValue: false }),
advisor: belongsTo('advisor', { async: true }),
user: belongsTo('user', { async: true }),
});
adapters/application.js
import { Adapter } from 'ember-graphql-adapter';
export default Adapter.extend();
serializers/application.js
import { Serializer } from 'ember-graphql-adapter';
export default Serializer.extend();
and this is the query that goes out:
query
comments {
comments(ids: ["1","2","3"]) {
id
body
created_at
important
advisor_id
user_id
}
}