added api docs page

This commit is contained in:
csawatzky 2025-04-10 10:18:09 -06:00
parent 0bf12c7d40
commit 538da5c4bb
21 changed files with 7562 additions and 1 deletions

View file

@ -0,0 +1,64 @@
import { Tab, Tabs } from "@mui/material";
// import { TabContext, TabPanel } from "@material-ui/lab";
import React, { useState } from "react";
import AgricultureDefinitions from "./definitions/agricultureDefinitions";
import AviationDefinitions from "./definitions/aviationDefinitions";
import ConstructionDefinitions from "./definitions/constructionDefinitions";
import GeneralDefinitions from "./definitions/generalDefinitions";
import MiningDefinitions from "./definitions/miningDefinitions";
interface TabPanelProps {
children?: React.ReactNode;
index: any;
value: any;
}
function TabPanelMine(props: TabPanelProps) {
const { children, value, index, ...other } = props;
return (
<div
role="tabpanel"
hidden={value !== index}
aria-labelledby={`simple-tab-${index}`}
{...other}>
{value === index && <React.Fragment>{children}</React.Fragment>}
</div>
);
}
export default function Definitions() {
const [currentTab, setCurrentTab] = useState("general");
return (
<>
<Tabs
value={currentTab}
onChange={(_, value) => setCurrentTab(value)}
indicatorColor="primary"
textColor="primary"
variant="fullWidth">
<Tab label={"General"} value={"general"} />
<Tab label={"Agriculture"} value={"agriculture"} />
<Tab label={"Aviation"} value={"aviation"} />
<Tab label={"Mining"} value={"mining"} />
<Tab label={"Construction"} value={"construction"} />
</Tabs>
<TabPanelMine value={currentTab} index="general">
<GeneralDefinitions />
</TabPanelMine>
<TabPanelMine value={currentTab} index="agriculture">
<AgricultureDefinitions />
</TabPanelMine>
<TabPanelMine value={currentTab} index="aviation">
<AviationDefinitions />
</TabPanelMine>
<TabPanelMine value={currentTab} index="mining">
<MiningDefinitions />
</TabPanelMine>
<TabPanelMine value={currentTab} index="construction">
<ConstructionDefinitions />
</TabPanelMine>
</>
);
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,253 @@
import { Box, List, ListItem, Typography } from "@mui/material";
import ObjectDefinitionDisplay, { data } from "./objectDefinitionDisplay";
// template
/**
*
{
name: "",
fields: [
{
fieldName: "",
fieldType: "",
fieldDescription: ""
},
]
},
*/
// aviation definitions
const terminalData: data[] = [
{
name: "Terminal",
fields: [
{
fieldName: "key",
fieldType: "string",
fieldDescription: "The key of the terminal"
},
{
fieldName: "name",
fieldType: "string",
fieldDescription: "The name of the terminal"
},
{
fieldName: "settings",
fieldType: "TerminalSettings",
fieldDescription: "The settings of the terminal"
}
]
},
{
name: "TerminalSettings",
fields: [
{
fieldName: "longitude",
fieldType: "float",
fieldDescription: "The longitude coordinate"
},
{
fieldName: "latitude",
fieldType: "float",
fieldDescription: "The latitude coordinate"
},
{
fieldName: "theme",
fieldType: "ObjectTheme",
fieldDescription: "Theme for display purposes"
}
]
}
];
const gateData: data[] = [
{
name: "Gate",
fields: [
{
fieldName: "key",
fieldType: "string",
fieldDescription: "The key of the gate"
},
{
fieldName: "name",
fieldType: "string",
fieldDescription: "The name of the gate"
},
{
fieldName: "settings",
fieldType: "GateSettings",
fieldDescription: "The settings of the gate"
},
{
fieldName: "componentPreferences",
fieldType: "map<string, GateComponentType(ENUM)>",
fieldDescription:
"A map using the component keys of linked components to the component type for the gate"
},
{
fieldName: "gateMutations",
fieldType: "map<string, GatMutations>",
fieldDescription:
"A map using device ids to store the mutated measurement estimates based on the sensors actual readings from that device"
},
{
fieldName: "pcaState",
fieldType: "PCAState (ENUM)",
fieldDescription: "The state of the connected pca unit"
}
]
},
{
name: "GateSettings",
fields: [
{
fieldName: "longitude",
fieldType: "float",
fieldDescription: "The longitude coordinate"
},
{
fieldName: "latitude",
fieldType: "float",
fieldDescription: "The latitude coordinate"
},
{
fieldName: "terminal",
fieldType: "string",
fieldDescription: "The key of the terminal this gate belongs to"
},
{
fieldName: "ductDiameter",
fieldType: "float",
fieldDescription: "The diameter of the ducting for the gate in millimeters"
},
{
fieldName: "ductLength",
fieldType: "float",
fieldDescription: "The length of the ducting in meters"
},
{
fieldName: "frictionFactor",
fieldType: "float",
fieldDescription: "The friction coefficient of the ducting"
},
{
fieldName: "thermalConductivity",
fieldType: "float",
fieldDescription: "The thermal conductivity of the ducting"
},
{
fieldName: "thermalResistance",
fieldType: "float",
fieldDescription: "The thermal resistance of the ducting"
},
{
fieldName: "upperFlow",
fieldType: "float",
fieldDescription: "The upper limit of acceptable mass air flow"
},
{
fieldName: "lowerFlow",
fieldType: "float",
fieldDescription: "The lower limit of acceptable mass air flow"
},
{
fieldName: "pcaType",
fieldType: "string",
fieldDescription: "The type of pca on the gate"
},
{
fieldName: "ductName",
fieldType: "string",
fieldDescription: "The name of the ducting"
},
// {
// fieldName: "airport",
// fieldType: "",
// fieldDescription: ""
// },
{
fieldName: "letterIdentifier",
fieldType: "string",
fieldDescription: "The letter assigned to the gate"
},
{
fieldName: "numberIdentifier",
fieldType: "string",
fieldDescription: "The number assigned to the gate"
},
{
fieldName: "hourlyApuCost",
fieldType: "float",
fieldDescription: "The cost to run the apu of an aircraft for an hour at the gate"
},
{
fieldName: "hourlyPcaCost",
fieldType: "float",
fieldDescription: "The cost to run the pca unit for an hour at the gate"
},
{
fieldName: "theme",
fieldType: "ObjectTheme",
fieldDescription: "Them for display purposes"
}
]
},
{
name: "GateMutations",
fields: [
{
fieldName: "cfm",
fieldType: "float",
fieldDescription: "The cfm value in the ducting calculated from the pressure sensors"
},
{
fieldName: "temp",
fieldType: "float",
fieldDescription: "The estimated final temp in the aircraft cab"
}
]
},
{
name: "FlowAt",
fields: [
{
fieldName: "airFlow",
fieldType: "float",
fieldDescription: "The Mass air flow value"
},
{
fieldName: "time",
fieldType: "string",
fieldDescription: "Timestamp in RFC3339 format for the mass airflow measurement"
}
]
}
];
export default function AviationDefinition() {
return (
<Box>
<Typography variant="h5" style={{ fontWeight: 650 }}>
Terminal Definitions
</Typography>
<List>
{terminalData.map((e, i) => (
<ListItem key={i} style={{ marginBottom: 10 }}>
<ObjectDefinitionDisplay data={e} />
</ListItem>
))}
</List>
<Typography variant="h5" style={{ fontWeight: 650 }}>
Gate Definitions
</Typography>
<List>
{gateData.map((e, i) => (
<ListItem key={i} style={{ marginBottom: 10 }}>
<ObjectDefinitionDisplay data={e} />
</ListItem>
))}
</List>
</Box>
);
}

View file

@ -0,0 +1,224 @@
import { Box, List, ListItem, Typography } from "@mui/material";
import ObjectDefinitionDisplay, { data } from "./objectDefinitionDisplay";
// template
/**
*
{
name: "",
fields: [
{
fieldName: "",
fieldType: "",
fieldDescription: ""
},
]
},
*/
// construction definitions
const siteData: data[] = [
{
name: "Site",
fields: [
{
fieldName: "settings",
fieldType: "SiteSettings",
fieldDescription: "The settings of a jobsite"
},
{
fieldName: "status",
fieldType: "SiteStatus",
fieldDescription: "The status of a jobsite"
}
]
},
{
name: "SiteSettings",
fields: [
{
fieldName: "key",
fieldType: "string",
fieldDescription: "The key of the site"
},
{
fieldName: "objectKey (deprecated)",
fieldType: "string",
fieldDescription:
"was originally going to be used as the obect the site was linked to before relative objects was implemented, currently will only contain the id of the user who created the site"
},
{
fieldName: "userId",
fieldType: "string",
fieldDescription: "The id of the user who created the site"
},
{
fieldName: "siteName",
fieldType: "string",
fieldDescription: "The name of the site"
},
{
fieldName: "longitude",
fieldType: "float",
fieldDescription: "The longitude of the site"
},
{
fieldName: "latitude",
fieldType: "float",
fieldDescription: "The latitude of the site"
},
{
fieldName: "theme",
fieldType: "ObjectTheme",
fieldDescription: "Theme for display purposes"
},
{
fieldName: "active",
fieldType: "bool",
fieldDescription: "Whether the site is currently active"
}
// these were taken out as users felt they were not necessary
// {
// fieldName: "siteId",
// fieldType: "string",
// fieldDescription: ""
// },
// {
// fieldName: "siteAddress",
// fieldType: "string",
// fieldDescription: ""
// },
// {
// fieldName: "siteDescription",
// fieldType: "string",
// fieldDescription: ""
// },
// {
// fieldName: "clientName",
// fieldType: "string",
// fieldDescription: ""
// },
// {
// fieldName: "clientPhone",
// fieldType: "string",
// fieldDescription: ""
// },
// {
// fieldName: "jobType",
// fieldType: "string",
// fieldDescription: ""
// },
// {
// fieldName: "jobDetails",
// fieldType: "string",
// fieldDescription: ""
// },
]
},
{
name: "SiteStatus",
fields: [
{
fieldName: "timestamp",
fieldType: "string",
fieldDescription: "Timestamp in RFC3339 format for the creation of the site"
}
]
}
];
const objectHeaterData: data[] = [
{
name: "ObjectHeater",
fields: [
{
fieldName: "key",
fieldType: "string",
fieldDescription: "The key of the heater"
},
{
fieldName: "name",
fieldType: "string",
fieldDescription: "The name of the heater"
},
{
fieldName: "settings",
fieldType: "ObjectHeaterSettings",
fieldDescription: "The settigns of the heater"
}
]
},
{
name: "ObjectHeaterSettings",
fields: [
{
fieldName: "siteKey",
fieldType: "string",
fieldDescription: "The key for the site"
},
{
fieldName: "make",
fieldType: "string",
fieldDescription: "The make of the heater"
},
{
fieldName: "model",
fieldType: "string",
fieldDescription: "The model of the heater"
},
{
fieldName: "fuelType",
fieldType: "FuelType",
fieldDescription: "The type of fuel the heater runs on"
},
{
fieldName: "tankSize",
fieldType: "float",
fieldDescription: "The size of the tank in gallons"
},
{
fieldName: "fuelConsumption",
fieldType: "float",
fieldDescription: "The rate fuel is used in gallons per hour (G/hr)"
},
{
fieldName: "airCirculation",
fieldType: "float",
fieldDescription: "The rate that the heater circulates air in CFM"
},
{
fieldName: "mutations",
fieldType: "LinearMutation (ARRAY)",
fieldDescription:
"Any mutations to perform using multiple components attached to the heater and combining them to convert into other measurements using a linear regression formula"
}
]
}
];
export default function ConstructionDefinitions() {
return (
<Box>
<Typography variant="h5" style={{ fontWeight: 650 }}>
Site Definitions
</Typography>
<List>
{siteData.map((e, i) => (
<ListItem key={i} style={{ marginBottom: 10 }}>
<ObjectDefinitionDisplay data={e} />
</ListItem>
))}
</List>
<Typography variant="h5" style={{ fontWeight: 650 }}>
Heater Definitions
</Typography>
<List>
{objectHeaterData.map((e, i) => (
<ListItem key={i} style={{ marginBottom: 10 }}>
<ObjectDefinitionDisplay data={e} />
</ListItem>
))}
</List>
</Box>
);
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,205 @@
import { Box, List, ListItem, Typography } from "@mui/material";
import ObjectDefinitionDisplay, { data } from "./objectDefinitionDisplay";
// mining definitions
const mineData: data[] = [
{
name: "Mine",
fields: [
{
fieldName: "settings",
fieldType: "MineSettings",
fieldDescription: "The settings of the mine"
},
{
fieldName: "status",
fieldType: "MineStatus",
fieldDescription: "The status of the mine (contains no properties at this time)"
}
]
},
{
name: "MineSettings",
fields: [
{
fieldName: "key",
fieldType: "string",
fieldDescription: "The key of the mine"
},
{
fieldName: "placeables",
fieldType: "Placeable (ARRAY)",
fieldDescription: "Placeable components of the mine"
},
{
fieldName: "devices",
fieldType: "int (ARRAY)",
fieldDescription: "The ids of devices that are part of the mine"
},
{
fieldName: "sensors",
fieldType: "MinSensor (ARRAY)",
fieldDescription: "Sensors within the mine"
},
{
fieldName: "name",
fieldType: "string",
fieldDescription: "The name of the mine"
}
]
},
// there are no properties in the MineStatus definition of the protobuf
// {
// name: "MineStatus",
// fields: [
// {
// fieldName: "",
// fieldType: "",
// fieldDescription: ""
// },
// ]
// },
{
name: "MineSimple",
fields: [
{
fieldName: "key",
fieldType: "string",
fieldDescription: ""
},
{
fieldName: "name",
fieldType: "string",
fieldDescription: ""
}
]
},
{
name: "Placeable",
fields: [
{
fieldName: "x",
fieldType: "float",
fieldDescription: "The x value on the canvas"
},
{
fieldName: "y",
fieldType: "float",
fieldDescription: "The y value on the canvas"
},
{
fieldName: "angle",
fieldType: "float",
fieldDescription:
"The angle to rotate the image, or for corner vents the angle of the curve"
},
{
fieldName: "width",
fieldType: "float",
fieldDescription: "The width of the image"
},
{
fieldName: "radius",
fieldType: "float",
fieldDescription: "The radius of the image"
},
{
fieldName: "magnitude",
fieldType: "float",
fieldDescription: "General measurement for different placeables. Length of vent for example"
},
{
fieldName: "direction",
fieldType: "int",
fieldDescription: "The direction the placeable is facing"
},
{
fieldName: "type",
fieldType: "PlaceableType",
fieldDescription: "The type of placeable"
},
{
fieldName: "subtype",
fieldType: "int",
fieldDescription: "The subtype of the placeable"
}
]
},
{
name: "MineComponentPreferences",
fields: [
{
fieldName: "sensors",
fieldType: "MineSensorPreferences (ARRAY)",
fieldDescription: "Assigned preferences for the sensors in relation to the mine"
}
]
},
{
name: "MineSensorPreferences",
fields: [
{
fieldName: "enabled",
fieldType: "bool",
fieldDescription: "If the sensor is currently enabled"
},
{
fieldName: "x",
fieldType: "float",
fieldDescription: "The x position on the canvas"
},
{
fieldName: "y",
fieldType: "float",
fieldDescription: "The y position on the canvas"
},
{
fieldName: "nickname",
fieldType: "string",
fieldDescription: "Nickname given to the sensor"
}
]
},
{
name: "MineSensor",
fields: [
{
fieldName: "x",
fieldType: "float",
fieldDescription: "The x position on the canvas"
},
{
fieldName: "y",
fieldType: "float",
fieldDescription: "The y position on the canvas"
},
{
fieldName: "componentKey",
fieldType: "string",
fieldDescription: "The key of the component"
},
{
fieldName: "index",
fieldType: "int",
fieldDescription: "The index of the component"
}
]
}
];
export default function MiningDefinitions() {
return (
<Box>
<Typography variant="h5" style={{ fontWeight: 650 }}>
Mine Definitions
</Typography>
<List>
{mineData.map((e, i) => (
<ListItem key={i} style={{ marginBottom: 10 }}>
<ObjectDefinitionDisplay data={e} />
</ListItem>
))}
</List>
</Box>
);
}

View file

@ -0,0 +1,116 @@
import {
Box,
darken,
Grid2 as Grid,
Table,
TableBody,
TableCell,
TableHead,
TableRow,
Theme,
Typography
} from "@mui/material";
import { makeStyles } from "@mui/styles";
import { getThemeType } from "theme";
export interface FieldInformation {
fieldName: string;
fieldType: string;
fieldDescription: string;
}
export interface data {
name: string;
fields: FieldInformation[];
}
interface Props {
data: data;
}
const useStyles = makeStyles((theme: Theme) => ({
cellNarrow: {
width: "20%",
padding: 5
},
cellWide: {
width: "80%",
padding: 5
},
dark: {
backgroundColor: getThemeType() === "light" ? "rgb(245, 245, 245)" : "rgb(50, 50, 50)",
padding: 0
},
light: {
backgroundColor: getThemeType() === "light" ? "rgb(235, 235, 235)" : "rgb(60, 60, 60)",
padding: 0
},
container: {
width: "100%",
border: "2px solid white",
padding: 5,
borderRadius: 10
},
table: {
width: "100%"
},
header: {
fontWeight: 650,
fontSize: 20
},
tableHeader: {
fontSize: 17,
fontWeight: 650
},
tableData: {
fontSize: 17
},
subHeader: {
fontSize: 14,
color: darken(theme.palette.text.primary, 0.3)
}
})
);
export default function ObjectDefinitionDisplay(props: Props) {
const { data } = props;
const classes = useStyles();
return (
<Box width="100%">
<Typography className={classes.header}>{data.name}</Typography>
<Box className={classes.container}>
<Table className={classes.table}>
<TableHead>
<TableRow>
<TableCell align="left" className={classes.cellNarrow}>
<Typography className={classes.tableHeader}>Field Names</Typography>
</TableCell>
<TableCell align="left" className={classes.cellWide}>
<Typography className={classes.tableHeader}>Description</Typography>
</TableCell>
</TableRow>
</TableHead>
<TableBody>
{data.fields.map((field, i) => (
<TableRow className={i % 2 === 0 ? classes.light : classes.dark} key={i}>
<TableCell align="left" className={classes.cellNarrow}>
<Grid container direction="column">
<Grid>
<Typography className={classes.tableData}>{field.fieldName}</Typography>
</Grid>
<Grid>
<Typography className={classes.subHeader}>{field.fieldType}</Typography>
</Grid>
</Grid>
</TableCell>
<TableCell align="left" className={classes.cellWide}>
<Typography className={classes.tableData}>{field.fieldDescription}</Typography>
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</Box>
</Box>
);
}

65
src/apiDocs/endpoints.tsx Normal file
View file

@ -0,0 +1,65 @@
import { Tab, Tabs } from "@mui/material";
import { useEffect, useState } from "react";
//import { TabContext, TabPanel } from "@material-ui/lab";
import GeneralEndpoints from "apiDocs/endpoints/generalEndpoints";
import AviationEndpoints from "apiDocs/endpoints/aviationEndpoints";
import AgricultureEndpoints from "apiDocs/endpoints/agricultureEndpoints";
import MiningEndpoints from "apiDocs/endpoints/miningEndpoints";
import ConstructionEndpoints from "apiDocs/endpoints/constructionEndpoints";
import React from "react";
interface TabPanelProps {
children?: React.ReactNode;
index: any;
value: any;
}
function TabPanelMine(props: TabPanelProps) {
const { children, value, index, ...other } = props;
return (
<div
role="tabpanel"
hidden={value !== index}
aria-labelledby={`simple-tab-${index}`}
{...other}>
{value === index && <React.Fragment>{children}</React.Fragment>}
</div>
);
}
export default function Endpoints() {
const [currentTab, setCurrentTab] = useState("general");
return (
<>
<Tabs
value={currentTab}
onChange={(_, value) => setCurrentTab(value)}
indicatorColor="primary"
textColor="primary"
variant="fullWidth">
<Tab label={"General"} value={"general"} />
<Tab label={"Agriculture"} value={"agriculture"} />
<Tab label={"Aviation"} value={"aviation"} />
<Tab label={"Mining"} value={"mining"} />
<Tab label={"Construction"} value={"construction"} />
</Tabs>
<TabPanelMine value={currentTab} index="general">
<GeneralEndpoints />
</TabPanelMine>
<TabPanelMine value={currentTab} index="aviation">
<AviationEndpoints />
</TabPanelMine>
<TabPanelMine value={currentTab} index="agriculture">
<AgricultureEndpoints />
</TabPanelMine>
<TabPanelMine value={currentTab} index="mining">
<MiningEndpoints />
</TabPanelMine>
<TabPanelMine value={currentTab} index="construction">
<ConstructionEndpoints />
</TabPanelMine>
</>
);
}

View file

@ -0,0 +1,500 @@
import { Box, List, ListItem, Typography } from "@mui/material";
import EndpointDisplay, { EndPointData } from "apiDocs/endpoints/endpointDisplay";
import React from "react";
/**
* endpoint template
{
requestType: "",
url: "https://api.brandxtech.ca/v1/",
description: "",
urlOptions: [],
urlParams: [],
requestBody: "",
responseParams: []
},
*/
export default function AgricultureEndpoints() {
//note any requests that are not a get are commented out as our backend only allows get requests through the API for the moment
//if you are here to put the other requests types into the api docs make sure to finish the documentation for each endpoint
const fieldEndpoints: EndPointData[] = [
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/fields",
description: "get a list of fields",
urlOptions: [
"limit - the number to load",
"offset - how many to skip over before starting to load",
"order - the sort order",
"by - what to sort by in the data",
"search - a string to search for a match in the data"
],
responseParams: ["repeated Field fields", "uint32 next_offset", "uint32 total"]
},
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/field/:field",
description: "get a specified field",
urlParams: [":field - the key of the field"],
responseParams: [
"FieldSettings settings",
"FieldStatus status",
"repeated Permission field_permissions"
]
}
// {
// requestType: "POST",
// url: "https://api.brandxtech.ca/v1/fields/:field",
// description: "add a new field",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
// {
// requestType: "PUT",
// url: "https://api.brandxtech.ca/v1/fields/:field",
// description: "update an existing field",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
// {
// requestType: "DEL",
// url: "https://api.brandxtech.ca/v1/fields/:field",
// description: "remove an existing field",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
];
const binEndpoints: EndPointData[] = [
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/bins",
description: "get a list of bins",
urlOptions: [
"limit - the number to load",
"offset - how many to skip over before starting to load",
"order - the sort order",
"by - what to sort by in the data",
"search - a string to search for a match in the data"
],
responseParams: ["repeated Bin bins", "uint32 next_offset", "uint32 total"]
},
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/binsAndData",
description: "list bins and their metrics",
urlOptions: [
"limit - the number to load",
"offset - how many to skip over before starting to load",
"order - the sort order",
"by - what to sort by in the data",
"search - a string to search for a match in the data"
],
responseParams: [
"repeated Bin bins",
"repeated BinYard bin_yards",
"BinMetrics metrics",
"uint32 next_offset",
"uint32 total",
"repeated GrainBag bags"
]
},
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/bins/:bin",
description: "gets a specified bin",
urlParams: [":bin - the key of the bin"],
responseParams: [
"BinSettings settings",
"BinStatus status",
"repeated Permission bin_permissions"
]
},
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/bins/:bin/components",
description: "list the components linked to a bin",
urlParams: [":bin - the key of the bin"],
responseParams: ["repeated Component components", "map<string, uint64> component_devices"]
},
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/bins/:bin/components/measurements",
description: "get the measurements for components attached to a bin over a set interval",
urlOptions: ["start - RFC3339 formatted timestamp", "end - RFC3339 formatted timestamp"],
urlParams: [":bin - the key of the bin"],
responseParams: ["repeated UnitMeasurementsForComponent measurements"]
},
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/bins/:bin/history",
description: "get the history of changes to a bin",
urlOptions: [
"limit - the number of records to retrieve",
"offset - the number of records to skip over before startgin retrieval"
],
urlParams: [":bin - the key of the bin"],
responseParams: ["repeated BinHistory history", "uint32 next_offset", "uint32 total"]
}
// {
// requestType: "POST",
// url: "https://api.brandxtech.ca/v1/bins",
// description: "add a new bin",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
// {
// requestType: "POST",
// url: "https://api.brandxtech.ca/v1/bins/:bin/addComponent/:device/:component",
// description: "attach an existing component on a device to a bin",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
// {
// requestType: "POST",
// url: "https://api.brandxtech.ca/v1/bins/:bin/removeComponent/:device/:component",
// description: "",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
// {
// requestType: "POST",
// url: "https://api.brandxtech.ca/v1/bins/:bin/removeAllComponents",
// description: "removes all attached components from a bin",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
// {
// requestType: "POST",
// url: "https://api.brandxtech.ca/v1/bins/:bin/updateTopNodes",
// description: "updates the top nodes of cable components ttached to a bin",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
// {
// requestType: "PUT",
// url: "https://api.brandxtech.ca/v1/bins/:bin",
// description: "update a bin",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
// {
// requestType: "DEL",
// url: "https://api.brandxtech.ca/v1/bins/:bin",
// description: "removes an existing bin",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
];
const binYardEndpoints: EndPointData[] = [
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/binYards",
description: "get a list of bin yards",
urlOptions: [
"limit - the number to load",
"offset - how many to skip over before starting to load",
"order - the sort order",
"by - what to sort by in the data",
"search - a string to search for a match in the data"
],
responseParams: ["repeated BinYard yard", "uint32 next_offset", "uint32 total"]
},
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/binYards/:binYard",
description: "get a specific bin yard",
urlParams: [":binYard - the key for the yard"],
responseParams: ["BinYard yard"]
}
// {
// requestType: "POST",
// url: "https://api.brandxtech.ca/v1/binYards",
// description: "add a new bin yard",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
// {
// requestType: "PUT",
// url: "https://api.brandxtech.ca/v1/binyards/:binyard",
// description: "update an existing binyard",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
// {
// requestType: "DEL",
// url: "https://api.brandxtech.ca/v1/binyards/:binyard",
// description: "delete an existing bin yard",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
];
const harvestPlanEndpoints: EndPointData[] = [
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/harvestplans",
description: "get a list of harvest plans",
urlOptions: [
"limit - the number to load",
"offset - how many to skip over before starting to load",
"order - the sort order",
"by - what to sort by in the data",
"search - a string to search for a match in the data"
],
responseParams: ["repeated HarvestPlan harvest_plan", "uint32 next_offset", "uint32 total"]
},
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/harvestplans/:harvestplan",
description: "get a specified harvest plan",
urlParams: [":harvestplan - the key of the harvest plan"],
responseParams: [
"HarvestPlanSettings settings",
"HarvestPlanStatus status",
"repeated Permission plan_permissions"
]
},
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/harvestplans/:harvestplan/history",
description: "get a history of changes to the harvest plan",
urlOptions: [
"limit - the number to load",
"offset - the number to pass over before starting to load"
],
urlParams: [":harvestplan - the key of the harvest plan"],
responseParams: ["repeated HarvestPlanHistory history", "uint32 next_offset", "uint32 total"]
}
// {
// requestType: "POST",
// url: "https://api.brandxtech.ca/v1/harvestplans",
// description: "create a new harvest plan",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
];
const contractEndpoints: EndPointData[] = [
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/contracts",
description: "get a list of contracts",
urlOptions: [
"limit - the number to load",
"offset - how many to skip over before starting to load",
"order - the sort order",
"by - what to sort by in the data",
"search - a string to search for a match in the data"
],
responseParams: ["repeated Contract contracts", "uint32 next_offset", "uint32 total"]
},
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/contracts/:contract",
description: "get a specified contract",
urlParams: [":contract - the key of the contract"],
responseParams: ["Contract contract"]
},
// {
// requestType: "POST",
// url: "https://api.brandxtech.ca/v1/contracts",
// description: "add a new contract",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
// {
// requestType: "PUT",
// url: "https://api.brandxtech.ca/v1/contracts/:contract",
// description: "update an existing contract",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
// {
// requestType: "DEL",
// url: "https://api.brandxtech.ca/v1/contracts/:contract",
// description: "remove an existing contract",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/contractsbyyear",
description: "get a list of contracts for a specified year",
urlOptions: [
"limit - the number to load",
"offset - how many to skip over before starting to load",
"order - the sort order",
"by - what to sort by in the data",
"search - a string to search for a match in the data",
"year - the year for the contracts"
],
responseParams: [
"repeated Contract contracts",
"uint32 next_offset",
"uint32 total",
"map<string, EvaluatePermissionsResponse> contract_permissions"
]
}
];
const grainBagEndpoints: EndPointData[] = [
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/grainbags",
description: "get a list of grainbags",
urlOptions: [
"limit - the number to load",
"offset - how many to skip over before starting to load",
"order - the sort order",
"by - what to sort by in the data",
"search - a string to search for a match in the data"
],
responseParams: ["repeated GrainBag grain_bags", "uint32 next_offset", "uint32 total"]
},
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/grainbags/:grainbag",
description: "get a specified grainbag",
urlParams: [":grainbag - the key of the grain bag"],
responseParams: ["GrainBag grain_bag"]
},
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/grainbags/:grainbag/history",
description: "get the history of changes to a grain bag",
urlOptions: [
"limit - the number of records to load",
"offset - the number of records to skip over before starting to load",
"start - RFC3339 formatted timestamp",
"end - RFC3339 formatted timestamp"
],
urlParams: [":grainbag - the key of the grainbag"],
responseParams: ["repeated ObjectHistory history", "uint32 next_offset", "uint32 total"]
}
// {
// requestType: "POST",
// url: "https://api.brandxtech.ca/v1/grainbags",
// description: "add a new grain bag",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
// {
// requestType: "PUT",
// url: "https://api.brandxtech.ca/v1/grainbags/:grainbag",
// description: "update an existing grain bag",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
// {
// requestType: "DEL",
// url: "https://api.brandxtech.ca/v1/grainbags/:grainbag",
// description: "delete an existing grain bag",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
];
return (
<Box>
<Typography variant="h5" style={{ fontWeight: 650 }}>
Endpoints for retrieving field data
</Typography>
<List>
{fieldEndpoints.map((e, i) => (
<ListItem key={i} style={{ marginBottom: 10 }}>
<EndpointDisplay endpoint={e} />
</ListItem>
))}
</List>
<Typography variant="h5" style={{ fontWeight: 650 }}>
Endpoints for retrieving bin data
</Typography>
<List>
{binEndpoints.map((e, i) => (
<ListItem key={i} style={{ marginBottom: 10 }}>
<EndpointDisplay endpoint={e} />
</ListItem>
))}
</List>
<Typography variant="h5" style={{ fontWeight: 650 }}>
Endpoints for retrieving bin yard data
</Typography>
<List>
{binYardEndpoints.map((e, i) => (
<ListItem key={i} style={{ marginBottom: 10 }}>
<EndpointDisplay endpoint={e} />
</ListItem>
))}
</List>
<Typography variant="h5" style={{ fontWeight: 650 }}>
Endpoints for retrieving harvest plan data
</Typography>
<List>
{harvestPlanEndpoints.map((e, i) => (
<ListItem key={i} style={{ marginBottom: 10 }}>
<EndpointDisplay endpoint={e} />
</ListItem>
))}
</List>
<Typography variant="h5" style={{ fontWeight: 650 }}>
Endpoints for retrieving contract data
</Typography>
<List>
{contractEndpoints.map((e, i) => (
<ListItem key={i} style={{ marginBottom: 10 }}>
<EndpointDisplay endpoint={e} />
</ListItem>
))}
</List>
<Typography variant="h5" style={{ fontWeight: 650 }}>
Endpoints for retrieving grain bag data
</Typography>
<List>
{grainBagEndpoints.map((e, i) => (
<ListItem key={i} style={{ marginBottom: 10 }}>
<EndpointDisplay endpoint={e} />
</ListItem>
))}
</List>
</Box>
);
}

