We provide a set of interface request libraries that allow plugin developers to call the basic abilities of plugins.
Compatibility Requirements
API
getLanguage
Get user language
Params
| Param | Description | Type | Required | Default |
|---|
| user_uuid | user uuid | string | Y | - |
| team_uuid | team uuid | string | Y | - |
Returns
| Param | Description | Type |
|---|
| language | user language type | string |
Example
import { Language } from '@ones-op/node-ability'
export async function multiple_language() {
const teamUUID = 'xxx'
const language = await Language.getLanguage(user_uuid, teamUUID)
}
getLanguageString
Gets the corresponding content of the specified language
Params
| Param | Description | Type | Required | Default |
|---|
| language | language type | string | Y | - |
| key | the field you want to get | string | Y | - |
Returns
| Param | Description | Type |
|---|
| value | The corresponding value of key in this language | string |
Example
import { Language } from '@ones-op/node-ability'
export async function multiple_language() {
const description = await Language.getLanguageString(language, 'PluginDescription')
}
downloadFile
Download the file in the plugin storage space workspace
- ONES Requirement:
v3.11.0+
Params
| Param | Description | Type | Required | Default |
|---|
| filePath | path of file | string | Y | - |
| timeoutSeconds | effective time | number | N | 300(s) |
| teamUUID | team UUID | string | Y | |
Returns
| Param | Description | Type |
|---|
| url | file download URL | string |
Example
import { downloadFile } from '@ones-op/node-ability'
export async function downloadUrl() {
const teamUUID = 'xxx'
const url = await downloadFile('plugin.sql', teamUUID)
return {
body: {
res: url,
},
}
}
uploadFile
Upload file to plugin storage space workspace
- ONES Requirement:
v3.11.40+
Params
| Param | Description | Type | Required | Default |
|---|
| filePath | The directory of the plugin storage space you want to upload to | string | N | . |
| timeoutSeconds | effective time | number | N | 3600(s) |
| teamUUID | team id | string | Y | |
Returns
| Param | Description | Type |
|---|
| url | file upload link | string |
Example
import { uploadFile } from '@ones-op/node-ability'
export async function uploadFileToPlugin(request: PluginRequest): Promise<PluginResponse> {
const url = await uploadFile()
return {
body: {
res: url,
},
}
}
createLog
Generate plugin audit logs
Params
| Param | Description | Type | Required | Default |
|---|
| headers | Need to include user uuid and ip address. Example: { 'Ones-User-Id': 'xxxxxx', 'X-Real-Ip': '127.0.0.1', } | Record<string, string> | Y | - |
| message | Audit log information | string | Y | - |
| teamUUID | Team uuid | string | Y | - |
Returns
| Param | Description | Type |
|---|
| resp | result | Record<string, any> |
Example
import { AuditLog } from '@ones-op/node-ability'
export async function testAuditLog(request: PluginRequest): Promise<PluginResponse> {
const auditHeader = {
'Ones-User-Id': 'E6ZqgsSX',
'X-Real-Ip': '127.0.0.1',
}
const teamUUID = 'xxx'
const resp = await AuditLog.createLog(auditHeader, 'Test log', teamUUID)
return {
body: {
res: 'audit log',
resp: resp,
},
}
}
getAbilityConfig
Get ability configuration information
Params
| Param | Description | Type | Required | Default |
|---|
| abilityID | id of ability | string | N | - |
| teamUUID | Team uuid | string | Y | - |
Returns
| Param | Description | Type |
|---|
| response | ability configuration information | Record<string, any> |
Example
import { getAbilityConfig } from '@ones-op/node-ability'
const teamUUID = ''
const response = await getAbilityConfig('Qcf5BG5P', teamUUID)
addRepos
Add linked repositories
- Added in:
v0.4.0+
- ONES Requirement:
v3.13.9+
Params
| Param | Description | Type | Required | value range |
|---|
| toolUUID | UUID of the link code repository type | string | Y | len=8 |
| list | Add a list of code repositories | RepoInfo[] | Y | 0<=size<=100 |
| teamUUID | Team UUID | string | Y | |
RepoInfo
Returns
BatchRepoResponse
| Param | Description | Type | Required |
|---|
| successCount | the number of successfully added repositories | int | Y |
| failureCount | the number of failures added repositories | int | Y |
| Responses | the detail info of add repositories | RepoResponse[] | Y |
RepoResponse
| Param | Description | Type | Required |
|---|
| success | whether succeed | boolean | Y |
| uri | repository uri | string | Y |
| namespace | repository namespace | string | Y |
| name | repository name | string | Y |
| repoUUID | repository UUID | string | Y |
| error | error detail | string | N |
Example
import { addRepos } from '@ones-op/node-ability'
const toolUUID: string = 'xxx';
const list: AddRepoInfo[] = [...];
const teamUUID: string = 'xxx';
const batchResponse = await addRepos(toolUUID, list, teamUUID);
queryRepo
query linked single code repository
- Added in:
v0.4.0+
- ONES Requirement:
v3.13.9+
Params
| Param | Description | Type | Required | value range |
|---|
| toolUUID | UUID of the link code repository type | string | Y | len=8 |
| teamUUID | Team UUID (mandatory for organization-level plugins, optional for team-level plugins) | string | N | len=8 |
| uri | repository URI | string | Y | len<=100 |
| namespace | repository namespace | string | Y | len<=256 |
| name | repository name | string | Y | len<=256 |
Returns
RepoInfo
| Param | Description | Type | Required |
|---|
| repoUUID | repository UUID | string | Y |
| userUUID | linked repository user UUID | string | Y |
| uri | repository URI | string | Y |
| namespace | repository namespace | string | Y |
| name | repository name | string | Y |
| certificationtype | authentication type (enum: OAUTH、PASSWORD、TOKEN、NONE、OTHER) | enum | Y |
Example
import { queryRepo } from '@ones-op/node-ability'
const toolUUID = 'xxx'
const uri = 'xxx'
const namespace = 'xxx'
const name = 'xxx'
const teamUUID = 'xxx'
const repoInfo = await queryRepo(toolUUID, uri, namespace, name, teamUUID)
queryRepos
query all linked code repositories
- Added in:
v0.4.0+
- ONES Requirement:
v3.13.9+
Params
| Param | Description | Type | Required | value range |
|---|
| toolUUID | UUID of the link code repository type | string | Y | len=8 |
| teamUUID | Team UUID | string | Y | len=8 |
Returns
RepoInfo[]
| Param | Description | Type | Required |
|---|
| repoUUID | repository UUID | string | Y |
| userUUID | linked repository user UUID | string | Y |
| uri | repository URI | string | Y |
| namespace | repository namespace | string | Y |
| name | repository name | string | Y |
| certificationtype | authentication type (enum: OAUTH、PASSWORD、TOKEN、NONE、OTHER) | enum | Y |
Example
import { queryRepos } from '@ones-op/node-ability'
const toolUUID = 'xxx'
const teamUUID = 'xxx'
const repoInfos = await queryRepos(toolUUID, teamUUID)
addRepoCommits
add repo commits
- Added in:
v0.4.0+
- ONES Requirement:
v3.13.9+
Params
| Param | Description | Type | Required | value range |
|---|
| toolUUID | UUID of the link code repository type | string | Y | len=8 |
| repoUUID | UUID of the code repository | string | Y | len=8 |
| teamUUID | Team UUID | string | Y | len=8 |
| list | Add a list of code commits | RepoCommit[] | Y | 0<=size<=100 |
RepoCommit
| Param | Description | Type | Required | value range |
|---|
| hash | commit unique identifier | string | Y | len<=48 |
| author | commit author | string | Y | len<=128 |
| message | commit message | string | Y | - |
| branch | commit branch | string | Y | len<=128 |
| url | commit web url | string | Y | len<=2048 |
| createAt | commit timestamp (unit: second) | int64 | Y | min=1 |
| statsTotal | Statistics affect the total number of rows | int64 | N | max=2147483647 |
| statsAdditions | Count the total number of rows affected by adding statistics | int64 | N | max=2147483647 |
| statsDeletions | Count the total number of rows affected by deletion | int64 | N | max=2147483647 |
Example
import { addRepoCommits } from '@ones-op/node-ability'
const toolUUID: string = 'xxx';
const repoUUID: string = 'xxx';
const list: AddRepoInfo[] = [...];
const teamUUID: string = 'xxx'
await addRepoCommits(toolUUID, repoUUID, list, teamUUID)
addRepoPullRequest
add single repo pull request (support for add and update)
- Added in:
v0.4.0+
- ONES Requirement:
v3.13.9+
Params
| Param | Description | Type | Required | value range |
|---|
| toolUUID | UUID of the link code repository type | string | Y | len=8 |
| repoUUID | UUID of the code repository | string | Y | len=8 |
| teamUUID | Team UUID | string | Y | len=8 |
| pr | pull request info | RepoPullRequest | Y | - |
RepoPullRequest
| Param | Description | Type | Required | value range |
|---|
| number | pr unique identifier | number | Y | max=2147483647 |
| action | pr action (enum: UPDATE、CLOSE、ADD、REOPEN、MERGE) | enum | Y | - |
| author | pr author | string | Y | len<=128 |
| title | pr title | string | Y | len<=256 |
| url | pr web url | string | Y | len<=1024 |
| fromBranch | pr source branch | string | Y | len<=128 |
| toBranch | pr dest branch | string | Y | len<=128 |
| createAt | pr timestamp (unit: second) | int64 | Y | min=1 |
| state | pr state (enum: OPEN、MERGED、CLOSED) | enum | Y | - |
| reviewers | pr reviewers | string array | N | len<=1024 |
| updateAt | last update pr timestamp (unit: second) | int64 | N | min=1 |
| updateUser | last updat pr user name | string | N | len<=128 |
Example
import { addRepoPullRequest } from '@ones-op/node-ability'
const toolUUID: string = 'xxx'
const repoUUID: string = 'xxx'
const pullRequest: RepoPullRequest = '{...}'
const teamUUID: string = 'xxx'
await addRepoPullRequest(toolUUID, repoUUID, pullRequest, teamUUID)
Notify
Send third-party notification information to specific users.
Params
| Param | Description | Type | Required | Default |
|---|
| Title | information title | string | Y | - |
| ToUsers | Array of users to receive notifications | string[] | Y | - |
| NotifyWay | Notification type, optional values: - Email: NotifyWay.Email - Lark: NotifyWay.Lark - YouDu: NotifyWay.YouDu - WeCom: NotifyWay.WeChat - DingTalk: NotifyWay.DingDing | NotifyWay | Y | - |
| MessageBody | Array of message bodies, each message body contains: - Body: notification content - url:notification jump link | IMessageBody[] | Y | - |
| Ext | Extension field | string | Y | - |
| Source | Source, for the record | string | Y | - |
Example
import { Notify, NotifyWay } from '@ones-op/node-ability'
export async function sendEmail(request: PluginRequest): Promise<PluginResponse> {
const { user_uuid } = request?.body as any
if (!user_uuid) {
return {
body: {
error: 'Missing parameters user_uuid',
},
}
}
const NotifyRes = await Notify({
Title: 'Test',
ToUsers: [user_uuid],
NotifyWay: NotifyWay.Email,
MessageBody: [
{
Body: 'Email sending test',
Url: 'https://ones.com/',
},
],
Ext: 'ext string',
Source: 'source string',
})
return {
body: {
NotifyRes: NotifyRes,
data: 'success',
},
}
}
Plugin.getPluginUser
Get information about the plugin super admin
Params
| Param | Description | Type | Required | Default |
|---|
| teamUUID | The uuid of the team | string | Y | - |
Returns
| Param | Description |
|---|
| user_uuid | User's uuid |
| org_uuid | The uuid of the organization the plugin belongs to |
| team_uuid | The uuid of the team the plugin belongs to |
| app_uuid | The app_id of the plugin |
| instance_uuid | The id of the plugin instance |
| name | Username |
| email | User email |
Example
import { Plugin } from '@ones-op/node-ability'
const teamUUID = 'xxx'
const user = await Plugin.getPluginUser(teamUUID)
Field. FieldsAdd
Add script-field to issue
Params
| Param | Description | Type | Required | Default |
|---|
| Name | field name | string | Y | - |
| Type | script-field type - 1001: single-selectionion - 1002: multiple-selection | int | Y | - |
Returns
| Param | Description | Type |
|---|
| UUID | uuid for script-field | string |
Example
const FieldsAddRes = await Field.FieldsAdd({
Name: 'task_field',
Type: 1001,
})
if (FieldsAddRes.Error) {
throw new Error('Failed to create field')
}
const { UUID: fieldUUID } = FieldsAddRes
Field. ItemsAdd
Add project script-field
Params
| Param | Description | Type | Required | Default |
|---|
| FieldType | script-field type - FieldTypeEnum.SingleLabel : single-selectionion - FieldTypeEnum.MultiLabel : multiple-selection | string | Y | - |
| Name | Field name | string | Y | - |
| ItemType | Fixed value: field | string | Y | - |
| Pool | Fixed value: PoolEnum.Project : project | string | Y | - |
| ContextType | context type | string | Y | - |
| required | Is it required | bool | Y | - |
Returns
| Param | Description | Type |
|---|
| UUID | uuid for script-field | string |
Example
const ItemsAddProjectRes = await Field.ItemsAdd({
FieldType: FieldTypeEnum.SingleLabel,
Name: 'project_field',
ItemType: 'field',
Pool: PoolEnum.Project,
ContextType: 'team',
Required: false,
})
if (ItemsAddProjectRes.Error) {
throw new Error('Failed to create field')
}
const { UUID: fieldUUID } = ItemsAddProjectRes
Field. AddGroupField
Add field group to entity
Params
| Param | Description | Type | Required | Default |
|---|
| ObjectType | The entity type of the FieldGroup, optional value: - PoolEnum.Project : project - PoolEnum.Task : issue | string | Y | - |
| Name | FieldGroup name | string | Y | - |
| Relations | Relationship information array | IRelationMessage[] | Y | - |
IRelationMessage
| Param | Description | Type |
|---|
| FieldUUID | The fieldUUID of the field | string |
| FieldParentUUID | The parent field UUID , indicating that it forms a hierarchical relationship with this field | string |
| Position | Position : the position in the fieldgroup | string |
Returns
| Param | Description | Type |
|---|
| GroupUUID | script-field group uuid | string[] |
Example
const relateionsTask: any[] = []
fieldUUIDs.forEach((fieldUUID, index) => {
const relation = {
FieldUUID: fieldUUID,
FieldParentUUID: '',
Position: index,
}
relateionsTask.push(relation)
})
const AddGroupFieldRes = await Field.AddGroupField({
ObjectType: PoolEnum.Task,
Name: 'issueFieldGroup',
Relations: relateionsTask,
})
Field.UpdateFieldGroup
- Added in:
v0.8.0+
- ONES Requirement:
v3.16.18+
Update attribute group
Params
Field.Relation parameter introduction
| Parameters | Type | Description |
|---|
| FieldUUID | string | Script property fieldUUID |
| FieldParentUUID | string | Script attribute parent node fieldUUID |
| Position | int | Order in property configuration |
Field.UpdateFieldGroupRequest parameter introduction
| Parameters | Type | Description |
|---|
| TeamUUID | string | Teamuuid |
| Relations | []Relation | New association |
| ObjectType | PoolEnum | The type to which the property group belongs |
| GroupUUID | string | Modified attribute group UUID |
| Name | string | Attribute group name |
Returns
| Parameters | Type | Description |
|---|
| jobUUID | string | When the attribute group needs to complete the attribute configuration operation, an asynchronous task will be generated to complete the event, which can be queried by jobID |
| status | string | Update result. When it is "success", it means the update has been successful. When it is "waiting", it means that a task with complete attribute configuration is generated. You can query the result by querying the asynchronous task sdk |
Error
| errcode | reason | level | statusCode |
|---|
| FieldGroupNotFound | FieldGroupNotFound | error | 404 |
| FieldNotFound | FieldNotFound | error | 404 |
| UpdateFieldGroupJobAlreadyExists | UpdateFieldGroupJobAlreadyExists | error | 400 |
Example
import type {
Relation,
UpdateFieldGroupRequest,
UpdateScriptFieldRequest,
} from '@ones-op/node-ability'
import { Field, FieldTypeEnum, PoolEnum, AbilityError } from '@ones-op/node-ability'
import { Logger } from '@ones-op/node-logger'
import type { PluginRequest, PluginResponse } from '@ones-op/node-types'
export async function checkJobStatus(request: PluginRequest): Promise<PluginResponse> {
const status = await Field.CheckUpdateFieldGroupJobStatus('jobUUID', 'teamUUID')
return {
body: {
res: 'hello world',
requestBody: resp,
},
}
}
Field.UpdateScriptField
- Added in:
v0.8.0+
- ONES Requirement:
v3.16.18+
Update script properties
Params
Field.UpdateScriptFieldRequest parameter introduction
| Parameters | Type | Description |
|---|
| Pool | string | The context to which the script attribute belongs, including products, projects, and work items |
| FieldUUID | string | Script attribute UUID |
| TeamUUID | string | UUID of the team to which the attribute belongs |
| Name | string | The new name of the script property |
Error
| errcode | reason | level | statusCode |
|---|
| FieldNotFound | FieldNotFound | error | 404 |
| FieldNameConflict | FieldNameConflict | error | 400 |
Example
import type {
Relation,
UpdateFieldGroupRequest,
UpdateScriptFieldRequest,
} from '@ones-op/node-ability'
import { Field, FieldTypeEnum, PoolEnum, AbilityError } from '@ones-op/node-ability'
import { Logger } from '@ones-op/node-logger'
import type { PluginRequest, PluginResponse } from '@ones-op/node-types'
export async function updateFieldName(request: PluginRequest): Promise<PluginResponse> {
const u: UpdateScriptFieldRequest = {
Pool: PoolEnum.Product,
FieldUUID: 'fieldUUID',
TeamUUID: 'teamUUID',
Name: 'newFieldName',
}
try {
const resp = await Field.UpdateScriptField(u)
} catch (e) {
if (e instanceof AbilityError) {
Logger.error('err', e)
}
}
return {
body: {
res: 'hello world',
},
}
}
Job.CheckJobStatus
- Added in:
v0.8.0+
- ONES Requirement:
v3.16.18+
Query asynchronous task status
Request result parameter introduction
| Parameters | Type | Description |
|---|
| jobUUID | string | When the attribute group needs to complete the attribute configuration operation, an asynchronous task will be generated to complete the event. At this time, a jobID will be returned to represent the task |
| teamUUID | string | UUID of the team to which the job belongs |
Return
| Parameters | Type | Description |
|---|
| status | string | Task status, there are three states: "success", "waiting", and "fail", which represent success, incomplete, and failure respectively |
Error
| errcode | reason | level | statusCode |
|---|
| JobNotFound | JobNotFound | error | 404 |
Example
import type {
Relation,
UpdateFieldGroupRequest,
UpdateScriptFieldRequest,
} from '@ones-op/node-ability'
import { Field, FieldTypeEnum, PoolEnum, AbilityError } from '@ones-op/node-ability'
import { Logger } from '@ones-op/node-logger'
import type { PluginRequest, PluginResponse } from '@ones-op/node-types'
export async function checkJobStatus(request: PluginRequest): Promise<PluginResponse> {
const status = await Field.CheckJobStatus('jobUUID', 'teamUUID')
return {
body: {
res: 'hello world',
requestBody: resp,
},
}
}
PluginFile.uploadFile
Upload files to issue attachments
Params
| Param | Description | Type | Required | Default |
|---|
| filePath | file address, the path under the workspace directory | string | Y | - |
| referenceID | uuid of the issue | string | Y | - |
| desc | file description | string | Y | - |
| teamUUID | uuid of the team | string | Y | - |
Returns
| Param | Description | Type |
|---|
| hash | hash value of the file | string |
| url | file download url | string |
| name | file name | string |
| size | file size | int |
| mime | file type | string |
| version | file version | int |
Example
const file = await PluginFile.uploadFile('files/test.txt', 'taskuuid', 'desc', 'teamUUID')
Process.create
Create a progress manager.
Params
| Param | Description | Type | Required | Default |
|---|
| processType | type of Progress Manager,Optional values: Download Progress Manager:ProcessType.DownloadFile Datasync Progress Manager:ProcessType.DataSync | string | Y | - |
| userUUID | uuid of user | string | Y | - |
| title | title of progress | LanguagePkg | Y | - |
| timeoutSeconds | Timeout limit, if the Progress Manager is not completed within the time limit, it fails. | number | N | 60(s) |
| moduleID | moduleID of Progress Manager(only applicable to Datasync Progress Manager) | string | N | - |
| teamUUID | uuid of the team which the Progress Manager belongs,only if the plugin is used at the organizational level | string | N | - |
LanguagePkg
| Param | Description | Type | Required | Default |
|---|
| zh | Chinese title | string | Y | - |
| en | English title | string | Y | - |
Returns
| Param | Description | Type |
|---|
| processUUID | the uuid of Progress Manager | string |
Error
| errcode | reason | level | statusCode |
|---|
| InvalidParameter | Invalid parameter. | error | 400 |
Example
import { Process, LanguagePkg, ProcessType, ProcessResult } from '@ones-op/node-ability'
import type { PluginRequest, PluginResponse } from '@ones-op/node-types'
export async function createProcess(request: PluginRequest): Promise<PluginResponse> {
const { user_uuid, title, timeout } = request?.body as any
const titlePkg: LanguagePkg = {
en: 'process',
zh: title,
}
const processUUID = await Process.create(ProcessType.DownloadFile, user_uuid, titlePkg, timeout)
return {
body: {
process_uuid: processUUID,
},
}
}
import {
Process,
LanguagePkg,
ProcessType,
ProcessResult,
AbilityError,
} from '@ones-op/node-ability'
import type { PluginRequest, PluginResponse } from '@ones-op/node-types'
export async function createProcess(request: PluginRequest): Promise<PluginResponse> {
const { user_uuid, title, timeout } = request?.body as any
const titlePkg: LanguagePkg = {
en: 'process',
zh: title,
}
let processUUID = ''
try {
const processUUID = await Process.create(ProcessType.DownloadFile, user_uuid, titlePkg, timeout)
} catch (e) {
if (e instanceof AbilityError) {
}
}
return {
body: {
process_uuid: processUUID,
},
}
}
Process.update
Update the progress of the progress manager.
Params
| Param | Description | Type | Required | Default |
|---|
| processUUID | uuid of Process Manager | string | Y | - |
| currentSuccessfulCount | current number of completions | number | Y | - |
| currentFailedCount | current number of failures | number | Y | - |
| currentRemainingCount | current remaining number | number | Y | - |
Example
import { Process, LanguagePkg, ProcessType, ProcessResult } from '@ones-op/node-ability'
import type { PluginRequest, PluginResponse } from '@ones-op/node-types'
export async function updateProgress(request: PluginRequest): Promise<PluginResponse> {
const { process_uuid: processUUID } = request?.body as any
const currentSuccessfulCount = 10
const currentFailedCount = 5
const currentRemainingCount = 30
await Process.update(
processUUID,
currentSuccessfulCount,
currentFailedCount,
currentRemainingCount,
)
return {
body: {
status: 'ok',
},
}
}
Process.done
Set progress manager status to completed.
Params
| Param | Description | Type | Required | Default |
|---|
| processUUID | uuid of Process Manager | string | Y | - |
| isSuccess | Success or failure | bool | Y | - |
| resultText | Details | LanguagePkg | Y | - |
| payload | The action at completion | ProcessResult | Y | - |
Returns
| Param | Description | Type | Required | Default |
|---|
| filePath | File path,available when Download Progress Manager | string | N | - |
| data | Extra content,available when Datasync Progress Manager | string | N | - |
Example
import { Process, LanguagePkg, ProcessType, ProcessResult } from '@ones-op/node-ability'
import type { PluginRequest, PluginResponse } from '@ones-op/node-types'
export async function doneProcess(request: PluginRequest): Promise<PluginResponse> {
const { process_uuid: processUUID } = request?.body as any
const resultText: LanguagePkg = {
en: 'content',
zh: '详情内容',
}
const payload: ProcessResult = {
filePath: './plugin.sql',
}
const isSuccess = true
await Process.done(processUUID, isSuccess, resultText, payload)
return {
body: {
status: 'ok',
process_uuid: processUUID,
},
}
}
getUserTeamUUIDsByEmail
Find the user's uuid and list of team uuids based on the user's mailbox.
Params
| Param | Description | Type | Required | Default |
|---|
| email | user email | string | Y | - |
Returns
| Param | Description | Type |
|---|
| user_uuid | user's uuid | string |
| team_uuids | list of uuids of the user's team | string[] |
Example
import { getUserTeamUUIDsByEmail } from '@ones-op/node-ability'
const resp = await getUserTeamUUIDsByEmail('marsdev@ones.com')
getUserTeamUUIDsByIdNumber
Find the user's uuid and the uuid list of the team they belong to based on the user's job number.
Params
| Param | Description | Type | Required | Default |
|---|
| id_number | user ID | string | Y | - |
Returns
| Param | Description | Type |
|---|
| user_uuid | user's uuid | string |
| team_uuids | list of uuids of the user's team | string[] |
Example
import { getUserTeamUUIDsByIdNumber } from '@ones-op/node-ability'
const resp = await getUserTeamUUIDsByIdNumber('123456')
getUserTeamUUIDsByThirdPartyIDAndThirdPartyType
According to the user's third-party system id and third-party system type, find the user's uuid and the uuid list of the team he belongs to.
Params
| Param | Description | Type | Required | Default |
|---|
| third_party_id | user's third party system id | string | Y | - |
| third_party_type | type code of the third party system | number | Y | - |
Returns
| Param | Description | Type |
|---|
| user_uuid | user's uuid | string |
| team_uuids | list of uuids of the user's team | string[] |
Example
import { getUserTeamUUIDsByThirdPartyIDAndThirdPartyType } from '@ones-op/node-ability'
const resp = await getUserTeamUUIDsByThirdPartyIDAndThirdPartyType('12345678', 0)
Type
AbilityError
| Param | Description | Type |
|---|
| level | error level | string |
| reason | error reason | string |
| statusCode | http status code | string |
| errcode | error code | string |