Skip to content
Enforcer Ninja SDK is a library for the go language to aid in interfacing with the Enforcer Ninja API
Go
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
README.md
api.go
sdk.go
sdk_test.go
test.example.toml
usage.go
utils.go
view.go

README.md

Enforcer Ninja SDK (Go) GoDoc Status

Enforcer Ninja SDK is a library for the go language to aid in interfacing with the Enforcer Ninja API

Usage

Usage examples are available below. For more in-depth examples and documentation, be sure to visit our documentation.

Initializing SDK

func ExampleNew() {
	var (
		sdk *SDK
		err error
	)

	if sdk, err = New(testAPIKey); err != nil {
		log.Fatal(err)
	}

	// You can now begin making Enforcer Ninja requests!
	fmt.Println(sdk)
	return
}

Getting usage

func ExampleSDK_GetUsage() {
	var (
		usage []UsageEntry
		err   error
	)

	if usage, err = testSDK.GetUsage(ViewWeek); err != nil {
		log.Fatalf("Error getting usage: %v", err)
	}

	for _, entry := range usage {
		fmt.Printf("Entry: %+v\n", entry)
	}
}

Getting limit

func ExampleSDK_GetLimit() {
	var (
		limit uint64
		err   error
	)

	if limit, err = testSDK.GetLimit(); err != nil {
		log.Fatalf("Error getting limit: %v", err)
	}

	fmt.Printf("Limit: %d", limit)
}

Verifying e-mail address

func ExampleSDK_VerifyEmail() {
	var err error
	if err = testSDK.VerifyEmail("open-source@hatchify.co"); err != nil {
		log.Fatalf("Error verifying email: %v", err)
	}
}
You can’t perform that action at this time.