View file

@ -0,0 +1,179 @@
import { Box, List, ListItem, Typography } from "@mui/material";
import EndpointDisplay, { EndPointData } from "apiDocs/endpoints/endpointDisplay";
import React from "react";
/**
{
requestType: "",
url: "https://api.brandxtech.ca/v1/",
description: "",
urlOptions: [],
urlParams: [],
requestBody: "",
responseParams: []
},
*/
export default function AviationEndpoints() {
//note any requests that are not a get are commented out as our backend only allows get requests through the API for the moment
//if you are here to put the other requests types into the api docs make sure to finish the documentation for each endpoint
const terminalEndpoints: EndPointData[] = [
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/terminals",
description: "gets a list of terminals",
urlOptions: [
"limit - the number of terminals to load",
"offset - the number of terminals to skip over before loading",
"order - the sort order",
"by - what to sort by in the terminals settings",
"search - a string to search the terminals settings and return matches"
],
requestBody: "",
responseParams: ["repeated Terminal terminals", "uint32 next_offset", "uint32 total"]
}
// {
// requestType: "POST",
// url: "https://api.brandxtech.ca/v1/terminals",
// description: "add a new terminal",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
// {
// requestType: "PUT",
// url: "https://api.brandxtech.ca/v1/terminals/:terminal",
// description: "update an existing terminal",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
// {
// requestType: "DEL",
// url: "https://api.brandxtech.ca/v1/terminals/:terminal",
// description: "remove an existing terminal",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
];
const gateEndpoints: EndPointData[] = [
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/gates",
description: "gets list of gates",
urlOptions: [
"limit - the number of gates to load",
"offset - the number of gates to skip before starting to load",
"order - the sort order",
"by - what to sort by in the gate settings",
"search - a string to search the gate settings for and "
],
responseParams: ["repeated Gate gates", "uint32 next_offset", "uint32 total"]
},
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/gates/:gate/measurements",
description: "get the measurements for the components linked to the gate",
urlOptions: ["start - RFC3339 formatted timestamp", "end - RFC3339 formatted timestamp"],
urlParams: [":gate - the key of the gate"],
responseParams: ["repeated UnitMeasurementsForComponent measurements"]
},
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/gates/:gate",
description: "get a specified gate",
urlParams: [":gate - the key of the gate"],
responseParams: ["Gate gate"]
},
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/gates/:gate/airflow",
description: "get the estimated mass airflow of the gate",
urlOptions: [
"device - the id of the device",
"ambient - the key of the component assigned to ambient temp",
"pressure - the key of the component assigned to pressure",
"start - RFC3339 formatted timestamp for the start of the measurement window",
"start - RFC3339 formatted timestamp for the end of the measurement window"
],
urlParams: [":gate - the key of the gate"],
responseParams: ["repeated FlowAt values"]
}
// {
// requestType: "POST",
// url: "https://api.brandxtech.ca/v1/gates",
// description: "add a new gate",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
// may restrict this one as it effectively changes permissions a gate has to a device
// {
// requestType: "POST",
// url: "https://api.brandxtech.ca/v1/gates/:gate/link",
// description: "update the devices linked to the gate",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
// {
// requestType: "PUT",
// url: "https://api.brandxtech.ca/v1/gates/:gate",
// description: "update an existing gates settings",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
// {
// requestType: "PUT",
// url: "https://api.brandxtech.ca/v1/gatePrefs/:gate",
// description: "update the preferences of an existing gate",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
// {
// requestType: "DEL",
// url: "https://api.brandxtech.ca/v1/gates/:gate",
// description: "delete an existing gate",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
];
return (
<Box>
<Typography variant="h5" style={{ fontWeight: 650 }}>
Endpoints for retrieving terminal data
</Typography>
<List>
{terminalEndpoints.map((e, i) => (
<ListItem key={i} style={{ marginBottom: 10 }}>
<EndpointDisplay endpoint={e} />
</ListItem>
))}
</List>
<Typography variant="h5" style={{ fontWeight: 650 }}>
Endpoints for retrieving gate data
</Typography>
<List>
{gateEndpoints.map((e, i) => (
<ListItem key={i} style={{ marginBottom: 10 }}>
<EndpointDisplay endpoint={e} />
</ListItem>
))}
</List>
</Box>
);
}

