server icon indicating copy to clipboard operation
server copied to clipboard

Add graphql docs

Open jmattheis opened this issue 6 years ago • 14 comments

jmattheis avatar May 21 '19 19:05 jmattheis

That would be grade. So that it can be used in the other Service.

emilycares avatar Jun 11 '20 06:06 emilycares

Hey @micmine, the structure is viewable here https://github.com/traggo/server/blob/master/schema.graphql I think most of the stuff is self explanatory.

jmattheis avatar Jun 11 '20 18:06 jmattheis

Hey @micmine, the structure is viewable here https://github.com/traggo/server/blob/master/schema.graphql I think most of the stuff is self explanatory.

~~I'm not understanding how to build the mutation to login to the APIs, could you provide an example?~~

I eventually managed to get the token 🚀, can't say I completely understand how to use GraphQL 😅

mutation{
    login(username: "admin", pass: "admin", deviceName: "postman", cookie: true, type: NoExpiry ){
        token
    }
}

maxiride avatar Jan 25 '21 11:01 maxiride

Glad to hear this, so it all works fine now? You probably can inspect the browser requests when you do something inside the ui.

jmattheis avatar Jan 25 '21 15:01 jmattheis

You probably can inspect the browser requests when you do something inside the ui.

Indeed.

One thing wasn't as I expected it. The login route returns a token, I expected it to be needed as an Authorization header" Bearer token" instead I made it work as a cookie value. Is this intended?

maxiride avatar Jan 25 '21 16:01 maxiride

Yeah, this is one way, another one would be via "Authorization: traggo TOKEN", traggo should probably be changed to bearer (:. See https://github.com/traggo/server/blob/master/auth/middleware.go#L83

jmattheis avatar Jan 25 '21 16:01 jmattheis

Hello, Thanks for the app. I really like how it respects the zen of minimalism. I'm not very good at Graphql. Just wanted to make sure if I can do some personal customization for myself via python and Graph ql. Thanks.

Shahin-rmz avatar Jun 18 '22 21:06 Shahin-rmz

@Shahin-rmz yeah, this should be possible. You can find GraphQL python clients here: https://graphql.org/code/#python-client

jmattheis avatar Jun 18 '22 21:06 jmattheis

So I want to make a client for linux and android, which gets my tasks from nextcloud tasks app and set the projectand task tags inside traggo automatically. And I just press play button on the client. And after some minutes, send me a push notification to do.pomodoro style job. Is it good idea or useless complication?

Shahin-rmz avatar Jun 18 '22 21:06 Shahin-rmz

I'd say it is a good idea, if it solves one of your problems (:.

jmattheis avatar Jun 18 '22 21:06 jmattheis

Sorry for not responding. I am using traggo again. I have tied to use your API spec, but it does not seem to be correctly formatted. When i try to use it in my program it fails to load the file.

error: Failed to generate GraphQLQuery impl: Query parser error: query parse error: Parse error at 1:1
       Unexpected `enum[Name]`
       Expected `{`, `query`, `mutation`, `subscription` or `fragment`

I am using this client: https://github.com/graphql-rust/graphql-client

emilycares avatar Nov 19 '22 07:11 emilycares

Please paste the code you are trying to run.

jmattheis avatar Nov 19 '22 07:11 jmattheis

https://github.com/micmine/traggo-jira

emilycares avatar Nov 19 '22 09:11 emilycares

#[derive(GraphQLQuery)]
#[graphql(
    schema_path = "src/apispecification/schema.graphql",
    query_path = "src/apispecification/schema.graphql",
)]

You cannot use the schema as a query, you need to write a query yourself. F.ex a login query looks like this https://github.com/traggo/server/issues/49#issuecomment-766734868

jmattheis avatar Nov 19 '22 09:11 jmattheis