go-patchmonkey

module
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2024 License: MIT

README

Go Patchmonkey

coverage report

Description

Golang library for interacting with the Patchmonkey API. Docs on the API can be found here

Usage

Right now just check out the stuff in _examples/. Still trying to figure out how this all should work.

For the examples to work, export the PATCHMONKEY_TOKEN env var to your long lived token.

Auto Generated GraphQL Code

Code is generated from a schema using Genqlient.

Be sure to run go generate ./... after making changes to the schema or query listings.

go run ./fetch-schema/ > patchmonkey/schema.graphql
go generate ./...

Testing Tips

Check with http calls using something like this:

$ cat /tmp/gql.json
{
  "query": "query Computers($name_search: String!, $show_retired: Boolean!) { computers(nameSearch: $name_search, showRetired: $show_retired) { name } }",
  "operationName": "Computers",
  "variables": {
    "name_search": "drews",
    "show_retired": false
  }
}
$ curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $(idms-oidc-tool get-shortlived-token -c 'patchmonkey' -e '/graphql' -t)" https://patchmonkey.oit.duke.edu/graphql -d @/tmp/gql.json
...

Directories

Path Synopsis
_examples
Package patchmonkey provides the base bits for interacting with the Patchmonkey GraphQL API
Package patchmonkey provides the base bits for interacting with the Patchmonkey GraphQL API
Package types is a helper package that holds some misc.
Package types is a helper package that holds some misc.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL