api_schema: api_schema

api_schemaR Documentation

api_schema

Description

R6 class for handling the NAMC graphql schema

Value

a namc_oauth2 class (R6 class)

Super class

NAMCr::base_class -> api_schema

Public fields

tpl_pagination_first

is the numeric first record to return

tpl_pagination_offset

is the numeric offset of the return

tpl_pagination_cursor

is the cursor used to fetch data at

tpl_page_fieldname

is the name of the field holding page data

required_kind

is string value of required argument kind

singular_kind

is string value of singular argument kind

array_kind

is string value of array argument kind Parse the API types

Methods

Public methods

Inherited methods

Method configure()

Usage
api_schema$configure()
Returns

api_schema For method chaining

Examples
types = ( namc_api$new(argList=...) )$get_api_types()
schema = api_schema$new(types = types)
schema$configure()

Parse introspected schema


Method parse_endpoints()

Usage
api_schema$parse_endpoints()
Returns

api_schema For method chaining

Examples
types = ( namc_api$new(argList=...) )$get_api_types()
schema = api_schema$new(types = types)
schema$parse_endpoints()

Discover info on API endpoint


Method parse_endpoint()

Usage
api_schema$parse_endpoint(endpoint, special_type = NA)
Arguments
endpoint

Name of API endpoint to discover

special_type

Name of the type of the API endpoint

Returns

list Info structure of API details

Examples
types = ( namc_api$new(argList=...) )$get_api_types()
schema = api_schema$new(types = types)
schema$parse_endpoint("siteInfo","Query")

Check if argument is numeric


Method is_arg_numeric()

Usage
api_schema$is_arg_numeric(endpoint, argname)
Arguments
endpoint

String name of api endpoint

argname

String name of api endpoint argument

Returns

logical TRUE/FALSE if argument is numeric

Check if argument is numeric


Method is_arg_boolean()

Usage
api_schema$is_arg_boolean(endpoint, argname)
Arguments
endpoint

String name of api endpoint

argname

String name of api endpoint argument

Returns

logical TRUE/FALSE if argument is numeric

Get the sub-type contained within an api endpoint


Method get_special_type_from_endpoint()

Usage
api_schema$get_special_type_from_endpoint(endpoint)
Arguments
endpoint

String name of api endpoint

Determine if an endpoint has an edge


Method has_edge()

Usage
api_schema$has_edge(endpoint)
Arguments
endpoint

String name of api endpoint

Get the name of the graphql edge contained in an endpoint


Method get_edge_name()

Usage
api_schema$get_edge_name(endpoint)
Arguments
endpoint

String name of api endpoint

Returns

String name of endpoint edge

Get all available endpoint names


Method get_endpoints()

Usage
api_schema$get_endpoints()
Returns

Array of endpoint names

Get info about an endpoint


Method get_endpoint()

Usage
api_schema$get_endpoint(endpoint)
Arguments
endpoint

String name of api endpoint

Get all available field names for an endpoint


Method get_fields()

Usage
api_schema$get_fields(endpoint)
Arguments
endpoint

String name of api endpoint

Get info about an endpoint field


Method get_field()

Usage
api_schema$get_field(endpoint, field)
Arguments
endpoint

String name of api endpoint

field

String name for a field of the endpoint

Get all arguments for and endpoint


Method get_arguments()

Usage
api_schema$get_arguments(endpoint, no_paging = FALSE)
Arguments
endpoint

String name of api endpoint

no_paging

Get info about an argument


Method get_argument()

Usage
api_schema$get_argument(endpoint, argname)
Arguments
endpoint

String name of api endpoint

argname

Checks if an argument is required


Method is_argument_required()

Usage
api_schema$is_argument_required(endpoint, argname)
Arguments
endpoint

String name of api endpoint

argname

Checks if argument name is valid for an endpoint


Method is_argument()

Usage
api_schema$is_argument(endpoint, argname)
Arguments
endpoint

String name of api endpoint

argname

Check if endpoint exists


Method is_endpoint()

Usage
api_schema$is_endpoint(endpoint)
Arguments
endpoint

String name of api endpoint

Describe an Endpoint.


Method info()

info prints text to the console describing an endpoint

Usage
api_schema$info(endpoint, no_paging = FALSE, format = "text")
Arguments
endpoint

api endpoint name to get information about.

no_paging

Logical that omits the paging arguments by default

format

One of: 'markdown', 'text' (default) argument inclusion

Details

This function presents a text block describing an endpoint and its corresponding input parameters. Inputs are marked as required where applicable.

Examples
info()


Method clone()

The objects of this class are cloneable with this method.

Usage
api_schema$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples


types = ( namc_api$new(argList=...) )$get_api_types()
schema = api_schema$new(types = types)


## ------------------------------------------------
## Method `api_schema$configure`
## ------------------------------------------------


types = ( namc_api$new(argList=...) )$get_api_types()
schema = api_schema$new(types = types)
schema$configure()

Parse introspected schema


## ------------------------------------------------
## Method `api_schema$parse_endpoints`
## ------------------------------------------------


types = ( namc_api$new(argList=...) )$get_api_types()
schema = api_schema$new(types = types)
schema$parse_endpoints()

Discover info on API endpoint


## ------------------------------------------------
## Method `api_schema$parse_endpoint`
## ------------------------------------------------


types = ( namc_api$new(argList=...) )$get_api_types()
schema = api_schema$new(types = types)
schema$parse_endpoint("siteInfo","Query")

Check if argument is numeric


## ------------------------------------------------
## Method `api_schema$info`
## ------------------------------------------------


info()


namc-utah/NAMCr documentation built on Feb. 12, 2024, 4:29 a.m.