c# - 如何使用 ApiClient.Default.CallApi()?
问题描述
查看 Autodesk.Forge 参考属性,我发现了一个名为 CallApiAsync() 的方法,我想用它来发送请求,例如GET
Autodesk BIM 360 项目的属性。
以下是 CallApiAsync() 使用的参数,但有人可以解释它们每个是什么以及null
我不需要的参数如何?
CallApiAsync(string path,
RestSharp.Method method,
System.Collections.Generic.Dictionary<string, string> queryParams,
object postBody,
System.Collections.Generic.Dictionary<string, string> headerParams,
System.Collections.Generic.Dictionary<string, string> formParams,
System.Collections.Generic.Dictionary<string, RestSharp.FileParameter> fileParams,
System.Collections.Generic.Dictionary<string, string> pathParams,
string contentType)
解决方案
如果您在此处查看源代码,它不会真正检查 null 或回退到任何默认值,因此您需要为不需要的 args 提供一个空值,例如
CallApiAsync(“Your:Api/path/”, Method.GET, new Dictionary<string,string>(), new {}, ...)
推荐阅读
- big-o - 从伪代码中判断它是哪个 Big-O 的规则是什么?
- android - 非初始化进程/文件的 SElinux 域转换(Android Natvie)
- c# - 为什么 PictureBox.Invalidate() 会导致程序崩溃?System.AccessViolationException
- javascript - 单击以在两个列表之间交换元素
- php - 从 php 表中从选中的复选框中检索数据
- mysql - 进房限制DB
- c++ - mysql C 连接器函数在类中定义时不起作用
- java - 在二维数组中找到最小值
- python - 我可以将 one-hot 编码向量而不是原始句子直接输入 PYTHON 模块 word2vec.Word2Vec 吗?
- javascript - Jquery通过选择选项数据值设置标记位置