package com.growthbeat.analytics.model;

import java.util.Date;

public class Segment {

	private String id;
	private String originId;
	private String originName;
	private String description;
	private String query;
	private Date created;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getOriginId() {
		return originId;
	}

	public void setOriginId(String originId) {
		this.originId = originId;
	}

	public String getOriginName() {
		return originName;
	}

	public void setOriginName(String originName) {
		this.originName = originName;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getQuery() {
		return query;
	}

	public void setQuery(String query) {
		this.query = query;
	}

	public Date getCreated() {
		return created;
	}

	public void setCreated(Date created) {
		this.created = created;
	}

}

@@ -61,181 +61,2093 @@
 te;%0A
-%0Apublic class Segment %7B%0A%0A%09private String id;%0A%09private String originId;%0A%09private String originName;%0A%09private String description;%0A%09private String query;%0A%09private Date created;
+import java.util.HashMap;%0Aimport java.util.List;%0Aimport java.util.Map;%0A%0Aimport org.codehaus.jackson.type.TypeReference;%0A%0Aimport com.growthbeat.Context;%0Aimport com.growthbeat.http.JsonUtils;%0A%0Apublic class Segment %7B%0A%0A%09private String id;%0A%09private String originId;%0A%09private String originName;%0A%09private String description;%0A%09private String query;%0A%09private Date created;%0A%0A%09public static Segment findById(String id, Context context) %7B%0A%09%09String json = context.getGrowthbeatHttpClient().get(%22/1/segments/%22 + id, new HashMap%3CString, Object%3E());%0A%09%09return JsonUtils.deserialize(json, Segment.class);%0A%09%7D%0A%0A%09public static List%3CSegment%3E findByParentSegmentId(String parentSegmentId, Integer depth, Context context) %7B%0A%09%09Map%3CString, Object%3E params = new HashMap%3CString, Object%3E();%0A%09%09params.put(%22parentSegmentId%22, parentSegmentId);%0A%09%09if (depth != null)%0A%09%09%09params.put(%22depth%22, depth);%0A%09%09String json = context.getGrowthbeatHttpClient().get(%22/1/segments%22, params);%0A%09%09return JsonUtils.deserialize(json, new TypeReference%3CList%3CSegment%3E%3E() %7B%0A%09%09%7D);%0A%09%7D%0A%0A%09public static Segment create(String parentSegmentId, String name, String description, String query, Context context) %7B%0A%09%09Map%3CString, Object%3E params = new HashMap%3CString, Object%3E();%0A%09%09params.put(%22parentSegmentId%22, parentSegmentId);%0A%09%09params.put(%22name%22, name);%0A%09%09params.put(%22description%22, description);%0A%09%09params.put(%22query%22, query);%0A%09%09String json = context.getGrowthbeatHttpClient().post(%22/1/segments%22, params);%0A%09%09return JsonUtils.deserialize(json, Segment.class);%0A%09%7D%0A%0A%09public static Segment update(String segmentId, String description, String query, Context context) %7B%0A%09%09Map%3CString, Object%3E params = new HashMap%3CString, Object%3E();%0A%09%09params.put(%22description%22, description);%0A%09%09params.put(%22query%22, query);%0A%09%09String json = context.getGrowthbeatHttpClient().put(%22/1/segments/%22 + segmentId, params);%0A%09%09return JsonUtils.deserialize(json, Segment.class);%0A%09%7D%0A%0A%09public static void delete(String segmentId, Context context) %7B%0A%09%09Map%3CString, Object%3E params = new HashMap%3CString, Object%3E();%0A%09%09context.getGrowthbeatHttpClient().delete(%22/1/segments/%22 + segmentId, params);%0A%09%7D
 %0A%0A%09p

Add Segment API.