Skip to content

APP-6069 Update apis.json to match new values #343

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 3, 2024
Merged

Conversation

DTCurrie
Copy link
Member

@DTCurrie DTCurrie commented Aug 29, 2024

Updates the apis.json file to use the new fields we use for code sample generation. See similar changes for the Python SDK and RDK.

It's important to note the TS-SDK had a departure from other SDKs where it declared a client field. I have updated that to use importName to match other code sample implementations.

Another callout is the addition of these two, currently repetitive, fields:

{
  ...
  "packagePath": "@viamrobotics/sdk",
  "packageName": "VIAM"
}

We are using these to generate a singular import statement of:

import * as VIAM from "@viamrobotics/sdk";

With these new fields, it would be trivial to allow breaking up these imports to sub-modules if that happens in the future, for example (not using valid paths):

{
  ...
  "board": {
    "importName": "BoardClient",
    "func": "getGPIO",
    "args": ["'16'"],
    "comment": "Note that the pin supplied is a placeholder. Please change this to a valid pin you are using.",
    "packagePath": "@viamrobotics/sdk/components/",
    "packageName": "board"
  },
  "camera": {
    "importName": "CameraClient",
    "func": "getImage",
    "packagePath": "@viamrobotics/sdk/components/",
    "packageName": "camera"
  },
  ...
  "motion": {
    "importName": "MotionClient",
    "func": "getPose",
    "args": [],
    "comment": "Note this function requires additional arguments. Please provide valid arguments for function to work properly.",
    "packagePath": "@viamrobotics/sdk/services/",
    "packageName": "motion"
  },
  ...
}
import { BoardClient } from "@viamrobotics/sdk/components/board";
import { CameraClient } from "@viamrobotics/sdk/components/camera";
import { MotionClient } from "@viamrobotics/sdk/services/motion";

@DTCurrie DTCurrie requested a review from njooma August 29, 2024 16:01
@DTCurrie DTCurrie self-assigned this Aug 29, 2024
@DTCurrie DTCurrie requested a review from a team as a code owner August 29, 2024 16:01
@DTCurrie DTCurrie requested a review from stuqdog August 29, 2024 16:01
@DTCurrie DTCurrie changed the title Update apis.json to match new values APP-6069 Update apis.json to match new values Aug 29, 2024
@njooma njooma merged commit 26f65bc into main Sep 3, 2024
3 checks passed
@njooma njooma deleted the update-apis-json branch September 3, 2024 16:10
njooma added a commit that referenced this pull request Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants