示例#1
0
        private void InitEndpoints(FreshdeskConfigInternal config)
        {
            var settings = new JsonSerializerSettings
            {
                ContractResolver = new FreshdeskContractResolver(config),
            };

            Contacts  = new FreshdeskContactsEndpoint(config, _httpClient, settings);
            Companies = new FreshdeskCompaniesEndpoint(config, _httpClient, settings);
            Tickets   = new FreshdeskTicketsEndpoint(config, _httpClient, settings);
        }
        private List <string> GetNonSerializableTicketProps(FreshdeskConfigInternal config)
        {
            var props = new List <string> {
                "id", "deleted", "created_at", "updated_at", "fwd_emails",
                "reply_cc_emails", "to_emails", "fr_escalated", "spam",
                "is_escalated", "description_text", "attachments"
            };

            if (!config.MultiCompanySupport)
            {
                props.Add("company_id");
            }
            return(props);
        }
        private static List <string> GetNonSerializableContactProps(FreshdeskConfigInternal config)
        {
            var props = new List <string> {
                "id", "deleted", "created_at", "updated_at"
            };

            if (!config.MultiCompanySupport)
            {
                props.Add("other_companies");
            }
            if (!config.MultiLanguageSupport)
            {
                props.Add("language");
            }
            if (!config.MultiTimeZoneSupport)
            {
                props.Add("time_zone");
            }
            return(props);
        }
示例#4
0
 internal FreshdeskContactsEndpoint(FreshdeskConfigInternal config, FreshdeskHttpClient httpClient, JsonSerializerSettings serializationSettings)
 {
     _apiBaseUri            = config.ApiBaseUri;
     _httpClient            = httpClient;
     _serializationSettings = serializationSettings;
 }
 public FreshdeskContractResolver(FreshdeskConfigInternal config)
 {
     _nonSerializableContactProps = GetNonSerializableContactProps(config);
     _nonSerializableCompanyProps = GetNonSerializableCompanyProps();
     _nonSerializableTicketProps  = GetNonSerializableTicketProps(config);
 }
示例#6
0
 public FreshdeskClient(FreshdeskConfig config)
 {
     _httpClient = InitHttpClient(config);
     InitEndpoints(FreshdeskConfigInternal.FromConfig(config));
 }