Skip to content

Commit

Permalink
Merge pull request #35 from KingBuzzer/set-description-for-contenttype
Browse files Browse the repository at this point in the history
Add support for descriptions in content type creation.
  • Loading branch information
tomxor committed May 26, 2015
2 parents 66eac3e + 069c03e commit 76f7eb3
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 1 deletion.
19 changes: 19 additions & 0 deletions src/main/java/com/contentful/java/cma/model/CMAContentType.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ public class CMAContentType extends StatefulResource {
// Name
String name;

// Description Field
String description;

// Display Field
String displayField;

Expand Down Expand Up @@ -106,4 +109,20 @@ public CMAContentType setDisplayField(String displayField) {
this.displayField = displayField;
return this;
}

/**
* Returns the description of this Content Type.
*/
public String getDescription() {
return description;
}

/**
* Sets the description field for this Content Type.
* @return this {@code CMAContentType} instance
*/
public CMAContentType setDescription(String description) {
this.description = description;
return this;
}
}
3 changes: 3 additions & 0 deletions src/test/kotlin/com/contentful/java/cma/ContentTypeTests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class ContentTypeTests : BaseTest() {
"spaceid",
CMAContentType()
.setName("whatever1")
.setDescription("desc1")
.setDisplayField("df")
.addField(CMAField().setId("f1")
.setName("field1")
Expand Down Expand Up @@ -66,6 +67,7 @@ class ContentTypeTests : BaseTest() {
CMAContentType()
.setId("contenttypeid")
.setName("whatever1")
.setDescription("desc1")
.setDisplayField("df")
.setFields(listOf(
CMAField().setId("f1")
Expand Down Expand Up @@ -203,6 +205,7 @@ class ContentTypeTests : BaseTest() {
"spaceid", "contenttypeid", TestCallback()) as TestCallback)

assertEquals("Blog Post", result.getName())
assertEquals("desc1", result.getDescription())

// Fields
val fields = result.getFields()
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/content_type_create_request.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"name":"whatever1","displayField":"df","fields":[{"id":"f1","name":"field1","type":"Text","required":true},{"id":"f2","name":"field2","type":"Number"}]}
{"name":"whatever1","description":"desc1","displayField":"df","fields":[{"id":"f1","name":"field1","type":"Text","required":true},{"id":"f2","name":"field2","type":"Number"}]}
1 change: 1 addition & 0 deletions src/test/resources/content_type_create_response.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "whatever1",
"description": "desc1",
"displayField": "df",
"fields": [
{
Expand Down
1 change: 1 addition & 0 deletions src/test/resources/content_type_fetch_one_response.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "Blog Post",
"description": "desc1",
"fields": [
{
"id": "titleid",
Expand Down

0 comments on commit 76f7eb3

Please sign in to comment.