Skip to content

First And Second Level Resources

Sean Reeise edited this page Apr 7, 2023 · 3 revisions

Built In Methods For Finding Second Level Resources

The OpenApi object has a method that can return the second level resources of a given path as well and it is generally pretty accurate but its still necessary to make sure that the second level resources are ones that actually need to be generated and also that there are not more second level resources that are missing:

use graph_codegen::openapi::OpenApi;

fn main() {
    let open_api = OpenApi::default();

    // Returns BTreeSet<String>
    let resources = open_api.first_second_level_resources("teams");
    println!("{:#?}", resources);
}

This prints out:

{
    "channels",
    "installedApps",
    "primaryChannel",
    "schedule",
    "tags",
}

The only one not currently implemented as a separate client is installedApps. Those methods are part of the TeamsIdApiClient. installedApps could easily be implemented as a seperate client as well. I chose not to change installedApps because those methods were not in conflict with other methods, such as same method names, and there wasn't a large number of requests but the number is around 9.

Clone this wiki locally