@@ -1434,3 +1434,174 @@ get_content_packages <- function(content) {
14341434 res <- content $ packages()
14351435 parse_connectapi_typed(res , connectapi_ptypes $ content_packages )
14361436}
1437+
1438+ # ' Search for content on the Connect server
1439+ # '
1440+ # ' @param client A Connect object
1441+ # ' @param q The search query, using the syntax described in the Connect
1442+ # ' documentation on [content search
1443+ # ' terms](https://docs.posit.co/connect/user/viewing-content/#searching-content)
1444+ # ' @param page_number Integer. The page to return relative to the given `page_size`.
1445+ # ' Must be greater than 0.
1446+ # ' @param page_size Integer. The number of items to include in each page. This
1447+ # ' parameter is "best effort" since there may not be enough results to honor the
1448+ # ' request. If `page_size` is less than 1 or greater than 500, an error will be
1449+ # ' returned.
1450+ # ' @param include Comma-separated character string of values indicating additional
1451+ # ' details to include in the response. Values can be `owner` and `vanity_url`;
1452+ # ' both are included by default.
1453+ # ' @param ... Extra arguments. Currently not used.
1454+ # '
1455+ # ' @return
1456+ # ' A list containing sub-fields:
1457+ # ' * `total`: The total number of results.
1458+ # ' * `results`: A list of lists representing content items on Connect.
1459+ # '
1460+ # ' Each piece of content contains the following fields:
1461+ # ' * `guid`: The unique identifier of this content item.
1462+ # ' * `name`: A simple, URL-friendly identifier. Allows alpha-numeric
1463+ # ' characters, hyphens ("-"), and underscores ("_").
1464+ # ' * `title`: The title of this content.
1465+ # ' * `description`: A rich description of this content
1466+ # ' * `access_type`: Access type describes how this content manages its
1467+ # ' viewers. It may have a value of `all`, `logged_in` or `acl`.
1468+ # ' The value `all` is the most permissive; any visitor to Posit
1469+ # ' Connect will be able to view this content. The value `logged_in`
1470+ # ' indicates that all Posit Connect accounts may view the content. The
1471+ # ' `acl` value lets specifically enumerated users and groups view the
1472+ # ' content. Users configured as collaborators may always view content.
1473+ # ' * `connection_timeout`: Maximum number of seconds allowed without data
1474+ # ' sent or received across a client connection. A value of 0 means
1475+ # ' connections will never time-out (not recommended). When null, the
1476+ # ' default `Scheduler.ConnectionTimeout` is used. Applies only to content
1477+ # ' types that are executed on demand.
1478+ # ' * `read_timeout`: Maximum number of seconds allowed without data received
1479+ # ' from a client connection. A value of 0 means a lack of client (browser)
1480+ # ' interaction never causes the connection to close. When null, the default
1481+ # ' `Scheduler.ReadTimeout` is used. Applies only to content types that are
1482+ # ' executed on demand.
1483+ # ' * `init_timeout`: The maximum number of seconds allowed for an interactive
1484+ # ' application to start. Posit Connect must be able to connect
1485+ # ' to a newly launched Shiny application, for example, before this threshold
1486+ # ' has elapsed. When null, the default `Scheduler.InitTimeout` is
1487+ # ' used. Applies only to content types that are executed on demand.
1488+ # ' * `idle_timeout`: The maximum number of seconds a worker process
1489+ # ' for an interactive application to remain alive after it goes idle (no
1490+ # ' active connections). When null, the default `Scheduler.IdleTimeout`
1491+ # ' is used. Applies only to content types that are executed on demand.
1492+ # ' * `max_processes`: Specifies the total number of concurrent processes
1493+ # ' allowed for a single interactive application. When null, the
1494+ # ' default `Scheduler.MaxProcesses` setting is used. Applies only to
1495+ # ' content types that are executed on demand.
1496+ # ' * `min_processes`: Specifies the minimum number of concurrent
1497+ # ' processes allowed for a single interactive application. When null, the
1498+ # ' default `Scheduler.MinProcesses` is used. Applies only to content types
1499+ # ' that are executed on demand.
1500+ # ' * `max_conns_per_process`: Specifies the maximum number of
1501+ # ' client connections allowed to an individual process. Incoming connections
1502+ # ' which will exceed this limit are routed to a new process or rejected.
1503+ # ' When null, the default `Scheduler.MaxConnsPerProcess` is used. Applies
1504+ # ' only to content types that are executed on demand.
1505+ # ' * `load_factor`: Controls how aggressively new processes are spawned.
1506+ # ' When null, the default `Scheduler.LoadFactor` is used. Applies only to
1507+ # ' content types that are executed on demand.
1508+ # ' * `created_time`: The timestamp (RFC3339) indicating when this
1509+ # ' content was created.
1510+ # ' * `last_deployed_time`: The timestamp (RFC3339) indicating when
1511+ # ' this content last had a successful bundle deployment performed.
1512+ # ' * `bundle_id`: The identifier for the active deployment bundle.
1513+ # ' Automatically assigned upon the successful deployment of that bundle.
1514+ # ' * `app_mode`: The runtime model for this content. Has a value
1515+ # ' of `unknown` before data is deployed to this item. Automatically assigned
1516+ # ' upon the first successful bundle deployment. Allowed: `api`,
1517+ # ' `jupyter-static`, `python-api`, `python-bokeh`, `python-dash`,
1518+ # ' `python-streamlit`, `rmd-shiny`, `rmd-static`, `shiny`, `static`,
1519+ # ' `tensorflow-saved-model`, `unknown`.
1520+ # ' * `content_category`: Describes the specialization of the content
1521+ # ' runtime model. Automatically assigned upon the first successful bundle
1522+ # ' deployment.
1523+ # ' * `parameterized`: True when R Markdown rendered content
1524+ # ' allows parameter configuration. Automatically assigned upon the first
1525+ # ' successful bundle deployment. Applies only to content with an app_mode
1526+ # ' of rmd-static.
1527+ # ' * `r_version`: The version of the R interpreter associated
1528+ # ' with this content. The value null represents that an R interpreter is
1529+ # ' not used by this content or that the R package environment has not been
1530+ # ' successfully restored. Automatically assigned upon the successful
1531+ # ' deployment of a bundle.
1532+ # ' * `py_version`: The version of the Python interpreter
1533+ # ' associated with this content. The value null represents that a Python
1534+ # ' interpreter is not used by this content or that the Python package
1535+ # ' environment has not been successfully restored. Automatically assigned
1536+ # ' upon the successful deployment of a bundle.
1537+ # ' * `run_as`: The UNIX user that executes this content.
1538+ # ' When null, the default Applications.RunAs is used. Applies
1539+ # ' only to executable content types - not static.
1540+ # ' * `run_as_current_user`: Indicates if this content is allowed
1541+ # ' to execute as the logged-in user when using PAM authentication.
1542+ # ' Applies only to executable content types - not static.
1543+ # ' * `owner_guid`: The unique identifier for the owner
1544+ # ' * `content_url`: The URL associated with this content. Computed
1545+ # ' from the GUID for this content.
1546+ # ' * `dashboard_url`: The URL within the Connect dashboard where
1547+ # ' this content can be configured. Computed from the GUID for this content.
1548+ # ' * `role`: The relationship of the accessing user to this
1549+ # ' content. A value of owner is returned for the content owner. editor
1550+ # ' indicates a collaborator. The viewer value is given to users who are
1551+ # ' permitted to view the content. A none role is returned for
1552+ # ' administrators who cannot view the content but are permitted to view
1553+ # ' its configuration. Computed at the time of the request.
1554+ # ' * `vanity_url`: The vanity URL associated with this content item.
1555+ # ' * `id`: The internal numeric identifier of this content item.
1556+ # ' * `tags`: Tags associated with this content item. Each entry is a list
1557+ # ' with the following fields:
1558+ # ' * `id`: The identifier for the tag.
1559+ # ' * `name`: The name of the tag.
1560+ # ' * `parent_id`: The identifier for the parent tag. Null if the tag is a
1561+ # ' top-level tag.
1562+ # ' * `created_time`: The timestamp (RFC3339) indicating when the tag was
1563+ # ' created.
1564+ # ' * `updated_time`: The timestamp (RFC3339) indicating when the tag was
1565+ # ' last updated.
1566+ # ' * `owner`: Basic details about the owner of this content item. Each entry
1567+ # ' is a list with the following fields:
1568+ # ' * `guid`: The user's GUID, or unique identifier, in UUID RFC4122 format.
1569+ # ' * `username`: The user's username.
1570+ # ' * `first_name`: The user's first name.
1571+ # ' * `last_name`: The user's last name.
1572+ # '
1573+ # ' @details
1574+ # ' Please see https://docs.posit.co/connect/api/#get-/v1/search/content for more
1575+ # ' information.
1576+ # '
1577+ # ' @examples
1578+ # ' \dontrun{
1579+ # ' library(connectapi)
1580+ # ' client <- connect()
1581+ # '
1582+ # ' search_content(client, q = "")
1583+ # ' }
1584+ # '
1585+ # ' @family content functions
1586+ # ' @export
1587+ search_content <- function (
1588+ client ,
1589+ q = NULL ,
1590+ page_number = 1 ,
1591+ page_size = 500 ,
1592+ include = " owner,vanity_url" ,
1593+ ...
1594+ ) {
1595+ error_if_less_than(client $ version , " 2024.04.0" )
1596+
1597+ path <- v1_url(" search" , " content" )
1598+
1599+ query <- list (
1600+ q = q ,
1601+ page_number = page_number ,
1602+ page_size = page_size ,
1603+ include = include
1604+ )
1605+
1606+ client $ GET(path , query = query )
1607+ }
0 commit comments