Class SendonContacts

java.lang.Object
io.sendon.base.SendonClient
io.sendon.contacts.SendonContacts

public class SendonContacts extends SendonClient
SendonContacts provides methods to interact with the Sendon Contacts API. It allows adding, retrieving, and deleting phone numbers from the blocklist.
  • Constructor Details

    • SendonContacts

      public SendonContacts(String userId, String apiKey)
      Initializes the SendonContacts client with user credentials.
      Parameters:
      userId - The user ID for authentication.
      apiKey - The API key for authentication.
    • SendonContacts

      public SendonContacts(String userId, String apiKey, boolean useOkHttp)
      Initializes the SendonContacts client with user credentials and an option to use OkHttp.
      Parameters:
      userId - The user ID for authentication.
      apiKey - The API key for authentication.
      useOkHttp - Whether to use OkHttp for HTTP requests.
  • Method Details

    • addBlocklist

      public AddBlocklist addBlocklist(String phoneNumber)
      Adds a phone number to the blocklist.
      Parameters:
      phoneNumber - The phone number to be added to the blocklist.
      Returns:
      An AddBlocklist object containing the API response, or null if an error occurs.
    • addBlocklist

      public AddBlocklist addBlocklist(String phoneNumber, String messageType, String senderNumber, String kakaoChannelId, String rcsChatbotId, String rcsBrandId)
      Adds a phone number to the blocklist with optional parameters.
      Parameters:
      phoneNumber - The phone number to be added to the blocklist.
      messageType - The message type (SMS, KAKAO, RCS). Default is SMS.
      senderNumber - The sender number to block from.
      kakaoChannelId - The Kakao channel ID for Kakao message blocking.
      rcsChatbotId - The RCS chatbot ID for RCS message blocking.
      rcsBrandId - The RCS brand ID for RCS message blocking.
      Returns:
      An AddBlocklist object containing the API response, or null if an error occurs.
    • addBlocklist

      public AddBlocklist addBlocklist(CreateBlocklistRequest request)
      Adds a phone number to the blocklist using a request object.
      Parameters:
      request - The CreateBlocklistRequest object containing all parameters.
      Returns:
      An AddBlocklist object containing the API response, or null if an error occurs.
    • getBlocklist

      public GetBlocklist getBlocklist(int cursor, int limit)
      Retrieves the blocklist with pagination support.
      Parameters:
      cursor - The cursor for pagination.
      limit - The maximum number of entries to retrieve.
      Returns:
      A GetBlocklist object containing the API response, or null if an error occurs.
    • getBlocklist

      public GetBlocklist getBlocklist(String senderNumber, String[] kakaoChannelIds, String[] blockTypes, String startDate, String endDate, Integer cursor, Integer limit)
      Retrieves the blocklist with advanced filtering and pagination support.
      Parameters:
      senderNumber - Filter by specific sender number.
      kakaoChannelIds - Array of Kakao channel IDs to filter by.
      blockTypes - Array of block types (WEB, API, ARS) to filter by.
      startDate - Start date for filtering (YYYY-MM-DD HH:mm:ss format).
      endDate - End date for filtering (YYYY-MM-DD HH:mm:ss format).
      cursor - The cursor for pagination (default: 0).
      limit - The maximum number of entries to retrieve (default: 20).
      Returns:
      A GetBlocklist object containing the API response, or null if an error occurs.
    • getBlocklist

      public GetBlocklist getBlocklist(GetBlocklistRequest request)
      Retrieves the blocklist using a request object.
      Parameters:
      request - The GetBlocklistRequest object containing all filter and pagination parameters.
      Returns:
      A GetBlocklist object containing the API response, or null if an error occurs.
    • deleteBlocklist

      public DeleteBlocklist deleteBlocklist(long blocklistId)
      Deletes a phone number from the blocklist by its block ID.
      Parameters:
      blocklistId - The ID of the blocklist entry to delete.
      Returns:
      A DeleteBlocklist object containing the API response, or null if an error occurs.
    • createBlocklistBuilder

      public static ContactBuilder.CreateBlocklistBuilder createBlocklistBuilder()
      Creates a new builder for creating blocklist entries. Provides a fluent API for configuring blocklist creation requests.
      Returns:
      A new ContactBuilder.CreateBlocklistBuilder instance.
    • getBlocklistBuilder

      public static ContactBuilder.GetBlocklistBuilder getBlocklistBuilder()
      Creates a new builder for retrieving blocklist entries. Provides a fluent API for configuring blocklist retrieval requests with filtering and pagination.
      Returns:
      A new ContactBuilder.GetBlocklistBuilder instance.