View file

@ -0,0 +1,161 @@
import { Box, List, ListItem, Typography } from "@mui/material";
import EndpointDisplay, { EndPointData } from "apiDocs/endpoints/endpointDisplay";
import React from "react";
/**
* endpoint template
{
requestType: "",
url: "https://api.brandxtech.ca/v1/",
description: "",
urlOptions: [],
urlParams: [],
requestBody: "",
responseParams: []
},
*/
export default function ConstructionEndpoints() {
const jobsiteEndpoints: EndPointData[] = [
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/sites",
description: "get a list of jobsites",
urlOptions: [
"limit - the number to load",
"offset - how many to skip over before starting to load",
"order - the sort order",
"by - what to sort by in the data",
"search - a string to search for a match in the data"
],
responseParams: ["repeated Site sites", "uint32 next_offset", "uint32 total"]
},
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/sites/:site",
description: "get a specific site",
urlParams: [":site - the key of the site"],
responseParams: ["SiteSettings settings", "SiteStatus status"]
}
// {
// requestType: "POST",
// url: "https://api.brandxtech.ca/v1/sites",
// description: "add a new jobsite",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
// {
// requestType: "POST",
// url: "https://api.brandxtech.ca/v1/sites/:site/link",
// description: "update the devices linked to a site",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
// {
// requestType: "PUT",
// url: "https://api.brandxtech.ca/v1/sites/:site",
// description: "update an existing jobsite",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
// {
// requestType: "DEL",
// url: "https://api.brandxtech.ca/v1/sites/:site",
// description: "",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
];
const heaterEndpoints: EndPointData[] = [
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/objectHeaters",
description:
"get a list of heater objects, note these are different than the heater components on a device",
urlOptions: [
"limit - the number to load",
"offset - how many to skip over before starting to load",
"order - the sort order",
"by - what to sort by in the data",
"search - a string to search for a match in the data"
],
responseParams: ["repeated ObjectHeater heaters", "uint32 next_offset", "uint32 total"]
},
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/objectHeaters/:objectHeater",
description:
"get a specific object heater, not this is different than a heater component on a device",
urlParams: [":objectHeater - the key of the heater object"],
responseParams: ["ObjectHeater heater"]
}
// {
// requestType: "POST",
// url: "https://api.brandxtech.ca/v1/objectHeaters",
// description: "add a new heater object",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
// {
// requestType: "POST",
// url: "https://api.brandxtech.ca/v1/objectHeaters/:objectHeater/link",
// description: "update the device connected to the heater",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
// {
// requestType: "PUT",
// url: "https://api.brandxtech.ca/v1/objectHeaters/:objectHeater",
// description: "update an existing heater",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
// {
// requestType: "DEL",
// url: "https://api.brandxtech.ca/v1/objectHeaters/:objectHeater",
// description: "delete an existing heater",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
];
return (
<Box>
<Typography variant="h5" style={{ fontWeight: 650 }}>
Endpoints for retrieving jobsite data
</Typography>
<List>
{jobsiteEndpoints.map((e, i) => (
<ListItem key={i} style={{ marginBottom: 10 }}>
<EndpointDisplay endpoint={e} />
</ListItem>
))}
</List>
<Typography variant="h5" style={{ fontWeight: 650 }}>
Endpoints for retrieving heater data
</Typography>
<List>
{heaterEndpoints.map((e, i) => (
<ListItem key={i} style={{ marginBottom: 10 }}>
<EndpointDisplay endpoint={e} />
</ListItem>
))}
</List>
</Box>
);
}

