Interface IRequest<T>

Type Parameters:
T - the type of object this request will return
All Known Implementing Classes:
AbstractAuthorizationRequest, AbstractDataPagingCursorbasedRequest, AbstractDataPagingRequest, AbstractDataRequest, AbstractRequest, AddItemsToPlaylistRequest, AddItemToUsersPlaybackQueueRequest, AuthorizationCodePKCERefreshRequest, AuthorizationCodePKCERequest, AuthorizationCodeRefreshRequest, AuthorizationCodeRequest, AuthorizationCodeUriRequest, ChangePlaylistsDetailsRequest, CheckCurrentUserFollowsArtistsOrUsersRequest, CheckUsersFollowPlaylistRequest, CheckUsersSavedAlbumsRequest, CheckUsersSavedEpisodesRequest, CheckUsersSavedShowsRequest, CheckUsersSavedTracksRequest, ClientCredentialsRequest, CreatePlaylistRequest, FollowArtistsOrUsersRequest, FollowPlaylistRequest, FollowPlaylistRequest, GetAlbumRequest, GetAlbumsTracksRequest, GetArtistRequest, GetArtistsAlbumsRequest, GetArtistsRelatedArtistsRequest, GetArtistsTopTracksRequest, GetAudioAnalysisForTrackRequest, GetAudioFeaturesForSeveralTracksRequest, GetAudioFeaturesForTrackRequest, GetAvailableGenreSeedsRequest, GetCategoryRequest, GetCategorysPlaylistsRequest, GetCurrentUsersProfileRequest, GetCurrentUsersRecentlyPlayedTracksRequest, GetCurrentUsersSavedAlbumsRequest, GetEpisodeRequest, GetInformationAboutUsersCurrentPlaybackRequest, GetListOfCategoriesRequest, GetListOfCurrentUsersPlaylistsRequest, GetListOfFeaturedPlaylistsRequest, GetListOfNewReleasesRequest, GetListOfUsersPlaylistsRequest, GetPlaylistCoverImageRequest, GetPlaylistRequest, GetPlaylistsItemsRequest, GetRecommendationsRequest, GetSeveralAlbumsRequest, GetSeveralArtistsRequest, GetSeveralEpisodesRequest, GetSeveralShowsRequest, GetSeveralTracksRequest, GetShowRequest, GetShowsEpisodesRequest, GetTheUsersQueueRequest, GetTrackRequest, GetUsersAvailableDevicesRequest, GetUsersCurrentlyPlayingTrackRequest, GetUsersFollowedArtistsRequest, GetUsersProfileRequest, GetUsersSavedEpisodesRequest, GetUsersSavedShowsRequest, GetUsersSavedTracksRequest, GetUsersTopArtistsAndTracksRequest, GetUsersTopArtistsRequest, GetUsersTopTracksRequest, PauseUsersPlaybackRequest, RemoveAlbumsForCurrentUserRequest, RemoveItemsFromPlaylistRequest, RemoveUsersSavedEpisodesRequest, RemoveUsersSavedShowsRequest, RemoveUsersSavedTracksRequest, ReorderPlaylistsItemsRequest, ReplacePlaylistsItemsRequest, SaveAlbumsForCurrentUserRequest, SaveEpisodesForCurrentUserRequest, SaveShowsForCurrentUserRequest, SaveTracksForUserRequest, SearchAlbumsRequest, SearchAlbumsSpecialRequest, SearchArtistsRequest, SearchEpisodesRequest, SearchItemRequest, SearchPlaylistsRequest, SearchShowsRequest, SearchTracksRequest, SeekToPositionInCurrentlyPlayingTrackRequest, SetRepeatModeOnUsersPlaybackRequest, SetVolumeForUsersPlaybackRequest, SkipUsersPlaybackToNextTrackRequest, SkipUsersPlaybackToPreviousTrackRequest, StartResumeUsersPlaybackRequest, ToggleShuffleForUsersPlaybackRequest, TransferUsersPlaybackRequest, UnfollowArtistsOrUsersRequest, UnfollowPlaylistRequest, UnfollowPlaylistRequest, UploadCustomPlaylistCoverImageRequest

