Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ description: A guide in my new Starlight docs site.
</div>

## Creating and running triggers
If you are testing components in development, check out [Working with Triggers](../../developer_guide/components/triggers/)
If you are testing components in development, check out [Working with Triggers](../../developer_guide/testing_triggers/triggers)

<div style="position:relative;height:0;width:100%;overflow:hidden;z-index:99999;box-sizing:border-box;padding-bottom:calc(52.75862069% + 32px)">
<iframe src="https://www.guidejar.com/embed/4c1580fa-5c01-47b0-9c8b-30f1239dd372?type=1&controls=on" width="100%" height="100%" style="height:100%;position:absolute;inset:0" allowfullscreen frameborder="0"></iframe>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ scopes in the `authorizations` method of the `CONNECTION_DEFINITION` constant. T
define the properties that are required for the connection, such as Client ID and Client Secret. Here is an example of
a connection with OAuth2 authorization:

```
``` java
public static final ModifiableConnectionDefinition CONNECTION_DEFINITION = connection()
.baseUri((connectionParameters, context) -> "base url")
.authorizations(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ In `server/libs/modules/components/newcomponent/src/main/java/com/bytechef/compo
`NewComponentDummyAction` class defines the connection. The `ACTION_DEFINITION` constant contains all the details about
the action, including its name, title, description, properties and others.

```
``` java
public static final ModifiableActionDefinition ACTION_DEFINITION = action("dummy")
.title("Dummy Action")
.description("Action description.")
Expand All @@ -24,17 +24,14 @@ public static final ModifiableActionDefinition ACTION_DEFINITION = action("dummy
.perform(NewComponentDummyAction::perform);
```

The `perform` method contains the logic for the action. Here is the simplest example of the `perform` method that returns the value of the `name` property.


```
protected static Object perform(
``` java
protected static String perform(
Parameters inputParameters, Parameters connectionParameters, ActionContext actionContext) {

return actionContext
.http(http -> http.post("some url"))
.configuration(Http.responseType(Http.ResponseType.JSON))
.body()
.execute()
.getBody(new TypeReference<>() {});
return inputParemeters.getRequiredString("name");
}
```

For more information about any method in the `ACTION_DEFINITION`, refer to the [action documentation](../component_specification/action.md).
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ In `server/libs/modules/components/newcomponent/src/main/java/com/bytechef/compo
`NewComponentComponentHandler` class defines the component. The `COMPONENT_DEFINITION` constant contains all the details
about the component, including its name, title, description, icon, categories, connection, actions, triggers and others.

```
``` java
private static final ComponentDefinition COMPONENT_DEFINITION = component("newComponent")
.title("New Component")
.description("New component description.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,24 @@ title: "Initial Setup"
To create new component, we will use `example` component as template.

1. Copy the example component from `server/libs/modules/components/example` into a new package `server/libs/modules/components/newcomponent`, where `newcomponent` is name of your new component.
2. Inside the new package, replace all occurrences of word `example` with `newcomponent`. Then, replace all occurrences of `Example` with `NewComponent`.

#### Setup Gradle
2. Update Settings:
- Open `bytechef/settings.gradle.kts`.
- Add the following line to include your new component in the build process:
```kotlin
include("server:libs:modules:components:newcomponent")
```

3. In file `bytechef/settings.gradle.kts`, add line: `include("server:libs:modules:components:newcomponent")`
4. In both files `bytechef/server/ee/apps/worker-app/build.gradle.kts` and `bytechef/server/apps/server-app/build.gradle.kts`, add line `implementation(project(":server:libs:modules:components:newcomponent"))`
5. Load gradle changes. After that IntelliJ should recognize your connector as a java module.
3. Modify Build Files:
- Open `bytechef/server/ee/apps/worker-app/build.gradle.kts` and `bytechef/server/apps/server-app/build.gradle.kts`.
- Add the following line to both files to ensure your component is included as a dependency:
```kotlin
implementation(project(":server:libs:modules:components:newcomponent"))
```
4. Load Gradle Changes:
- Refresh or reload the Gradle project in IntelliJ IDEA.
- This step ensures that IntelliJ recognizes your new component as a Java module, allowing you to work with it seamlessly within the IDE.

5. Rename Package and Classes:
- Inside the newly created package, rename the `example` subpackage to `newcomponent`.
- Additionally, rename all classes within this package that start with `Example` to start with `NewComponent`.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ title: "Component"
The component definition is used to specify the properties of a component. Below is an explanation of each method that can be used in the component definition:

- `component(String name)` - Builds new `ModifiableComponentDefinition` with the specified name. The name defines the component key (backend ID).
- `actions(A... actionDefinitions)` - Specifies the actions that the component can perform.
- [`actions(A... actionDefinitions)`](./action) - Specifies the actions that the component can perform.
- `categories(ComponentCategory... category)` - Defines the category or categories that the component belongs to, used to group components together in the UI.
- `connection(ModifiableConnectionDefinition connectionDefinition)` - Sets the connection definition for the component.
- [`connection(ModifiableConnectionDefinition connectionDefinition)`](./connection) - Sets the connection definition for the component.
- `connectionRequired(boolean connectionRequired)` - Indicates whether the component requires a connection to be configured before it can be used.
- `customAction(boolean customAction)` - Indicates if the component is REST-based.
- `description(String description)` - Provides a short description of the component.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Each authorization type has different properties that are required for successfu

Basic Auth is a simple authentication scheme built into the HTTP protocol. It requires a username and password, which are sent with each request.

```
```java
authorization(AuthorizationType.BASIC_AUTH)
.title("Basic Auth")
.properties(
Expand All @@ -50,7 +50,7 @@ authorization(AuthorizationType.BASIC_AUTH)

Bearer Token authentication involves sending a token with each request. This token is typically obtained from an authorization server and represents the user's identity.

```
```java
authorization(AuthorizationType.BEARER_TOKEN)
.title("Bearer Token")
.properties(
Expand All @@ -63,7 +63,7 @@ authorization(AuthorizationType.BEARER_TOKEN)

OAuth2 Authorization Code is a robust authorization framework that allows third-party applications to obtain limited access to a web service. It involves redirecting the user to an authorization server to obtain an authorization code, which is then exchanged for an access token.

```
```java
authorization(AuthorizationType.OAUTH2_AUTHORIZATION_CODE)
.title("OAuth2 Authorization Code")
.properties(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,20 @@ title: "Property"
The `ModifiableArrayProperty` class is a customizable property type designed to handle array values within a component.

- `array(String name)` - Initializes a new `ModifiableArrayProperty` with the specified name.
- `defaultValue(...)` - Sets the default value for the property using various data types such as Boolean, Integer, Long, Float, Double, String, or Map.
- `exampleValue(...)` - Provides an example value for illustrative purposes using various data types.
- `items(...)` - Specifies the properties that define the items in the array.
- `defaultValue(T... defaultValue)` - Sets the default value for the property using various data types such as Boolean, Integer, Long, Float, Double, String, or Map.
- `exampleValue(T... exampleValue)` - Provides an example value for illustrative purposes using various data types.
- `items(P.. properties)` - Specifies the properties that define the items in the array.
- `optionsLookupDependsOn(String... optionsLookupDependsOn)` - Defines dependencies for option lookups.
- `maxItems(long maxItems)` - Sets the maximum number of items allowed in the array.
- `minItems(long minItems)` - Sets the minimum number of items required in the array.
- `multipleValues(boolean multipleValues)` - Indicates whether the array can contain multiple values.
- `options(...)` - Specifies a list of options for the property or defines a function to dynamically generate options.
- `options(Option<Object>... options)` - Specifies a list of options for the property.
- `options(OptionsFunction optionsFunction)` - Defines a function to dynamically generate options.

### Boolean Property

The `ModifiableBooleanProperty` class is a customizable property type designed to handle boolean values within a component.

- `bool(String name)` - Initializes a new `ModifiableBooleanProperty` with the specified name.
- `defaultValue(boolean defaultValue)` - Sets the default value for the property.
- `exampleValue(boolean exampleValue)` - Provides an example value for illustrative purposes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,42 @@
title: "Customize Component"
---

### Connector Icon
### Connector Icon and Category

1. Find an Icon:
- Search for a suitable user interface icon for your component in `.svg` format.

2. Save the Icon:
- Place the icon in the following directory: `server/libs/modules/components/newcomponent/src/main/resources/assets/newcomponent.svg`.

3. Update Component Handler:
- In `NewComponentComponentHandler.class`, override the `modifyComponent(ModifiableComponentDefinition modifiableComponentDefinition)` method:
3. Choose a Category:
- Select a category for your component. Available categories can be found in [ComponentCategory](https://github.com/bytechefhq/bytechef/blob/master/sdks/backend/java/component-api/src/main/java/com/bytechef/component/definition/ComponentCategory.java).

4. Update Component Handler:
- In `NewComponentComponentHandler`, override the `modifyComponent(ModifiableComponentDefinition modifiableComponentDefinition)` method:
```java
@Override
public ModifiableComponentDefinition modifyComponent(ModifiableComponentDefinition modifiableComponentDefinition) {
return modifiableComponentDefinition.icon("path:assets/newcomponent.svg");
return modifiableComponentDefinition
.icon("path:assets/newcomponent.svg")
.categories(ComponentCategory.HELPERS);
}
```

### Connection

If your component requires custom authentication parameters, override the `modifyConnection(ModifiableConnectionDefinition modifiableConnectionDefinition)` method in `NewComponentComponentHandler.class`.
If your component requires custom authentication parameters, override the `modifyConnection(ModifiableConnectionDefinition modifiableConnectionDefinition)` method in `NewComponentComponentHandler`.

Refer to examples like [`ShopifyComponentHandler`](https://github.com/bytechefhq/bytechef/blob/master/server/libs/modules/components/shopify/src/main/java/com/bytechef/component/shopify/ShopifyComponentHandler.java#L72), [`DiscordComponentHandler`](https://github.com/bytechefhq/bytechef/blob/master/server/libs/modules/components/discord/src/main/java/com/bytechef/component/discord/DiscordComponentHandler.java#L92), or [`PipelinerComponentHandler`](https://github.com/bytechefhq/bytechef/blob/master/server/libs/modules/components/pipeliner/src/main/java/com/bytechef/component/pipeliner/PipelinerComponentHandler.java#L57) for guidance.

### Action

If some actions require properties not specified in the OpenAPI schema, override the `modifyActions(ModifiableActionDefinition... actionDefinitions)` method in `NewComponentComponentHandler`.

Refer to examples like [`ShopifyComponentHandler.class`](https://github.com/bytechefhq/bytechef/blob/master/server/libs/modules/components/shopify/src/main/java/com/bytechef/component/shopify/ShopifyComponentHandler.java#L72), [`DiscordComponentHandler.class`](https://github.com/bytechefhq/bytechef/blob/master/server/libs/modules/components/discord/src/main/java/com/bytechef/component/discord/DiscordComponentHandler.java#L92), or [`PipelinerComponentHandler.class`](https://github.com/bytechefhq/bytechef/blob/master/server/libs/modules/components/pipeliner/src/main/java/com/bytechef/component/pipeliner/PipelinerComponentHandler.java#L57) for guidance.
Refer to examples like [`DiscordComponentHandler`](https://github.com/bytechefhq/bytechef/blob/master/server/libs/modules/components/discord/src/main/java/com/bytechef/component/discord/DiscordComponentHandler.java#L66) or [`ClickupComponentHandler`](https://github.com/bytechefhq/bytechef/blob/master/server/libs/modules/components/clickup/src/main/java/com/bytechef/component/clickup/ClickupComponentHandler.java#L60).

### Dynamic options

For parameters that require dynamic options, override the `modifyProperty(ActionDefinition actionDefinition, ModifiableProperty<?> modifiableProperty)` method in `NewComponentComponentHandler.class`.
For parameters that require dynamic options, override the `modifyProperty(ActionDefinition actionDefinition, ModifiableProperty<?> modifiableProperty)` method in `NewComponentComponentHandler`.

Check examples such as [`ShopifyComponentHandler.class`](https://github.com/bytechefhq/bytechef/blob/master/server/libs/modules/components/shopify/src/main/java/com/bytechef/component/shopify/ShopifyComponentHandler.java#L96) for implementation details.
Check examples such as [`ShopifyComponentHandler`](https://github.com/bytechefhq/bytechef/blob/master/server/libs/modules/components/shopify/src/main/java/com/bytechef/component/shopify/ShopifyComponentHandler.java#L96) for implementation details.
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@
import com.bytechef.component.example.trigger.ExampleDummyTrigger;
import com.google.auto.service.AutoService;

/**
* @author Mario Cvjetojevic
*/
@AutoService(ComponentHandler.class)
public class ExampleComponentHandler implements ComponentHandler {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
import com.bytechef.component.definition.ComponentDsl.ModifiableActionDefinition;
import com.bytechef.component.definition.Parameters;

/**
* @author Mario Cvjetojevic
*/
public class ExampleDummyAction {

public static final ModifiableActionDefinition ACTION_DEFINITION = action("dummyAction")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@

package com.bytechef.component.example.constant;

/**
* @author Mario Cvjetojevic
*/
public final class ExampleConstants {
public class ExampleConstants {

public static final String ID = "id";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
import com.bytechef.test.jsonasssert.JsonFileAssert;
import org.junit.jupiter.api.Test;

/**
* @author Mario Cvjetojevic
*/
class ExampleComponentHandlerTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

/**
* @author Mario Cvjetojevic
*/
class ExampleDummyActionTest {

@Test
Expand Down