Class: Recipes
appLib/SDKDrivers/xFrameDriver/recipes.Recipes
Recipes repository --- currently not supported
The Recipe class allows you to manage the recipes of the app.
Implements
IBundle
Hierarchy
-
Repository
↳
Recipes
Implements
-
IBundle
<APIRecipeV2
>
Table of contents
Constructors
Methods
- calcLabelsHaveAttributes
- clone
- create
- crudReq
- crudReqSync
- delete
- doesLabelHaveAttributes
- get
- getLabelAttributes
- missingRequiredAttribute
- query
- update
Constructors
constructor
• new Recipes(agent
)
Creates an instance of Repository.
Parameters
Name | Type |
---|---|
agent |
PeerAgent |
Inherited from
Methods
calcLabelsHaveAttributes
▸ calcLabelsHaveAttributes(payload
): Promise
<void
>
Calculates the labels that have attributes on the studio's side.
Example
await dl.recipes.calcLabelsHaveAttributes({ label: 'label-1' })
Parameters
Name | Type | Description |
---|---|---|
payload |
Object |
|
payload.label |
string |
The label to check. |
payload.recipeId? |
string |
The id of the recipe to check. |
Returns
Promise
<void
>
- A promise that resolves when the calculation is done.
Implementation of
IBundle.calcLabelsHaveAttributes
clone
▸ clone(recipeId
): Promise
<APIRecipeV2
>
Clones a recipe.
Example
const recipe = await dl.recipes.clone('recipeId-1')
Parameters
Name | Type | Description |
---|---|---|
recipeId |
string |
The id of the recipe to clone. |
Returns
Promise
<APIRecipeV2
>
- A promise that resolves to the cloned recipe.
create
▸ create(payload
): Promise
<APIRecipeV2
>
Creates a new recipe.
Example
const recipe = await dl.recipes.create({
title: 'My recipe'
})
Parameters
Name | Type | Description |
---|---|---|
payload |
any |
The payload to create the recipe. |
Returns
Promise
<APIRecipeV2
>
- A promise that resolves to the created recipe.
Implementation of
IBundle.create
crudReq
▸ crudReq(data
): void
Sends a CRUD request to the xFrame.
Parameters
Name | Type |
---|---|
data |
any |
Returns
void
Inherited from
crudReqSync
▸ crudReqSync(data
, options?
): Promise
<any
>
Sends a CRUD request to the xFrame.
Parameters
Name | Type | Description |
---|---|---|
data |
any |
The data to send. |
options |
Object |
|
options.timeout? |
number |
an option to set the timeout for the request. |
Returns
Promise
<any
>
Inherited from
delete
▸ delete(recipeId
): Promise
<void
>
Deletes a specific recipe by its id.
Example
await dl.recipes.delete('recipeId-1')
Parameters
Name | Type | Description |
---|---|---|
recipeId |
string |
The id of the recipe to delete. |
Returns
Promise
<void
>
- A promise that resolves when the recipe has been deleted.
Implementation of
IBundle.delete
doesLabelHaveAttributes
▸ doesLabelHaveAttributes(payload
): Promise
<boolean
>
Checks if a label has attributes.
Example
const hasAttributes = await dl.recipes.doesLabelHaveAttributes({ label: 'label-1' })
Parameters
Name | Type | Description |
---|---|---|
payload |
Object |
|
payload.label |
string |
The label to check. |
payload.recipeId? |
string |
The id of the recipe to check. |
Returns
Promise
<boolean
>
- A promise that resolves to a boolean indicating if the label has attributes.
Implementation of
IBundle.doesLabelHaveAttributes
get
▸ get(id?
): Promise
<APIRecipeV2
>
Retrieves a recipe by id.
If the recipe id is not provided, the active recipe will be returned.
Example
const activeRecipe = await dl.recipes.get()
Example
const recipe = await dl.recipes.get('recipeId-1')
Parameters
Name | Type | Description |
---|---|---|
id? |
string |
The id of the recipe to get. |
Returns
Promise
<APIRecipeV2
>
- A promise that resolves to the queried recipe.
Implementation of
IBundle.get
getLabelAttributes
▸ getLabelAttributes(label
): Promise
<SDKAttributeInstruction
[]>
Gets the attributes of a label.
Example
const attributes = await dl.recipes.getLabelAttributes('label-1')
Parameters
Name | Type | Description |
---|---|---|
label |
string |
The label to get the attributes of. |
Returns
Promise
<SDKAttributeInstruction
[]>
- A promise that resolves to the attributes of the label.
missingRequiredAttribute
▸ missingRequiredAttribute(annotationId
): Promise
<boolean
>
Checks if an annotation is missing a required attribute.
Example
const missing = await dl.recipes.missingRequiredAttribute('clientId-1')
Parameters
Name | Type | Description |
---|---|---|
annotationId |
string |
The clientId of the annotation to check. |
Returns
Promise
<boolean
>
- A promise that resolves to a boolean indicating if the annotation is missing a required attribute.
Implementation of
IBundle.missingRequiredAttribute
query
▸ query(payload?
): Promise
<IPagedResponse
<APIRecipeV2
>>
Lists all recipes.
Example
const pagedResponse = await dl.recipes.query({ projectIds: ['projectId-1'] })
const recipes = pagedResponse.items
Parameters
Name | Type | Description |
---|---|---|
payload? |
Partial <APIRecipeV2 > |
An Object containing the possible projectIds filter. |
Returns
Promise
<IPagedResponse
<APIRecipeV2
>>
- A promise that resolves to a paged response with the queried recipes.
Implementation of
IBundle.query
update
▸ update(payload
): Promise
<APIRecipeV2
>
Updates a recipe.
Example
const recipe = await dl.recipes.update({
id: 'recipeId-1',
title: 'My updated recipe'
})
console.log(recipe.title) // 'My updated recipe'
Parameters
Name | Type | Description |
---|---|---|
payload |
Partial <APIRecipeV2 > |
The payload to update the recipe. |
Returns
Promise
<APIRecipeV2
>
- A promise that resolves to the updated recipe.
Implementation of
IBundle.update