using System; using System.Collections.Generic; using Top.Api; namespace DingTalk.Api { /// /// 基础TOP请求类,存放一些通用的请求参数。 /// public abstract class BaseDingTalkRequest : IDingTalkRequest where T : DingTalkResponse { /// /// HTTP请求URL参数 /// internal TopDictionary otherParams; /// /// HTTP请求头参数 /// private TopDictionary headerParams; private String httpMethod = "POST"; public void AddOtherParameter(string key, string value) { if (this.otherParams == null) { this.otherParams = new TopDictionary(); } this.otherParams.Add(key, value); } public void AddHeaderParameter(string key, string value) { GetHeaderParameters().Add(key, value); } public IDictionary GetHeaderParameters() { if (this.headerParams == null) { this.headerParams = new TopDictionary(); } return this.headerParams; } public abstract string GetApiName(); public abstract string GetApiCallType(); public abstract void Validate(); public abstract IDictionary GetParameters(); public void SetHttpMethod(String httpMethod) { this.httpMethod = httpMethod; } public string GetHttpMethod() { return httpMethod; } } }