/appstoreconnect-openapi-go

Contains generated Golang client code ( based on OpenAPI 3 specifications ) for Apple AppStore Connect API

Primary LanguageGo

AppStoreConnect-OpenApi-Go

This is a generated Go project for Apple's App Store Connect API.

Apple provided an OpenAPI downloable specification which allows use to generate client api codes.

Client code generation was done with OpenAPI Generator

Motivation

When I was generating the code for my own use, I experienced some difficulties with OpenAPI Generator. After fixing all the bugs, I thought it would be helpful to share this generated code with others.

Thus I would appreciate a star if this project is useful to you.

Installation

Add the generated code to your project

go get github.com/xr1337/appstoreconnect-openapi-go/generated

Usage

Heres a non-production recommended code to test the API out

import 	api "github.com/xr1337/appstoreconnect-openapi-go/generated"

func main() {
	cfg := api.NewConfiguration()
	auth := context.WithValue(context.Background(), api.ContextAccessToken, signedToken)
	client := api.NewAPIClient(cfg)
	response, _, _ := client.UsersApi.UsersGetCollection(auth, nil)
	for _, user := range response.Data {
		fmt.Println(user.Attributes.Username)
	}
}

Checkout out the example folder for more examples ( includes reading Apples .p8 file )

Alternatively, OpenAPI generates a README.md file (View here) to see what APIs that you can use

Regenerate

The Makefile comes with a example docker command to regenerate the project. Requirements: docker

make generate

The output will generate a new folder called out. You may want to remove the generated go.mod and go.sum files.

License

MIT