Skip to content

feat: add SDK app icon and visibility tools#59

Open
Sebastian Mertens Make (MAKESEB) wants to merge 2 commits into
integromat:mainfrom
MAKESEB:fix/sdk-app-icon-visibility-tools
Open

feat: add SDK app icon and visibility tools#59
Sebastian Mertens Make (MAKESEB) wants to merge 2 commits into
integromat:mainfrom
MAKESEB:fix/sdk-app-icon-visibility-tools

Conversation

@MAKESEB
Copy link
Copy Markdown

Adds SDK support for app icon upload/download (check binary upload added) and app/module visibility actions, so generated consumers like Make CLI can expose these commands from SDK tool definitions.

Summary:
- Add SDK app icon upload/download methods and tools
- Add app public/private visibility methods and tools
- Add module public/private visibility methods and tools
- Support raw binary request bodies and ArrayBuffer responses in make ts
- Add unit tests for icon and visibility operations

Copilot AI review requested due to automatic review settings May 29, 2026 09:33
@MAKESEB Sebastian Mertens Make (MAKESEB) requested a review from a team as a code owner May 29, 2026 09:33
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds SDK-level support for app icon upload/download and for marking SDK apps and modules public/private, including the underlying transport changes required to send raw binary request bodies and receive ArrayBuffer responses. The new methods are surfaced both on the typed SDKApps / SDKModules clients and as MakeTool definitions consumable by downstream tools such as Make CLI.

Changes:

  • Extend the core HTTP layer (FetchOptions, prepareBody, handleResponse) to accept Uint8Array/ArrayBuffer bodies and an explicit responseType (json | text | arrayBuffer).
  • Add setIcon/getIcon and makePublic/makePrivate to SDKApps, plus makePublic/makePrivate to SDKModules, with matching MakeTool entries (including PNG validation in the icon tools).
  • Update the test fetch mock to surface binary request bodies as ArrayBuffer and add unit tests covering icon upload/download and visibility toggles.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/types.ts Widens FetchOptions.body to allow binary payloads and adds the responseType option.
src/make.ts Threads responseType through fetch/handleResponse and lets prepareBody pass binary bodies through unchanged.
src/endpoints/sdk/apps.ts Adds setIcon/getIcon and makePublic/makePrivate plus the SDKAppVisibilityResponse/IconUploadResponse types.
src/endpoints/sdk/apps.tools.ts Adds icon and visibility MakeTools and a local PNG header parser.
src/endpoints/sdk/modules.ts Adds makePublic/makePrivate and SDKModuleVisibilityResponse.
src/endpoints/sdk/modules.tools.ts Adds matching module visibility MakeTools with a shared result shaper.
src/index.ts Re-exports the new visibility response types.
test/test.utils.ts Teaches mockFetch to expose binary request bodies as ArrayBuffer.
test/sdk/apps.spec.ts Adds tests for icon upload/download and app visibility.
test/sdk/modules.spec.ts Adds a test for module visibility toggles.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +30 to +40
function visibilityResult(scope: 'app', name: string, version: number, visibility: 'public' | 'private', response: JSONValue) {
return {
changed: true,
scope,
appName: name,
version,
visibility,
public: visibility === 'public',
response,
};
}
Comment on lines +5 to +22
function moduleVisibilityResult(
appName: string,
appVersion: number,
moduleName: string,
visibility: 'public' | 'private',
response: JSONValue,
) {
return {
changed: true,
scope: 'module',
appName,
version: appVersion,
moduleName,
visibility,
public: visibility === 'public',
response,
};
}
Comment thread src/endpoints/sdk/apps.ts
Comment on lines +288 to +312
const response = await this.#fetch<IconUploadResponse | string>(`/sdk/apps/${name}/${version}/icon`, {
method: 'PUT',
headers: {
'Content-Type': options.contentType ?? 'image/png',
'imt-apps-sdk-version': options.sdkVersion ?? '2.5.0',
},
body: iconData,
});

if (response && typeof response === 'object') {
return response.success ?? response.changed ?? true;
}
return true;
}

/**
* Download an app icon at a given rendered size.
*/
async getIcon(name: string, version: number, size = 512, options: { sdkVersion?: string } = {}): Promise<ArrayBuffer> {
return await this.#fetch<ArrayBuffer>(`/sdk/apps/${name}/${version}/icon/${size}`, {
headers: {
'imt-apps-sdk-version': options.sdkVersion ?? '2.5.0',
},
responseType: 'arrayBuffer',
});
Comment thread src/make.ts
Comment on lines 389 to 409
/**
* Prepare the request body for API calls
*
* @param body The request body - can be an object, string, or undefined
* @param headers The headers object to potentially modify the content-type
* @returns The body serialized as a string
* @protected
*/
protected prepareBody(
body: Record<string, JSONValue> | Array<JSONValue> | string | undefined,
body: Record<string, JSONValue> | Array<JSONValue> | string | Uint8Array | ArrayBuffer | undefined,
headers: Record<string, string>,
): string {
): string | Uint8Array | ArrayBuffer | undefined {
if (body instanceof Uint8Array || body instanceof ArrayBuffer) {
return body;
}
if (body && typeof body !== 'string') {
headers['content-type'] = 'application/json';
return JSON.stringify(body);
}
return body as string;
return body as string | undefined;
}
Comment thread src/make.ts
Comment on lines 488 to +499
/**
* Handle successful API responses
*
* Parses the response based on content-type header.
* JSON responses are parsed as objects, other responses as text.
*
* @template T The expected response type
* @param response The successful response from the API
* @returns Promise resolving to the parsed response data
* @protected
*/
protected async handleResponse<T>(response: Response): Promise<T> {
protected async handleResponse<T>(response: Response, responseType?: FetchOptions['responseType']): Promise<T> {
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