Open History to see the last commit
1export interface DeviceHubAccess {
2 readonly httpBase: string;
3 readonly wsBase: string;
4 readonly query: Readonly<Record<string, string>>;
5 readonly credentials: boolean;
6}
7
8export const withDeviceHubQuery = (url: string, access: DeviceHubAccess): string => {
9 const entries = Object.entries(access.query);
10 if (entries.length === 0) return url;
11 const separator = url.includes("?") ? "&" : "?";
12 return `${url}${separator}${new URLSearchParams(entries).toString()}`;
13};