public Api SalesLeadRequestAddInfo(string authToken) { var apiDesc = Global.ApiExplorer.ApiDescriptions.FirstOrDefault(x => x.RelativePath.Equals(ApiObject.Route + "/" + this.ActionContext.ActionDescriptor.ActionName.Replace("Info", ""))); if (apiDesc == null) { throw new Exception("Failed to find ApiDescription for " + this.ActionContext.ActionDescriptor.ActionName); } var endPoint = new Api(apiDesc); ClassMappingUtilities.SetNullOrEmptyOnlyPropertiesForTarget(ApiObject, endPoint); endPoint.Servers = ApiObject.Servers ?? ApiObject.SetServer(this.Request.RequestUri, Common.Global.LocalServerName, Common.Global.ServerStatusType); endPoint.ResponseQuoteObjectType = null; return(endPoint); }
//Static constructor is used to initialize any static data or to perform a particular action that needs to be preformed once only static NewLeadsController() { #region API object ApiObject = new Api(); ClassMappingUtilities.SetPropertiesForTarget(Global.ApiObject, ApiObject); ApiObject.WebServiceName = "NewLeads"; ApiObject.ApiName += ".Leads"; ApiObject.RoutePrefix = Global.ApiObject.RoutePrefix.Replace("{version}", Global.ApiObject.Versions.LastOrDefault()?.MajorVersionId.ToString() + ".0"); //don't specify the minor verison in routing... ApiObject.Route = "{endpoint}/{authToken}"; ApiObject.RequestObjectType = typeof(ALeadsRequest); ApiObject.RequestObjectType = typeof(ALeadsResponse); ApiObject.ResponsePostbackObjectType = null; ApiObject.RateLimited = true; ApiObject.Versions = Global.ApiObject.Versions; #endregion }