View file

@ -0,0 +1,83 @@
import { Box, Grid2 as Grid, List, ListItem, Typography } from "@mui/material";
import React from "react";
export interface EndPointData {
requestType: "GET" | "POST" | "PUT" | "DEL";
url: string;
description: string;
urlParams?: string[];
urlOptions?: string[];
requestBody?: string;
responseParams?: string[];
}
interface Props {
endpoint: EndPointData;
}
export default function EndpointDisplay(props: Props) {
const { endpoint } = props;
return (
<Box style={{ border: "2px solid white", padding: 10, borderRadius: 10 }}>
<Grid container spacing={2} >
<Grid size={12}>
<Typography variant="h6">
{endpoint.requestType} {endpoint.url}
</Typography>
<Typography>{endpoint.description}</Typography>
</Grid>
<Grid size={6}>
<Typography variant="h6" style={{ fontWeight: 650 }}>
Request
</Typography>
</Grid>
<Grid size={6}>
<Typography variant="h6" style={{ fontWeight: 650 }}>
Response
</Typography>
</Grid>
<Grid size={6}>
{endpoint.urlParams && (
<React.Fragment>
<Typography>URL Parameters</Typography>
<List>
{endpoint.urlParams.map((param, i) => (
<ListItem key={i}>{param}</ListItem>
))}
</List>
</React.Fragment>
)}
{endpoint.urlOptions && (
<React.Fragment>
<Typography>URL Options</Typography>
<List>
{endpoint.urlOptions.map((op, i) => (
<ListItem key={i}>{op}</ListItem>
))}
</List>
</React.Fragment>
)}
{endpoint.requestBody && (
<React.Fragment>
<Typography>Request Body</Typography>
<List>
<ListItem key={"body"}>{endpoint.requestBody}</ListItem>
</List>
</React.Fragment>
)}
</Grid>
<Grid size={6}>
{"{"}
{endpoint.responseParams && (
<List>
{endpoint.responseParams.map((op, i) => (
<ListItem key={i}>{op}</ListItem>
))}
</List>
)}
{"}"}
</Grid>
</Grid>
</Box>
);
}

