@smokeballdev/smokeball-client-sdk

Interface: Api

Entry point for layouts to Smokeball.

Methods

add()

add(request): Promise<LayoutMatter>
Adds a new layout matter item to a matter.

Parameters

request
AddLayoutMatterItemRequest the update request.

Returns

Promise<LayoutMatter>

Example

const request: AddLayoutMatterItemRequest = {
  layoutDesignId: '913bb0d3-f7b7-4702-9419-ee508f7782d0',
  parentItemId: '7250a634-4d67-4054-8f07-5b6c8a9dcfa8',
  values: [
      // Specify the fields to update here. Fields that are missing are ignored.
  ]
};
const layout = await sdk.layouts.add(request);

get()

get(matterId?): Promise<LayoutMatter>
Gets the layout associated to the current context or the specified matter id if provided.

Parameters

matterId?
string the layout to retrieve, use null for the matter in the current context.

Returns

Promise<LayoutMatter> the specified layout.

Example

// Returns the layout with the specified matter id.
const matter = await sdk.layouts.get('e9b9084b-c9b4-4f3c-9f5a-4c83ed3ac265');

getContacts()

getContacts(itemId): Promise<GetLayoutMatterItemContactsResponse>
Gets the contacts associated to the provided item id and matter id of the current context.

Parameters

itemId
string the layout item with contacts.

Returns

Promise<GetLayoutMatterItemContactsResponse> the contacts associated with the layout item.

Example

const layoutContacts = await sdk.layouts.getContacts('e9b9084b-c9b4-4f3c-9f5a-4c83ed3ac265');

getItem()

getItem(itemId): Promise<LayoutMatterItem>
Gets a layout item associated to the current context.

Parameters

itemId
string the layout item to retrieve.

Returns

Promise<LayoutMatterItem> the specified layout item.

Example

// Returns a layout item.
const item = await sdk.layouts.getItem('21e9a129-8fa3-4a94-812c-123d7716df8e');

observe()

observe(callback, matterId?): void
Creates a subscription for the layout matter associated to the current context or the specified matter id if provided. Only one subscription will be made per session. Regardless of how many times this function is called, the last registered callback will be used.

Parameters

callback
(layout) => void the function to execute when a change is made to layout(s) in Smokeball.
matterId?
string the layout to subscribe to.

Returns

void

Example

sdk.layouts.observe(layouts => {
  // Perform syncing code here.
});

remove()

remove(request): Promise<LayoutMatter>
Removes a layout matter item from a matter.

Parameters

request
RemoveLayoutMatterItemRequest the update request.

Returns

Promise<LayoutMatter>

Example

const request: RemoveLayoutMatterItemRequest = {
  itemId: 'f6dd87bf-0266-40cf-b256-fdbc3ffbac66',
  parentItemId: '7250a634-4d67-4054-8f07-5b6c8a9dcfa8',
};
const layout = await sdk.layouts.remove(request);

update()

update(request): Promise<LayoutMatter>
Updates the layout associated to the specified matter id and returns the layout.

Parameters

request
UpdateLayoutMatterItemRequest the update request.

Returns

Promise<LayoutMatter>

Example

const request: UpdateLayoutMatterItemRequest = {
  matterId: 'a31260b5-9921-4723-83c5-61b8679941af',
  itemId: '7250a634-4d67-4054-8f07-5b6c8a9dcfa8',
  values: [
      // Specify the fields to update here. Fields that are missing are ignored.
  ]
};
const layout = await sdk.layouts.update(request);