Skip to content

JoyMoe/QcloudSharp

Repository files navigation

QcloudSharp: Unoffical Qcloud.com API wrapper for .Net

AppVeyor GitHub license NuGet NuGet netstandard1.6 netstandard2.0 netstandard2.1

中文说明

Installation

To install QcloudSharp, run the following command in the Package Manager Console

PM> Install-Package QcloudSharp

Example

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":"[email protected]","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.

Constants

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

Classes

QcloudClient

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> ...])

ApiResult

public class ApiResult : DynamicObject

Constructors

  • ApiResult()

Properties

  • int Code
  • string Message

Dynamic Properties

  • object Any { Get; Set; }

License

The MIT License

More info see LICENSE