Skip to main content

Configuration

configuration := analogwakatime.NewConfiguration()
client := analogwakatime.NewAPIClient(configuration)

NewConfiguration() loads the server list from OpenAPI. Index 0 is the production host https://api.testingmyproject.space.

Select another server index

ctx := context.WithValue(
context.Background(),
analogwakatime.ContextServerIndex,
1,
)

Templated server variables

ctx := context.WithValue(
context.Background(),
analogwakatime.ContextServerVariables,
map[string]string{"basePath": "v2"},
)

Enum values are validated. Unused variables are ignored.

Per-operation server overrides

Operations are keyed as "{classname}Service.{nickname}":

ctx := context.WithValue(
context.Background(),
analogwakatime.ContextOperationServerIndices,
map[string]int{"{classname}Service.{nickname}": 2},
)
ctx = context.WithValue(
ctx,
analogwakatime.ContextOperationServerVariables,
map[string]map[string]string{
"{classname}Service.{nickname}": {"port": "8443"},
},
)

Pointer helpers

Generated model fields are pointers. Use the package helpers when you need *T values:

  • PtrBool, PtrInt, PtrInt32, PtrInt64
  • PtrFloat, PtrFloat32, PtrFloat64
  • PtrString, PtrTime