Convert an object into an object with a rapid-style class.
Usage
as_api_object(
x,
target_class,
...,
alternate_names = NULL,
arg = caller_arg(x),
call = caller_env()
)
Arguments
- x
The object to coerce. Must be empty, or be a named list or character vector having names corresponding to the parameter of the
target_class
, or names that can be coerced to those names viasnakecase::to_snake_case()
. Extra names are ignored.- target_class
The S7 class to which the object should be converted.
- ...
These dots are for future extensions and must be empty.
- alternate_names
Character vector (optional). An optional named character vector, where the names are the names as they might appear in
x
, and the values are the corresponding properties.- arg
An argument name as a string. This argument will be mentioned in error messages as the input that is at the origin of a problem.
- call
The execution environment of a currently running function, e.g.
caller_env()
. The function will be mentioned in error messages as the source of the error. See thecall
argument ofabort()
for more information.
See also
rapid object
as_rapid()
,
class_rapid()
,
expand_servers()