public interface IRequest<T>
Interface representing a request to the Spotify Web API.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    Interface for building requests to the Spotify Web API.
  • Method Summary

    Modifier and Type
    Method
    Description
    Execute DELETE request and get JSON response.
    Execute the request synchronously.
    Execute the request asynchronously.
    org.apache.hc.core5.http.HttpEntity
    Get the request body.
    List<org.apache.hc.core5.http.NameValuePair>
    Get the body parameters for this request.
    org.apache.hc.core5.http.ContentType
    Get the content type for this request.
    List<org.apache.hc.core5.http.Header>
    Get the headers for this request.
    Get the HTTP manager for this request.
    Get JSON response as string.
    Get the URI for this request.
    Execute POST request and get JSON response.
    Execute PUT request and get JSON response.
  • Method Details

    • getHttpManager

      IHttpManager getHttpManager()
      Get the HTTP manager for this request.
      Returns:
      The HTTP manager.
    • getUri

      URI getUri()
      Get the URI for this request.
      Returns:
      The request URI.
    • getHeaders

      List<org.apache.hc.core5.http.Header> getHeaders()
      Get the headers for this request.
      Returns:
      List of headers.
    • getContentType

      org.apache.hc.core5.http.ContentType getContentType()
      Get the content type for this request.
      Returns:
      The content type.
    • getBody

      org.apache.hc.core5.http.HttpEntity getBody()
      Get the request body.
      Returns:
      The HTTP entity body.
    • getBodyParameters

      List<org.apache.hc.core5.http.NameValuePair> getBodyParameters()
      Get the body parameters for this request.
      Returns:
      List of body parameters.
    • execute

      T execute() throws IOException, SpotifyWebApiException, org.apache.hc.core5.http.ParseException
      Execute the request synchronously.
      Returns:
      The response.
      Throws:
      IOException - If an I/O error occurs.
      SpotifyWebApiException - If a Spotify Web API error occurs.
      org.apache.hc.core5.http.ParseException - If a parsing error occurs.
    • executeAsync

      CompletableFuture<T> executeAsync()
      Execute the request asynchronously.
      Returns:
      A CompletableFuture for the response.
    • getJson

      String getJson() throws IOException, SpotifyWebApiException, org.apache.hc.core5.http.ParseException
      Get JSON response as string.
      Returns:
      JSON response string.
      Throws:
      IOException - If an I/O error occurs.
      SpotifyWebApiException - If a Spotify Web API error occurs.
      org.apache.hc.core5.http.ParseException - If a parsing error occurs.
    • postJson

      String postJson() throws IOException, SpotifyWebApiException, org.apache.hc.core5.http.ParseException
      Execute POST request and get JSON response.
      Returns:
      JSON response string.
      Throws:
      IOException - If an I/O error occurs.
      SpotifyWebApiException - If a Spotify Web API error occurs.
      org.apache.hc.core5.http.ParseException - If a parsing error occurs.
    • putJson

      String putJson() throws IOException, SpotifyWebApiException, org.apache.hc.core5.http.ParseException
      Execute PUT request and get JSON response.
      Returns:
      JSON response string.
      Throws:
      IOException - If an I/O error occurs.
      SpotifyWebApiException - If a Spotify Web API error occurs.
      org.apache.hc.core5.http.ParseException - If a parsing error occurs.
    • deleteJson

      String deleteJson() throws IOException, SpotifyWebApiException, org.apache.hc.core5.http.ParseException
      Execute DELETE request and get JSON response.
      Returns:
      JSON response string.
      Throws:
      IOException - If an I/O error occurs.
      SpotifyWebApiException - If a Spotify Web API error occurs.
      org.apache.hc.core5.http.ParseException - If a parsing error occurs.