View file

@ -0,0 +1,839 @@
import { Box, List, ListItem, Typography } from "@mui/material";
import EndpointDisplay, { EndPointData } from "apiDocs/endpoints/endpointDisplay";
const genericListOptions = [
"limit - the number to load",
"offset - how many to skip over before starting to load",
"order - the sort order",
"by - what to sort by in the data",
"search - a string to search the data for a match"
];
export default function GeneralEndpoints() {
//all of the endpoint that are not a get are commented out for now as users with the api keys can only hit get endpoints
const apiKeys: EndPointData[] = [
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/teams/:team/apiKeys",
description: "gets all of the api keys associated with a team",
urlParams: [":team - the unique id for a team"],
responseParams: ["repeated string keys"]
}
// {
// requestType: "POST",
// url: "https://api.brandxtech.ca/v1/teams/:team/apiKeys",
// description: "add a new api key for the team",
// urlParams: [":team - the unique id for a team"],
// responseParams: ["string key"]
// },
// {
// requestType: "DEL",
// url: "https://api.brandxtech.ca/v1/teams/:team/apiKeys",
// description: "add a new api key for the team",
// urlParams: [":team - the unique id for a team"],
// urlOptions: ["key - the api key to remove"]
// }
];
const notifications: EndPointData[] = [
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/notifications",
description: "gets a list of notifications",
urlOptions: [
"limit - the number to load",
"offset - how many to skip over before starting to load",
"order - the sort order",
"by - what to sort by in the data",
"search - a string to search the data for a match"
],
responseParams: ["repeated Notification notifications", "uint32 nextOffset", "uint32 total"]
}
];
const notes: EndPointData[] = [
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/notes",
description: "gets a list of notes",
urlOptions: [
"limit - the number to load",
"offset - how many to skip over before starting to load",
"order - the sort order",
"by - what to sort by in the data",
"search - a string to search the data for a match"
],
responseParams: ["repeated Note notes", "uint32 nextOffset", "uint32 total"]
},
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/note/:note",
description: "gets a list of notes",
urlParams: [":note - the key of the note"],
responseParams: ["NoteSettings settings", "NoteStatus status"]
}
// {
// requestType: "POST",
// url: "https://api.brandxtech.ca/v1/notes",
// description: "adds a new note",
// requestBody: "NoteSettings",
// responseParams: ["string note"]
// },
// {
// requestType: "PUT",
// url: "https://api.brandxtech.ca/v1/notes",
// description: "updates an existing note",
// requestBody: "NoteSettings"
// },
// {
// requestType: "DEL",
// url: "https://api.brandxtech.ca/v1/notes/:note",
// description: "deletes a note",
// urlParams: [":note - the key of the note"]
// }
];
const mapMarkers: EndPointData[] = [
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/homeMarkers",
description: "get the home markers set for a team",
urlOptions: genericListOptions,
urlParams: [],
requestBody: "",
responseParams: ["repeated HomeMarker homeMarker", "uint32 nextOffset", "uint32 total"]
},
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/homeMarkers/:homeMarker",
description: "Get a specific Home Marker based on the key",
urlParams: [":homeMarker - the key of the home marker"],
responseParams: ["HomeMarkerSettings settings", "HomeMarkerStatus status"]
},
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/fieldMarkers",
description: "list all field markers",
urlOptions: genericListOptions,
responseParams: ["repeated FieldMarker fieldMarker", "uint32 nextOffset", "uint32 total"]
},
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/fieldMarkers/:fieldMarker",
description: "get a specified field marker",
urlParams: [":fieldMarker - the key of the field marker"],
responseParams: ["FieldMarkerSettings settings", "FieldMarkerStatus status"]
}
// {
// requestType: "POST",
// url: "https://api.brandxtech.ca/v1/homeMarkers",
// description: "add a new home marker",
// requestBody: "HomeMarkerSettings",
// responseParams: ["string homeMarker"]
// },
// {
// requestType: "POST",
// url: "https://api.brandxtech.ca/v1/fieldMarkers",
// description: "add a new field marker",
// requestBody: "FieldMarkerSettings",
// responseParams: ["string fieldMarker"]
// },
// {
// requestType: "PUT",
// url: "https://api.brandxtech.ca/v1/homeMarkers/:homeMarker",
// description: "update an existing home marker",
// urlOptions: [":homeMarker - the key for the marker"],
// urlParams: ["HomeMarkerSettings"]
// },
// {
// requestType: "DEL",
// url: "https://api.brandxtech.ca/v1/homeMarkers/:homeMarker",
// description: "Delete an existing home marker",
// urlParams: [":homeMarker - the key of the home marker"]
// },
// {
// requestType: "PUT",
// url: "https://api.brandxtech.ca/v1/fieldMarkers/:fieldMarker",
// description: "update an existing field marker",
// urlParams: [":fieldMarker - the key for the field marker"],
// requestBody: "FieldMarkerSettings"
// },
// {
// requestType: "DEL",
// url: "https://api.brandxtech.ca/v1/fieldMarkers/:fieldMarker",
// description: "delete an existing field marker",
// urlParams: [":fieldMarker - the key for the marker"]
// }
];
const tasks: EndPointData[] = [
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/tasks",
description: "get a list of tasks",
urlOptions: [
"limit - the number to load",
"offset - how many to skip over before starting to load",
"order - the sort order",
"by - what to sort by in the data",
"search - a string to search the data for a match",
"from - RFC3339 formatted timestamp to get all tasks with start after (to be used in conjunction with to)",
"to - RFC3339 formatted timestamp to get all tasks with start before (to be used in conjunction with from)"
],
responseParams: ["repeated Task tasks", "uint32 nextOffset", "uint32 total"]
},
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/tasks/:task",
description: "get an existing task",
urlParams: [":task - the key for the task"],
responseParams: ["TaskSettings settigns", "string key"]
}
// {
// requestType: "POST",
// url: "https://api.brandxtech.ca/v1/tasks",
// description: "add a new task",
// requestBody: "TaskSettings",
// responseParams: ["string task"]
// },
// {
// requestType: "DEL",
// url: "https://api.brandxtech.ca/v1/tasks/:task",
// description: "delete an existing task",
// urlParams: [":task - the key of the task"]
// },
// {
// requestType: "PUT",
// url: "https://api.brandxtech.ca/v1/tasks/:task",
// description: "update an existing task",
// urlParams: [":task - the key of the task"],
// requestBody: "TaskSettings"
// }
];
const devices: EndPointData[] = [
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/devices",
description: "get a list of devices",
urlOptions: [
"limit - the number of devices to load",
"offset - the number of devices to skip over before starting to load",
"order - what to sort the devices by",
"by - how to order them (ASC/DESC)",
"search - what to search in the devices for",
"ids - comma seperated string of device ids to get",
"comprehensive - boolean value of whether to get the components for the loaded devices",
"measurements - boolean value of wether to get the measurements when loading comprehensive devices",
"hologram - boolean value of whehter to get the hologram data for cellular devices"
],
responseParams: [
"repeated Device devices",
"uint32 next_offset",
"uint32 total",
"repeated ComprehensiveDevice comprehensive_devices",
"repeated HologramDevice hologram_devices"
]
},
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/multidevices",
description: "get a list of devices based on given ids",
urlOptions: ["devices - comma seperated string of device ids"],
responseParams: ["repeated Device devices", "uint32 nextOffset", "uint32 total"]
},
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/devices/:device",
description: "get a specified device",
urlParams: [":device - the id of the device"],
responseParams: ["DeviceSettings settings", "DeviceStatus status"]
},
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/devices/:device/geojson",
description: "get the geojson data of a device such as longitude and latitude",
urlParams: [":device - the id of the device"],
responseParams: ["DeviceGeoJson"]
},
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/geojson/devices",
description: "list the geojson data for devices",
urlOptions: ["devices - comma seperated string of device ids"],
responseParams: ["repeated DeviceGeoJSON geojsonDevices"]
},
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/devices/:device/history",
description: "get the history of changes to the device",
urlParams: [":device - the device id"],
responseParams: ["repeated DeviceHistory history", "uint32 nextOffset", "uint32 total"]
},
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/devices/:device/completeHistory",
description: "get the history of a device and all its attached components and interactions",
urlParams: [":device - the device id"],
responseParams: ["repeated ObjectHistory history", "uint32 nextOffset", "uint32 total"]
},
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/devices/:device/usage",
description: "get data the usage of a device from a starting point to now",
urlOptions: ["start - the date to start from"],
urlParams: [":device - the id of the device"],
responseParams: [
"string status",
"repeated Session sessions",
"float latitude",
"float longitude"
]
},
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/devices/:device/paused",
description: "get the pause state of the device",
urlParams: [":device - the id of the device"],
responseParams: ["bool paused"]
},
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/devices/:device/datacap",
description: "get the monthly data cap for a device",
urlParams: [":device - the id of the device"],
responseParams: ["int64 overlimit"]
},
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/devices/:device/overlimit",
description: "Get whether the datacap has been hit for a device",
urlParams: [":device - the id of the device"],
responseParams: ["bool isover"]
}
// {
// requestType: "POST",
// url: "https://api.brandxtech.ca/v1/devices/:device/clearPending",
// description: "clears pending device requests",
// urlParams: [":device - the id of the device"]
// },
// {
// requestType: "POST",
// url: "https://api.brandxtech.ca/v1/devices/:device/pause",
// description: "Pause a cellular device",
// urlParams: [":device - the id of the device"]
// },
// {
// requestType: "POST",
// url: "https://api.brandxtech.ca/v1/bulkPauseDevices",
// description: "pause or resume a list of devices",
// urlOptions: [
// "ids - comma seperated list of device ids",
// "paused - boolean to pause or unpause"
// ],
// responseParams: ["repeated DeviceSuccess devicesPaused"]
// },
// {
// requestType: "POST",
// url: "https://api.brandxtech.ca/v1/bulkChangeDataCap",
// description: "change the data cap for multiple devices",
// urlOptions: [
// "ids - comma seperated list of device ids",
// "datacap - the value for the new datacap"
// ],
// responseParams: ["repeated uint64", "uint64 bytes"]
// },
// {
// requestType: "POST",
// url: "https://api.brandxtech.ca/v1/devices/:device/resume",
// description: "resume a cellular device",
// urlParams: [":device - the id of the device"]
// },
// {
// requestType: "POST",
// url: "https://api.brandxtech.ca/v1/devices/:device/sync",
// description:
// "syncronizes the configuration on the device with the configuration saved in the database",
// urlParams: [":device - the id of the device"]
// },
// {
// requestType: "POST",
// url: "https://api.brandxtech.ca/v1/devices/:device/upgrade",
// description: "tell a device to upgrade to the latest firmware on its channel",
// urlParams: [":device - the id of the device"],
// responseParams: ["string key"]
// },
// {
// requestType: "POST",
// url: "https://api.brandxtech.ca/v1/devices/:device/datacap",
// description: "set the monthly datacap for a device",
// urlOptions: ["limit - the new datacap for the device"],
// urlParams: [":device - the id of the device"]
// },
// {
// requestType: "PUT",
// url: "https://api.brandxtech.ca/v1/devices/:device/tags/:tag",
// description: "sets a tag on the device",
// urlParams: [":device - the id if the device", ":tag - the tag to set on the device"]
// },
// {
// requestType: "PUT",
// url: "https://api.brandxtech.ca/v1/devices/:device/update",
// description: "update a device",
// urlParams: [":device - the id of the device"],
// requestBody: "DeviceSettings"
// },
//I think users should be able to use this one but im not sure
// {
// requestType: "PUT",
// url: "https://api.brandxtech.ca/v1/devices/:device/wifi",
// description: "update the wifi connection of a device",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
//thi one i dont think users should be able to do
// {
// requestType: "DEL",
// url: "https://api.brandxtech.ca/v1/devices/:device",
// description: "remove an existing device",
// urlParams: [
// ":device - the id of the device"
// ],
// },
// {
// requestType: "DEL",
// url: "https://api.brandxtech.ca/v1/devices/:device/tags/:tag",
// description: "remove a tag from a device",
// urlParams: [":device - the id of the device", ":tag - the tag to remove from the device"]
// }
];
const components: EndPointData[] = [
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/components/forObject",
description: "gets all the components linked to an object such as a bin",
urlOptions: [
"keys - comma seperated list of keys, the final key in the list is the object that will be used to load the components, all keys before are for the permissions chain",
"types - the corresponding object type for the key in the same position in the keys option"
],
responseParams: ["repeated Component components", "map<string, uint64> component_devices"]
},
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/devices/:device/components",
description: "Gets all components for a device",
urlOptions: [
"comprehensive - boolean whether to get the other related information for a component such as measurements"
],
urlParams: [":device - the device id"],
responseParams: ["repeated Component components", "map<string, uint64> component_devices"]
},
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/devices/:device/components/:component",
description: "get a specified component on a device",
urlParams: [":device - the device id", ":component - the key of the component"],
responseParams: [
"ComponentSettings settings",
"ComponentStatus status",
"repeated UnitMeasurementsForComponent last_measurement",
"repeated Permission permissions"
]
},
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/devices/:device/components/:component/history",
description: "get the history of changes to a devices component",
urlOptions: [
"limit - the number of records to retrieve",
"offset - the number of records to pass over before starting retrieval"
],
urlParams: [":device - the device id", ":components - the key of the component"],
responseParams: ["repeated ComponentHistory history", "uint32 nextOffset", "uint32 total"]
}
// {
// requestType: "POST",
// url: "https://api.brandxtech.ca/v1/devices/:device/components",
// description: "add a new component to a device",
// urlParams: [
// ":device - the device id"
// ],
// requestBody: "ComponentSettings"
// },
// {
// requestType: "POST",
// url: "https://api.brandxtech.ca/v1/devices/:device/multiComponents",
// description: "add multiple components to a device",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
// {
// requestType: "PUT",
// url: "https://api.brandxtech.ca/v1/devices/:device/components/:component/preferences",
// description: "update a components preferences",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
// {
// requestType: "PUT",
// url: "https://api.brandxtech.ca/v1/devices/:device/components/:component/update",
// description: "update the settings of a component",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
// {
// requestType: "DEL",
// url: "https://api.brandxtech.ca/v1/devices/:device/components/:component",
// description: "removes an existing component",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
];
const interactions: EndPointData[] = [
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/devices/:device/interactions",
description: "list the interactions for a device",
urlParams: [":device - the device id"],
responseParams: ["repeated Interaction interactions"]
},
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/devices/:device/components/:component/interactions",
description: "list the interactions for a specified component on a device",
urlParams: [":device - the id of the device", ":component - the key of the component"],
responseParams: ["repeated Interaction interactions"]
}
// {
// requestType: "POST",
// url: "https://api.brandxtech.ca/v1/devices/:device/interactions",
// description: "add a new interaction to a device",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
// {
// requestType: "POST",
// url: "https://api.brandxtech.ca/v1/devices/:device/interactions/multi",
// description: "add multiple interactions to a device",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
// {
// requestType: "PUT",
// url: "https://api.brandxtech.ca/v1/devices/:device/interactions",
// description: "update an existing interaction on a device",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
// {
// requestType: "PUT",
// url: "https://api.brandxtech.ca/v1/devices/:device/interactions/:interaction/interactionPondSettings",
// description: `update the settings of an interaction in the pond without touching the interaction on the device,
// use this only for pond specific settings that the device does not need`,
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
// {
// requestType: "DEL",
// url: "https://api.brandxtech.ca/v1/devices/:device/interactions/:interaction",
// description: "remove an existing interaction from a device",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
];
const measurements: EndPointData[] = [
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/devices/:device/components/:component/unitMeasurements",
description: "list the unit measurements for a component",
urlOptions: [
"limit - the maximum number of measurements to get",
"offset - the number of records to skip over before starting retrieval",
"order - what to order the measurements by",
"type - enum value of measurement type to include if you only want a specific type ie. only get temperature and not humidity for a grain cable you would include type=1",
"start - RFC3339 formatted timestamp for the start of the window",
"end - RFC3339 formatted timestamp for the end of the window"
],
urlParams: [":device - the id of the device", ":component - the key of the component"],
responseParams: [
"repeated UnitMeasurementsForComponent measurements",
"uint32 next_offset",
"uint32 total"
]
},
{
requestType: "GET",
url:
"https://api.brandxtech.ca/v1/devices/:device/components/:component/measurements/sampleUnit",
description: "get a list of sample unit measurements",
urlOptions: [
"start - RFC3339 formatted timestamp for the start of the window",
"end - RFC3339 formatted timestamp for the end of the window",
"size - the number of records to get for the sample"
],
urlParams: [":device - the id of the device", ":component - the key of the component"],
responseParams: ["repeated UnitMeasurementsForComponent measurements"]
},
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/objects/:object/:type/unitMeasurements",
description:
"gets the measurements on object can estimate of itself using components that are attached to it",
urlOptions: [
"limit - the maximum number of measurements to get",
"offset - the number of records to skip over before starting retrieval",
"order - what to order the measurements by",
"start - RFC3339 formatted timestamp for the start of the window",
"end - RFC3339 formatted timestamp for the end of the window"
],
urlParams: [":object - the key of the object", ":type - enum value of the type of the object"]
}
];
const groups: EndPointData[] = [
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/groups",
description: "lis device groups",
urlOptions: genericListOptions,
responseParams: ["repeated Group groups", "uint32 next_offset", "uint32 total"]
},
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/groups/:group",
description: "get a specific device group",
urlParams: [":group - the id of the group"],
responseParams: ["GroupSettings settings", "GroupStatus status"]
},
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/groups/:group/devices",
description: "list the devices from a specific group",
urlOptions: [
"limit - the number of records to load from the group",
"offset - the number of records to pass before starting retrieval",
"order - a key in the device settings to order them by",
"search - a string to search the data for and only return matching devices",
"comprehensive - boolean value on whether to load the device with their components as well"
],
urlParams: [":group - the id of the group"],
responseParams: [
"repeated Device devices",
"uint32 next_offset",
"uint32 total",
"repeated ComprehensiveDevice comprehensive_devices",
"repeated HologramDevice hologram_devices"
]
}
// {
// requestType: "POST",
// url: "https://api.brandxtech.ca/v1/groups",
// description: "add a new group",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
// {
// requestType: "POST",
// url: "https://api.brandxtech.ca/v1/groups/:group/devices/:device/add",
// description: "add a device to an existing group",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
// {
// requestType: "POST",
// url: "https://api.brandxtech.ca/v1/groups/:group/devices/:device/remove",
// description: "remove a device from an existing group",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
// {
// requestType: "PUT",
// url: "https://api.brandxtech.ca/v1/groups/:group",
// description: "update an existing group",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
// {
// requestType: "DEL",
// url: "https://api.brandxtech.ca/v1/groups/:group",
// description: "removes an exisitng group",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
];
const transactions: EndPointData[] = [
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/transactions",
description: "list all transactions between two dates",
urlOptions: ["start - RFC3339 formatted timestamp", "end - RFC3339 formatted timestamp"],
responseParams: ["repeated Transaction transactions", "uint32 next_offset", "uint32 total"]
}
// {
// requestType: "POST",
// url: "https://api.brandxtech.ca/v1/transactions",
// description: "create a new transaction",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
// {
// requestType: "PUT",
// url: "https://api.brandxtech.ca/v1/transactions/:transaction/revoke",
// description: "revoke an existing transaction",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
// {
// requestType: "POST",
// url: "https://api.brandxtech.ca/v1/transactions/:transaction/update",
// description: "update an existing transaction",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
];
return (
<Box>
<Typography variant="h5" style={{ fontWeight: 650 }}>
Endpoints for managing API keys
</Typography>
<List>
{apiKeys.map((e, i) => (
<ListItem key={i} style={{ marginBottom: 10 }}>
<EndpointDisplay endpoint={e} />
</ListItem>
))}
</List>
<Typography variant="h5" style={{ fontWeight: 650 }}>
Endpoints for managing notifications
</Typography>
<List>
{notifications.map((e, i) => (
<ListItem key={i} style={{ marginBottom: 10 }}>
<EndpointDisplay endpoint={e} />
</ListItem>
))}
</List>
<Typography variant="h5" style={{ fontWeight: 650 }}>
Endpoints for managing notes
</Typography>
<List>
{notes.map((e, i) => (
<ListItem key={i} style={{ marginBottom: 10 }}>
<EndpointDisplay endpoint={e} />
</ListItem>
))}
</List>
<Typography variant="h5" style={{ fontWeight: 650 }}>
Endpoints for managing map markers
</Typography>
<List>
{mapMarkers.map((e, i) => (
<ListItem key={i} style={{ marginBottom: 10 }}>
<EndpointDisplay endpoint={e} />
</ListItem>
))}
</List>
<Typography variant="h5" style={{ fontWeight: 650 }}>
Endpoints for managing tasks
</Typography>
<List>
{tasks.map((e, i) => (
<ListItem key={i} style={{ marginBottom: 10 }}>
<EndpointDisplay endpoint={e} />
</ListItem>
))}
</List>
<Typography variant="h5" style={{ fontWeight: 650 }}>
Endpoints for managing devices
</Typography>
<List>
{devices.map((e, i) => (
<ListItem key={i} style={{ marginBottom: 10 }}>
<EndpointDisplay endpoint={e} />
</ListItem>
))}
</List>
<Typography variant="h5" style={{ fontWeight: 650 }}>
Endpoints for managing components
</Typography>
<List>
{components.map((e, i) => (
<ListItem key={i} style={{ marginBottom: 10 }}>
<EndpointDisplay endpoint={e} />
</ListItem>
))}
</List>
<Typography variant="h5" style={{ fontWeight: 650 }}>
Endpoints for managing interactions
</Typography>
<List>
{interactions.map((e, i) => (
<ListItem key={i} style={{ marginBottom: 10 }}>
<EndpointDisplay endpoint={e} />
</ListItem>
))}
</List>
<Typography variant="h5" style={{ fontWeight: 650 }}>
Endpoints for managing measurements
</Typography>
<List>
{measurements.map((e, i) => (
<ListItem key={i} style={{ marginBottom: 10 }}>
<EndpointDisplay endpoint={e} />
</ListItem>
))}
</List>
<Typography variant="h5" style={{ fontWeight: 650 }}>
Endpoints for managing groups
</Typography>
<List>
{groups.map((e, i) => (
<ListItem key={i} style={{ marginBottom: 10 }}>
<EndpointDisplay endpoint={e} />
</ListItem>
))}
</List>
<Typography variant="h5" style={{ fontWeight: 650 }}>
Endpoints for managing transactions
</Typography>
<List>
{transactions.map((e, i) => (
<ListItem key={i} style={{ marginBottom: 10 }}>
<EndpointDisplay endpoint={e} />
</ListItem>
))}
</List>
</Box>
);
}

