private FreshdeskClient()
 {
     Tickets       = new FreshdeskTicketClient(this);
     Contacts      = new FreshdeskContactClient(this);
     Groups        = new FreshdeskGroupClient(this);
     Agents        = new FreshdeskAgentClient(this);
     Companies     = new FreshdeskCompaniesClient(this);
     Solutions     = new FreshdeskSolutionClient(this);
     TicketFields  = new TicketFieldsClient(this);
     Conversations = new ConversationsClient(this);
     ChannelApi    = new ChannelApiClient(this);
 }
Exemple #2
0
        /// <summary>
        /// Construct a freshdesk client object when you already have access
        /// to HttpClient objects or want to otherwise pool them outside of
        /// this client.
        ///
        /// It is recommended that you use this method in long lived
        /// applications where many of these clients will be created.
        /// </summary>
        /// <param name="httpClient">
        /// A HttpClient object with authentication and
        /// <seealso cref="HttpClient.BaseAddress"/> already set.
        /// </param>
        public FreshdeskClient(HttpClient httpClient)
        {
            if (httpClient == null)
            {
                throw new ArgumentNullException(nameof(httpClient));
            }

            if (string.IsNullOrWhiteSpace(httpClient.BaseAddress?.AbsoluteUri))
            {
                throw new ArgumentOutOfRangeException(nameof(httpClient), httpClient, "The http client must have a base uri set");
            }

            Tickets       = new FreshdeskTicketClient(this);
            Contacts      = new FreshdeskContactClient(this);
            Groups        = new FreshdeskGroupClient(this);
            Agents        = new FreshdeskAgentClient(this);
            Companies     = new FreshdeskCompaniesClient(this);
            Solutions     = new FreshdeskSolutionClient(this);
            TicketFields  = new TicketFieldsClient(this);
            Conversations = new ConversationsClient(this);
            ChannelApi    = new ChannelApiClient(this);

            _httpClient = httpClient;
        }