Object oriented programming

Hi there. Is it possible to use OOP paradigm in plugin development?

I wish to make objects extends class. And class must have some methods like async method receiving src and method creating rectangle (at picture below). I can’t figure out how to turn such API requests into class methods. Help with example

It’s not entirely clear what difficulties you’re facing. Just create a class(es) with the required methods.

For example:

class CreateRectangle {
	createRectangle(imageData) {
		const rect = figma.createRectangle();
		if (imageData) {
			rect.resize(imageData.width, imageData.height);
			rect.fills = [{ type: 'IMAGE', imageHash: imageData.hash, scaleMode: 'FILL' }];
		return rect;

class CreateImage extends CreateRectangle {
	async createImageAsync(imageData) {
		const image = await figma.createImageAsync(imageData);
		const { width, height } = await image.getSizeAsync();
		return {hash: image.hash, width, height};

This is example i’ve looked for :handshake:
Good luck =)