View file

@ -0,0 +1,121 @@
import { Box, List, ListItem, Typography } from "@mui/material";
import EndpointDisplay, { EndPointData } from "apiDocs/endpoints/endpointDisplay";
import React from "react";
/**
* endpoint template
{
requestType: "",
url: "https://api.brandxtech.ca/v1/",
description: "",
urlOptions: [],
urlParams: [],
requestBody: "",
responseParams: []
},
*/
export default function MiningEndpoints() {
const mineEndpoints: EndPointData[] = [
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/mines",
description: "get a list of mines",
urlOptions: [
"limit - the number to load",
"offset - how many to skip over before starting to load",
"order - the sort order",
"by - what to sort by in the data",
"search - a string to search for a match in the data"
],
responseParams: ["repeated Mine mines", "uint32 next_offset", "uint32 total"]
},
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/mineSimple",
description: "get a list of just the key and name of your mines",
urlOptions: [
"limit - the number to load",
"offset - how many to skip over before starting to load",
"order - the sort order",
"by - what to sort by in the data",
"search - a string to search for a match in the data"
],
responseParams: ["repeated MineSimple mines", "uint32 next_offset", "uint32 total"]
},
{
requestType: "GET",
url: "https://api.brandxtech.ca/v1/mines/:mine",
description: "get a specified mine",
urlParams: [":mine - the key of the mine"],
responseParams: [
"Mine mine",
"repeated Device devices",
"repeated Component components",
"repeated Permission permissions",
"map<string, MineComponentPreferences> component_preferences",
"map<string, uint64> component_devices"
]
}
// {
// requestType: "POST",
// url: "https://api.brandxtech.ca/v1/mines",
// description: "add a new mine",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
// {
// requestType: "POST",
// url: "https://api.brandxtech.ca/v1/mines/:mine/addDevice/:device",
// description: "attach a device to a mine",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
// {
// requestType: "POST",
// url: "https://api.brandxtech.ca/v1/mines/:mine/addComponent/:device/:component",
// description: "attach a component to a mine",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
// {
// requestType: "PUT",
// url: "https://api.brandxtech.ca/v1/mines",
// description: "update a mine",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
// {
// requestType: "DEL",
// url: "https://api.brandxtech.ca/v1/mines/:mine",
// description: "remove an existing mine",
// urlOptions: [],
// urlParams: [],
// requestBody: "",
// responseParams: []
// },
];
return (
<Box>
<Typography variant="h5" style={{ fontWeight: 650 }}>
Endpoints for retrieving mine data
</Typography>
<List>
{mineEndpoints.map((e, i) => (
<ListItem key={i} style={{ marginBottom: 10 }}>
<EndpointDisplay endpoint={e} />
</ListItem>
))}
</List>
</Box>
);
}

