Files
threshold/api/billing/custom.go
shadowdaoandClaude Sonnet 5.5 962d708fdd Rename Go module paths to repo.anhonesthost.net/CyberCoveLLC/threshold
Rename root, api and sdk module paths (imports, go.mod, go_package,
ldflags, build scripts, buf configs) and regenerate protobuf/gateway
code with the project's pinned toolchain. Wire identifiers unchanged.
api gets a local replace for sdk; root/api/sdk require v0.1.0.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-12 10:33:41 -07:00

64 lines
1.4 KiB
Go

// Copyright IBM Corp. 2020, 2026
// SPDX-License-Identifier: MPL-2.0
package billing
import (
"context"
"fmt"
"net/url"
"repo.anhonesthost.net/CyberCoveLLC/threshold/api"
)
type MonthlyActiveUsersResult struct {
Items []*ActiveUsers
response *api.Response
}
func (r MonthlyActiveUsersResult) GetItems() any {
return r.Items
}
func (r MonthlyActiveUsersResult) GetResponse() *api.Response {
return r.response
}
func (c *Client) MonthlyActiveUsers(ctx context.Context, opt ...Option) (*MonthlyActiveUsersResult, error) {
opts, apiOpts := getOpts(opt...)
if c.client == nil {
return nil, fmt.Errorf("nil client")
}
req, err := c.client.NewRequest(ctx, "GET", "billing:monthly-active-users", nil, apiOpts...)
if err != nil {
return nil, fmt.Errorf("error creating MonthlyActiveUsers request: %w", err)
}
if len(opts.queryMap) > 0 {
q := url.Values{}
for k, v := range opts.queryMap {
q.Add(k, v)
}
req.URL.RawQuery = q.Encode()
}
resp, err := c.client.Do(req)
if err != nil {
return nil, fmt.Errorf("error performing client request during MonthlyActiveUsers call: %w", err)
}
mau := new(MonthlyActiveUsersResult)
mau.Items = []*ActiveUsers{}
apiErr, err := resp.Decode(mau)
if err != nil {
return nil, fmt.Errorf("error decoding MonthlyActiveUsers response: %w", err)
}
if apiErr != nil {
return nil, apiErr
}
mau.response = resp
return mau, nil
}