Skip to content
Merged

1598 #1813

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions docs/src/content/docs/reference/components/figma.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,34 @@ Version: 1
## Actions


### Get Comments
Gets a list of comments left on the file.

#### Properties

| Name | Type | Control Type | Description |
|:--------------:|:------------:|:--------------------:|:-------------------:|
| File Key | STRING | TEXT | File to get comments from. Figma file key copy from Figma file URL. |


### Output



Type: OBJECT


#### Properties

| Type | Control Type |
|:------------:|:--------------------:|
| [{STRING\(id), STRING\(file_key), STRING\(parent_id), {STRING\(id), STRING\(handle), STRING\(img_url), STRING\(email)}\(user)}] | ARRAY_BUILDER |






### Post Comment
Posts a new comment on the file.

Expand Down
43 changes: 43 additions & 0 deletions server/libs/modules/components/figma/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,48 @@ servers:
- url: "https://api.figma.com"
paths:
/v1/files/{fileKey}/comments:
get:
summary: "Get Comments"
description: "Gets a list of comments left on the file."
operationId: "getComments"
parameters:
- name: "fileKey"
in: "path"
description: "File to get comments from. Figma file key copy from Figma file URL."
required: true
schema:
type: "string"
title: "File Key"
responses:
200:
description: "Successful response."
content:
application/json:
schema:
type: "object"
properties:
body:
type: "array"
items:
type: "object"
properties:
id:
type: "string"
file_key:
type: "string"
parent_id:
type: "string"
user:
type: "object"
properties:
id:
type: "string"
handle:
type: "string"
img_url:
type: "string"
email:
type: "string"
post:
summary: "Post Comment"
description: "Posts a new comment on the file."
Expand Down Expand Up @@ -64,3 +106,4 @@ components:
refreshUrl: "https://www.figma.com/api/oauth/refresh"
scopes:
file_comments:write: " "
files:read: ""
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import com.bytechef.component.OpenApiComponentHandler;
import com.bytechef.component.definition.ComponentDefinition;
import com.bytechef.component.figma.action.FigmaGetCommentsAction;
import com.bytechef.component.figma.action.FigmaPostCommentAction;
import com.bytechef.component.figma.connection.FigmaConnection;

Expand All @@ -34,7 +35,8 @@ public abstract class AbstractFigmaComponentHandler implements OpenApiComponentH
.title("Figma")
.description(
"Figma is a cloud-based design and prototyping tool that enables teams to collaborate in real-time on user interface and user experience projects."))
.actions(modifyActions(FigmaPostCommentAction.ACTION_DEFINITION))
.actions(modifyActions(FigmaGetCommentsAction.ACTION_DEFINITION,
FigmaPostCommentAction.ACTION_DEFINITION))
.connection(modifyConnection(FigmaConnection.CONNECTION_DEFINITION))
.triggers(getTriggers());

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* Copyright 2023-present ByteChef Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.bytechef.component.figma.action;

import static com.bytechef.component.OpenApiComponentHandler.PropertyType;
import static com.bytechef.component.definition.ComponentDsl.action;
import static com.bytechef.component.definition.ComponentDsl.array;
import static com.bytechef.component.definition.ComponentDsl.object;
import static com.bytechef.component.definition.ComponentDsl.outputSchema;
import static com.bytechef.component.definition.ComponentDsl.string;
import static com.bytechef.component.definition.Context.Http.ResponseType;

import com.bytechef.component.definition.ComponentDsl;
import java.util.Map;

/**
* Provides a list of the component actions.
*
* @generated
*/
public class FigmaGetCommentsAction {
public static final ComponentDsl.ModifiableActionDefinition ACTION_DEFINITION = action("getComments")
.title("Get Comments")
.description("Gets a list of comments left on the file.")
.metadata(
Map.of(
"method", "GET",
"path", "/v1/files/{fileKey}/comments"

))
.properties(string("fileKey").label("File Key")
.description("File to get comments from. Figma file key copy from Figma file URL.")
.required(true)
.metadata(
Map.of(
"type", PropertyType.PATH)))
.output(outputSchema(object()
.properties(array("body")
.items(object().properties(string("id").required(false), string("file_key").required(false),
string("parent_id").required(false),
object("user")
.properties(string("id").required(false), string("handle").required(false),
string("img_url").required(false), string("email").required(false))
.required(false)))
.required(false))
.metadata(
Map.of(
"responseType", ResponseType.JSON))));

private FigmaGetCommentsAction() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class FigmaConnection {
.label("Client Secret")
.required(true))
.authorizationUrl((connectionParameters, context) -> "https://www.figma.com/oauth")
.scopes((connection, context) -> List.of("file_comments:write"))
.scopes((connection, context) -> List.of("file_comments:write", "files:read"))
.tokenUrl((connectionParameters, context) -> "https://www.figma.com/api/oauth/token")
.refreshUrl((connectionParameters, context) -> "https://www.figma.com/api/oauth/refresh"));

Expand Down
Loading
Loading