To install QcloudSharp, run the following command in the Package Manager Console
PM> Install-Package QcloudSharp
using QcloudSharp;
using Newtonsoft.Json;
dynamic client = new QcloudClient
{
SecretId = "Your_Secret_Id",
SecretKey = "Your_Secret_Key",
Endpoint = Constants.Endpoint.Trade, // Endpoint can be used as the first argument of Dynamic Methods
Region = Constants.Region.CAN, // Region can be used as the first or second argument of Dynamic Methods
};
var resultString = client.DescribeUserInfo();
// e.g. {"code":0,"message": "","userInfo":{"name":"compName","isOwner":1,"mailStatus":1,"mail":"112233@qq.com","phone":"13811112222"}}
dynamic result = JsonConvert.DeserializeObject<ApiResult>(resultString);
try
{
Console.WriteLine(result.Code);
Console.WriteLine(result.userInfo.name);
Console.WriteLine(result.notExist);
}
catch(Exception ex)
{
Console.WriteLine(ex.message);
}
Or you can have a look at sample.
All Constants are provided by class QcloudSharp.Constants
.
public static class Endpoint // Abbreviation for endpoint domain
Members
- Account
- Batch
- Bgpip
- Bill
- Bm
- Bmeip
- Bmlb
- Bmvpc
- Cbs
- Cdb
- Cdn
- Cmem
- CmqQueue
- CmqTopic
- Cns
- Csec
- Cvm
- Dayu
- Dfw
- Eip
- Image
- Iot
- Kms
- Lb
- Live
- Market
- Mongodb
- Monitor
- Partners
- Redis
- Scaling
- Snapshot
- Sqlserver
- Tdsql
- Tmt
- Trade
- Vod
- Vod2
- Vpc
- Wenzhi
- Wss
- Yunsou
public static class Region // IATA code for Region city
Members
- BJS
bj
- CAN
gz
- CAN1
gzopen
- CKG
cq
- CTU
cd
- FRA
de
- HKG
hk
- SEL
kr
- SHA
sh
- SHA2
shjr
- SIN
sg
- SJC
usw
- SZX2
szjr
- YTO
ca
public class QcloudClient : DynamicObject
Constructors
QcloudClient()
QcloudClient(SecretId, SecretKey)
Properties
- string
SecretId
- string
SecretKey
- string
Region
- string
Endpoint
Methods
void AddParameter(KeyValuePair<string, string>)
void AddParameter(IEnumerable<KeyValuePair<string, string>>)
void ClearParameter()
Submit(string, string, string)
Submit(string, string)
Submit(string)
Dynamic Methods
{Action}([string][, string][, IEnumerable<KeyValuePair<string, string>>])
{Action}([string][, string][, KeyValuePair<string, string> ...])
public class ApiResult : DynamicObject
Constructors
ApiResult()
Properties
- int
Code
- string
Message
Dynamic Properties
- object Any { Get; Set; }
The MIT License
More info see LICENSE