Skip to content

Commit 670f0b4

Browse files
Implement GetAppBranding
1 parent 2b19a20 commit 670f0b4

File tree

4 files changed

+73
-0
lines changed

4 files changed

+73
-0
lines changed

package-lock.json

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"@bufbuild/protobuf": "^1.10.0",
5656
"@connectrpc/connect": "^1.6.0",
5757
"@connectrpc/connect-web": "^1.6.0",
58+
"@viamrobotics/sdk": "^0.44.0",
5859
"bsonfy": "^1.0.2",
5960
"exponential-backoff": "^3.1.2"
6061
},

src/app/app-client.spec.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2034,4 +2034,35 @@ describe('AppClient tests', () => {
20342034
});
20352035
});
20362036
});
2037+
2038+
describe('getAppBranding tests', () => {
2039+
beforeEach(() => {
2040+
mockTransport = createRouterTransport(({ service }) => {
2041+
service(AppService, {
2042+
getAppBranding: () =>
2043+
new pb.GetAppBrandingResponse({
2044+
logoPath: '/branding/logo.png',
2045+
textCustomizations: {
2046+
machinePicker: new pb.TextOverrides({
2047+
fields: {
2048+
heading: 'Welcome',
2049+
subheading: 'Select your machine.',
2050+
},
2051+
}),
2052+
},
2053+
}),
2054+
});
2055+
});
2056+
});
2057+
2058+
it('getAppBranding', async () => {
2059+
const response = await subject().getAppBranding(
2060+
'publicNamespace',
2061+
'appName'
2062+
);
2063+
expect(response.logoPath).toEqual('/branding/logo.png');
2064+
expect(response.textCustomizations.machinePicker!.fields.heading).toEqual('Welcome');
2065+
expect(response.textCustomizations.machinePicker!.fields.subheading).toEqual('Select your machine.');
2066+
});
2067+
});
20372068
});

src/app/app-client.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
Fragment,
1414
FragmentVisibility,
1515
GetAppContentResponse,
16+
GetAppBrandingResponse,
1617
GetRobotPartLogsResponse,
1718
GetRobotPartResponse,
1819
GetRobotPartByNameAndLocationResponse,
@@ -2213,4 +2214,30 @@ export class AppClient {
22132214
data: Struct.fromJson(data),
22142215
});
22152216
}
2217+
2218+
/**
2219+
* Retrieves the app branding for an organization/app.
2220+
*
2221+
* @example
2222+
*
2223+
* ```ts
2224+
* const branding = await appClient.getAppBranding(
2225+
* '<YOUR-PUBLIC-NAMESPACE>',
2226+
* '<YOUR-APP-NAME>'
2227+
* );
2228+
* ```
2229+
*
2230+
* For more information, see [App
2231+
* API](https://docs.viam.com/dev/reference/apis/fleet/#getappbranding).
2232+
*
2233+
* @param publicNamespace The public namespace of the organization
2234+
* @param name The name of the app
2235+
* @returns The branding information for the app
2236+
*/
2237+
async getAppBranding(
2238+
publicNamespace: string,
2239+
name: string
2240+
): Promise<GetAppBrandingResponse> {
2241+
return this.client.getAppBranding({ publicNamespace, name });
2242+
}
22162243
}

0 commit comments

Comments
 (0)