// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.

package org_tangled

// schema: org.tangled.temp.spindle.quota.usage

import (
	"context"

	"github.com/bluesky-social/indigo/lex/util"
)

const (
	TempSpindleQuotaUsageNSID = "org.tangled.temp.spindle.quota.usage"
)

// TempSpindleQuotaUsage_Output is the output of a org.tangled.temp.spindle.quota.usage call.
type TempSpindleQuotaUsage_Output struct {
	// usages: non-zero usage rows, including active reservations and committed allocations
	Usages []*TempSpindleQuotaDefs_Usage `json:"usages" cborgen:"usages"`
}

// TempSpindleQuotaUsage calls the XRPC method "org.tangled.temp.spindle.quota.usage".
//
// did: limit results to rows for this subject DID
// scope: limit results to one aggregation axis: user or repo
func TempSpindleQuotaUsage(ctx context.Context, c util.LexClient, did string, scope string) (*TempSpindleQuotaUsage_Output, error) {
	var out TempSpindleQuotaUsage_Output

	params := map[string]interface{}{}
	if did != "" {
		params["did"] = did
	}
	if scope != "" {
		params["scope"] = scope
	}
	if err := c.LexDo(ctx, util.Query, "", "org.tangled.temp.spindle.quota.usage", params, nil, &out); err != nil {
		return nil, err
	}

	return &out, nil
}
