timpani-api

module
v1.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 14, 2026 License: Apache-2.0

README

Timpani API

Go Reference Code Wiki Go Report Card

Thin, easy-to-use API wrappers for Temporal workflows that use Timpani.

This package is not required in order to use Timpani. However, it saves time, simplifies code, minimizes duplication, and prevents mistakes.

Timpani is a Temporal worker that sends API calls and receives asynchronous event notifications to/from various well-known third-party services.

Usage

First, when your Temporal worker starts, initialize the activity options for all Timpani activities.

import (
    "github.com/tzrikka/timpani-api/pkg/temporal"
    "go.temporal.io/sdk/workflow"
)

temporal.ActivityOptions = temporal.DefaultActivityOptions("timpani")

// Or:

temporal.ActivityOptions = &workflow.ActivityOptions{ /* ... */ }

This is especially important if you changed your Timpani worker's task queue name to something other than the default "timpani".

Note that the package's defaults are DefaultActivityOptions("timpani"), i.e.:

workflow.ActivityOptions{
    TaskQueue: "timpani",
    StartToCloseTimeout: 5 * time.Second,
    RetryPolicy: &temporal.RetryPolicy{
        MaximumAttempts: 5,
    },
}

Now you can call any *Activity() function from any timpani-api subpackage, for example:

import "github.com/tzrikka/timpani-api/pkg/slack"

bot, err := slack.BotsInfoActivity(ctx, botID)

You may also call Temporal's workflow.ExecuteActivity() function directly, and just use the following from any timpani-api subpackage:

  • *ActivityName string as the activity parameter
  • *Request struct as the args parameter
  • Reference to an empty *Response struct as the valuePtr parameter in workflow.Future.Get() calls

Example:

import (
    "github.com/tzrikka/timpani-api/pkg/slack"
    "go.temporal.io/sdk/workflow"
)

func SlackBotInfo(ctx workflow.Context, botID string) (*slack.Bot, error) {
    req := slack.BotsInfoRequest{Bot: botID}
    opts := workflow.ActivityOptions{ /* ... */ }
    actx := workflow.WithActivityOptions(ctx, opts)

    fut := workflow.ExecuteActivity(actx, slack.BotsInfoActivityName, req)

    resp := new(slack.BotsInfoResponse)
    if err := fut.Get(ctx, resp); err != nil {
        return nil, err
    }

    return resp.Bot, nil
}

Directories

Path Synopsis
Package internal requests the Timpani worker to execute Temporal activities with preconfigured Temporal options.
Package internal requests the Timpani worker to execute Temporal activities with preconfigured Temporal options.
pkg
bitbucket
Package bitbucket provides request/response/payload types, and Timpani activity names and wrapper functions, for interacting with Bitbucket Cloud.
Package bitbucket provides request/response/payload types, and Timpani activity names and wrapper functions, for interacting with Bitbucket Cloud.
github
Package github provides request/response/payload types, and Timpani activity names and wrapper functions, for interacting with GitHub via its REST API.
Package github provides request/response/payload types, and Timpani activity names and wrapper functions, for interacting with GitHub via its REST API.
jira
Package jira provides request/response/payload types, and Timpani activity names and wrapper functions, for interacting with Jira Cloud.
Package jira provides request/response/payload types, and Timpani activity names and wrapper functions, for interacting with Jira Cloud.
slack
Package slack provides request/response/payload types, and Timpani activity names and wrapper functions, for interacting with Slack and GovSlack.
Package slack provides request/response/payload types, and Timpani activity names and wrapper functions, for interacting with Slack and GovSlack.
temporal
Package temporal provides common, modifiable activity options for all Timpani activities, related to timeouts and retries.
Package temporal provides common, modifiable activity options for all Timpani activities, related to timeouts and retries.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL