trem_get: Perform a GET request to Tremendous API

Description Usage Arguments Value Examples

View source: R/func_get.R

Description

This function provides lower-level access to perform GET requests via Tremendous API. Available endpoints can be found on the official Tremendous API documentation.

Usage

1
2
3
4
5
6
7
8
trem_get(
  client,
  path,
  query = list(),
  disk = NULL,
  stream = NULL,
  parse = TRUE
)

Arguments

client

A Tremendous API Client object, created with trem_client_new.

path

The URL path, appended to the base URL, for GET requests such as listing available payment types, funding sources, account members, and more. See the Tremendous API Documentation for examples.

query

Query terms as a named list. See crul::HttpClient for more details.

disk

A path to write to. NULL by default, so info is written to memory. See crul::HttpClient for more details.

stream

An R function to determine how to stream data. NULL by default, so info is streaned with memory. See crul::HttpClient for more details.

parse

Logical: Should the API Response results be parsed into a data frame?

Value

If parse = TRUE (default), a list containing the response from the API request. Otherwise, the R6 HttpResponse object containing API request data.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
## Not run: 

# Create a new Tremendous API Client
test_client <- trem_client_new(api_key = "TEST_YOUR-API-KEY-HERE",
sandbox = TRUE) # Sandbox environment so no actual money is sent

# Perform a GET request to list funding sources available in your Tremendous
# Account. Documentation:
# https://developers.tremendous.com/reference/core-funding-source-index
trem_get(trem_client, "funding_sources")

# Perform a GET request to list all invoices on your Tremendous Account.
# Documentation:
# https://developers.tremendous.com/reference/core-invoices-index
trem_get(trem_client, "invoices")

# Perform a GET request to list all orders (payment history) on your Tremendous
# Account. Documentation:
# https://developers.tremendous.com/reference/core-orders-index
trem_get(trem_client, "orders")

# Perform a GET request to list a specific order's information (payment history)
# from your Tremendous Account. Documentation:
# https://developers.tremendous.com/reference/core-orders-show
trem_get(trem_client, "orders/YOUR-ORDER-ID")

  
## End(Not run)

tremendousr documentation built on Sept. 30, 2021, 5:09 p.m.