View file

@ -0,0 +1,46 @@
import { Box } from "@mui/material";
import GeneralEnums from "./enumerators/generalEnums";
export default function Enumerators() {
//const [currentTab, setCurrentTab] = useState("general");
/*
for now all of the enums are in general since the most of the industry specific groupings dont have very many,
consider spliting them up when they have more
*/
return (
<Box>
{/*
<Tabs
value={currentTab}
onChange={(_, value) => setCurrentTab(value)}
indicatorColor="primary"
textColor="primary"
variant="fullWidth">
<Tab label={"General"} value={"general"} />
<Tab label={"Agriculture"} value={"agriculture"} />
<Tab label={"Aviation"} value={"aviation"} />
<Tab label={"Mining"} value={"mining"} />
<Tab label={"Construction"} value={"construction"} />
</Tabs>
<TabPanel value={currentTab} index="general">
<GeneralEnums />
</TabPanel>
<TabPanel value={currentTab} index="agriculture">
<AgricultureEnums />
</TabPanel>
<TabPanel value={currentTab} index="aviation">
<AviationEnums />
</TabPanel>
<TabPanel value={currentTab} index="mining">
<MiningEnums />
</TabPanel>
<TabPanel value={currentTab} index="construction">
<ConstructionEnums />
</TabPanel>
</TabContext>
*/}
<GeneralEnums />
</Box>
);
}

