"use strict";(self.webpackChunkdocs_site=self.webpackChunkdocs_site||[]).push([[2475],{1432:(e,s,t)=>{t.r(s),t.d(s,{assets:()=>c,contentTitle:()=>o,default:()=>u,frontMatter:()=>i,metadata:()=>n,toc:()=>l});const n=JSON.parse('{"id":"XXTLanControl.lua/assist/create","title":"Create an Assist Request (LCC.assist.create)","description":"Declaration","source":"@site/i18n/en/docusaurus-plugin-content-docs/current/XXTLanControl.lua/assist/create.md","sourceDirName":"XXTLanControl.lua/assist","slug":"/XXTLanControl.lua/assist/create","permalink":"/docs/en/XXTLanControl.lua/assist/create","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":20,"frontMatter":{"sidebar_position":20},"sidebar":"tutorialSidebar","previous":{"title":"Common Options and Return Objects","permalink":"/docs/en/XXTLanControl.lua/assist/common-options"},"next":{"title":"Wait for an Assist Result (LCC.assist.wait)","permalink":"/docs/en/XXTLanControl.lua/assist/wait"}}');var r=t(4848),a=t(8453);const i={sidebar_position:20},o="Create an Assist Request (LCC.assist.create)",c={},l=[{value:"Declaration",id:"declaration",level:2},{value:"Parameters",id:"parameters",level:2},{value:"Return Values",id:"return-values",level:2},{value:"Notes",id:"notes",level:2},{value:"Example",id:"example",level:2}];function d(e){const s={a:"a",blockquote:"blockquote",br:"br",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(s.header,{children:(0,r.jsx)(s.h1,{id:"create-an-assist-request-lccassistcreate",children:"Create an Assist Request (LCC.assist.create)"})}),"\n",(0,r.jsx)(s.h2,{id:"declaration",children:"Declaration"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-lua",children:"task, err = LCC.assist.create(options)\n"})}),"\n",(0,r.jsx)(s.h2,{id:"parameters",children:"Parameters"}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsxs)(s.li,{children:["options",(0,r.jsx)(s.br,{}),"\n","Table. Assist request configuration. See ",(0,r.jsx)(s.a,{href:"/docs/en/XXTLanControl.lua/assist/common-options",children:"Common Options and Return Objects"}),"."]}),"\n"]}),"\n",(0,r.jsx)(s.h2,{id:"return-values",children:"Return Values"}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsxs)(s.li,{children:["task",(0,r.jsx)(s.br,{}),"\n","Table or ",(0,r.jsx)(s.code,{children:"nil"}),". The control-center task object on success."]}),"\n",(0,r.jsxs)(s.li,{children:["err",(0,r.jsx)(s.br,{}),"\n","String or ",(0,r.jsx)(s.code,{children:"nil"}),". Failure reason."]}),"\n"]}),"\n",(0,r.jsx)(s.h2,{id:"notes",children:"Notes"}),"\n",(0,r.jsxs)(s.blockquote,{children:["\n",(0,r.jsxs)(s.p,{children:["Creates the task only and does not wait for a human result.",(0,r.jsx)(s.br,{}),"\n","If ",(0,r.jsx)(s.code,{children:"screenshotLocalPath"})," is provided, the SDK uploads the local device screenshot before creating the task.",(0,r.jsx)(s.br,{}),"\n","If ",(0,r.jsx)(s.code,{children:"screenshotImage"})," or ",(0,r.jsx)(s.code,{children:"screenshotImageData"})," is provided, the SDK converts it to a data URL and sends it in the request body without saving a file first.",(0,r.jsx)(s.br,{}),"\n","After successful creation, the task is tracked as an unfinished request for the current script and can later be cleaned up by ",(0,r.jsx)(s.code,{children:"cancel_all()"}),".",(0,r.jsx)(s.br,{}),"\n","Script-created tasks automatically set ",(0,r.jsx)(s.code,{children:"deviceId = device.udid()"})," and ",(0,r.jsx)(s.code,{children:'source = "lua-script"'}),"."]}),"\n"]}),"\n",(0,r.jsx)(s.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-lua",children:'local task, err = LCC.assist.create({\n    type = "control",\n    title = "Handle verification",\n    text = "Remote-control the device, finish the current verification, then click Done",\n    timeout = 300,\n})\n\nif not task then\n    nLog("failed to create assist request", err)\n    return\nend\n\nlocal result, waitErr = LCC.assist.wait(task.id, 300, 1000)\nif not result then\n    nLog("assist request not completed", waitErr)\nend\n'})})]})}function u(e={}){const{wrapper:s}={...(0,a.R)(),...e.components};return s?(0,r.jsx)(s,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,s,t)=>{t.d(s,{R:()=>i,x:()=>o});var n=t(6540);const r={},a=n.createContext(r);function i(e){const s=n.useContext(a);return n.useMemo(function(){return"function"==typeof e?e(s):{...s,...e}},[s,e])}function o(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),n.createElement(a.Provider,{value:s},e.children)}}}]);