本文整理汇总了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));
});