View file

@ -0,0 +1,115 @@
import {
Accordion,
AccordionDetails,
AccordionSummary,
Box,
darken,
Table,
TableBody,
TableCell,
TableHead,
TableRow,
Theme,
Typography
} from "@mui/material";
import { ExpandMore } from "@mui/icons-material";
import { makeStyles } from "@mui/styles";
import { getThemeType } from "theme";
export interface EnumPairs {
key: string;
val: number;
}
export interface data {
name: string;
pairs: EnumPairs[];
}
interface Props {
data: data;
}
const useStyles = makeStyles((theme: Theme) => ({
cellNarrow: {
width: "20%",
padding: 5
},
cellWide: {
width: "80%",
padding: 5
},
dark: {
backgroundColor: getThemeType() === "light" ? "rgb(245, 245, 245)" : "rgb(50, 50, 50)",
padding: 0
},
light: {
backgroundColor: getThemeType() === "light" ? "rgb(235, 235, 235)" : "rgb(60, 60, 60)",
padding: 0
},
container: {
width: "100%",
border: "2px solid white",
padding: 5,
borderRadius: 10
},
table: {
width: "100%"
},
header: {
fontWeight: 650,
fontSize: 20
},
tableHeader: {
fontSize: 17,
fontWeight: 650
},
tableData: {
fontSize: 17
},
subHeader: {
fontSize: 14,
color: darken(theme.palette.text.primary, 0.3)
}
})
);
export default function EnumeratorDisplay(props: Props) {
const { data } = props;
const classes = useStyles();
return (
<Accordion style={{ width: "100%" }}>
<AccordionSummary expandIcon={<ExpandMore />}>
<Typography className={classes.header}>{data.name}</Typography>
</AccordionSummary>
<AccordionDetails>
<Box className={classes.container}>
<Table className={classes.table}>
<TableHead>
<TableRow>
<TableCell align="left" className={classes.cellNarrow}>
<Typography className={classes.tableHeader}>Enumerator Value</Typography>
</TableCell>
<TableCell align="left" className={classes.cellWide}>
<Typography className={classes.tableHeader}>Enumerator Key</Typography>
</TableCell>
</TableRow>
</TableHead>
<TableBody>
{data.pairs.map((pair, i) => (
<TableRow className={i % 2 === 0 ? classes.light : classes.dark} key={i}>
<TableCell align="left" className={classes.cellNarrow}>
<Typography className={classes.tableData}>{pair.val}</Typography>
</TableCell>
<TableCell align="left" className={classes.cellWide}>
<Typography className={classes.tableData}>{pair.key}</Typography>
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</Box>
</AccordionDetails>
</Accordion>
);
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,76 @@
import { Box, List, ListItem, Typography } from "@mui/material";
export default function Information() {
return (
<Box>
<Box>
<Typography variant="h4">General Information</Typography>
<Typography>
In order to use the API you will need to make sure to have a team key set and included in
the header in the format key: Authorization, value: Apikey aaabbb for example
"Authorization: Apikey fekssxi1n5gh1"
</Typography>
</Box>
<Box marginTop={5}>
<Typography variant="h4">Global Variables</Typography>
<Typography>
There are two global url parameters that exist for all API calls, keys and types, they are
both comma seperated strings that are used to add to the context chain for permissions.
For regular calls the team that the api key you place in the header belongs to is the only
option in the context and therefore when listing objects such as bins it will consider all
of the bins accessible to the team. If you add to the keys and types options it will add
the array into the context of the api call so for example if you want to load only the
bins in a specified binyard you add the key of the the binyard to the keys and 'binyard'
to the type like so
</Typography>
<Typography style={{ margin: 5 }}>
'https://api.brandxtech.ca/v1/bins?keys=ST0MQc7_y4aHNA&types=binyard'
</Typography>
<Typography>
Adding this into the context will then cause it to go down the chain checking to make sure
the team has access to the yard and then loading the bins that yard has access to. Note
that in the above example adding more than one yard would come back with nothing as it
would check the team to the yard and then that yard to the next yard which is not
possible. Also Note that the types defined in the parameter must be a type as defined by
us and are case sensitive, see below for a list of acceptable types.
</Typography>
<Typography variant="h6" style={{ marginTop: 5 }}>
Acceptable Types
</Typography>
<List>
<ListItem>backpack</ListItem>
<ListItem>bin</ListItem>
<ListItem>binyard</ListItem>
<ListItem>component</ListItem>
<ListItem>contract</ListItem>
<ListItem>device</ListItem>
<ListItem>device_preset</ListItem>
<ListItem>field</ListItem>
<ListItem>field_marker</ListItem>
<ListItem>file</ListItem>
<ListItem>firmware</ListItem>
<ListItem>gate</ListItem>
<ListItem>grainbag</ListItem>
<ListItem>group</ListItem>
<ListItem>harvest_plan</ListItem>
<ListItem>harvest_year</ListItem>
<ListItem>home_marker</ListItem>
<ListItem>interaction</ListItem>
<ListItem>link</ListItem>
<ListItem>note</ListItem>
<ListItem>objectHeater</ListItem>
<ListItem>mine</ListItem>
<ListItem>notificationBanner</ListItem>
<ListItem>site</ListItem>
<ListItem>tag</ListItem>
<ListItem>terminal</ListItem>
<ListItem>transaction</ListItem>
<ListItem>task</ListItem>
<ListItem>team</ListItem>
<ListItem>upgrade</ListItem>
<ListItem>user</ListItem>
</List>
</Box>
</Box>
);
}