本文整理匯總了TypeScript中rcf.AuthorizedRestApi.%24F方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript AuthorizedRestApi.%24F方法的具體用法?TypeScript AuthorizedRestApi.%24F怎麽用?TypeScript AuthorizedRestApi.%24F使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類rcf.AuthorizedRestApi
的用法示例。
在下文中一共展示了AuthorizedRestApi.%24F方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1:
import * as FormData from 'form-data';
import * as rcf from 'rcf';
import * as fs from 'fs';
import * as path from 'path';
let configFile = (process.argv.length < 3 ? path.join(__dirname, '../client_test_config.json') : process.argv[2]);
let connectOptions: rcf.ApiInstanceConnectOptions = JSON.parse(fs.readFileSync(configFile, 'utf8'));
let $driver = $node.get();
let api = new rcf.AuthorizedRestApi($driver, rcf.AuthorizedRestApi.connectOptionsToAccess(connectOptions));
//let form = new FormData();
let form: FormData = $driver.createFormData();
form.append('FirstName', 'Wen');
form.append('LastName', 'Chang');
form.append("Myfile[]", fs.createReadStream('C:/tmp/signedcorrected 4506-T.pdf'), 'signedcorrected 4506-T.pdf');
form.append("Myfile[]", fs.createReadStream('C:/tmp/polaris.txt'), 'polaris.txt');
api.$F("POST", '/services/upload/file_upload', form)
.then((ret: rcf.RESTReturn) => {
console.log(JSON.stringify(ret, null, 2));
}).catch((err: any) => {
console.error("!!! Error: " + JSON.stringify(err));
});
api.$F("POST", '/services/upload/s3_upload', form)
.then((ret: rcf.RESTReturn) => {
console.log(JSON.stringify(ret, null, 2));
}).catch((err: any) => {
console.error("!!! Error: " + JSON.stringify(err));
});