![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@botmock/client
Advanced tools
Botmock client package is used to unlock data from Botmock projects.
Let's take a deeper dive and see what are those public methods that are exposed by Botmock Client and also what to expect from the response from these public methods.
The package is available to install on npm. It is written in TypeScript, and comes bundled with type definitions.
npm install @botmock/client
Resources are all the nuts and bolts of a given project. Resources includes project information, a board is part of a project, so its information which includes the information about blocks and its connections. A project belongs to a team so resources also give us team information. Our intents, entities and variables are essential part of a board, so resources also contains information about these three.
Each of the following methods is publicly available on an instance of the named export Client
:
const client = new Client({ token: process.env.TOKEN });
const project = await client.getProject(process.env.TEAM_ID, process.env.projectId);
getProject(teamId: string, projectId: string): FetchResult
This method takes two parameters: teamId
as a string and projectId
which is also a string and then returns JSON for the information about the project as shown in a sample JSON below:
{
"id": "16f1c520-05c6-11e7-bc31-5554df9b496b",
"name": "Kindly",
"created_at": "2017-03-10 19:16:40",
"updated_at": "2017-09-15 14:15:59",
"type": "mock",
"platform": "facebook"
}
getTeam(teamId: string): FetchResult
This method takes in one parameter of teamId
as string and returns the team information as shown in the following JSON below:
{
"id": 38881,
"name": "First Team",
"photo": "https://www.gravatar.com/avatar/00f062fb089de61b9a7e8033bc40109a.jpg?s=200&d=identicon",
"created_at": {
"date": "2017-01-10 20:45:21.000000",
"timezone_type": 3,
"timezone": "UTC"
}
}
getBoard(teamId: string, projectId: string, boardId: string): FetchResult
GetBoard is a method that can be used to get all the board information if provided correct teamId, projectId, boardId
all these parameters are expected to be strings. The sample JSON response is shown below:
{
"board": {
"root_messages": [
"16f1c520-05c6-11e7-bc31-5554df9b496b"
],
"messages": [
{
"message_id": "16f1c520-05c6-11e7-bc31-5554df9b496b",
"message_type": "response",
"next_message_ids": [
{
"message_id": "16f1c520-05c6-11e7-bc31-5554df9b496b",
"action": "*",
"intent": "",
"conditional": false
}
],
"previous_message_ids": [],
"is_root": true,
"payload": {
"en": {
"facebook": {
"blocks": [
[]
]
}
}
}
},
{
"message_id": "16f1c520-05c6-11e7-bc31-5554df9b496b",
"message_type": "response",
"next_message_ids": [
{
"message_id": "16f1c520-05c6-11e7-bc31-5554df9b496b",
"action": "*",
"intent": "",
"conditional": false
}
],
"previous_message_ids": [
{
"message_id": "16f1c520-05c6-11e7-bc31-5554df9b496b",
"action": "*"
}
],
"is_root": false,
"payload": {
"en": {
"facebook": {
"blocks": [
{
"component_type": "text",
"nodeName": "Bot Says",
"text": "Your bot reply goes here...",
"buttons": [],
"delay": 2000,
"workflow_index": 0
}
]
}
}
}
},
]
},
"slots": {
"34cb53e0-898e-11ea-a937-3f5c9b13d9b8": []
},
"variables": [],
"created_at": {
"date": "2020-04-28 20:24:05.000000",
"timezone_type": 3,
"timezone": "UTC"
},
"updated_at": {
"date": "2020-04-30 17:02:40.000000",
"timezone_type": 3,
"timezone": "UTC"
}
}
getIntents(teamId: string, projectId: string): FetchResult
This method takes in a teamId
and projectId
and returns all the intents of a specific project. It returns an array of intent object and each object consists of an intent id
, name
, list of utterances
and some meta information like created_at
and updated_at
[
{
"id": "16f1c520-05c6-11e7-bc31-5554df9b496b",
"name": "Order Pizza",
"utterances": {
"en": [
{
"text": "I want to order pizza",
"variables": []
},
{
"text": "Order pizza",
"variables": []
}
]
},
"created_at": {
"date": "2020-04-28 20:24:05.000000",
"timezone_type": 3,
"timezone": "UTC"
},
"updated_at": {
"date": "2020-04-28 20:24:05.000000",
"timezone_type": 3,
"timezone": "UTC"
},
"is_global": false,
"slots": []
}
]
getEntities(teamId: string, projectId: string): FetchResult
This method takes in same as getIntents method a teamId
and projectId
and returns all the entities of a specific project. The sample JSON is shown below.
[
{
"id": "16f1c520-05c6-11e7-bc31-5554df9b496b",
"name": "orderTime",
"data": {
"en": [
{
"value": "lunch",
"synonyms": [
"brunch"
]
},
{
"value": "breakfast",
"synonyms": []
}
]
},
"created_at": {
"date": "2020-04-30 17:36:10.000000",
"timezone_type": 3,
"timezone": "UTC"
},
"updated_at": {
"date": "2020-04-30 17:36:10.000000",
"timezone_type": 3,
"timezone": "UTC"
}
}
]
An Enum
containing all resource names can be imported as follows:
import { Resource } from "@botmock/client";
export enum Resource {
PROJECT = "project",
TEAM = "team",
BOARD = "board",
INTENTS = "intents",
VARIABLES = "variables",
ENTITIES = "entities",
}
This import gives us access to names of all available resources. When we call getResources
its on us which resources we need. so we need to pass then in the parameters of getResources
method as shown below. It can all but it can also be a few on them.
getResources
methodThis public method can be used to fetch an array of resource names from a given project:
import { Client } from "@botmock/client";
const client = new Client({ token: process.env.TOKEN });
(async () => {
const { intents, project } = await client.getResources({
resources: [Resource.INTENTS, Resource.PROJECT], // Here we are going to only get two resources
teamId: "1",
projectId: "1",
boardId: "1",
});
})();
client.getResources
promise resolves with an object containing keys for each of the elements of resources
array.
If you would like to report an issue please feel free to send an email to help@botmock.com
Thanks for using Botmock! Happy Prototyping 😎 😎 👩🏻🎨 👨🏻🎨 😎 😎
FAQs
## Overview
We found that @botmock/client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.