Skip to content

Class astrea::snapshot::SpaceTrackClient

ClassList > astrea > snapshot > SpaceTrackClient

SpaceTrackClient class for interacting with the SpaceTrack API.More...

  • #include <SpaceTrackClient.hpp>

Public Types

Type Name
enum EnumType Action
Enumeration for the different actions that can be performed in SpaceTrack.
enum EnumType Controller
Enumeration for the different controllers available in SpaceTrack.
enum EnumType PublicFilesClass
Enumeration for the different classes of public files available in SpaceTrack.
typedef std::variant< SpaceDataClass, PublicFilesClass > RequestClass
Type alias for the request class, which can be either SpaceDataClass or PublicFilesClass.
enum EnumType SpaceDataClass
Enumeration for the different classes of space data available in SpaceTrack.

Public Functions

Type Name
SpaceTrackClient () = default
Default constructor for SpaceTrackClient .
void login (const std::string & username, const std::string & password)
Logs in to the SpaceTrack API.
nlohmann::json query (const std::string & username, const std::string & password, const Controller & controller=Controller::BASIC_SPACE_DATA, const Action & action=Action::QUERY, const RequestClass & requestClass=SpaceDataClass::GP, const std::vector< std::pair< std::string, std::string >> predicates={})
Queries the SpaceTrack API for data.
nlohmann::json retrieve_all (const std::string & username, const std::string & password)
Retrieves all data from the SpaceTrack API.
~SpaceTrackClient () = default
Default destructor for SpaceTrackClient .

Detailed Description

This class provides methods to login, query data, and retrieve information from the SpaceTrack API. It supports various controllers and actions to access different types of space data.

Note:

WARNING: Do NOT use this for automated scripts. I have NOT setup a check to make sure we're within the automated script limits and you could get your SpaceTrack account banned.

Public Types Documentation

enum Action

Enumeration for the different actions that can be performed in SpaceTrack.

enum astrea::snapshot::SpaceTrackClient::Action {
    QUERY,
    MODEL_DEF
};

This enumeration defines the various actions that can be performed when querying data from the SpaceTrack API.


enum Controller

Enumeration for the different controllers available in SpaceTrack.

enum astrea::snapshot::SpaceTrackClient::Controller {
    BASIC_SPACE_DATA,
    PUBLIC_FILES
};

This enumeration defines the various controllers that can be used to access different types of data from the SpaceTrack API.


enum PublicFilesClass

Enumeration for the different classes of public files available in SpaceTrack.

enum astrea::snapshot::SpaceTrackClient::PublicFilesClass {
    DIRS,
    DOWNLOAD,
    FILES,
    LOAD_PUBLIC_DATA
};

This enumeration defines the various classes of public files that can be accessed from the SpaceTrack API.


typedef RequestClass

Type alias for the request class, which can be either SpaceDataClass or PublicFilesClass.

using astrea::snapshot::SpaceTrackClient::RequestClass =  std::variant<SpaceDataClass, PublicFilesClass>;

This type alias allows for a unified way to handle different types of requests in the SpaceTrackClient.


enum SpaceDataClass

Enumeration for the different classes of space data available in SpaceTrack.

enum astrea::snapshot::SpaceTrackClient::SpaceDataClass {
    ANNOUNCEMENT,
    BOX_SCORE,
    CDM_PUBLIC,
    DECAY,
    GP,
    GP_HISTORY,
    LAUNCH_SITE,
    SATCAT,
    SATCAT_CHANGE,
    SATCAT_DEBUT,
    TIP
};

This enumeration defines the various classes of space data that can be queried from the SpaceTrack API.


Public Functions Documentation

function SpaceTrackClient

Default constructor for SpaceTrackClient .

astrea::snapshot::SpaceTrackClient::SpaceTrackClient () = default

Initializes the SpaceTrackClient instance.


function login

Logs in to the SpaceTrack API.

void astrea::snapshot::SpaceTrackClient::login (
    const std::string & username,
    const std::string & password
) 

This function authenticates the user with the SpaceTrack API using the provided username and password.

Parameters:

  • username The username for the SpaceTrack account.
  • password The password for the SpaceTrack account.

function query

Queries the SpaceTrack API for data.

nlohmann::json astrea::snapshot::SpaceTrackClient::query (
    const std::string & username,
    const std::string & password,
    const Controller & controller=Controller::BASIC_SPACE_DATA,
    const Action & action=Action::QUERY,
    const RequestClass & requestClass=SpaceDataClass::GP,
    const std::vector< std::pair< std::string, std::string >> predicates={}
) 

This function sends a query to the SpaceTrack API using the specified parameters and returns the response as a JSON object.

Parameters:

  • username The username for the SpaceTrack account.
  • password The password for the SpaceTrack account.
  • controller The controller to use for the query.
  • action The action to perform (e.g., QUERY, MODEL_DEF).
  • requestClass The class of data to request (e.g., GP, SATCAT).
  • predicates Optional predicates to filter the query results.

Returns:

A JSON object containing the query results.


function retrieve_all

Retrieves all data from the SpaceTrack API.

nlohmann::json astrea::snapshot::SpaceTrackClient::retrieve_all (
    const std::string & username,
    const std::string & password
) 

This function retrieves all data available in the SpaceTrack API for the specified user.

Parameters:

  • username The username for the SpaceTrack account.
  • password The password for the SpaceTrack account.

Returns:

A JSON object containing all available data.


function ~SpaceTrackClient

Default destructor for SpaceTrackClient .

astrea::snapshot::SpaceTrackClient::~SpaceTrackClient () = default

Cleans up the SpaceTrackClient instance.



The documentation for this class was generated from the following file astrea/snapshot/snapshot/http-queries/spacetrack/SpaceTrackClient.hpp