/// <summary> /// Return the full list of ticket fields /// /// c.f. https://developers.freshdesk.com/api/#list_all_ticket_fields /// </summary> /// /// <param name="cancellationToken"></param> /// /// <returns> /// A list of all configured ticket fields, note that this API is not /// paged so an entire list is returned every time. /// </returns> public async Task <List <TicketField> > ListAllTicketFieldsAsync( CancellationToken cancellationToken = default) { return(await _freshdeskClient .ApiOperationAsync <List <TicketField> >(HttpMethod.Get, "/api/v2/ticket_fields", cancellationToken : cancellationToken) .ConfigureAwait(false)); }
/// <summary> /// Retrieve all details about a single agent by their id. /// /// c.f. https://developers.freshdesk.com/api/#view_agent /// </summary> /// <param name="agentId"> /// The unique identifier for the agent. /// </param> /// /// <param name="cancellationToken"></param> /// /// <returns>The full agent information</returns> public async Task <Agent> ViewAgentAsync( long agentId, CancellationToken cancellationToken = default) { return(await _freshdeskClient .ApiOperationAsync <Agent>(HttpMethod.Get, $"/api/v2/agents/{agentId}", cancellationToken : cancellationToken) .ConfigureAwait(false)); }
/// <summary> /// Retrieve all details about a single group by its id. /// /// c.f. https://developers.freshdesk.com/api/#view_group /// </summary> /// <param name="groupId"> /// The unique identifier for the group. /// </param> /// /// <param name="cancellationToken"></param> /// /// <returns>The full group information</returns> public async Task <Group> ViewGroupAsync( long groupId, CancellationToken cancellationToken = default) { return(await _freshdeskClient .ApiOperationAsync <Group>(HttpMethod.Get, $"/api/v2/groups/{groupId}", cancellationToken : cancellationToken) .ConfigureAwait(false)); }
public async Task <Ticket> CreateTicketAsync( ChannelCreateTicketRequest request, CancellationToken cancellationToken = default) { if (request == null) { throw new ArgumentNullException(nameof(request), "Request must not be null"); } return(await _client .ApiOperationAsync <Ticket, ChannelCreateTicketRequest>(HttpMethod.Post, "/api/channel/v2/tickets", request, cancellationToken) .ConfigureAwait(false)); }
/// <summary> /// Create a reply to a ticket. /// /// c.f. https://developers.freshdesk.com/api/#reply_ticket /// </summary> /// /// <param name="ticketId"> /// The ticket to add the reply to. /// </param> /// /// <param name="request"> /// Defines the set of properties to set on the reply. /// </param> /// /// <param name="cancellationToken"></param> /// /// <returns>The full conversation entry</returns> public async Task <ConversationEntry> CreateReplyAsync( long ticketId, CreateReplyRequest request, CancellationToken cancellationToken = default) { if (request == null) { throw new ArgumentNullException(nameof(request), "Request must not be null"); } return(await _client .ApiOperationAsync <ConversationEntry, CreateReplyRequest>(HttpMethod.Post, $"/api/v2/tickets/{ticketId}/reply", request, cancellationToken) .ConfigureAwait(false)); }
/// <inheritdoc /> public async Task <Models.Me> ViewMeAsync( CancellationToken cancellationToken = default) { return(await _freshdeskClient .ApiOperationAsync <Models.Me>(HttpMethod.Get, $"/api/v2/agents/me", cancellationToken : cancellationToken) .ConfigureAwait(false)); }
/// <inheritdoc /> public async Task <Role> ViewRoleAsync( long roleId, CancellationToken cancellationToken = default) { return(await _freshdeskClient .ApiOperationAsync <Role>(HttpMethod.Get, $"/api/v2/roles/{roleId}", cancellationToken : cancellationToken) .ConfigureAwait(false)); }
/// <inheritdoc /> public async Task <Company> ViewCompanyAsync( long companyId, CancellationToken cancellationToken = default) { return(await _freshdeskClient .ApiOperationAsync <Company>(HttpMethod.Get, $"/api/v2/companies/{companyId}", cancellationToken : cancellationToken) .ConfigureAwait(false)); }
/// <summary> /// Get all information about a single ticket by <see cref="ticketId"/> /// /// c.f. https://developers.freshdesk.com/api/#view_a_ticket /// </summary> /// /// <param name="ticketId"> /// The unique identifier of the ticket. /// </param> /// /// <param name="includes"> /// A set of optional includes which will consume extra API credits to /// retrieve more linked information about the ticket. /// </param> /// /// <param name="cancellationToken"></param> /// /// <returns>The full ticket information</returns> public async Task <Ticket> ViewTicketAsync( long ticketId, TicketIncludes?includes = default, CancellationToken cancellationToken = default) { var url = $"/api/v2/tickets/{ticketId}"; if (includes.HasValue) { url += $"?include={includes}"; } return(await _freshdeskClient .ApiOperationAsync <Ticket>(HttpMethod.Get, url, cancellationToken : cancellationToken) .ConfigureAwait(false)); }
/// <summary> /// Retrieve all details about a single category by its id. /// /// c.f. https://developers.freshdesk.com/api/#solution_category_attributes /// </summary> /// /// <param name="categoryId"> /// The unique identifier for the category. /// </param> /// /// <param name="languageCode"> /// The language code of the language to translate the category into. /// Defaults to null which means don't translate. /// </param> /// /// <param name="cancellationToken"></param> /// /// <returns>The full group information</returns> public async Task <Category> ViewCategoryAsync( long categoryId, string?languageCode = null, CancellationToken cancellationToken = default) { var url = string.IsNullOrWhiteSpace(languageCode) ? $"/api/v2/solutions/categories/{categoryId}" : $"/api/v2/solutions/categories/{categoryId}/{languageCode}"; return(await _freshdeskClient .ApiOperationAsync <Category>(HttpMethod.Get, url, cancellationToken : cancellationToken) .ConfigureAwait(false)); }