Skip to content

Stack8/github-zenhub-sdk

Repository files navigation

github-zenhub-sdk

This library provides a convenient interface for interacting with GitHub and ZenHub's GraphQL APIs. It simplifies common operations and offers a structured approach to managing data.

Build

./gradlew clean build

Versioning

We follow Semantic Versioning 2.0.0, as we do in most projects at ZIRO.

The version can be found in the gradle build file.

We should follow the git-flow process as we do in other projects.

Usage

Authentication

To use this SDK, you will need to set up a valid GitHub and Zenhub tokens via the following environment variables: GITHUB_API_TOKEN and ZENHUB_GRAPHQL_TOKEN, respectively.

This may have already been done. You can run the following commands to check:

echo $GITHUB_API_TOKEN # If nothing prints, then you need to set it up.
echo $ZENHUB_GRAPHQL_TOKEN # If nothing prints, then you need to set it up.

If they are not set up, then you can follow these instructions.

Making API Calls

There is a GitHubClientSmokeTest.kt file you can explore to better understand how to invoke the API. Furthermore, you can actually run the file. Similarly, there is a ZenHubClientSmokeTest.kt file.

Modifying the SDK

Updating the schemas

The schemas are found in the corresponding GraphQL folder. However, please note that we do not modify the schema files manually. There is a gradle task to fetch the latest schema from the web for you.

./gradlew updateSchemas

Adding New GraphQL Queries and Mutations

You can write your own graphql queries and mutations by adding them to the corresponding GraphQL folder.

Updating Existing GraphQL Queries and Mutations

You can modify the graphql queries and mutations as needed, however, you must be careful not to introduce breaking changes. In order to avoid breaking changes, you should follow the Parallel Change Pattern.

Generating SDK Code

When you build the project, kotlin code will be automatically generated from the GraphQL code and added to the classpath. You can use the smoke test classes (as described in Making API Calls) to verify the results.