Skip to content

Commit

Permalink
feat(blocktype): add documentation entry
Browse files Browse the repository at this point in the history
  • Loading branch information
Sylvain Durand committed Jul 17, 2024
1 parent e5f8dd4 commit bc861d7
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/main/java/sipa/blockprovider/BlockTypeBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,17 @@ public BlockTypeBuilder withVersion(final int major, final int minor, final int
return this;
}

/**
* Set the version of the block type.
*
* @param url external documentation url
* @return the block type builder
*/
public BlockTypeBuilder withDocumentation(final String url) {
this.blockConfiguration.setDocumentation(url);
return this;
}

/**
* Specify the endpoint settings associated with the block type.
*
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/sipa/blockprovider/domain/BlockConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
public class BlockConfiguration {

private String version;
private final Documentation documentation = new Documentation();
private final Endpoint endpoint = new Endpoint();
private final List<Template> templates = new ArrayList<>();

Expand All @@ -27,4 +28,14 @@ public void setVersion(final String version) {
public List<Template> getTemplates() {
return this.templates;
}

public Documentation getDocumentation() {
return this.documentation;
}

public void setDocumentation(final String url) { this.documentation.url = url; }

public class Documentation {
private String url;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ void shouldSerializeOneBlockType() {
// the block type
.addType("bold").withVersion(1, 0, 0)

// set documentation
.withDocumentation("http://ww.google.fr")

// declare the endpoint url
.withEndpoint("https://localhost/block-configurations", "GET", "pure")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ void shouldSerializeTwoBlockTypes() {
// the block type
.addType("bold").withVersion(1, 0, 0)

// set documentation
.withDocumentation("http://ww.google.fr")

// the input text
.addParameter("text")
.configurableAsString(null)
Expand Down

0 comments on commit bc861d7

Please sign in to comment.