Skip to content

Meter methods: update, delete

The Meter Verbs update, delete as typed SDK methods, with inputs, result, refusals and an example.

Reference for Meter, one group of Meter methods.

Meter.update

Changes the given properties of a Meter. Verb page.

TypeScript
interface MeterVerbs {
  update(input: MeterUpdateInput, options?: SB.CallOptions): SB.Call<Meter>
}

Emits Meter.updated.

Inputs

InputTypeRequiredDescription
idstringrequiredThe id of the Meter.
unitstringWhat it counts, such as calls or tokens.
ofstringThe declared Event the Meter counts.
aggregationstringHow counted Events combine over the window: a sum of a value, a count, or the last value.
windowstringThe period usage accrues over before it bills, such as a month.

Returns

OutputTypeRequiredDescription
meterMeterrequiredThe Meter.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

TypeScript
import { $ } from 'startup-builder'

const meter = await $.Meter.update({ id: 'mtr_z08Ufi8LwY', unit: 'call' })

Meter.delete

Deletes a Meter: a soft delete that keeps its history, undone by Thing.restore. Verb page.

TypeScript
interface MeterVerbs {
  delete(input: MeterDeleteInput, options?: SB.CallOptions): SB.Call<Meter>
}

Emits Meter.deleted.

Inputs

InputTypeRequiredDescription
idstringrequiredThe id of the Meter.

Returns

OutputTypeRequiredDescription
meterMeterrequiredThe Meter.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

TypeScript
import { $ } from 'startup-builder'

const meter = await $.Meter.delete({ id: 'mtr_z08Ufi8LwY' })