MyNixOS website logo
Description

Secure and Intuitive Access to 'Plug' Interface.

Provides a secure and user-friendly interface to interact with the 'Plug' <https://plugbytpf.com.br> 'API'. It enables developers to store and manage tokens securely using the 'keyring' package, retrieve data from 'API' endpoints with the 'httr2' package, and handle large datasets with chunked data fetching. Designed for simplicity and security, the package facilitates seamless integration with 'Plug' ecosystem.

plug plug website

The Plug API Integration Package provides an intuitive and secure interface to interact with the Plug API. It enables developers to store user credentials securely, fetch data using custom SQL queries, and manage authentication tokens automatically.

Note: To access the Plug API, you must have valid credentials (username and password) provided by the API administrators.

Note: Plug uses Microsoft SQL as its database system, so SQL queries must adhere to Microsoft SQL Server syntax (e.g., SELECT TOP 1 instead of LIMIT).

Installation

You can install the development version of the package directly from GitHub:

# Install devtools if not already installed
install.packages("devtools")

# Install the package
devtools::install_github("StrategicProjects/plug")

Features

  • Secure Credential Storage: Safely store and retrieve user credentials with keyring.
  • Token Management: Automatically handle API token generation and expiration.
  • Query Execution: Execute custom SQL queries securely using the Plug API.
  • Data Download: Retrieve all data from specific tables with ease.

Getting Started

Before using the package, you need to store your Plug API credentials securely:

# Store your username and password
plug_store_credentials("your_username", "your_password")

Fetching a Token

The package automatically fetches and caches an authentication token. If you need to retrieve it manually, use:

# Fetch a valid token
token <- plug_get_valid_token()

Listing Stored Credentials and Tokens

You can list stored credentials and tokens:

# List credentials
credentials <- plug_list_credentials()
print(credentials)

# List tokens
tokens <- plug_list_tokens()
print(tokens)

Executing SQL Queries

ou can execute custom SQL queries on the Plug API:

# Example: Execute a query
data <- plug_execute_query(sql_template = "SELECT * FROM Contratos_VIEW LIMIT 1")
# Example: Download All Data from a Table
data <- plug_download_base(base_name = "Contratos_VIEW")
print(data)

Development

This package is under active development. Contributions are welcome! If you encounter any issues, please open an issue on GitHub.

License

This package is licensed under the MIT License.

Metadata

Version

0.1.0

License

Unknown

Platforms (76)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows