Skip to content

Latest commit

 

History

History
569 lines (450 loc) · 23.8 KB

SpacesApi.md

File metadata and controls

569 lines (450 loc) · 23.8 KB

SpacesApi

All URIs are relative to https://api.twitter.com

Method HTTP request Description
findSpaceById GET /2/spaces/{id} Space lookup by Space ID
findSpacesByCreatorIds GET /2/spaces/by/creator_ids Space lookup by their creators
findSpacesByIds GET /2/spaces Space lookup up Space IDs
searchSpaces GET /2/spaces/search Search for Spaces
spaceBuyers GET /2/spaces/{id}/buyers Retrieve the list of users who purchased a ticket to the given space
spaceTweets GET /2/spaces/{id}/tweets Retrieve tweets from a Space

findSpaceById

SingleSpaceLookupResponse findSpaceById(id, spaceFields, expansions)

Space lookup by Space ID

Returns a variety of information about the Space specified by the requested ID

Example

// Import classes:
import com.twitter.clientlib.ApiClient;
import com.twitter.clientlib.ApiException;
import com.twitter.clientlib.Configuration;
import com.twitter.clientlib.auth.*;
import com.twitter.clientlib.model.*;
import com.twitter.clientlib.TwitterCredentialsOAuth2;
import com.twitter.clientlib.TwitterCredentialsBearer;
import com.twitter.clientlib.api.TwitterApi;

import com.twitter.clientlib.api.SpacesApi;
import java.util.List;
import java.util.Set;
import java.util.Arrays;
import java.util.HashSet;
import java.time.OffsetDateTime;

