Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,29 @@ jobs:
- name: Verify Build
run: go build ./...

- name: Compile documented import path
# Guards the public import path used in the README and docs.
run: |
mkdir -p /tmp/consumer && cd /tmp/consumer
cat > main.go <<'GO'
package main

import (
"github.com/keymint-dev/keymint-go"
legacy "github.com/keymint-dev/keymint-go/src"
)

func main() {
c, _ := keymint.New("key", "")
_, _ = c.ActivateKey(keymint.ActivateKeyParams{HostID: keymint.String("host")})
_, _ = legacy.New("key", "")
}
GO
go mod init consumer
go mod edit -require=github.com/keymint-dev/keymint-go@v0.0.0 -replace="github.com/keymint-dev/keymint-go=$GITHUB_WORKSPACE"
go mod tidy
go build ./...

- name: Run contract tests
run: go test ./... -run 'TestSignKey|TestGetKey|TestActivateKey|TestCreateKey|TestFloating|TestApiErrors' -v

Expand All @@ -61,4 +84,4 @@ jobs:
KEYMINT_TEST_READONLY_API_KEY: ${{ secrets.KEYMINT_TEST_READONLY_API_KEY }}
KEYMINT_TEST_CLIENT_API_KEY: ${{ secrets.KEYMINT_TEST_CLIENT_API_KEY }}
KEYMINT_TEST_PRODUCT_ID: ${{ vars.KEYMINT_TEST_PRODUCT_ID }}
run: go test ./src/ -run TestLiveLicenseWorkflowsEndToEnd -v
run: go test . -run TestLiveLicenseWorkflowsEndToEnd -v
File renamed without changes.
File renamed without changes.
11 changes: 11 additions & 0 deletions Pointers.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package keymint

// String returns a pointer to s, for optional string fields such as
// ActivateKeyParams.HostID.
func String(s string) *string { return &s }

// Int returns a pointer to i, for optional integer fields.
func Int(i int) *int { return &i }

// Bool returns a pointer to b, for optional boolean fields.
func Bool(b bool) *bool { return &b }
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ Add the SDK to your project:
go get github.com/keymint-dev/keymint-go
```

### Upgrading from v1.5.0 or earlier

Import the module root, `github.com/keymint-dev/keymint-go`. The old
`github.com/keymint-dev/keymint-go/src` path still compiles but is deprecated
and will be removed in a future major version.

Optional fields take pointers; use the helpers `keymint.String`, `keymint.Int`
and `keymint.Bool`, for example `HostID: keymint.String(hostId)`.

## Usage

```go
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
71 changes: 71 additions & 0 deletions src/compat.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// Package keymint (import path github.com/keymint-dev/keymint-go/src) is
// deprecated: import github.com/keymint-dev/keymint-go instead. This package
// only forwards to the module root so existing /src imports keep compiling.
package keymint

import km "github.com/keymint-dev/keymint-go"

// Types.
type (
Client = km.Client
NewCustomer = km.NewCustomer
KeyFormat = km.KeyFormat
CreateKeyParams = km.CreateKeyParams
CreateKeyResponse = km.CreateKeyResponse
ApiErrorDetails = km.ApiErrorDetails
ApiError = km.ApiError
ActivateKeyParams = km.ActivateKeyParams
ActivationLicensee = km.ActivationLicensee
ActivateKeyResponse = km.ActivateKeyResponse
DeactivateKeyParams = km.DeactivateKeyParams
DeactivateKeyResponse = km.DeactivateKeyResponse
DeviceDetails = km.DeviceDetails
LicenseDetails = km.LicenseDetails
CustomerDetails = km.CustomerDetails
GetKeyParams = km.GetKeyParams
GetKeyResponse = km.GetKeyResponse
BlockKeyParams = km.BlockKeyParams
BlockKeyResponse = km.BlockKeyResponse
UnblockKeyParams = km.UnblockKeyParams
UnblockKeyResponse = km.UnblockKeyResponse
CreateCustomerParams = km.CreateCustomerParams
CreateCustomerResponse = km.CreateCustomerResponse
Customer = km.Customer
GetAllCustomersParams = km.GetAllCustomersParams
PaginationMeta = km.PaginationMeta
GetAllCustomersResponse = km.GetAllCustomersResponse
GetCustomerWithKeysParams = km.GetCustomerWithKeysParams
CustomerLicenseKey = km.CustomerLicenseKey
GetCustomerWithKeysResponse = km.GetCustomerWithKeysResponse
UpdateCustomerParams = km.UpdateCustomerParams
UpdateCustomerResponse = km.UpdateCustomerResponse
ToggleCustomerStatusParams = km.ToggleCustomerStatusParams
ToggleCustomerStatusResponse = km.ToggleCustomerStatusResponse
GetCustomerByIdParams = km.GetCustomerByIdParams
GetCustomerByIdResponse = km.GetCustomerByIdResponse
DeleteCustomerParams = km.DeleteCustomerParams
DeleteCustomerResponse = km.DeleteCustomerResponse
FloatingCheckoutParams = km.FloatingCheckoutParams
FloatingCheckoutResponse = km.FloatingCheckoutResponse
FloatingHeartbeatParams = km.FloatingHeartbeatParams
FloatingHeartbeatResponse = km.FloatingHeartbeatResponse
FloatingCheckinParams = km.FloatingCheckinParams
FloatingCheckinResponse = km.FloatingCheckinResponse
UpdateKeyParams = km.UpdateKeyParams
UpdateKeyResponse = km.UpdateKeyResponse
SignKeyParams = km.SignKeyParams
SignKeyResponse = km.SignKeyResponse
RequestOptions = km.RequestOptions
)

// Functions.
var (
GetMachineID = km.GetMachineID
GetOrCreateInstallationID = km.GetOrCreateInstallationID
GenerateSessionSignature = km.GenerateSessionSignature
New = km.New
VerifyWebhookSignature = km.VerifyWebhookSignature
String = km.String
Int = km.Int
Bool = km.Bool
)
Loading