Skip to content
/ XCLI Public
generated from genyleap/Project-Template

XCLI is a command-line interface (CLI) tool for interacting with the Twitter API. It allows developers to perform actions such as authenticating via OAuth 2.0, retrieving information from API endpoints, and working with Twitter Spaces. This project is designed with a focus on simplicity, modularity, and extensibility.

License

Notifications You must be signed in to change notification settings

genyleap/XCLI

Repository files navigation

XCLI

XCLI is a command-line interface (CLI) tool for interacting with the Twitter API. It allows developers to perform actions such as authenticating via OAuth 2.0, retrieving information from API endpoints, and working with Twitter Spaces. This project is designed with a focus on simplicity, modularity, and extensibility.

Features

  • OAuth 2.0 Authentication: Securely authenticate with Twitter using bearer tokens.
  • Custom API Requests: Perform GET requests to specified Twitter API endpoints with query parameters.
  • Twitter Spaces: Fetch detailed information about Twitter Spaces by providing a Space ID.
  • Extensive Logging: Provides formatted error and info logs for better debugging and user feedback.

Requirements

  • C++ Compiler: A modern C++ compiler with support for C++20 or higher (e.g., GCC 10+, Clang 12+, or MSVC 2019+).
  • Dependencies:
  • Build Tools:
    • CMake for building the project.

Installation

Clone the Repository

git clone https://github.com/genyleap/XCLI.git
cd XCLI

Build the Project

  1. Create a build directory:

    mkdir build && cd build
  2. Run CMake to configure the build:

    cmake ..
  3. Build the project:

    cmake --build .

Usage

Basic Command Structure

xcli <command> [options]

Available Commands

  • auth: Authenticate with Twitter using OAuth 2.0.

    xcli auth
  • get: Perform a GET request to a specified API endpoint.

    xcli get <endpoint> [key=value ...]

    Example:

    xcli get /2/users/by/username/johndoe user.fields=id,name,username
  • space: Fetch information about a Twitter Space using its Space ID.

    xcli space <space_id>

    Example:

    xcli space 1vOGwMNOZXYxB

Example Output

Authentication successful.
Tokens saved successfully to "auth_tokens.json".

API Response:
{
    "data": {
        "id": "1vOGwMNOZXYxB",
        "title": "Tech Talks",
        "host_ids": ["123456789"],
        "participant_count": 150,
        "created_at": "2024-12-15T10:00:00Z"
    }
}

Project Structure

XCLI/
├── source/               # Source code files & Header files
│   └── xcli.hpp    # Declaration of XCLI class
│   ├── xcli.cpp    # Main implementation of XCLI
│   └── ...
├── third-party/          # Third-party dependencies (e.g., JSON library)
├── CMakeLists.txt        # CMake configuration
└── README.md             # Project documentation

Configuration

Modify the following constants in xcli.hpp as needed:

  • tokenFile: Path to the JSON file where authentication tokens are stored.

Contributing

Contributions are welcome! If you have ideas or improvements, feel free to submit a pull request or open an issue.

Steps to Contribute

  1. Fork the repository.
  2. Create a new branch:
    git checkout -b feature/your-feature
  3. Commit your changes:
    git commit -m "Add your feature description"
  4. Push to your fork:
    git push origin feature/your-feature
  5. Submit a pull request.

License

This project is licensed under the MIT License.

Acknowledgments

About

XCLI is a command-line interface (CLI) tool for interacting with the Twitter API. It allows developers to perform actions such as authenticating via OAuth 2.0, retrieving information from API endpoints, and working with Twitter Spaces. This project is designed with a focus on simplicity, modularity, and extensibility.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published