e-bon
e-bon.ro
TypeScript SDK

client.org

Reference for the OrgResource — organization profile, locations and notification settings, mirroring /api/v1/org.

client.org

client.org wraps /api/v1/org/* — the calling organization's profile, its locations and its email-notification settings. See the matching REST documentation at Organizations API.

HTTP-level failures surface as EBonApiError — see Errors and /en/api/errors.

client.org.get()

Get the current organization.

async get(): Promise<Organization>

No parameters. Returns the current Organization.

const org = await client.org.get();

client.org.update(body)

Update organization properties.

async update(body: UpdateOrgBody): Promise<Organization>
NameTypeRequiredNotes
namestringnoRename the organization.
billingAddressBillingAddressnoReplace the full billing address.

Returns the updated Organization.

await client.org.update({ name: 'ACME SRL' });

client.org.listLocations()

List all locations.

async listLocations(): Promise<Location[]>

No parameters. Returns an array of Location.

const locations = await client.org.listLocations();

client.org.createLocation(body)

Create a new location.

async createLocation(body: CreateLocationBody): Promise<Location>
NameTypeRequiredNotes
namestringyesHuman-readable label.
addressstringyesPostal address (single string).

Returns the created Location.

await client.org.createLocation({ name: 'Cluj HQ', address: 'Strada Memorandumului 1' });

client.org.updateLocation(id, body)

Update a location.

async updateLocation(id: string, body: UpdateLocationBody): Promise<Location>
NameTypeRequiredNotes
namestringnoRename the location.
addressstringnoReplace the postal address.

Returns the updated Location.

await client.org.updateLocation('loc_01HZ...', { name: 'Cluj HQ' });

client.org.deleteLocation(id)

Delete a location.

async deleteLocation(id: string): Promise<undefined>
NameTypeRequiredNotes
idstringyesLocation identifier.

Returns undefined on success.

await client.org.deleteLocation('loc_01HZ...');

client.org.getNotificationSettings()

Get notification settings.

async getNotificationSettings(): Promise<NotificationSettings>

No parameters. Returns { subscribers: NotificationSubscriber[] } — every email and the categories they receive.

const { subscribers } = await client.org.getNotificationSettings();

client.org.updateNotificationSettings(body)

Update notification settings.

async updateNotificationSettings(body: UpdateNotificationSettingsBody): Promise<NotificationSettings>
NameTypeRequiredNotes
subscribersNotificationSubscriber[]yesFull replacement list — each entry is { email, categories: NotificationCategory[] }.

Returns the updated NotificationSettings. NotificationCategory is one of 'reports' | 'alerts' | 'billing' | 'device_events' | 'analytics'.

await client.org.updateNotificationSettings({
  subscribers: [
    { email: 'ops@example.com', categories: ['alerts', 'device_events'] },
    { email: 'finance@example.com', categories: ['reports', 'billing'] },
  ],
});