Skip to content

Go SDK

go get -u github.com/scalekit-inc/scalekit-sdk-go
v2.0.10 Thread-safe Zero dependencies
Updated 1 day ago
Initialize the client
package main
import (
"os"
"github.com/scalekit-inc/scalekit-sdk-go/scalekit"
)
func main() {
scalekitClient := scalekit.NewScalekitClient(
os.Getenv("SCALEKIT_ENVIRONMENT_URL"),
os.Getenv("SCALEKIT_CLIENT_ID"),
os.Getenv("SCALEKIT_CLIENT_SECRET"),
)
// Use scalekitClient for authentication
}

v2.0.10

What's Changed

New Contributors

Full Changelog: v2.0.9...v2.0.10

Domain List API - Release Summary

Overview

Enhanced the ListDomains API with filtering and pagination capabilities to provide more flexible and efficient domain management operations.

Changes

New Features

1. Domain Type Filtering

The ListDomains API now supports filtering domains by type:

  • ALLOWED_EMAIL_DOMAIN: Filter for allowed email domains only
  • ORGANIZATION_DOMAIN: Filter for organization domains only
  • DOMAIN_TYPE_UNSPECIFIED: Unspecified domain type

Usage Example:

// List only organization domains
orgDomains, err := client.Domain().ListDomains(ctx, organizationId, &scalekit.ListDomainOptions{
    DomainType: scalekit.DomainTypeOrganization,
})

// List only allowed email domains
allowedEmailDomains, err := client.Domain().ListDomains(ctx, organizationId, &scalekit.ListDomainOptions{
    DomainType: scalekit.DomainTypeAllowedEmail,
})

2. Pagination Support

Added pagination controls to manage large result sets:

  • PageSize: Number of domains to return per page (default: 100)
  • PageNumber: Page number to retrieve (1-indexed)

Usage Example:

// List domains with custom pagination
domains, err := client.Domain().ListDomains(ctx, organizationId, &scalekit.ListDomainOptions{
    PageSize:   50,
    PageNumber: 1,
})

3. Combined Filtering and Pagination

Filter and paginate simultaneously for efficient domain queries:

Usage Example:

// List organization domains with pagination
orgDomains, err := client.Domain().ListDomains(ctx, organizationId, &scalekit.ListDomainOptions{
    DomainType: scalekit.DomainTypeOrganization,
    PageSize:   25,
    PageNumber: 1,
})

API Signature

Before:

ListDomains(ctx context.Context, organizationId string) (*ListDomainResponse, error)

After:

ListDomains(ctx context.Context, organizationId string, options ...*ListDomainOptions) (*ListDomainResponse, error)

Backward Compatibility

Fully backward compatible - The API can still be called without options:

// Still works - returns all domains with default page size of 10
allDomains, err := client.Domain().ListDomains(ctx, organizationId)

New Types

ListDomainOptions

type ListDomainOptions struct {
    DomainType DomainType  // Optional: Filter by domain type
    PageSize   uint32      // Optional: Number of results per page (default: 10)
    PageNumber uint32      // Optional: Page number to retrieve
}

Implementation Details

Default Behavior

  • When no options are provided, the API returns all domains with a default page size of 10
  • Domain type filtering is optional and can be omitted
  • Pagination parameters are optional; if not specified, default page size applies

Type Conversion

The SDK automatically converts string domain type constants to the appropriate gRPC enum values:

  • scalekit.DomainTypeAllowedEmaildomains.DomainType_ALLOWED_EMAIL_DOMAIN
  • scalekit.DomainTypeOrganizationdomains.DomainType_ORGANIZATION_DOMAIN
  • scalekit.DomainTypeUnspecifieddomains.DomainType_DOMAIN_TYPE_UNSPECIFIED

Testing

Comprehensive test coverage has been added in test/domain_test.go:

  • ✅ Test listing all domains (no filter)
  • ✅ Test filtering by ORGANIZATION_DOMAIN type
  • ✅ Test filtering by ALLOWED_EMAIL_DOMAIN type
  • ✅ Test verification that filtered results only contain domains of the specified type
  • ✅ Test that created domains appear in the list

Migration Guide

No Changes Required

Existing code continues to work without modification:

// Existing code - no changes needed
domains, err := client.Domain().ListDomains(ctx, organizationId)

Optional: Add Filtering

To take advantage of new filtering capabilities:

// New: Filter by domain type
orgDomains, err := client.Domain().ListDomains(ctx, organizationId, &scalekit.ListDomainOptions{
    DomainType: scalekit.DomainTypeOrganization,
})

Benefits

  1. Performance: Filtering reduces unnecessary data transfer and processing
  2. Scalability: Pagination enables handling of large domain lists efficiently
  3. Flexibility: Combined filtering and pagination for precise queries
  4. Backward Compatibility: No breaking changes to existing implementations

Related Files

  • domain.go: Core implementation with ListDomainOptions and enhanced ListDomains method
  • test/domain_test.go: Comprehensive test suite including TestListDomains function
  • pkg/grpc/scalekit/v1/domains/: gRPC protocol buffer definitions

v2.0.9

What's Changed

  • Add WebAuthn sdk methods in #41

Full Changelog: v2.0.8...v2.0.9

v2.0.8

What's Changed

  • Added support for Bring your own Auth for MCP Servers in #39

Full Changelog: v2.0.7...v2.0.8

v2.0.7

What's Changed

New sdk methods

  • Add user management settings to organization API by @dhaneshbs in #38

Full Changelog: v2.0.6...v2.0.7

v2.0.6

What's Changed

Generate proto files to support given_name and family_name in user object in #37

Full Changelog: v2.0.5...v2.0.6

v2.0.5

What's Changed

  • Added Session management sdk methods & interceptorpayload verification method #34

Full Changelog: v2.0.4...v2.0.5

v2.0.2

What's Changed

  • Add ResendInvite method to UserService and Regenerate protobuf files by @dhaneshbs in #28

Full Changelog: v2.0.1...v2.0.2