public class Example {
  public static void main(String[] args) {
    TwitterApi apiInstance = new TwitterApi();
    // Set the credentials based on the API's "security" tag values.
    // Check the API definition in https://api.twitter.com/2/openapi.json
    // When multiple options exist, the SDK supports only "OAuth2UserToken" or "BearerToken"

    // Uncomment and set the credentials configuration
      
    // Configure HTTP bearer authorization:
    // TwitterCredentialsBearer credentials = new TwitterCredentialsBearer(System.getenv("TWITTER_BEARER_TOKEN"));
    // apiInstance.setTwitterCredentials(credentials);

    // Configure OAuth2 access token for authorization:
    // TwitterCredentialsOAuth2 credentials = new TwitterCredentialsOAuth2(System.getenv("TWITTER_OAUTH2_CLIENT_ID"),
    //     System.getenv("TWITTER_OAUTH2_CLIENT_SECRET"),
    //     System.getenv("TWITTER_OAUTH2_ACCESS_TOKEN"),
    //     System.getenv("TWITTER_OAUTH2_REFRESH_TOKEN"));
    // apiInstance.setTwitterCredentials(credentials);

    // Set the params values
    String id = "id_example"; // String | The space id to be retrieved
    Set<String> spaceFields = new HashSet<>(Arrays.asList()); // Set<String> | A comma separated list of Space fields to display.
    Set<String> expansions = new HashSet<>(Arrays.asList()); // Set<String> | A comma separated list of fields to expand.
    try {
           SingleSpaceLookupResponse result = apiInstance.spaces().findSpaceById(id, spaceFields, expansions);
            System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SpacesApi#findSpaceById");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
id String The space id to be retrieved
spaceFields Set<String> A comma separated list of Space fields to display. [optional] [enum: created_at, creator_id, host_ids, invited_user_ids, is_ticketed, lang, participant_count, scheduled_start, speaker_ids, started_at, title, updated_at]
expansions Set<String> A comma separated list of fields to expand. [optional] [enum: creator_id, host_ids, invited_user_ids, speaker_ids]

Return type

SingleSpaceLookupResponse

Authorization

BearerToken, OAuth2UserToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/problem+json

HTTP response details

Status code Description Response headers
200 The request was successful -
0 The request has failed. -

findSpacesByCreatorIds

MultiSpaceLookupResponse findSpacesByCreatorIds(userIds, spaceFields, expansions)

Space lookup by their creators

Returns a variety of information about the Spaces created by the provided User IDs

Example

// Import classes:
import com.twitter.clientlib.ApiClient;
import com.twitter.clientlib.ApiException;
import com.twitter.clientlib.Configuration;
import com.twitter.clientlib.auth.*;
import com.twitter.clientlib.model.*;
import com.twitter.clientlib.TwitterCredentialsOAuth2;
import com.twitter.clientlib.TwitterCredentialsBearer;
import com.twitter.clientlib.api.TwitterApi;

import com.twitter.clientlib.api.SpacesApi;
import java.util.List;
import java.util.Set;
import java.util.Arrays;
import java.util.HashSet;
import java.time.OffsetDateTime;

public class Example {
  public static void main(String[] args) {
    TwitterApi apiInstance = new TwitterApi();
    // Set the credentials based on the API's "security" tag values.
    // Check the API definition in https://api.twitter.com/2/openapi.json
    // When multiple options exist, the SDK supports only "OAuth2UserToken" or "BearerToken"

    // Uncomment and set the credentials configuration
      
    // Configure HTTP bearer authorization:
    // TwitterCredentialsBearer credentials = new TwitterCredentialsBearer(System.getenv("TWITTER_BEARER_TOKEN"));
    // apiInstance.setTwitterCredentials(credentials);

    // Configure OAuth2 access token for authorization:
    // TwitterCredentialsOAuth2 credentials = new TwitterCredentialsOAuth2(System.getenv("TWITTER_OAUTH2_CLIENT_ID"),
    //     System.getenv("TWITTER_OAUTH2_CLIENT_SECRET"),
    //     System.getenv("TWITTER_OAUTH2_ACCESS_TOKEN"),
    //     System.getenv("TWITTER_OAUTH2_REFRESH_TOKEN"));
    // apiInstance.setTwitterCredentials(credentials);

    // Set the params values
    List<String> userIds = Arrays.asList(); // List<String> | The users to search through
    Set<String> spaceFields = new HashSet<>(Arrays.asList()); // Set<String> | A comma separated list of Space fields to display.
    Set<String> expansions = new HashSet<>(Arrays.asList()); // Set<String> | A comma separated list of fields to expand.
    try {
           MultiSpaceLookupResponse result = apiInstance.spaces().findSpacesByCreatorIds(userIds, spaceFields, expansions);
            System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SpacesApi#findSpacesByCreatorIds");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
userIds List<String> The users to search through
spaceFields Set<String> A comma separated list of Space fields to display. [optional] [enum: created_at, creator_id, host_ids, invited_user_ids, is_ticketed, lang, participant_count, scheduled_start, speaker_ids, started_at, title, updated_at]
expansions Set<String> A comma separated list of fields to expand. [optional] [enum: creator_id, host_ids, invited_user_ids, speaker_ids]

Return type

MultiSpaceLookupResponse

Authorization

BearerToken, OAuth2UserToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/problem+json

HTTP response details

Status code Description Response headers
200 The request was successful -
0 The request has failed. -

findSpacesByIds

MultiSpaceLookupResponse findSpacesByIds(ids, spaceFields, expansions)

Space lookup up Space IDs

Returns a variety of information about the Spaces specified by the requested IDs

Example

// Import classes:
import com.twitter.clientlib.ApiClient;
import com.twitter.clientlib.ApiException;
import com.twitter.clientlib.Configuration;
import com.twitter.clientlib.auth.*;
import com.twitter.clientlib.model.*;
import com.twitter.clientlib.TwitterCredentialsOAuth2;
import com.twitter.clientlib.TwitterCredentialsBearer;
import com.twitter.clientlib.api.TwitterApi;

import com.twitter.clientlib.api.SpacesApi;
import java.util.List;
import java.util.Set;
import java.util.Arrays;
import java.util.HashSet;
import java.time.OffsetDateTime;

public class Example {
  public static void main(String[] args) {
    TwitterApi apiInstance = new TwitterApi();
    // Set the credentials based on the API's "security" tag values.
    // Check the API definition in https://api.twitter.com/2/openapi.json
    // When multiple options exist, the SDK supports only "OAuth2UserToken" or "BearerToken"

    // Uncomment and set the credentials configuration
      
    // Configure HTTP bearer authorization:
    // TwitterCredentialsBearer credentials = new TwitterCredentialsBearer(System.getenv("TWITTER_BEARER_TOKEN"));
    // apiInstance.setTwitterCredentials(credentials);

    // Configure OAuth2 access token for authorization:
    // TwitterCredentialsOAuth2 credentials = new TwitterCredentialsOAuth2(System.getenv("TWITTER_OAUTH2_CLIENT_ID"),
    //     System.getenv("TWITTER_OAUTH2_CLIENT_SECRET"),
    //     System.getenv("TWITTER_OAUTH2_ACCESS_TOKEN"),
    //     System.getenv("TWITTER_OAUTH2_REFRESH_TOKEN"));
    // apiInstance.setTwitterCredentials(credentials);

    // Set the params values
    List<String> ids = Arrays.asList(); // List<String> | A list of space ids
    Set<String> spaceFields = new HashSet<>(Arrays.asList()); // Set<String> | A comma separated list of Space fields to display.
    Set<String> expansions = new HashSet<>(Arrays.asList()); // Set<String> | A comma separated list of fields to expand.
    try {
           MultiSpaceLookupResponse result = apiInstance.spaces().findSpacesByIds(ids, spaceFields, expansions);
            System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SpacesApi#findSpacesByIds");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
ids List<String> A list of space ids
spaceFields Set<String> A comma separated list of Space fields to display. [optional] [enum: created_at, creator_id, host_ids, invited_user_ids, is_ticketed, lang, participant_count, scheduled_start, speaker_ids, started_at, title, updated_at]
expansions Set<String> A comma separated list of fields to expand. [optional] [enum: creator_id, host_ids, invited_user_ids, speaker_ids]

Return type

MultiSpaceLookupResponse

Authorization

BearerToken, OAuth2UserToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/problem+json

HTTP response details

Status code Description Response headers
200 The request was successful -
0 The request has failed. -

searchSpaces

MultiSpaceLookupResponse searchSpaces(query, state, maxResults, spaceFields, expansions)

Search for Spaces

Returns Spaces that match the provided query.

Example

// Import classes:
import com.twitter.clientlib.ApiClient;
import com.twitter.clientlib.ApiException;
import com.twitter.clientlib.Configuration;
import com.twitter.clientlib.auth.*;
import com.twitter.clientlib.model.*;
import com.twitter.clientlib.TwitterCredentialsOAuth2;
import com.twitter.clientlib.TwitterCredentialsBearer;
import com.twitter.clientlib.api.TwitterApi;

import com.twitter.clientlib.api.SpacesApi;
import java.util.List;
import java.util.Set;
import java.util.Arrays;
import java.util.HashSet;
import java.time.OffsetDateTime;

public class Example {
  public static void main(String[] args) {
    TwitterApi apiInstance = new TwitterApi();
    // Set the credentials based on the API's "security" tag values.
    // Check the API definition in https://api.twitter.com/2/openapi.json
    // When multiple options exist, the SDK supports only "OAuth2UserToken" or "BearerToken"

    // Uncomment and set the credentials configuration
      
    // Configure HTTP bearer authorization:
    // TwitterCredentialsBearer credentials = new TwitterCredentialsBearer(System.getenv("TWITTER_BEARER_TOKEN"));
    // apiInstance.setTwitterCredentials(credentials);

    // Configure OAuth2 access token for authorization:
    // TwitterCredentialsOAuth2 credentials = new TwitterCredentialsOAuth2(System.getenv("TWITTER_OAUTH2_CLIENT_ID"),
    //     System.getenv("TWITTER_OAUTH2_CLIENT_SECRET"),
    //     System.getenv("TWITTER_OAUTH2_ACCESS_TOKEN"),
    //     System.getenv("TWITTER_OAUTH2_REFRESH_TOKEN"));
    // apiInstance.setTwitterCredentials(credentials);

    // Set the params values
    String query = "crypto"; // String | The search query
    String state = "live"; // String | The state of spaces to search for
    Integer maxResults = 56; // Integer | The number of results to return. The maximum for this value is 100.
    Set<String> spaceFields = new HashSet<>(Arrays.asList()); // Set<String> | A comma separated list of Space fields to display.
    Set<String> expansions = new HashSet<>(Arrays.asList()); // Set<String> | A comma separated list of fields to expand.
    try {
           MultiSpaceLookupResponse result = apiInstance.spaces().searchSpaces(query, state, maxResults, spaceFields, expansions);
            System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SpacesApi#searchSpaces");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
query String The search query
state String The state of spaces to search for [optional] [default to all] [enum: live, scheduled, all]
maxResults Integer The number of results to return. The maximum for this value is 100. [optional]
spaceFields Set<String> A comma separated list of Space fields to display. [optional] [enum: created_at, creator_id, host_ids, invited_user_ids, is_ticketed, lang, participant_count, scheduled_start, speaker_ids, started_at, title, updated_at]
expansions Set<String> A comma separated list of fields to expand. [optional] [enum: creator_id, host_ids, invited_user_ids, speaker_ids]

Return type

MultiSpaceLookupResponse

Authorization

BearerToken, OAuth2UserToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/problem+json

HTTP response details

Status code Description Response headers
200 The request was successful -
0 The request has failed. -

spaceBuyers

MultiUserLookupResponse spaceBuyers(id, userFields)

Retrieve the list of users who purchased a ticket to the given space

Retrieves the list of users who purchased a ticket to the given space

Example

// Import classes:
import com.twitter.clientlib.ApiClient;
import com.twitter.clientlib.ApiException;
import com.twitter.clientlib.Configuration;
import com.twitter.clientlib.auth.*;
import com.twitter.clientlib.model.*;
import com.twitter.clientlib.TwitterCredentialsOAuth2;
import com.twitter.clientlib.TwitterCredentialsBearer;
import com.twitter.clientlib.api.TwitterApi;

import com.twitter.clientlib.api.SpacesApi;
import java.util.List;
import java.util.Set;
import java.util.Arrays;
import java.util.HashSet;
import java.time.OffsetDateTime;

public class Example {
  public static void main(String[] args) {
    TwitterApi apiInstance = new TwitterApi();
    // Set the credentials based on the API's "security" tag values.
    // Check the API definition in https://api.twitter.com/2/openapi.json
    // When multiple options exist, the SDK supports only "OAuth2UserToken" or "BearerToken"

    // Uncomment and set the credentials configuration
      
    // Configure HTTP bearer authorization:
    // TwitterCredentialsBearer credentials = new TwitterCredentialsBearer(System.getenv("TWITTER_BEARER_TOKEN"));
    // apiInstance.setTwitterCredentials(credentials);

    // Configure OAuth2 access token for authorization:
    // TwitterCredentialsOAuth2 credentials = new TwitterCredentialsOAuth2(System.getenv("TWITTER_OAUTH2_CLIENT_ID"),
    //     System.getenv("TWITTER_OAUTH2_CLIENT_SECRET"),
    //     System.getenv("TWITTER_OAUTH2_ACCESS_TOKEN"),
    //     System.getenv("TWITTER_OAUTH2_REFRESH_TOKEN"));
    // apiInstance.setTwitterCredentials(credentials);


    // Set the params values
    String id = "1YqKDqWqdPLsV"; // String | The space id from which tweets will be retrieved
    Set<String> userFields = new HashSet<>(Arrays.asList()); // Set<String> | A comma separated list of User fields to display.
    try {
           MultiUserLookupResponse result = apiInstance.spaces().spaceBuyers(id, userFields);
            System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SpacesApi#spaceBuyers");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
id String The space id from which tweets will be retrieved
userFields Set<String> A comma separated list of User fields to display. [optional] [enum: id, created_at, name, username, protected, verified, withheld, profile_image_url, location, url, description, entities, pinned_tweet_id, public_metrics]

Return type

MultiUserLookupResponse

Authorization

BearerToken, OAuth2UserToken, UserToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/problem+json

HTTP response details

Status code Description Response headers
200 The request was successful -
0 The request has failed. -

spaceTweets

MultiTweetLookupResponse spaceTweets(maxResults, id, tweetFields)

Retrieve tweets from a Space

Retrieves tweets shared in the specified space

Example

// Import classes:
import com.twitter.clientlib.ApiClient;
import com.twitter.clientlib.ApiException;
import com.twitter.clientlib.Configuration;
import com.twitter.clientlib.auth.*;
import com.twitter.clientlib.model.*;
import com.twitter.clientlib.TwitterCredentialsOAuth2;
import com.twitter.clientlib.TwitterCredentialsBearer;
import com.twitter.clientlib.api.TwitterApi;

import com.twitter.clientlib.api.SpacesApi;
import java.util.List;
import java.util.Set;
import java.util.Arrays;
import java.util.HashSet;
import java.time.OffsetDateTime;

public class Example {
  public static void main(String[] args) {
    TwitterApi apiInstance = new TwitterApi();
    // Set the credentials based on the API's "security" tag values.
    // Check the API definition in https://api.twitter.com/2/openapi.json
    // When multiple options exist, the SDK supports only "OAuth2UserToken" or "BearerToken"

    // Uncomment and set the credentials configuration
      
    // Configure HTTP bearer authorization:
    // TwitterCredentialsBearer credentials = new TwitterCredentialsBearer(System.getenv("TWITTER_BEARER_TOKEN"));
    // apiInstance.setTwitterCredentials(credentials);

    // Configure OAuth2 access token for authorization:
    // TwitterCredentialsOAuth2 credentials = new TwitterCredentialsOAuth2(System.getenv("TWITTER_OAUTH2_CLIENT_ID"),
    //     System.getenv("TWITTER_OAUTH2_CLIENT_SECRET"),
    //     System.getenv("TWITTER_OAUTH2_ACCESS_TOKEN"),
    //     System.getenv("TWITTER_OAUTH2_REFRESH_TOKEN"));
    // apiInstance.setTwitterCredentials(credentials);

    // Set the params values
    Integer maxResults = 56; // Integer | The number of tweets to fetch from the provided space. If not provided, the value will default to the maximum of 100
    String id = "1YqKDqWqdPLsV"; // String | The space id from which tweets will be retrieved
    Set<String> tweetFields = new HashSet<>(Arrays.asList()); // Set<String> | A comma separated list of Tweet fields to display.
    try {
           MultiTweetLookupResponse result = apiInstance.spaces().spaceTweets(maxResults, id, tweetFields);
            System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SpacesApi#spaceTweets");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
maxResults Integer The number of tweets to fetch from the provided space. If not provided, the value will default to the maximum of 100 [optional]
id String The space id from which tweets will be retrieved
tweetFields Set<String> A comma separated list of Tweet fields to display. [optional] [enum: id, created_at, text, author_id, in_reply_to_user_id, referenced_tweets, attachments, withheld, geo, entities, public_metrics, possibly_sensitive, source, lang, context_annotations, non_public_metrics, promoted_metrics, organic_metrics, conversation_id, reply_settings]

Return type

MultiTweetLookupResponse

Authorization

BearerToken, OAuth2UserToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/problem+json

HTTP response details

Status code Description Response headers
200 The request was successful -
0 The request has failed. -