├── .classpath ├── .gitignore ├── .project ├── .settings ├── org.eclipse.core.resources.prefs ├── org.eclipse.jdt.core.prefs └── org.maven.ide.eclipse.prefs ├── LICENSE ├── README.markdown ├── pom.xml └── src ├── main └── java │ └── com │ └── podio │ ├── APIApplicationException.java │ ├── APIFactory.java │ ├── APITransportException.java │ ├── AuthProvider.java │ ├── BaseAPI.java │ ├── CustomJacksonJsonProvider.java │ ├── DryRunFilter.java │ ├── ExceptionFilter.java │ ├── LoginFilter.java │ ├── RateLimitFilter.java │ ├── RateLimits.java │ ├── ResourceFactory.java │ ├── app │ ├── AppAPI.java │ ├── Application.java │ ├── ApplicationConfiguration.java │ ├── ApplicationConfigurationBase.java │ ├── ApplicationConfigurationCreate.java │ ├── ApplicationCreate.java │ ├── ApplicationCreateResponse.java │ ├── ApplicationField.java │ ├── ApplicationFieldConfiguration.java │ ├── ApplicationFieldCreate.java │ ├── ApplicationFieldCreateResponse.java │ ├── ApplicationFieldSettings.java │ ├── ApplicationFieldStatus.java │ ├── ApplicationFieldType.java │ ├── ApplicationFieldUpdate.java │ ├── ApplicationInstall.java │ ├── ApplicationTask.java │ ├── ApplicationTaskBase.java │ ├── ApplicationTaskCreate.java │ ├── ApplicationUpdate.java │ ├── ApplicationViewType.java │ ├── CategoryOption.java │ ├── CategoryOptionStatus.java │ ├── DateFieldEndDateType.java │ ├── DateFieldTimeEntryType.java │ ├── Dependencies.java │ └── TextFieldSize.java │ ├── calendar │ ├── CalendarAPI.java │ ├── Event.java │ └── ParticipationStatus.java │ ├── comment │ ├── Comment.java │ ├── CommentAPI.java │ ├── CommentCreate.java │ ├── CommentCreateResponse.java │ └── CommentUpdate.java │ ├── common │ ├── AuthorizationEntity.java │ ├── AuthorizationEntityType.java │ ├── AuthorizationInterface.java │ ├── AvatarType.java │ ├── CSVUtil.java │ ├── CreatedBase.java │ ├── Empty.java │ ├── Reference.java │ ├── ReferenceType.java │ ├── Right.java │ ├── Role.java │ └── ToStringUtil.java │ ├── connection │ └── ConnectionType.java │ ├── contact │ ├── ConnectionContactTotal.java │ ├── ConnectionTypeContactTotal.java │ ├── ConnectionsContactTotal.java │ ├── ContactAPI.java │ ├── ContactCreate.java │ ├── ContactCreateResponse.java │ ├── ContactOrder.java │ ├── ContactTotal.java │ ├── ContactType.java │ ├── ContactUpdate.java │ ├── OrganizationContactTotal.java │ ├── Profile.java │ ├── ProfileBase.java │ ├── ProfileField.java │ ├── ProfileFieldValues.java │ ├── ProfileMini.java │ ├── ProfileType.java │ ├── ProfileUpdate.java │ ├── SpaceContactTotal.java │ ├── SpaceContactTotals.java │ └── UserContactTotal.java │ ├── conversation │ ├── Conversation.java │ ├── ConversationAPI.java │ ├── ConversationCreate.java │ ├── ConversationCreateResponse.java │ ├── Message.java │ ├── MessageCreate.java │ └── MessageCreateResponse.java │ ├── device │ ├── DeviceAPI.java │ └── PushSubscription.java │ ├── embed │ ├── Embed.java │ ├── EmbedAPI.java │ ├── EmbedCreate.java │ └── EmbedType.java │ ├── file │ ├── File.java │ ├── FileAPI.java │ ├── FileError.java │ ├── FileReference.java │ ├── FileSize.java │ ├── FileUpdate.java │ ├── FileUploadResponse.java │ └── FileUploadResult.java │ ├── filter │ ├── AbsolutePodioDate.java │ ├── AppFieldFilterBy.java │ ├── BaseAuthListFilterBy.java │ ├── BaseDateFilterBy.java │ ├── BaseIntListFilterBy.java │ ├── CreatedByFilterBy.java │ ├── CreatedOnFilterBy.java │ ├── CreatedViaFilterBy.java │ ├── DateFieldFilterBy.java │ ├── ExternalIdFilterBy.java │ ├── FieldFilterBy.java │ ├── FieldSortBy.java │ ├── FilterBy.java │ ├── FilterByValue.java │ ├── LastEditByFilterBy.java │ ├── LastEditOnFilterBy.java │ ├── LastEditViaFilterBy.java │ ├── MemberFieldFilterBy.java │ ├── NumberFieldFilterBy.java │ ├── NumberInterval.java │ ├── PodioDate.java │ ├── PodioDateInterval.java │ ├── ProgressFieldFilterBy.java │ ├── ProgressInterval.java │ ├── RelativePodioDate.java │ ├── SortBy.java │ ├── StandardSortBy.java │ ├── StateFieldFilterBy.java │ └── TitleFilterBy.java │ ├── hook │ ├── Hook.java │ ├── HookAPI.java │ ├── HookCreate.java │ ├── HookCreateResponse.java │ ├── HookStatus.java │ ├── HookType.java │ └── HookValidate.java │ ├── item │ ├── AppActivities.java │ ├── AppActivity.java │ ├── FieldValuesUpdate.java │ ├── FieldValuesView.java │ ├── Item.java │ ├── ItemAPI.java │ ├── ItemActivityType.java │ ├── ItemBadge.java │ ├── ItemCreate.java │ ├── ItemCreateResponse.java │ ├── ItemFieldDifference.java │ ├── ItemMicro.java │ ├── ItemMini.java │ ├── ItemReference.java │ ├── ItemRevision.java │ ├── ItemUpdate.java │ ├── ItemsResponse.java │ ├── filter │ │ ├── Filter.java │ │ ├── FilterCreatedOn.java │ │ ├── FilterDateField.java │ │ ├── FilterFieldValue.java │ │ ├── FilterInterval.java │ │ └── ItemFilter.java │ └── map │ │ ├── ExternalId.java │ │ ├── Field.java │ │ ├── FieldMap.java │ │ ├── ItemMap.java │ │ ├── MappedItemAPI.java │ │ ├── MoneyField.java │ │ ├── NameUtil.java │ │ ├── Transient.java │ │ └── converter │ │ ├── CategoryConverter.java │ │ ├── CategoryConverterProvider.java │ │ ├── ExternalIdConverter.java │ │ ├── FieldConverter.java │ │ ├── FieldConverterProvider.java │ │ ├── FieldConverterRegistry.java │ │ ├── MoneyConverter.java │ │ ├── MoneyConverterProvider.java │ │ ├── NumberConverter.java │ │ ├── NumberConverterProvider.java │ │ ├── ProgressConverter.java │ │ ├── ProgressConverterProvider.java │ │ ├── TextConverter.java │ │ └── TextConverterProvider.java │ ├── notification │ ├── InboxNewCount.java │ ├── NotificationAPI.java │ ├── NotificationContextType.java │ ├── NotificationDateType.java │ └── NotificationType.java │ ├── oauth │ ├── OAuthAPI.java │ ├── OAuthAppCredentials.java │ ├── OAuthClientCredentials.java │ ├── OAuthCodeCredentials.java │ ├── OAuthRefreshTokenCredentials.java │ ├── OAuthToken.java │ ├── OAuthUserCredentials.java │ └── OAuthUsernameCredentials.java │ ├── org │ ├── EndMemberInfo.java │ ├── OrgAPI.java │ ├── Organization.java │ ├── OrganizationCreate.java │ ├── OrganizationCreateResponse.java │ ├── OrganizationMember.java │ ├── OrganizationMini.java │ ├── OrganizationStatistics.java │ ├── OrganizationStatus.java │ └── OrganizationWithSpaces.java │ ├── rating │ ├── Rating.java │ ├── RatingAPI.java │ ├── RatingCreateResponse.java │ ├── RatingType.java │ ├── RatingTypeKeyDeserializer.java │ ├── RatingValue.java │ ├── RatingValuesMap.java │ ├── SingleRatingValue.java │ ├── TypeRating.java │ └── ValueRatings.java │ ├── search │ ├── Counts.java │ ├── ReferenceTypeSearchInApp.java │ ├── SearchAPI.java │ ├── SearchInAppResponse.java │ └── SearchResult.java │ ├── serialize │ ├── DateTimeDeserializer.java │ ├── DateTimeSerializer.java │ ├── DateTimeUtil.java │ ├── LocalDateDeserializer.java │ ├── LocalDateSerializer.java │ ├── LocaleDeserializer.java │ ├── LocaleSerializer.java │ ├── TimeZoneDeserializer.java │ └── TimeZoneSerializer.java │ ├── share │ └── Share.java │ ├── space │ ├── Space.java │ ├── SpaceAPI.java │ ├── SpaceCreate.java │ ├── SpaceCreateResponse.java │ ├── SpaceInvitation.java │ ├── SpaceInvitationUpdate.java │ ├── SpaceMember.java │ ├── SpaceMemberAdd.java │ ├── SpaceMemberDetails.java │ ├── SpaceMemberUpdate.java │ ├── SpaceMemberV2.java │ ├── SpaceMini.java │ ├── SpaceStatistics.java │ ├── SpaceTopMemberGroup.java │ ├── SpaceTopMembers.java │ ├── SpaceUpdate.java │ └── SpaceWithOrganization.java │ ├── status │ ├── Status.java │ ├── StatusAPI.java │ ├── StatusCreate.java │ ├── StatusCreateResponse.java │ ├── StatusFull.java │ └── StatusUpdate.java │ ├── stream │ ├── StreamAPI.java │ ├── StreamActivity.java │ ├── StreamActivityType.java │ ├── StreamObject.java │ └── StreamObjectV2.java │ ├── subscription │ ├── Subscription.java │ └── SubscriptionAPI.java │ ├── tag │ ├── TagAPI.java │ ├── TagCount.java │ └── TagReference.java │ ├── task │ ├── AssignValue.java │ ├── Task.java │ ├── TaskAPI.java │ ├── TaskActionType.java │ ├── TaskCreate.java │ ├── TaskCreateResponse.java │ ├── TaskDueDate.java │ ├── TaskDueStatus.java │ ├── TaskPrivate.java │ ├── TaskStatus.java │ ├── TaskText.java │ ├── TaskTotal.java │ ├── TaskTotals.java │ ├── TasksByDue.java │ └── TasksWithResponsible.java │ └── user │ ├── ProfileFieldMultiValue.java │ ├── ProfileFieldSingleValue.java │ ├── PropertyValue.java │ ├── User.java │ ├── UserAPI.java │ ├── UserMini.java │ ├── UserStatus.java │ ├── UserStatusType.java │ ├── UserType.java │ └── UserUpdate.java └── test └── java └── com └── podio ├── APIFactoryProvider.java ├── ResourceFactoryProvider.java ├── app └── AppAPITest.java ├── calendar └── CalendarAPITest.java ├── comment └── CommentAPITest.java ├── contact └── ContactAPITest.java ├── conversation └── ConversationAPITest.java ├── device └── DeviceAPITest.java ├── embed └── EmbedAPITest.java ├── file └── FileAPITest.java ├── hook └── HookAPITest.java ├── item ├── ItemAPITest.java └── map │ ├── BugMap1.java │ ├── BugMap2.java │ ├── BugMap3.java │ ├── HireStatus.java │ ├── ItemMapTest.java │ ├── MappedItemAPITest.java │ ├── NameUtilTest.java │ └── converter │ └── MoneyConverterTest.java ├── notification └── NotificationAPITest.java ├── org └── OrgAPITest.java ├── rating └── RatingAPITest.java ├── space └── SpaceAPITest.java ├── status └── StatusAPITest.java ├── stream └── StreamAPITest.java ├── subscription └── SubscriptionAPITest.java ├── tag └── TagAPITest.java ├── task └── TaskAPITest.java └── user └── UserAPITest.java /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | .idea 3 | *.iml 4 | 5 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | podio-java 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.m2e.core.maven2Nature 22 | 23 | 24 | -------------------------------------------------------------------------------- /.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | #Wed Dec 22 15:42:05 CET 2010 2 | eclipse.preferences.version=1 3 | encoding/=UTF-8 4 | -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | #Fri Oct 22 23:39:37 CEST 2010 2 | eclipse.preferences.version=1 3 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 4 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 5 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 6 | org.eclipse.jdt.core.compiler.compliance=1.6 7 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 8 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 9 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 10 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 12 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 13 | org.eclipse.jdt.core.compiler.source=1.6 14 | -------------------------------------------------------------------------------- /.settings/org.maven.ide.eclipse.prefs: -------------------------------------------------------------------------------- 1 | #Fri Oct 22 22:46:39 CEST 2010 2 | activeProfiles= 3 | eclipse.preferences.version=1 4 | fullBuildGoals=process-test-resources 5 | includeModules=false 6 | resolveWorkspaceProjects=true 7 | resourceFilterGoals=process-resources resources\:testResources 8 | skipCompilerPlugin=true 9 | version=1 10 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010-2011 Podio 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.markdown: -------------------------------------------------------------------------------- 1 | [![No Maintenance Intended](http://unmaintained.tech/badge.svg)](http://unmaintained.tech/) 2 | 3 | Podio Java API Client 4 | --------------------- 5 | 6 | This is the Java client for the [Podio](http://podio.com) API. Detailed documentation for the API is available on https://developers.podio.com. There you will find details on how to create an API key and use the API. 7 | 8 | An introduction to the Java client is also available at https://developers.podio.com/clients/java -------------------------------------------------------------------------------- /src/main/java/com/podio/APIApplicationException.java: -------------------------------------------------------------------------------- 1 | package com.podio; 2 | 3 | import java.util.Map; 4 | 5 | import com.sun.jersey.api.client.ClientResponse.Status; 6 | 7 | public class APIApplicationException extends RuntimeException { 8 | 9 | private static final long serialVersionUID = -4533177892434958205L; 10 | 11 | private final Status status; 12 | 13 | private final String error; 14 | 15 | private final String description; 16 | 17 | private final Map parameters; 18 | 19 | public APIApplicationException(Status status, String error, 20 | String description, Map parameters) { 21 | super(); 22 | this.status = status; 23 | this.error = error; 24 | this.description = description; 25 | this.parameters = parameters; 26 | } 27 | 28 | @Override 29 | public String toString() { 30 | return "APIException [status=" + status + ", error=" + error 31 | + ", description=" + description + ", parameters=" + parameters 32 | + "]"; 33 | } 34 | 35 | public Status getStatus() { 36 | return status; 37 | } 38 | 39 | public String getError() { 40 | return error; 41 | } 42 | 43 | public String getDescription() { 44 | return description; 45 | } 46 | 47 | public Map getParameters() { 48 | return parameters; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/podio/APIFactory.java: -------------------------------------------------------------------------------- 1 | package com.podio; 2 | 3 | import java.lang.reflect.InvocationTargetException; 4 | 5 | /** 6 | * Factory to make it simple to get a specific API to work with 7 | */ 8 | public class APIFactory { 9 | 10 | private final ResourceFactory resourceFactory; 11 | 12 | public APIFactory(ResourceFactory resourceFactory) { 13 | super(); 14 | this.resourceFactory = resourceFactory; 15 | } 16 | 17 | public T getAPI(Class apiClass) { 18 | try { 19 | return apiClass.getConstructor(ResourceFactory.class).newInstance( 20 | this.resourceFactory); 21 | } catch (InstantiationException e) { 22 | throw new RuntimeException(e); 23 | } catch (IllegalAccessException e) { 24 | throw new RuntimeException(e); 25 | } catch (InvocationTargetException e) { 26 | throw new RuntimeException(e); 27 | } catch (NoSuchMethodException e) { 28 | throw new RuntimeException(e); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/podio/APITransportException.java: -------------------------------------------------------------------------------- 1 | package com.podio; 2 | 3 | public class APITransportException extends RuntimeException { 4 | 5 | private static final long serialVersionUID = 5668433811286152593L; 6 | 7 | public APITransportException(Throwable cause) { 8 | super(cause); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/podio/AuthProvider.java: -------------------------------------------------------------------------------- 1 | package com.podio; 2 | 3 | import com.podio.oauth.OAuthAPI; 4 | import com.podio.oauth.OAuthClientCredentials; 5 | import com.podio.oauth.OAuthRefreshTokenCredentials; 6 | import com.podio.oauth.OAuthToken; 7 | import com.podio.oauth.OAuthUserCredentials; 8 | 9 | /** 10 | * Manages tokens based on client credentials and user credentials. 11 | */ 12 | public class AuthProvider { 13 | 14 | private final OAuthClientCredentials clientCredentials; 15 | private final OAuthUserCredentials userCredentials; 16 | private final OAuthAPI oauthAPI; 17 | 18 | private OAuthToken token; 19 | 20 | private long expireTime; 21 | 22 | public AuthProvider(ResourceFactory baseAPI, 23 | OAuthClientCredentials clientCredentials, 24 | OAuthUserCredentials userCredentials) { 25 | this.clientCredentials = clientCredentials; 26 | this.userCredentials = userCredentials; 27 | this.oauthAPI = new OAuthAPI(baseAPI); 28 | } 29 | 30 | private void updateToken(OAuthUserCredentials credentials) { 31 | this.token = oauthAPI.getToken(clientCredentials, credentials); 32 | this.expireTime = System.currentTimeMillis() + token.getExpiresIn() 33 | * 1000; 34 | } 35 | 36 | private void newToken() { 37 | updateToken(userCredentials); 38 | } 39 | 40 | private void refreshToken() { 41 | updateToken(new OAuthRefreshTokenCredentials( 42 | this.token.getRefreshToken())); 43 | } 44 | 45 | public synchronized OAuthToken getToken() { 46 | if (token == null) { 47 | newToken(); 48 | } else if (expireTime < System.currentTimeMillis() - 30 * 1000) { 49 | refreshToken(); 50 | } 51 | 52 | return token; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/podio/BaseAPI.java: -------------------------------------------------------------------------------- 1 | package com.podio; 2 | 3 | public abstract class BaseAPI { 4 | 5 | private final ResourceFactory resourceFactory; 6 | 7 | public BaseAPI(ResourceFactory resourceFactory) { 8 | this.resourceFactory = resourceFactory; 9 | } 10 | 11 | protected ResourceFactory getResourceFactory() { 12 | return resourceFactory; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/podio/CustomJacksonJsonProvider.java: -------------------------------------------------------------------------------- 1 | package com.podio; 2 | 3 | import javax.ws.rs.Consumes; 4 | import javax.ws.rs.core.MediaType; 5 | 6 | import org.codehaus.jackson.jaxrs.JacksonJsonProvider; 7 | import org.codehaus.jackson.map.ObjectMapper; 8 | 9 | /** 10 | * Custom jackson provider to accept multiple kinds of data as JSON 11 | */ 12 | @Consumes({ MediaType.APPLICATION_JSON, "text/json", "text/javascript", 13 | "application/x-javascript", "text/plain" }) 14 | public class CustomJacksonJsonProvider extends JacksonJsonProvider { 15 | 16 | public CustomJacksonJsonProvider(ObjectMapper mapper) { 17 | super(mapper); 18 | } 19 | 20 | @Override 21 | protected boolean isJsonType(MediaType mediaType) { 22 | if (super.isJsonType(mediaType)) { 23 | return true; 24 | } 25 | 26 | return mediaType != null 27 | && (mediaType.getType().equalsIgnoreCase("text") && mediaType 28 | .getSubtype().equals("javascript")) 29 | || (mediaType.getType().equalsIgnoreCase("application") && mediaType 30 | .getSubtype().equals("x-javascript")) 31 | || (mediaType.getType().equalsIgnoreCase("text") && mediaType 32 | .getSubtype().equals("plain")); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/podio/DryRunFilter.java: -------------------------------------------------------------------------------- 1 | package com.podio; 2 | 3 | import com.sun.jersey.api.client.ClientHandlerException; 4 | import com.sun.jersey.api.client.ClientRequest; 5 | import com.sun.jersey.api.client.ClientResponse; 6 | import com.sun.jersey.api.client.filter.ClientFilter; 7 | 8 | /** 9 | * Used to put the API in testmode 10 | */ 11 | public class DryRunFilter extends ClientFilter { 12 | 13 | @Override 14 | public ClientResponse handle(ClientRequest cr) 15 | throws ClientHandlerException { 16 | if (!cr.getURI().getPath().startsWith("/oauth")) { 17 | cr.getHeaders().putSingle("X-Podio-Dry-Run", "steYut44"); 18 | } 19 | 20 | return getNext().handle(cr); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/podio/ExceptionFilter.java: -------------------------------------------------------------------------------- 1 | package com.podio; 2 | 3 | import java.util.Map; 4 | 5 | import javax.ws.rs.core.Response.Status.Family; 6 | 7 | import com.sun.jersey.api.client.ClientHandlerException; 8 | import com.sun.jersey.api.client.ClientRequest; 9 | import com.sun.jersey.api.client.ClientResponse; 10 | import com.sun.jersey.api.client.GenericType; 11 | import com.sun.jersey.api.client.filter.ClientFilter; 12 | 13 | public class ExceptionFilter extends ClientFilter { 14 | 15 | @SuppressWarnings("unchecked") 16 | @Override 17 | public ClientResponse handle(ClientRequest cr) 18 | throws ClientHandlerException { 19 | try { 20 | ClientResponse response = getNext().handle(cr); 21 | if (response.getClientResponseStatus() == null 22 | || response.getClientResponseStatus().getFamily() != Family.SUCCESSFUL) { 23 | Map errorData = response 24 | .getEntity(new GenericType>() { 25 | }); 26 | 27 | throw new APIApplicationException( 28 | response.getClientResponseStatus(), 29 | (String) errorData.get("error"), 30 | (String) errorData.get("error_description"), 31 | (Map) errorData.get("parameters")); 32 | } else { 33 | return response; 34 | } 35 | } catch (ClientHandlerException e) { 36 | throw new APITransportException(e.getCause()); 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /src/main/java/com/podio/LoginFilter.java: -------------------------------------------------------------------------------- 1 | package com.podio; 2 | 3 | import javax.ws.rs.core.HttpHeaders; 4 | 5 | import com.sun.jersey.api.client.ClientHandlerException; 6 | import com.sun.jersey.api.client.ClientRequest; 7 | import com.sun.jersey.api.client.ClientResponse; 8 | import com.sun.jersey.api.client.filter.ClientFilter; 9 | 10 | /** 11 | * Filter for supplying the access token to the end point 12 | */ 13 | public class LoginFilter extends ClientFilter { 14 | 15 | private final AuthProvider authProvider; 16 | 17 | public LoginFilter(AuthProvider authProvider) { 18 | super(); 19 | this.authProvider = authProvider; 20 | } 21 | 22 | @Override 23 | public ClientResponse handle(ClientRequest cr) 24 | throws ClientHandlerException { 25 | cr.getHeaders().add(HttpHeaders.AUTHORIZATION, 26 | "OAuth2 " + authProvider.getToken().getAccessToken()); 27 | 28 | return getNext().handle(cr); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/podio/RateLimits.java: -------------------------------------------------------------------------------- 1 | package com.podio; 2 | 3 | public class RateLimits { 4 | 5 | private static Integer limit; 6 | private static Integer remaining; 7 | 8 | /** 9 | * Returns the ceiling for the request you just made. May be null if 10 | * there is no limit. 11 | * 12 | * @return the ceiling for the request you just made 13 | */ 14 | public static Integer getLimit() { 15 | return limit; 16 | } 17 | 18 | public static void setLimit(Integer limit) { 19 | RateLimits.limit = limit; 20 | } 21 | 22 | /** 23 | * Returns the number of requests you have left for the current 1 hour 24 | * window. May be null if there is no limit. 25 | * 26 | * @return the number of requests you have left for the current 1 hour 27 | * window 28 | */ 29 | public static Integer getRemaining() { 30 | return remaining; 31 | } 32 | 33 | public static void setRemaining(Integer remaining) { 34 | RateLimits.remaining = remaining; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/podio/app/ApplicationConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.podio.app; 2 | 3 | import java.util.List; 4 | 5 | public class ApplicationConfiguration extends ApplicationConfigurationBase { 6 | 7 | private static final long serialVersionUID = 1L; 8 | 9 | /** 10 | * A comma separated list of the tasks that will automatically be created 11 | * when a new item is added 12 | */ 13 | private List tasks; 14 | 15 | public ApplicationConfiguration() { 16 | super(); 17 | } 18 | 19 | public ApplicationConfiguration(String name, String itemName, 20 | String description, String usage, String externalId, String icon, 21 | boolean allowEdit, ApplicationViewType defaultView, 22 | boolean allowAttachments, boolean allowComments, boolean fivestar, 23 | String fivestarLabel, boolean approved, boolean thumbs, 24 | String thumbsLabel, boolean rsvp, String rsvpLabel, boolean yesno, 25 | String yesnoLabel, List tasks) { 26 | super(name, itemName, description, usage, externalId, icon, allowEdit, 27 | defaultView, allowAttachments, allowComments, fivestar, 28 | fivestarLabel, approved, thumbs, thumbsLabel, rsvp, rsvpLabel, 29 | yesno, yesnoLabel); 30 | this.tasks = tasks; 31 | } 32 | 33 | public List getTasks() { 34 | return tasks; 35 | } 36 | 37 | public void setTasks(List tasks) { 38 | this.tasks = tasks; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/podio/app/ApplicationConfigurationCreate.java: -------------------------------------------------------------------------------- 1 | package com.podio.app; 2 | 3 | import java.util.List; 4 | 5 | public class ApplicationConfigurationCreate extends 6 | ApplicationConfigurationBase { 7 | 8 | private static final long serialVersionUID = 1L; 9 | 10 | /** 11 | * A comma separated list of the tasks that will automatically be created 12 | * when a new item is added 13 | */ 14 | private List tasks; 15 | 16 | public ApplicationConfigurationCreate() { 17 | super(); 18 | } 19 | 20 | public ApplicationConfigurationCreate(String name, String itemName, 21 | String description, String usage, String externalId, String icon, 22 | boolean allowEdit, ApplicationViewType defaultView, 23 | boolean allowAttachments, boolean allowComments, boolean fivestar, 24 | String fivestarLabel, boolean approved, boolean thumbs, 25 | String thumbsLabel, boolean rsvp, String rsvpLabel, boolean yesno, 26 | String yesnoLabel, List tasks) { 27 | super(name, itemName, description, usage, externalId, icon, allowEdit, 28 | defaultView, allowAttachments, allowComments, fivestar, 29 | fivestarLabel, approved, thumbs, thumbsLabel, rsvp, rsvpLabel, 30 | yesno, yesnoLabel); 31 | this.tasks = tasks; 32 | } 33 | 34 | public List getTasks() { 35 | return tasks; 36 | } 37 | 38 | public void setTasks(List tasks) { 39 | this.tasks = tasks; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/podio/app/ApplicationCreate.java: -------------------------------------------------------------------------------- 1 | package com.podio.app; 2 | 3 | import java.io.Serializable; 4 | import java.util.List; 5 | 6 | import org.codehaus.jackson.annotate.JsonProperty; 7 | 8 | public class ApplicationCreate implements Serializable { 9 | 10 | private static final long serialVersionUID = 1L; 11 | 12 | /** 13 | * The id of the space on which the app is placed 14 | */ 15 | private int spaceId; 16 | 17 | /** 18 | * The new configuration of the app 19 | */ 20 | private ApplicationConfigurationCreate configuration; 21 | 22 | private List fields; 23 | 24 | public ApplicationCreate() { 25 | super(); 26 | } 27 | 28 | public ApplicationCreate(int spaceId, 29 | ApplicationConfigurationCreate configuration, 30 | List fields) { 31 | this.spaceId = spaceId; 32 | this.configuration = configuration; 33 | this.fields = fields; 34 | } 35 | 36 | @JsonProperty("space_id") 37 | public int getSpaceId() { 38 | return spaceId; 39 | } 40 | 41 | @JsonProperty("space_id") 42 | public void setSpaceId(int spaceId) { 43 | this.spaceId = spaceId; 44 | } 45 | 46 | @JsonProperty("config") 47 | public ApplicationConfigurationCreate getConfiguration() { 48 | return configuration; 49 | } 50 | 51 | @JsonProperty("config") 52 | public void setConfiguration(ApplicationConfigurationCreate configuration) { 53 | this.configuration = configuration; 54 | } 55 | 56 | public List getFields() { 57 | return fields; 58 | } 59 | 60 | public void setFields(List fields) { 61 | this.fields = fields; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/podio/app/ApplicationCreateResponse.java: -------------------------------------------------------------------------------- 1 | package com.podio.app; 2 | 3 | import java.io.Serializable; 4 | 5 | import org.codehaus.jackson.annotate.JsonProperty; 6 | 7 | public class ApplicationCreateResponse implements Serializable { 8 | 9 | private static final long serialVersionUID = 1L; 10 | 11 | /** 12 | * The id of the created app 13 | */ 14 | private int id; 15 | 16 | @JsonProperty("app_id") 17 | public int getId() { 18 | return id; 19 | } 20 | 21 | @JsonProperty("app_id") 22 | public void setId(int id) { 23 | this.id = id; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/podio/app/ApplicationField.java: -------------------------------------------------------------------------------- 1 | package com.podio.app; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | 5 | public class ApplicationField extends ApplicationFieldCreate { 6 | 7 | private static final long serialVersionUID = 1L; 8 | 9 | /** 10 | * The id of the field 11 | */ 12 | private int id; 13 | 14 | /** 15 | * The external id of the field 16 | */ 17 | private String externalId; 18 | 19 | /** 20 | * Indicates if the field was deleted in Podio - values include "active" and "deleted". 21 | */ 22 | private ApplicationFieldStatus status; 23 | 24 | @JsonProperty("field_id") 25 | public int getId() { 26 | return id; 27 | } 28 | 29 | @JsonProperty("field_id") 30 | public void setId(int id) { 31 | this.id = id; 32 | } 33 | 34 | public String getExternalId() { 35 | return externalId; 36 | } 37 | 38 | @JsonProperty("external_id") 39 | public void setExternalId(String externalId) { 40 | this.externalId = externalId; 41 | } 42 | 43 | @JsonProperty("status") 44 | public ApplicationFieldStatus getStatus() { 45 | return status; 46 | } 47 | 48 | @JsonProperty("status") 49 | public void setStatus(ApplicationFieldStatus status) { 50 | this.status = status; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/podio/app/ApplicationFieldCreate.java: -------------------------------------------------------------------------------- 1 | package com.podio.app; 2 | 3 | import java.io.Serializable; 4 | 5 | import org.codehaus.jackson.annotate.JsonProperty; 6 | 7 | public class ApplicationFieldCreate implements Serializable { 8 | 9 | private static final long serialVersionUID = 1L; 10 | 11 | /** 12 | * The type of the field (see area for more information) 13 | */ 14 | private ApplicationFieldType type; 15 | 16 | /** 17 | * The configuration of the field 18 | */ 19 | private ApplicationFieldConfiguration configuration; 20 | 21 | public ApplicationFieldCreate() { 22 | super(); 23 | } 24 | 25 | public ApplicationFieldCreate(ApplicationFieldType type, 26 | ApplicationFieldConfiguration configuration) { 27 | super(); 28 | this.type = type; 29 | this.configuration = configuration; 30 | } 31 | 32 | public ApplicationFieldType getType() { 33 | return type; 34 | } 35 | 36 | public void setType(ApplicationFieldType type) { 37 | this.type = type; 38 | } 39 | 40 | @JsonProperty("config") 41 | public ApplicationFieldConfiguration getConfiguration() { 42 | return configuration; 43 | } 44 | 45 | @JsonProperty("config") 46 | public void setConfiguration(ApplicationFieldConfiguration configuration) { 47 | this.configuration = configuration; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/podio/app/ApplicationFieldCreateResponse.java: -------------------------------------------------------------------------------- 1 | package com.podio.app; 2 | 3 | import java.io.Serializable; 4 | 5 | import org.codehaus.jackson.annotate.JsonProperty; 6 | 7 | public class ApplicationFieldCreateResponse implements Serializable { 8 | 9 | private static final long serialVersionUID = 1L; 10 | 11 | /** 12 | * The id of the created field 13 | */ 14 | private int id; 15 | 16 | @JsonProperty("field_id") 17 | public int getId() { 18 | return id; 19 | } 20 | 21 | @JsonProperty("field_id") 22 | public void setId(int id) { 23 | this.id = id; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/podio/app/ApplicationFieldStatus.java: -------------------------------------------------------------------------------- 1 | package com.podio.app; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonValue; 5 | 6 | public enum ApplicationFieldStatus { 7 | 8 | /** 9 | * The field is active. 10 | */ 11 | ACTIVE, 12 | 13 | /** 14 | * The field has been deleted. 15 | */ 16 | DELETED; 17 | 18 | @Override 19 | @JsonValue 20 | public String toString() { 21 | return name().toLowerCase(); 22 | } 23 | 24 | @JsonCreator() 25 | public static ApplicationFieldStatus getByName(String value) { 26 | return ApplicationFieldStatus.valueOf(value.toUpperCase()); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/podio/app/ApplicationFieldUpdate.java: -------------------------------------------------------------------------------- 1 | package com.podio.app; 2 | 3 | import java.io.Serializable; 4 | 5 | import org.codehaus.jackson.annotate.JsonProperty; 6 | 7 | public class ApplicationFieldUpdate implements Serializable { 8 | 9 | private static final long serialVersionUID = 1L; 10 | 11 | /** 12 | * The id of the field 13 | */ 14 | private int id; 15 | 16 | /** 17 | * The configuration of the field 18 | */ 19 | private ApplicationFieldConfiguration configuration; 20 | 21 | public ApplicationFieldUpdate() { 22 | super(); 23 | } 24 | 25 | public ApplicationFieldUpdate(int id, 26 | ApplicationFieldConfiguration configuration) { 27 | super(); 28 | this.id = id; 29 | this.configuration = configuration; 30 | } 31 | 32 | @JsonProperty("field_id") 33 | public int getId() { 34 | return id; 35 | } 36 | 37 | @JsonProperty("field_id") 38 | public void setId(int id) { 39 | this.id = id; 40 | } 41 | 42 | @JsonProperty("config") 43 | public ApplicationFieldConfiguration getConfiguration() { 44 | return configuration; 45 | } 46 | 47 | @JsonProperty("config") 48 | public void setConfiguration(ApplicationFieldConfiguration configuration) { 49 | this.configuration = configuration; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/podio/app/ApplicationInstall.java: -------------------------------------------------------------------------------- 1 | package com.podio.app; 2 | 3 | import java.io.Serializable; 4 | 5 | import org.codehaus.jackson.annotate.JsonProperty; 6 | 7 | public class ApplicationInstall implements Serializable { 8 | 9 | private static final long serialVersionUID = 1L; 10 | 11 | private int spaceId; 12 | 13 | public ApplicationInstall() { 14 | super(); 15 | } 16 | 17 | public ApplicationInstall(int spaceId) { 18 | super(); 19 | this.spaceId = spaceId; 20 | } 21 | 22 | @JsonProperty("space_id") 23 | public int getSpaceId() { 24 | return spaceId; 25 | } 26 | 27 | @JsonProperty("space_id") 28 | public void setSpaceId(int spaceId) { 29 | this.spaceId = spaceId; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/podio/app/ApplicationTask.java: -------------------------------------------------------------------------------- 1 | package com.podio.app; 2 | 3 | import java.util.List; 4 | 5 | import com.podio.user.UserMini; 6 | 7 | public class ApplicationTask extends ApplicationTaskBase { 8 | 9 | private static final long serialVersionUID = 1L; 10 | 11 | private List responsible; 12 | 13 | public List getResponsible() { 14 | return responsible; 15 | } 16 | 17 | public void setResponsible(List responsible) { 18 | this.responsible = responsible; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/podio/app/ApplicationTaskBase.java: -------------------------------------------------------------------------------- 1 | package com.podio.app; 2 | 3 | import java.io.Serializable; 4 | 5 | public class ApplicationTaskBase implements Serializable { 6 | 7 | private static final long serialVersionUID = 1L; 8 | 9 | private String text; 10 | 11 | public ApplicationTaskBase() { 12 | super(); 13 | } 14 | 15 | public ApplicationTaskBase(String text) { 16 | super(); 17 | this.text = text; 18 | } 19 | 20 | public String getText() { 21 | return text; 22 | } 23 | 24 | public void setText(String text) { 25 | this.text = text; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/podio/app/ApplicationTaskCreate.java: -------------------------------------------------------------------------------- 1 | package com.podio.app; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | 6 | public class ApplicationTaskCreate extends ApplicationTaskBase { 7 | 8 | private static final long serialVersionUID = 1L; 9 | 10 | private List responsible; 11 | 12 | public ApplicationTaskCreate() { 13 | super(); 14 | } 15 | 16 | public ApplicationTaskCreate(String text, Integer... responsible) { 17 | this(text, Arrays.asList(responsible)); 18 | } 19 | 20 | public ApplicationTaskCreate(String text, List responsible) { 21 | super(text); 22 | this.responsible = responsible; 23 | } 24 | 25 | public List getResponsible() { 26 | return responsible; 27 | } 28 | 29 | public void setResponsible(List responsible) { 30 | this.responsible = responsible; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/podio/app/ApplicationUpdate.java: -------------------------------------------------------------------------------- 1 | package com.podio.app; 2 | 3 | import java.io.Serializable; 4 | import java.util.List; 5 | 6 | import org.codehaus.jackson.annotate.JsonProperty; 7 | 8 | public class ApplicationUpdate implements Serializable { 9 | 10 | private static final long serialVersionUID = 1L; 11 | 12 | /** 13 | * The new configuration of the app 14 | */ 15 | private ApplicationConfigurationCreate configuration; 16 | 17 | private List fields; 18 | 19 | public ApplicationUpdate() { 20 | super(); 21 | } 22 | 23 | public ApplicationUpdate(ApplicationConfigurationCreate configuration, 24 | List fields) { 25 | this.configuration = configuration; 26 | this.fields = fields; 27 | } 28 | 29 | @JsonProperty("config") 30 | public ApplicationConfigurationCreate getConfiguration() { 31 | return configuration; 32 | } 33 | 34 | @JsonProperty("config") 35 | public void setConfiguration(ApplicationConfigurationCreate configuration) { 36 | this.configuration = configuration; 37 | } 38 | 39 | public List getFields() { 40 | return fields; 41 | } 42 | 43 | public void setFields(List fields) { 44 | this.fields = fields; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/podio/app/ApplicationViewType.java: -------------------------------------------------------------------------------- 1 | package com.podio.app; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonValue; 5 | 6 | public enum ApplicationViewType { 7 | 8 | BADGE, 9 | TABLE, 10 | LIST, 11 | NODE, 12 | CALENDAR, 13 | GALLERY, 14 | CARD, 15 | STREAM; 16 | 17 | @Override 18 | @JsonValue 19 | public String toString() { 20 | return name().toLowerCase(); 21 | } 22 | 23 | @JsonCreator 24 | public static ApplicationViewType getByName(String value) { 25 | return valueOf(value.toUpperCase()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/podio/app/CategoryOption.java: -------------------------------------------------------------------------------- 1 | package com.podio.app; 2 | 3 | import java.io.Serializable; 4 | 5 | public class CategoryOption implements Serializable { 6 | 7 | private static final long serialVersionUID = 1L; 8 | 9 | private int id; 10 | 11 | private CategoryOptionStatus status; 12 | 13 | private String text; 14 | 15 | private String color; 16 | 17 | public CategoryOption() { 18 | super(); 19 | } 20 | 21 | public CategoryOption(int id, CategoryOptionStatus status, String text, 22 | String color) { 23 | super(); 24 | this.id = id; 25 | this.status = status; 26 | this.text = text; 27 | this.color = color; 28 | } 29 | 30 | public int getId() { 31 | return id; 32 | } 33 | 34 | public void setId(int id) { 35 | this.id = id; 36 | } 37 | 38 | public CategoryOptionStatus getStatus() { 39 | return status; 40 | } 41 | 42 | public void setStatus(CategoryOptionStatus status) { 43 | this.status = status; 44 | } 45 | 46 | public String getText() { 47 | return text; 48 | } 49 | 50 | public void setText(String text) { 51 | this.text = text; 52 | } 53 | 54 | public String getColor() { 55 | return color; 56 | } 57 | 58 | public void setColor(String color) { 59 | this.color = color; 60 | } 61 | 62 | 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/com/podio/app/CategoryOptionStatus.java: -------------------------------------------------------------------------------- 1 | package com.podio.app; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonValue; 5 | 6 | public enum CategoryOptionStatus { 7 | 8 | /** 9 | * The option is still active 10 | */ 11 | ACTIVE, 12 | 13 | /** 14 | * The option has been deleted 15 | */ 16 | DELETED; 17 | 18 | @Override 19 | @JsonValue 20 | public String toString() { 21 | return name().toLowerCase(); 22 | } 23 | 24 | @JsonCreator() 25 | public static CategoryOptionStatus getByName(String value) { 26 | return CategoryOptionStatus.valueOf(value.toUpperCase()); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/podio/app/DateFieldEndDateType.java: -------------------------------------------------------------------------------- 1 | package com.podio.app; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonValue; 5 | 6 | public enum DateFieldEndDateType { 7 | 8 | ENABLED, 9 | DISABLED, 10 | REQUIRED; 11 | 12 | @Override 13 | @JsonValue 14 | public String toString() { 15 | return name().toLowerCase(); 16 | } 17 | 18 | @JsonCreator 19 | public static DateFieldEndDateType getByName(String value) { 20 | return valueOf(value.toUpperCase()); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/podio/app/DateFieldTimeEntryType.java: -------------------------------------------------------------------------------- 1 | package com.podio.app; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonValue; 5 | 6 | public enum DateFieldTimeEntryType { 7 | 8 | ENABLED, 9 | DISABLED, 10 | REQUIRED; 11 | 12 | @Override 13 | @JsonValue 14 | public String toString() { 15 | return name().toLowerCase(); 16 | } 17 | 18 | @JsonCreator 19 | public static DateFieldTimeEntryType getByName(String value) { 20 | return valueOf(value.toUpperCase()); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/podio/app/Dependencies.java: -------------------------------------------------------------------------------- 1 | package com.podio.app; 2 | 3 | import java.io.Serializable; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | public class Dependencies implements Serializable { 8 | 9 | private static final long serialVersionUID = 1L; 10 | 11 | private List apps; 12 | 13 | private Map> dependencies; 14 | 15 | public List getApps() { 16 | return apps; 17 | } 18 | 19 | public void setApps(List apps) { 20 | this.apps = apps; 21 | } 22 | 23 | public Map> getDependencies() { 24 | return dependencies; 25 | } 26 | 27 | public void setDependencies(Map> dependencies) { 28 | this.dependencies = dependencies; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/podio/app/TextFieldSize.java: -------------------------------------------------------------------------------- 1 | package com.podio.app; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonValue; 5 | 6 | public enum TextFieldSize { 7 | 8 | /** 9 | * A small text field with a single line 10 | */ 11 | SMALL, 12 | 13 | /** 14 | * A large text field with multiple lines 15 | */ 16 | LARGE; 17 | 18 | @Override 19 | @JsonValue 20 | public String toString() { 21 | return name().toLowerCase(); 22 | } 23 | 24 | @JsonCreator() 25 | public static TextFieldSize getByName(String value) { 26 | return TextFieldSize.valueOf(value.toUpperCase()); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/podio/calendar/ParticipationStatus.java: -------------------------------------------------------------------------------- 1 | package com.podio.calendar; 2 | 3 | public enum ParticipationStatus { 4 | 5 | INVITED, ACCEPTED, DECLINED, TENTATIVE; 6 | 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/podio/comment/Comment.java: -------------------------------------------------------------------------------- 1 | package com.podio.comment; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonProperty; 6 | 7 | import com.podio.common.CreatedBase; 8 | import com.podio.contact.ProfileMini; 9 | import com.podio.file.File; 10 | 11 | public class Comment extends CreatedBase { 12 | 13 | private static final long serialVersionUID = 1L; 14 | 15 | /** 16 | * The id of the comment. Can be used to update and delete the comment 17 | */ 18 | private int id; 19 | 20 | /** 21 | * The actual comment 22 | */ 23 | private String value; 24 | 25 | /** 26 | * The external id set on the comment 27 | */ 28 | private String externalId; 29 | 30 | /** 31 | * The alerts on the comment 32 | */ 33 | private List alerts; 34 | 35 | /** 36 | * The files on the comment 37 | */ 38 | private List files; 39 | 40 | @JsonProperty("comment_id") 41 | public int getId() { 42 | return id; 43 | } 44 | 45 | @JsonProperty("comment_id") 46 | public void setId(int id) { 47 | this.id = id; 48 | } 49 | 50 | public String getValue() { 51 | return value; 52 | } 53 | 54 | public void setValue(String value) { 55 | this.value = value; 56 | } 57 | 58 | @JsonProperty("external_id") 59 | public String getExternalId() { 60 | return externalId; 61 | } 62 | 63 | @JsonProperty("external_id") 64 | public void setExternalId(String externalId) { 65 | this.externalId = externalId; 66 | } 67 | 68 | public List getAlerts() { 69 | return alerts; 70 | } 71 | 72 | public void setAlerts(List alerts) { 73 | this.alerts = alerts; 74 | } 75 | 76 | public List getFiles() { 77 | return files; 78 | } 79 | 80 | public void setFiles(List files) { 81 | this.files = files; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/main/java/com/podio/comment/CommentCreate.java: -------------------------------------------------------------------------------- 1 | package com.podio.comment; 2 | 3 | import java.util.Collections; 4 | import java.util.List; 5 | 6 | import org.codehaus.jackson.annotate.JsonProperty; 7 | 8 | public class CommentCreate { 9 | 10 | /** 11 | * The comment to be made 12 | */ 13 | private String value; 14 | 15 | /** 16 | * The external id 17 | */ 18 | private String externalId; 19 | 20 | /** 21 | * The users who should be alerted about this comment 22 | */ 23 | private List alerts; 24 | 25 | /** 26 | * Temporary files that have been uploaded and should be attached to this 27 | * comment 28 | */ 29 | private List fileIds; 30 | 31 | public CommentCreate(String value) { 32 | this(value, null, Collections. emptyList(), Collections 33 | . emptyList()); 34 | } 35 | 36 | public CommentCreate(String value, String externalId, List alerts, 37 | List fileIds) { 38 | super(); 39 | this.value = value; 40 | this.externalId = externalId; 41 | this.alerts = alerts; 42 | this.fileIds = fileIds; 43 | } 44 | 45 | public String getValue() { 46 | return value; 47 | } 48 | 49 | public void setValue(String value) { 50 | this.value = value; 51 | } 52 | 53 | @JsonProperty("external_id") 54 | public String getExternalId() { 55 | return externalId; 56 | } 57 | 58 | public void setExternalId(String externalId) { 59 | this.externalId = externalId; 60 | } 61 | 62 | public List getAlerts() { 63 | return alerts; 64 | } 65 | 66 | public void setAlerts(List alerts) { 67 | this.alerts = alerts; 68 | } 69 | 70 | @JsonProperty("file_ids") 71 | public List getFileIds() { 72 | return fileIds; 73 | } 74 | 75 | public void setFileIds(List fileIds) { 76 | this.fileIds = fileIds; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/main/java/com/podio/comment/CommentCreateResponse.java: -------------------------------------------------------------------------------- 1 | package com.podio.comment; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | 5 | public class CommentCreateResponse { 6 | 7 | private int id; 8 | 9 | public int getId() { 10 | return id; 11 | } 12 | 13 | @JsonProperty("comment_id") 14 | public void setId(int id) { 15 | this.id = id; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/podio/comment/CommentUpdate.java: -------------------------------------------------------------------------------- 1 | package com.podio.comment; 2 | 3 | import java.util.Collections; 4 | import java.util.List; 5 | 6 | import org.codehaus.jackson.annotate.JsonProperty; 7 | 8 | public class CommentUpdate { 9 | 10 | /** 11 | * The comment to be made 12 | */ 13 | private String value; 14 | 15 | /** 16 | * The external id of the comment 17 | */ 18 | private String externalId; 19 | 20 | /** 21 | * Temporary files that have been uploaded and should be attached to this 22 | * comment 23 | */ 24 | private List fileIds; 25 | 26 | public CommentUpdate(String value) { 27 | this(value, Collections. emptyList()); 28 | } 29 | 30 | public CommentUpdate(String value, List fileIds) { 31 | super(); 32 | this.value = value; 33 | this.fileIds = fileIds; 34 | } 35 | 36 | public String getValue() { 37 | return value; 38 | } 39 | 40 | public void setValue(String value) { 41 | this.value = value; 42 | } 43 | 44 | @JsonProperty("external_id") 45 | public String getExternalId() { 46 | return externalId; 47 | } 48 | 49 | public void setExternalId(String externalId) { 50 | this.externalId = externalId; 51 | } 52 | 53 | @JsonProperty("file_ids") 54 | public List getFileIds() { 55 | return fileIds; 56 | } 57 | 58 | public void setFileIds(List fileIds) { 59 | this.fileIds = fileIds; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/com/podio/common/AuthorizationEntity.java: -------------------------------------------------------------------------------- 1 | package com.podio.common; 2 | 3 | import java.io.Serializable; 4 | import java.net.URL; 5 | 6 | import org.codehaus.jackson.annotate.JsonProperty; 7 | 8 | public class AuthorizationEntity implements Serializable { 9 | 10 | private static final long serialVersionUID = 1L; 11 | 12 | private AuthorizationEntityType type; 13 | 14 | private int id; 15 | 16 | private AvatarType avatarType; 17 | 18 | private Integer avatarId; 19 | 20 | private String name; 21 | 22 | private URL url; 23 | 24 | public AuthorizationEntityType getType() { 25 | return type; 26 | } 27 | 28 | public void setType(AuthorizationEntityType type) { 29 | this.type = type; 30 | } 31 | 32 | public int getId() { 33 | return id; 34 | } 35 | 36 | public void setId(int id) { 37 | this.id = id; 38 | } 39 | 40 | public AvatarType getAvatarType() { 41 | return avatarType; 42 | } 43 | 44 | @JsonProperty("avatar_type") 45 | public void setAvatarType(AvatarType avatarType) { 46 | this.avatarType = avatarType; 47 | } 48 | 49 | public Integer getAvatarId() { 50 | return avatarId; 51 | } 52 | 53 | @JsonProperty("avatar_id") 54 | public void setAvatarId(Integer avatarId) { 55 | this.avatarId = avatarId; 56 | } 57 | 58 | public String getName() { 59 | return name; 60 | } 61 | 62 | public void setName(String name) { 63 | this.name = name; 64 | } 65 | 66 | public URL getUrl() { 67 | return url; 68 | } 69 | 70 | public void setUrl(URL url) { 71 | this.url = url; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/com/podio/common/AuthorizationEntityType.java: -------------------------------------------------------------------------------- 1 | package com.podio.common; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonValue; 5 | 6 | public enum AuthorizationEntityType { 7 | 8 | USER, APP, SYSTEM; 9 | 10 | @Override 11 | @JsonValue 12 | public String toString() { 13 | return name().toLowerCase(); 14 | } 15 | 16 | @JsonCreator 17 | public static AuthorizationEntityType getByName(String value) { 18 | return valueOf(value.toUpperCase()); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/podio/common/AuthorizationInterface.java: -------------------------------------------------------------------------------- 1 | package com.podio.common; 2 | 3 | import java.io.Serializable; 4 | import java.net.URL; 5 | 6 | public class AuthorizationInterface implements Serializable { 7 | 8 | private static final long serialVersionUID = 1L; 9 | 10 | private int id; 11 | 12 | private String name; 13 | 14 | private URL url; 15 | 16 | public int getId() { 17 | return id; 18 | } 19 | 20 | public void setId(int id) { 21 | this.id = id; 22 | } 23 | 24 | public String getName() { 25 | return name; 26 | } 27 | 28 | public void setName(String name) { 29 | this.name = name; 30 | } 31 | 32 | public URL getUrl() { 33 | return url; 34 | } 35 | 36 | public void setUrl(URL url) { 37 | this.url = url; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/podio/common/AvatarType.java: -------------------------------------------------------------------------------- 1 | package com.podio.common; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonValue; 5 | 6 | public enum AvatarType { 7 | 8 | FILE, 9 | ICON; 10 | 11 | @Override 12 | @JsonValue 13 | public String toString() { 14 | return name().toLowerCase(); 15 | } 16 | 17 | @JsonCreator 18 | public static AvatarType getByName(String value) { 19 | return valueOf(value.toUpperCase()); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/podio/common/CSVUtil.java: -------------------------------------------------------------------------------- 1 | package com.podio.common; 2 | 3 | import java.util.Arrays; 4 | import java.util.Collection; 5 | 6 | public final class CSVUtil { 7 | 8 | private CSVUtil() { 9 | } 10 | 11 | public static String toCSV(Object... objects) { 12 | return toCSV(Arrays.asList(objects)); 13 | } 14 | 15 | public static String toCSV(Collection objects) { 16 | String out = ""; 17 | for (Object object : objects) { 18 | if (out != "") { 19 | out += "; "; 20 | } 21 | out += object; 22 | } 23 | return out; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/podio/common/CreatedBase.java: -------------------------------------------------------------------------------- 1 | package com.podio.common; 2 | 3 | import java.io.Serializable; 4 | 5 | import org.codehaus.jackson.annotate.JsonProperty; 6 | import org.joda.time.DateTime; 7 | 8 | public class CreatedBase implements Serializable { 9 | 10 | private static final long serialVersionUID = 1L; 11 | 12 | /** 13 | * The entity who created the comment 14 | */ 15 | private AuthorizationEntity createdBy; 16 | 17 | /** 18 | * The interface through which the comment was created 19 | */ 20 | private AuthorizationInterface createdVia; 21 | 22 | /** 23 | * The date and time the comment was created 24 | */ 25 | private DateTime createdOn; 26 | 27 | @JsonProperty("created_by") 28 | public AuthorizationEntity getCreatedBy() { 29 | return createdBy; 30 | } 31 | 32 | @JsonProperty("created_by") 33 | public void setCreatedBy(AuthorizationEntity createdBy) { 34 | this.createdBy = createdBy; 35 | } 36 | 37 | @JsonProperty("created_via") 38 | public AuthorizationInterface getCreatedVia() { 39 | return createdVia; 40 | } 41 | 42 | @JsonProperty("created_via") 43 | public void setCreatedVia(AuthorizationInterface createdVia) { 44 | this.createdVia = createdVia; 45 | } 46 | 47 | @JsonProperty("created_on") 48 | public DateTime getCreatedOn() { 49 | return createdOn; 50 | } 51 | 52 | @JsonProperty("created_on") 53 | public void setCreatedOn(DateTime createdOn) { 54 | this.createdOn = createdOn; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/com/podio/common/Empty.java: -------------------------------------------------------------------------------- 1 | package com.podio.common; 2 | 3 | public class Empty { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/com/podio/common/Reference.java: -------------------------------------------------------------------------------- 1 | package com.podio.common; 2 | 3 | public class Reference { 4 | 5 | private ReferenceType type; 6 | 7 | private int id; 8 | 9 | public Reference() { 10 | super(); 11 | } 12 | 13 | public Reference(ReferenceType type, int id) { 14 | super(); 15 | this.type = type; 16 | this.id = id; 17 | } 18 | 19 | @Override 20 | public String toString() { 21 | return type + ":" + id; 22 | } 23 | 24 | public String toURLFragment() { 25 | return toURLFragment(true); 26 | } 27 | 28 | public String toURLFragment(boolean endDash) { 29 | if (endDash) { 30 | return type + "/" + id + "/"; 31 | } else { 32 | return type + "/" + id; 33 | } 34 | } 35 | 36 | public ReferenceType getType() { 37 | return type; 38 | } 39 | 40 | public void setType(ReferenceType type) { 41 | this.type = type; 42 | } 43 | 44 | public int getId() { 45 | return id; 46 | } 47 | 48 | public void setId(int id) { 49 | this.id = id; 50 | } 51 | 52 | public static Reference parse(String value) { 53 | String[] split = value.split(":"); 54 | ReferenceType type = ReferenceType.getByName(split[0]); 55 | int id = Integer.parseInt(split[1]); 56 | 57 | return new Reference(type, id); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/podio/common/ReferenceType.java: -------------------------------------------------------------------------------- 1 | package com.podio.common; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonValue; 5 | 6 | public enum ReferenceType { 7 | 8 | ALERT, APP, APP_FIELD, APP_REVISION, BULLETIN, COMMENT, CONVERSATION, 9 | MESSAGE, FILE, ITEM, ITEM_REVISION, ITEM_VALUE, NOTIFICATION, ORG, PROFILE, 10 | RATING, SPACE, SPACE_MEMBER, STATUS, TASK, USER, WIDGET, QUESTION, QUESTION_ANSWER, 11 | ACTION, MEETING, GRANT, TASK_ACTION, ITEM_PARTICIPATION, VOTE; 12 | 13 | @Override 14 | @JsonValue 15 | public String toString() { 16 | return name().toLowerCase(); 17 | } 18 | 19 | @JsonCreator 20 | public static ReferenceType getByName(String value) { 21 | return valueOf(value.toUpperCase()); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/podio/common/Right.java: -------------------------------------------------------------------------------- 1 | package com.podio.common; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonValue; 5 | 6 | public enum Right { 7 | 8 | VIEW, UPDATE, DELETE, SUBSCRIBE, COMMENT, RATE, SHARE, INSTALL, ADD_APP, 9 | ADD_ITEM, ADD_FILE, ADD_TASK, ADD_SPACE, ADD_STATUS, ADD_CONVERSATION, REPLY, 10 | ADD_FILTER, ADD_WIDGET, STATISTICS, ADD_CONTACT, ADD_HOOK, ADD_ANSWER, 11 | ADD_QUESTION, ADD_MEETING, GRANT, DOWNLOAD; 12 | 13 | @Override 14 | @JsonValue 15 | public String toString() { 16 | return name().toLowerCase(); 17 | } 18 | 19 | @JsonCreator 20 | public static Right getByName(String value) { 21 | return valueOf(value.toUpperCase()); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/podio/common/Role.java: -------------------------------------------------------------------------------- 1 | package com.podio.common; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonValue; 5 | 6 | public enum Role { 7 | 8 | LIGHT, 9 | REGULAR, 10 | ADMIN; 11 | 12 | @Override 13 | @JsonValue 14 | public String toString() { 15 | return name().toLowerCase(); 16 | } 17 | 18 | @JsonCreator 19 | public static Role getByName(String value) { 20 | return valueOf(value.toUpperCase()); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/podio/common/ToStringUtil.java: -------------------------------------------------------------------------------- 1 | package com.podio.common; 2 | 3 | import java.util.Collection; 4 | 5 | public final class ToStringUtil { 6 | 7 | private ToStringUtil() { 8 | } 9 | 10 | public static String toString(Collection objects, CharSequence delimiter) { 11 | StringBuilder sb = new StringBuilder(); 12 | for (Object o : objects) { 13 | sb.append(o.toString()); 14 | sb.append(delimiter); 15 | } 16 | sb.setLength(sb.length() - delimiter.length()); 17 | return sb.toString(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/podio/connection/ConnectionType.java: -------------------------------------------------------------------------------- 1 | package com.podio.connection; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonValue; 5 | 6 | public enum ConnectionType { 7 | 8 | GOOGLE, OUTLOOK, VCARD; 9 | 10 | @Override 11 | @JsonValue 12 | public String toString() { 13 | return name().toLowerCase(); 14 | } 15 | 16 | @JsonCreator 17 | public static ConnectionType getByName(String value) { 18 | return valueOf(value.toUpperCase()); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/podio/contact/ConnectionContactTotal.java: -------------------------------------------------------------------------------- 1 | package com.podio.contact; 2 | 3 | public class ConnectionContactTotal { 4 | 5 | // private Connection connection; 6 | 7 | private int count; 8 | 9 | public int getCount() { 10 | return count; 11 | } 12 | 13 | public void setCount(int count) { 14 | this.count = count; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/podio/contact/ConnectionTypeContactTotal.java: -------------------------------------------------------------------------------- 1 | package com.podio.contact; 2 | 3 | import java.util.List; 4 | 5 | import com.podio.connection.ConnectionType; 6 | 7 | public class ConnectionTypeContactTotal { 8 | 9 | private ConnectionType type; 10 | 11 | private int count; 12 | 13 | private List connections; 14 | 15 | public ConnectionType getType() { 16 | return type; 17 | } 18 | 19 | public void setType(ConnectionType type) { 20 | this.type = type; 21 | } 22 | 23 | public int getCount() { 24 | return count; 25 | } 26 | 27 | public void setCount(int count) { 28 | this.count = count; 29 | } 30 | 31 | public List getConnections() { 32 | return connections; 33 | } 34 | 35 | public void setConnections(List connections) { 36 | this.connections = connections; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/podio/contact/ConnectionsContactTotal.java: -------------------------------------------------------------------------------- 1 | package com.podio.contact; 2 | 3 | import java.util.List; 4 | 5 | public class ConnectionsContactTotal { 6 | 7 | private List types; 8 | 9 | public List getTypes() { 10 | return types; 11 | } 12 | 13 | public void setTypes(List types) { 14 | this.types = types; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/podio/contact/ContactCreateResponse.java: -------------------------------------------------------------------------------- 1 | package com.podio.contact; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | 5 | public class ContactCreateResponse { 6 | 7 | private int id; 8 | 9 | public int getId() { 10 | return id; 11 | } 12 | 13 | @JsonProperty("profile_id") 14 | public void setId(int id) { 15 | this.id = id; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/podio/contact/ContactOrder.java: -------------------------------------------------------------------------------- 1 | package com.podio.contact; 2 | 3 | public enum ContactOrder { 4 | 5 | /** 6 | * How often the active user assigns tasks to the contact 7 | */ 8 | TASK, 9 | 10 | /** 11 | * How often the active user receives messages from the contact 12 | */ 13 | MESSAGE_IN, 14 | 15 | /** 16 | * How often the active user sends messages to the contact 17 | */ 18 | MESSAGE_OUT, 19 | 20 | /** 21 | * How often the active user sets the contact as the reference on an item 22 | * field. 23 | */ 24 | REFERENCE, 25 | 26 | /** 27 | * How often the active user have alerted the contact in a status or 28 | * comment. 29 | */ 30 | ALERT; 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/podio/contact/ContactTotal.java: -------------------------------------------------------------------------------- 1 | package com.podio.contact; 2 | 3 | public class ContactTotal { 4 | 5 | private UserContactTotal user; 6 | 7 | private ConnectionsContactTotal connection; 8 | 9 | public UserContactTotal getUser() { 10 | return user; 11 | } 12 | 13 | public void setUser(UserContactTotal user) { 14 | this.user = user; 15 | } 16 | 17 | public ConnectionsContactTotal getConnection() { 18 | return connection; 19 | } 20 | 21 | public void setConnection(ConnectionsContactTotal connection) { 22 | this.connection = connection; 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/podio/contact/ContactType.java: -------------------------------------------------------------------------------- 1 | package com.podio.contact; 2 | 3 | public enum ContactType { 4 | 5 | /** 6 | * Contact of type user 7 | */ 8 | USER, 9 | 10 | /** 11 | * A space contact 12 | */ 13 | SPACE; 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/podio/contact/OrganizationContactTotal.java: -------------------------------------------------------------------------------- 1 | package com.podio.contact; 2 | 3 | import java.util.List; 4 | 5 | import com.podio.org.Organization; 6 | 7 | public class OrganizationContactTotal { 8 | 9 | private Organization org; 10 | 11 | private int count; 12 | 13 | private List spaces; 14 | 15 | public Organization getOrg() { 16 | return org; 17 | } 18 | 19 | public void setOrg(Organization org) { 20 | this.org = org; 21 | } 22 | 23 | public int getCount() { 24 | return count; 25 | } 26 | 27 | public void setCount(int count) { 28 | this.count = count; 29 | } 30 | 31 | public List getSpaces() { 32 | return spaces; 33 | } 34 | 35 | public void setSpaces(List spaces) { 36 | this.spaces = spaces; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/podio/contact/Profile.java: -------------------------------------------------------------------------------- 1 | package com.podio.contact; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | import org.joda.time.DateTime; 5 | 6 | public class Profile extends ProfileUpdate { 7 | 8 | /** 9 | * The id of the profile 10 | */ 11 | private int profileId; 12 | 13 | /** 14 | * The id of the user 15 | */ 16 | private Integer userId; 17 | 18 | /** 19 | * The last time the user was seen 20 | */ 21 | private DateTime lastSeenOn; 22 | 23 | @JsonProperty("profile_id") 24 | public int getProfileId() { 25 | return profileId; 26 | } 27 | 28 | @JsonProperty("profile_id") 29 | public void setProfileId(int profileId) { 30 | this.profileId = profileId; 31 | } 32 | 33 | @JsonProperty("user_id") 34 | public Integer getUserId() { 35 | return userId; 36 | } 37 | 38 | @JsonProperty("user_id") 39 | public void setUserId(Integer userId) { 40 | this.userId = userId; 41 | } 42 | 43 | @JsonProperty("last_seen_on") 44 | public DateTime getLastSeenOn() { 45 | return lastSeenOn; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/podio/contact/ProfileBase.java: -------------------------------------------------------------------------------- 1 | package com.podio.contact; 2 | 3 | import java.io.Serializable; 4 | 5 | import org.codehaus.jackson.annotate.JsonProperty; 6 | 7 | public class ProfileBase implements Serializable { 8 | 9 | private static final long serialVersionUID = 1L; 10 | 11 | /** 12 | * The id of the profile 13 | */ 14 | private int profileId; 15 | 16 | /** 17 | * The id of the user 18 | */ 19 | private Integer userId; 20 | 21 | @Override 22 | public int hashCode() { 23 | final int prime = 31; 24 | int result = 1; 25 | result = prime * result + profileId; 26 | return result; 27 | } 28 | 29 | @Override 30 | public boolean equals(Object obj) { 31 | if (this == obj) 32 | return true; 33 | if (obj == null) 34 | return false; 35 | if (getClass() != obj.getClass()) 36 | return false; 37 | ProfileBase other = (ProfileBase) obj; 38 | if (profileId != other.profileId) 39 | return false; 40 | return true; 41 | } 42 | 43 | @JsonProperty("profile_id") 44 | public int getProfileId() { 45 | return profileId; 46 | } 47 | 48 | @JsonProperty("profile_id") 49 | public void setProfileId(int profileId) { 50 | this.profileId = profileId; 51 | } 52 | 53 | @JsonProperty("user_id") 54 | public Integer getUserId() { 55 | return userId; 56 | } 57 | 58 | @JsonProperty("user_id") 59 | public void setUserId(Integer userId) { 60 | this.userId = userId; 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/podio/contact/ProfileFieldValues.java: -------------------------------------------------------------------------------- 1 | package com.podio.contact; 2 | 3 | import java.util.Collections; 4 | import java.util.HashMap; 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | import org.codehaus.jackson.annotate.JsonValue; 9 | 10 | public final class ProfileFieldValues { 11 | 12 | private Map, Object> values = new HashMap, Object>(); 13 | 14 | @JsonValue 15 | public Map, Object> getValues() { 16 | return values; 17 | } 18 | 19 | public void setValues(Map, Object> values) { 20 | this.values = values; 21 | } 22 | 23 | public void setValue(ProfileField field, F value) { 24 | if (field.isSingle()) { 25 | values.put(field, value); 26 | } else { 27 | values.put(field, Collections.singletonList(value)); 28 | } 29 | } 30 | 31 | public F getValue(ProfileField field) { 32 | if (field.isSingle()) { 33 | return (F) values.get(field); 34 | } else { 35 | List list = (List) values.get(field); 36 | if (list == null || list.isEmpty()) { 37 | return null; 38 | } 39 | 40 | return (F) list.get(0); 41 | } 42 | } 43 | 44 | public void setValues(ProfileField field, List values) { 45 | this.values.put(field, values); 46 | } 47 | 48 | public List getValues(ProfileField field) { 49 | return (List) values.get(field); 50 | } 51 | } -------------------------------------------------------------------------------- /src/main/java/com/podio/contact/ProfileMini.java: -------------------------------------------------------------------------------- 1 | package com.podio.contact; 2 | 3 | 4 | public class ProfileMini extends ProfileBase { 5 | 6 | private static final long serialVersionUID = 1L; 7 | 8 | private Integer avatar; 9 | 10 | private String name; 11 | 12 | @Override 13 | public String toString() { 14 | return "ProfileMini [profileId=" + getProfileId() + ", avatar=" 15 | + avatar + ", name=" + name + "]"; 16 | } 17 | 18 | public Integer getAvatar() { 19 | return avatar; 20 | } 21 | 22 | public void setAvatar(Integer avatar) { 23 | this.avatar = avatar; 24 | } 25 | 26 | public String getName() { 27 | return name; 28 | } 29 | 30 | public void setName(String name) { 31 | this.name = name; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/podio/contact/ProfileType.java: -------------------------------------------------------------------------------- 1 | package com.podio.contact; 2 | 3 | public class ProfileType { 4 | 5 | public static final ProfileType FULL = new ProfileType( 6 | "full", Profile.class); 7 | public static final ProfileType MINI = new ProfileType( 8 | "mini", ProfileMini.class); 9 | 10 | private final String name; 11 | 12 | private final Class type; 13 | 14 | public ProfileType(String name, Class type) { 15 | super(); 16 | this.name = name; 17 | this.type = type; 18 | } 19 | 20 | public String getName() { 21 | return name; 22 | } 23 | 24 | public Class getType() { 25 | return type; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/podio/contact/SpaceContactTotal.java: -------------------------------------------------------------------------------- 1 | package com.podio.contact; 2 | 3 | import com.podio.space.Space; 4 | 5 | public class SpaceContactTotal { 6 | 7 | private Space space; 8 | 9 | private int count; 10 | 11 | public Space getSpace() { 12 | return space; 13 | } 14 | 15 | public void setSpace(Space space) { 16 | this.space = space; 17 | } 18 | 19 | public int getCount() { 20 | return count; 21 | } 22 | 23 | public void setCount(int count) { 24 | this.count = count; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/podio/contact/SpaceContactTotals.java: -------------------------------------------------------------------------------- 1 | package com.podio.contact; 2 | 3 | public class SpaceContactTotals { 4 | 5 | private int total; 6 | 7 | public int getTotal() { 8 | return total; 9 | } 10 | 11 | public void setTotal(int total) { 12 | this.total = total; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/podio/contact/UserContactTotal.java: -------------------------------------------------------------------------------- 1 | package com.podio.contact; 2 | 3 | import java.util.List; 4 | 5 | public class UserContactTotal { 6 | 7 | private List organizations; 8 | 9 | private int count; 10 | 11 | public List getOrganizations() { 12 | return organizations; 13 | } 14 | 15 | public void setOrganizations(List organizations) { 16 | this.organizations = organizations; 17 | } 18 | 19 | public int getCount() { 20 | return count; 21 | } 22 | 23 | public void setCount(int count) { 24 | this.count = count; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/podio/conversation/Conversation.java: -------------------------------------------------------------------------------- 1 | package com.podio.conversation; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonProperty; 6 | 7 | import com.podio.contact.ProfileMini; 8 | 9 | public class Conversation { 10 | 11 | /** 12 | * The id of the conversation 13 | */ 14 | private int id; 15 | 16 | /** 17 | * The subject of the conversation 18 | */ 19 | private String subject; 20 | 21 | /** 22 | * The list of participants in the conversation 23 | */ 24 | private List participants; 25 | 26 | @JsonProperty("conversation_id") 27 | public int getId() { 28 | return id; 29 | } 30 | 31 | @JsonProperty("conversation_id") 32 | public void setId(int id) { 33 | this.id = id; 34 | } 35 | 36 | public String getSubject() { 37 | return subject; 38 | } 39 | 40 | public void setSubject(String subject) { 41 | this.subject = subject; 42 | } 43 | 44 | public List getParticipants() { 45 | return participants; 46 | } 47 | 48 | public void setParticipants(List participants) { 49 | this.participants = participants; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/podio/conversation/ConversationCreate.java: -------------------------------------------------------------------------------- 1 | package com.podio.conversation; 2 | 3 | import java.util.List; 4 | 5 | public class ConversationCreate { 6 | 7 | private final String subject; 8 | 9 | private final String text; 10 | 11 | private final List participants; 12 | 13 | public ConversationCreate(String subject, String text, 14 | List participants) { 15 | super(); 16 | this.subject = subject; 17 | this.text = text; 18 | this.participants = participants; 19 | } 20 | 21 | public String getSubject() { 22 | return subject; 23 | } 24 | 25 | public String getText() { 26 | return text; 27 | } 28 | 29 | public List getParticipants() { 30 | return participants; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/podio/conversation/ConversationCreateResponse.java: -------------------------------------------------------------------------------- 1 | package com.podio.conversation; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | 5 | public class ConversationCreateResponse { 6 | 7 | private int conversationId; 8 | 9 | private int messageId; 10 | 11 | public int getConversationId() { 12 | return conversationId; 13 | } 14 | 15 | @JsonProperty("conversation_id") 16 | public void setConversationId(int conversationId) { 17 | this.conversationId = conversationId; 18 | } 19 | 20 | public int getMessageId() { 21 | return messageId; 22 | } 23 | 24 | @JsonProperty("message_id") 25 | public void setMessageId(int messageId) { 26 | this.messageId = messageId; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/podio/conversation/Message.java: -------------------------------------------------------------------------------- 1 | package com.podio.conversation; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | import org.joda.time.DateTime; 5 | 6 | import com.podio.contact.ProfileMini; 7 | 8 | public class Message { 9 | 10 | /** 11 | * The id of the message 12 | */ 13 | private int id; 14 | 15 | /** 16 | * The text of the message 17 | */ 18 | private String text; 19 | 20 | /** 21 | * The date the message was sent 22 | */ 23 | private DateTime createdOn; 24 | 25 | /** 26 | * The user who sent the message 27 | */ 28 | private ProfileMini createdBy; 29 | 30 | @JsonProperty("message_id") 31 | public int getId() { 32 | return id; 33 | } 34 | 35 | @JsonProperty("message_id") 36 | public void setId(int id) { 37 | this.id = id; 38 | } 39 | 40 | public String getText() { 41 | return text; 42 | } 43 | 44 | public void setText(String text) { 45 | this.text = text; 46 | } 47 | 48 | @JsonProperty("created_on") 49 | public DateTime getCreatedOn() { 50 | return createdOn; 51 | } 52 | 53 | @JsonProperty("created_on") 54 | public void setCreatedOn(DateTime createdOn) { 55 | this.createdOn = createdOn; 56 | } 57 | 58 | @JsonProperty("created_by") 59 | public ProfileMini getCreatedBy() { 60 | return createdBy; 61 | } 62 | 63 | @JsonProperty("created_by") 64 | public void setCreatedBy(ProfileMini createdBy) { 65 | this.createdBy = createdBy; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/com/podio/conversation/MessageCreate.java: -------------------------------------------------------------------------------- 1 | package com.podio.conversation; 2 | 3 | public class MessageCreate { 4 | 5 | private final String text; 6 | 7 | public MessageCreate(String text) { 8 | super(); 9 | this.text = text; 10 | } 11 | 12 | public String getText() { 13 | return text; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/podio/conversation/MessageCreateResponse.java: -------------------------------------------------------------------------------- 1 | package com.podio.conversation; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | 5 | public class MessageCreateResponse { 6 | 7 | private int messageId; 8 | 9 | public int getMessageId() { 10 | return messageId; 11 | } 12 | 13 | @JsonProperty("message_id") 14 | public void setMessageId(int messageId) { 15 | this.messageId = messageId; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/podio/device/DeviceAPI.java: -------------------------------------------------------------------------------- 1 | package com.podio.device; 2 | 3 | import com.podio.BaseAPI; 4 | import com.podio.ResourceFactory; 5 | 6 | 7 | public class DeviceAPI extends BaseAPI { 8 | 9 | public DeviceAPI(ResourceFactory resourceFactory) { 10 | super(resourceFactory); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/podio/device/PushSubscription.java: -------------------------------------------------------------------------------- 1 | package com.podio.device; 2 | 3 | public class PushSubscription { 4 | 5 | private long timestamp; 6 | 7 | private String channel; 8 | 9 | private String signature; 10 | 11 | public long getTimestamp() { 12 | return timestamp; 13 | } 14 | 15 | public void setTimestamp(long timestamp) { 16 | this.timestamp = timestamp; 17 | } 18 | 19 | public String getChannel() { 20 | return channel; 21 | } 22 | 23 | public void setChannel(String channel) { 24 | this.channel = channel; 25 | } 26 | 27 | public String getSignature() { 28 | return signature; 29 | } 30 | 31 | public void setSignature(String signature) { 32 | this.signature = signature; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/podio/embed/EmbedAPI.java: -------------------------------------------------------------------------------- 1 | package com.podio.embed; 2 | 3 | import javax.ws.rs.core.MediaType; 4 | 5 | import com.podio.BaseAPI; 6 | import com.podio.ResourceFactory; 7 | 8 | /** 9 | * Embeds are links shared by users in statuses, conversations and comments. One 10 | * or more embeds are also referred when creating items with an embed file type. 11 | */ 12 | public class EmbedAPI extends BaseAPI { 13 | 14 | public EmbedAPI(ResourceFactory resourceFactory) { 15 | super(resourceFactory); 16 | } 17 | 18 | /** 19 | * Grabs metadata and returns metadata for the given url such as title, 20 | * description and thumbnails. 21 | * 22 | * @param url 23 | * The URL of the embed 24 | * @return The full embed data 25 | */ 26 | public Embed createEmbed(String url) { 27 | return getResourceFactory().getApiResource("/embed/") 28 | .entity(new EmbedCreate(url), MediaType.APPLICATION_JSON_TYPE) 29 | .post(Embed.class); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/podio/embed/EmbedCreate.java: -------------------------------------------------------------------------------- 1 | package com.podio.embed; 2 | 3 | public class EmbedCreate { 4 | 5 | private final String url; 6 | 7 | public EmbedCreate(String url) { 8 | super(); 9 | this.url = url; 10 | } 11 | 12 | public String getUrl() { 13 | return url; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/podio/embed/EmbedType.java: -------------------------------------------------------------------------------- 1 | package com.podio.embed; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonValue; 5 | 6 | public enum EmbedType { 7 | 8 | /** 9 | * A direct link to a public image 10 | */ 11 | IMAGE("image"), 12 | 13 | /** 14 | * A link to a video service provider such as YouTube 15 | */ 16 | VIDEO("video"), 17 | 18 | /** 19 | * A link to a service provider that can be displayed inline, but is not 20 | * video (such as SlideShare) 21 | */ 22 | RICH("rich"), 23 | 24 | /** 25 | * A link to a plain web page 26 | */ 27 | LINK("link"), 28 | 29 | /** 30 | * An invalid or inaccessible link 31 | */ 32 | UNRESOLVED("unresolved"); 33 | 34 | private final String externalName; 35 | 36 | private EmbedType(String externalName) { 37 | this.externalName = externalName; 38 | } 39 | 40 | @Override 41 | @JsonValue 42 | public String toString() { 43 | return externalName; 44 | } 45 | 46 | @JsonCreator 47 | public static EmbedType getByName(String value) { 48 | for (EmbedType type : values()) { 49 | if (type.externalName.equals(value)) { 50 | return type; 51 | } 52 | } 53 | 54 | return null; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/com/podio/file/FileError.java: -------------------------------------------------------------------------------- 1 | package com.podio.file; 2 | 3 | public class FileError { 4 | 5 | private int code; 6 | 7 | private String message; 8 | 9 | @Override 10 | public String toString() { 11 | return "FileError [code=" + code + ", message=" + message + "]"; 12 | } 13 | 14 | public int getCode() { 15 | return code; 16 | } 17 | 18 | public void setCode(int code) { 19 | this.code = code; 20 | } 21 | 22 | public String getMessage() { 23 | return message; 24 | } 25 | 26 | public void setMessage(String message) { 27 | this.message = message; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/podio/file/FileReference.java: -------------------------------------------------------------------------------- 1 | package com.podio.file; 2 | 3 | import com.podio.common.Reference; 4 | import com.podio.common.ReferenceType; 5 | 6 | public class FileReference extends Reference { 7 | 8 | /** 9 | * The title of the reference 10 | */ 11 | private String title; 12 | 13 | public FileReference() { 14 | super(); 15 | } 16 | 17 | public FileReference(ReferenceType type, int id, String title) { 18 | super(type, id); 19 | this.title = title; 20 | } 21 | 22 | public String getTitle() { 23 | return title; 24 | } 25 | 26 | public void setTitle(String title) { 27 | this.title = title; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/podio/file/FileSize.java: -------------------------------------------------------------------------------- 1 | package com.podio.file; 2 | 3 | public enum FileSize { 4 | 5 | PREVIEW, 6 | BADGE, 7 | TINY, 8 | SMALL, 9 | MEDIUM, 10 | LARGE, 11 | EXTRA_LARGE; 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/podio/file/FileUpdate.java: -------------------------------------------------------------------------------- 1 | package com.podio.file; 2 | 3 | public class FileUpdate { 4 | 5 | private String description; 6 | 7 | public FileUpdate(String description) { 8 | super(); 9 | this.description = description; 10 | } 11 | 12 | public String getDescription() { 13 | return description; 14 | } 15 | 16 | public void setDescription(String description) { 17 | this.description = description; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/podio/file/FileUploadResponse.java: -------------------------------------------------------------------------------- 1 | package com.podio.file; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | 5 | public class FileUploadResponse { 6 | 7 | private String jsonRpc; 8 | 9 | private FileUploadResult result; 10 | 11 | private FileError error; 12 | 13 | private String id; 14 | 15 | @Override 16 | public String toString() { 17 | return "FileUploadResponse [jsonRpc=" + jsonRpc + ", result=" + result 18 | + ", error=" + error + ", id=" + id + "]"; 19 | } 20 | 21 | @JsonProperty("jsonrpc") 22 | public String getJsonRpc() { 23 | return jsonRpc; 24 | } 25 | 26 | @JsonProperty("jsonrpc") 27 | public void setJsonRpc(String jsonRpc) { 28 | this.jsonRpc = jsonRpc; 29 | } 30 | 31 | public FileError getError() { 32 | return error; 33 | } 34 | 35 | public void setError(FileError error) { 36 | this.error = error; 37 | } 38 | 39 | public FileUploadResult getResult() { 40 | return result; 41 | } 42 | 43 | public void setResult(FileUploadResult result) { 44 | this.result = result; 45 | } 46 | 47 | public String getId() { 48 | return id; 49 | } 50 | 51 | public void setId(String id) { 52 | this.id = id; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/podio/file/FileUploadResult.java: -------------------------------------------------------------------------------- 1 | package com.podio.file; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | 5 | public class FileUploadResult { 6 | 7 | private int fileId; 8 | 9 | @Override 10 | public String toString() { 11 | return "FileUploadResult [fileId=" + fileId + "]"; 12 | } 13 | 14 | @JsonProperty("file_id") 15 | public int getFileId() { 16 | return fileId; 17 | } 18 | 19 | @JsonProperty("file_id") 20 | public void setFileId(int fileId) { 21 | this.fileId = fileId; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/podio/filter/AbsolutePodioDate.java: -------------------------------------------------------------------------------- 1 | package com.podio.filter; 2 | 3 | import org.joda.time.LocalDate; 4 | 5 | public class AbsolutePodioDate implements PodioDate { 6 | 7 | private final LocalDate date; 8 | 9 | public AbsolutePodioDate(LocalDate date) { 10 | super(); 11 | this.date = date; 12 | } 13 | 14 | @Override 15 | public String serialize() { 16 | return this.date.toString("yyyy-MM-dd"); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/podio/filter/AppFieldFilterBy.java: -------------------------------------------------------------------------------- 1 | package com.podio.filter; 2 | 3 | import java.util.List; 4 | 5 | import com.podio.common.CSVUtil; 6 | 7 | public class AppFieldFilterBy extends FieldFilterBy> { 8 | 9 | public AppFieldFilterBy(int fieldId) { 10 | super(fieldId); 11 | } 12 | 13 | @Override 14 | public final String format(List values) { 15 | return CSVUtil.toCSV(values); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/podio/filter/BaseAuthListFilterBy.java: -------------------------------------------------------------------------------- 1 | package com.podio.filter; 2 | 3 | import java.util.List; 4 | 5 | import com.podio.common.CSVUtil; 6 | import com.podio.common.Reference; 7 | 8 | public abstract class BaseAuthListFilterBy implements FilterBy> { 9 | 10 | @Override 11 | public final String format(List values) { 12 | return CSVUtil.toCSV(values); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/podio/filter/BaseDateFilterBy.java: -------------------------------------------------------------------------------- 1 | package com.podio.filter; 2 | 3 | public abstract class BaseDateFilterBy implements FilterBy { 4 | 5 | @Override 6 | public final String format(PodioDateInterval value) { 7 | return value.serialize(); 8 | } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/podio/filter/BaseIntListFilterBy.java: -------------------------------------------------------------------------------- 1 | package com.podio.filter; 2 | 3 | import java.util.List; 4 | 5 | import com.podio.common.CSVUtil; 6 | 7 | public abstract class BaseIntListFilterBy implements FilterBy> { 8 | 9 | @Override 10 | public final String format(List values) { 11 | return CSVUtil.toCSV(values); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/podio/filter/CreatedByFilterBy.java: -------------------------------------------------------------------------------- 1 | package com.podio.filter; 2 | 3 | public class CreatedByFilterBy extends BaseAuthListFilterBy { 4 | 5 | @Override 6 | public String getKey() { 7 | return "created_by"; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/podio/filter/CreatedOnFilterBy.java: -------------------------------------------------------------------------------- 1 | package com.podio.filter; 2 | 3 | public class CreatedOnFilterBy extends BaseDateFilterBy { 4 | 5 | @Override 6 | public String getKey() { 7 | return "created_on"; 8 | } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/podio/filter/CreatedViaFilterBy.java: -------------------------------------------------------------------------------- 1 | package com.podio.filter; 2 | 3 | public class CreatedViaFilterBy extends BaseIntListFilterBy { 4 | 5 | @Override 6 | public String getKey() { 7 | return "created_via"; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/podio/filter/DateFieldFilterBy.java: -------------------------------------------------------------------------------- 1 | package com.podio.filter; 2 | 3 | public class DateFieldFilterBy extends BaseDateFilterBy { 4 | 5 | private final int fieldId; 6 | 7 | public DateFieldFilterBy(int fieldId) { 8 | super(); 9 | this.fieldId = fieldId; 10 | } 11 | 12 | @Override 13 | public final String getKey() { 14 | return Integer.toString(fieldId); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/podio/filter/ExternalIdFilterBy.java: -------------------------------------------------------------------------------- 1 | package com.podio.filter; 2 | 3 | public class ExternalIdFilterBy implements FilterBy { 4 | 5 | @Override 6 | public String getKey() { 7 | return "external_id"; 8 | } 9 | 10 | @Override 11 | public String format(String value) { 12 | return value; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/podio/filter/FieldFilterBy.java: -------------------------------------------------------------------------------- 1 | package com.podio.filter; 2 | 3 | public abstract class FieldFilterBy implements FilterBy { 4 | 5 | private final int fieldId; 6 | 7 | public FieldFilterBy(int fieldId) { 8 | super(); 9 | this.fieldId = fieldId; 10 | } 11 | 12 | @Override 13 | public final String getKey() { 14 | return Integer.toString(fieldId); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/podio/filter/FieldSortBy.java: -------------------------------------------------------------------------------- 1 | package com.podio.filter; 2 | 3 | public class FieldSortBy implements SortBy { 4 | 5 | private final int fieldId; 6 | 7 | public FieldSortBy(int fieldId) { 8 | super(); 9 | this.fieldId = fieldId; 10 | } 11 | 12 | @Override 13 | public String getKey() { 14 | return Integer.toString(fieldId); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/podio/filter/FilterBy.java: -------------------------------------------------------------------------------- 1 | package com.podio.filter; 2 | 3 | public interface FilterBy { 4 | 5 | String getKey(); 6 | 7 | String format(T value); 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/com/podio/filter/FilterByValue.java: -------------------------------------------------------------------------------- 1 | package com.podio.filter; 2 | 3 | public class FilterByValue { 4 | 5 | private final FilterBy by; 6 | 7 | private final T value; 8 | 9 | public FilterByValue(FilterBy by, T value) { 10 | super(); 11 | this.by = by; 12 | this.value = value; 13 | } 14 | 15 | public FilterBy getBy() { 16 | return by; 17 | } 18 | 19 | public T getValue() { 20 | return value; 21 | } 22 | 23 | public String getFormattedValue() { 24 | return by.format(value); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/podio/filter/LastEditByFilterBy.java: -------------------------------------------------------------------------------- 1 | package com.podio.filter; 2 | 3 | public class LastEditByFilterBy extends BaseAuthListFilterBy { 4 | 5 | @Override 6 | public String getKey() { 7 | return "last_edit_by"; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/podio/filter/LastEditOnFilterBy.java: -------------------------------------------------------------------------------- 1 | package com.podio.filter; 2 | 3 | public class LastEditOnFilterBy extends BaseDateFilterBy { 4 | 5 | @Override 6 | public String getKey() { 7 | return "last_edit_on"; 8 | } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/podio/filter/LastEditViaFilterBy.java: -------------------------------------------------------------------------------- 1 | package com.podio.filter; 2 | 3 | public class LastEditViaFilterBy extends BaseIntListFilterBy { 4 | 5 | @Override 6 | public String getKey() { 7 | return "last_edit_via"; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/podio/filter/MemberFieldFilterBy.java: -------------------------------------------------------------------------------- 1 | package com.podio.filter; 2 | 3 | import java.util.List; 4 | 5 | import com.podio.common.CSVUtil; 6 | 7 | public class MemberFieldFilterBy extends FieldFilterBy> { 8 | 9 | public MemberFieldFilterBy(int fieldId) { 10 | super(fieldId); 11 | } 12 | 13 | @Override 14 | public final String format(List values) { 15 | return CSVUtil.toCSV(values); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/podio/filter/NumberFieldFilterBy.java: -------------------------------------------------------------------------------- 1 | package com.podio.filter; 2 | 3 | public class NumberFieldFilterBy extends FieldFilterBy { 4 | 5 | public NumberFieldFilterBy(int fieldId) { 6 | super(fieldId); 7 | } 8 | 9 | @Override 10 | public String format(NumberInterval value) { 11 | return value.getFrom() + "-" + value.getTo(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/podio/filter/NumberInterval.java: -------------------------------------------------------------------------------- 1 | package com.podio.filter; 2 | 3 | public final class NumberInterval { 4 | 5 | private final float from; 6 | 7 | private final float to; 8 | 9 | public NumberInterval(float from, float to) { 10 | super(); 11 | this.from = from; 12 | this.to = to; 13 | } 14 | 15 | public float getFrom() { 16 | return from; 17 | } 18 | 19 | public float getTo() { 20 | return to; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/podio/filter/PodioDate.java: -------------------------------------------------------------------------------- 1 | package com.podio.filter; 2 | 3 | public interface PodioDate { 4 | 5 | String serialize(); 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/com/podio/filter/PodioDateInterval.java: -------------------------------------------------------------------------------- 1 | package com.podio.filter; 2 | 3 | import org.joda.time.LocalDate; 4 | 5 | public class PodioDateInterval { 6 | 7 | private final PodioDate fromDate; 8 | 9 | private final PodioDate toDate; 10 | 11 | public PodioDateInterval(PodioDate fromDate, PodioDate toDate) { 12 | super(); 13 | this.fromDate = fromDate; 14 | this.toDate = toDate; 15 | } 16 | 17 | public String serialize() { 18 | String result = ""; 19 | if (fromDate != null) { 20 | result += fromDate.serialize(); 21 | } 22 | result += "-"; 23 | if (toDate != null) { 24 | result += toDate.serialize(); 25 | } 26 | return result; 27 | } 28 | 29 | public static final PodioDateInterval absolute(LocalDate fromDate, LocalDate toDate) { 30 | return new PodioDateInterval(new AbsolutePodioDate(fromDate), new AbsolutePodioDate(toDate)); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/podio/filter/ProgressFieldFilterBy.java: -------------------------------------------------------------------------------- 1 | package com.podio.filter; 2 | 3 | public class ProgressFieldFilterBy extends FieldFilterBy { 4 | 5 | public ProgressFieldFilterBy(int fieldId) { 6 | super(fieldId); 7 | } 8 | 9 | @Override 10 | public String format(ProgressInterval value) { 11 | return value.getFrom() + "-" + value.getTo(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/podio/filter/ProgressInterval.java: -------------------------------------------------------------------------------- 1 | package com.podio.filter; 2 | 3 | public final class ProgressInterval { 4 | 5 | private final int from; 6 | 7 | private final int to; 8 | 9 | public ProgressInterval(int from, int to) { 10 | super(); 11 | this.from = from; 12 | this.to = to; 13 | 14 | if (from < 0 || from > 100) { 15 | throw new IllegalArgumentException("From must be between 0 and 100"); 16 | } 17 | if (to < 0 || to > 100) { 18 | throw new IllegalArgumentException("To must be between 0 and 100"); 19 | } 20 | if (to < from) { 21 | throw new IllegalArgumentException("To must be larger than from"); 22 | } 23 | } 24 | 25 | public int getFrom() { 26 | return from; 27 | } 28 | 29 | public int getTo() { 30 | return to; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/podio/filter/RelativePodioDate.java: -------------------------------------------------------------------------------- 1 | package com.podio.filter; 2 | 3 | public class RelativePodioDate implements PodioDate { 4 | 5 | public static enum Unit { 6 | DAY('d'), 7 | WEEK('w'), 8 | MONTH('m'), 9 | YEAR('y'); 10 | 11 | private final char character; 12 | 13 | private Unit(char character) { 14 | this.character = character; 15 | } 16 | 17 | public char getCharacter() { 18 | return character; 19 | } 20 | } 21 | 22 | private final int offset; 23 | 24 | private final Unit unit; 25 | 26 | private final boolean round; 27 | 28 | public RelativePodioDate(int offset, Unit unit, boolean round) { 29 | super(); 30 | this.offset = offset; 31 | this.unit = unit; 32 | this.round = round; 33 | } 34 | 35 | public int getOffset() { 36 | return offset; 37 | } 38 | 39 | public Unit getUnit() { 40 | return unit; 41 | } 42 | 43 | public boolean isRound() { 44 | return round; 45 | } 46 | 47 | @Override 48 | public String serialize() { 49 | String result = Integer.toString(this.offset); 50 | result += this.unit.getCharacter(); 51 | if (this.round) { 52 | result += "r"; 53 | } 54 | return result; 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/podio/filter/SortBy.java: -------------------------------------------------------------------------------- 1 | package com.podio.filter; 2 | 3 | public interface SortBy { 4 | 5 | String getKey(); 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/com/podio/filter/StandardSortBy.java: -------------------------------------------------------------------------------- 1 | package com.podio.filter; 2 | 3 | public enum StandardSortBy implements SortBy { 4 | 5 | LAST_EDIT_ON, 6 | CREATED_ON, 7 | FIVESTAR; 8 | 9 | @Override 10 | public String getKey() { 11 | return name().toLowerCase(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/podio/filter/StateFieldFilterBy.java: -------------------------------------------------------------------------------- 1 | package com.podio.filter; 2 | 3 | import java.util.List; 4 | 5 | import com.podio.common.CSVUtil; 6 | 7 | public class StateFieldFilterBy extends FieldFilterBy> { 8 | 9 | public StateFieldFilterBy(int fieldId) { 10 | super(fieldId); 11 | } 12 | 13 | @Override 14 | public String format(List values) { 15 | return CSVUtil.toCSV(values); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/podio/filter/TitleFilterBy.java: -------------------------------------------------------------------------------- 1 | package com.podio.filter; 2 | 3 | public class TitleFilterBy implements FilterBy { 4 | 5 | @Override 6 | public String getKey() { 7 | return "title"; 8 | } 9 | 10 | @Override 11 | public String format(String value) { 12 | return value; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/podio/hook/Hook.java: -------------------------------------------------------------------------------- 1 | package com.podio.hook; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | 5 | import com.podio.common.CreatedBase; 6 | 7 | public class Hook extends CreatedBase { 8 | 9 | private int id; 10 | 11 | private HookStatus status; 12 | 13 | private HookType type; 14 | 15 | private String url; 16 | 17 | public int getId() { 18 | return id; 19 | } 20 | 21 | @JsonProperty("hook_id") 22 | public void setId(int id) { 23 | this.id = id; 24 | } 25 | 26 | public HookStatus getStatus() { 27 | return status; 28 | } 29 | 30 | public void setStatus(HookStatus status) { 31 | this.status = status; 32 | } 33 | 34 | public HookType getType() { 35 | return type; 36 | } 37 | 38 | public void setType(HookType type) { 39 | this.type = type; 40 | } 41 | 42 | public String getUrl() { 43 | return url; 44 | } 45 | 46 | public void setUrl(String url) { 47 | this.url = url; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/podio/hook/HookCreate.java: -------------------------------------------------------------------------------- 1 | package com.podio.hook; 2 | 3 | public class HookCreate { 4 | 5 | /** 6 | * The url of endpoint 7 | */ 8 | private String url; 9 | 10 | /** 11 | * The type of events to listen to 12 | */ 13 | private HookType type; 14 | 15 | public HookCreate(String url, HookType type) { 16 | super(); 17 | this.url = url; 18 | this.type = type; 19 | } 20 | 21 | public String getUrl() { 22 | return url; 23 | } 24 | 25 | public void setUrl(String url) { 26 | this.url = url; 27 | } 28 | 29 | public HookType getType() { 30 | return type; 31 | } 32 | 33 | public void setType(HookType type) { 34 | this.type = type; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/podio/hook/HookCreateResponse.java: -------------------------------------------------------------------------------- 1 | package com.podio.hook; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | 5 | public class HookCreateResponse { 6 | 7 | /** 8 | * The id of the hook created 9 | */ 10 | private int id; 11 | 12 | public int getId() { 13 | return id; 14 | } 15 | 16 | @JsonProperty("hook_id") 17 | public void setId(int id) { 18 | this.id = id; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/podio/hook/HookStatus.java: -------------------------------------------------------------------------------- 1 | package com.podio.hook; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonValue; 5 | 6 | public enum HookStatus { 7 | 8 | INACTIVE, ACTIVE; 9 | 10 | @Override 11 | @JsonValue 12 | public String toString() { 13 | return name().toLowerCase(); 14 | } 15 | 16 | @JsonCreator 17 | public static HookStatus getByName(String value) { 18 | return valueOf(value.toUpperCase()); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/podio/hook/HookType.java: -------------------------------------------------------------------------------- 1 | package com.podio.hook; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonValue; 5 | 6 | public enum HookType { 7 | 8 | ITEM_CREATE("item.create"), 9 | ITEM_UPDATE("item.update"), 10 | ITEM_DELETE("item.delete"), 11 | COMMENT_CREATE("comment.create"), 12 | COMMENT_DELETE("comment.delete"), 13 | FILE_CHANGE("file.change"), 14 | APP_UPDATE("app.update"), 15 | APP_DELETE("app.delete"); 16 | 17 | private final String externalName; 18 | 19 | private HookType(String externalName) { 20 | this.externalName = externalName; 21 | } 22 | 23 | @Override 24 | @JsonValue 25 | public String toString() { 26 | return externalName; 27 | } 28 | 29 | @JsonCreator 30 | public static HookType getByName(String value) { 31 | for (HookType type : values()) { 32 | if (type.externalName.equals(value)) { 33 | return type; 34 | } 35 | } 36 | 37 | return null; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/podio/hook/HookValidate.java: -------------------------------------------------------------------------------- 1 | package com.podio.hook; 2 | 3 | public class HookValidate { 4 | 5 | private String code; 6 | 7 | public HookValidate(String code) { 8 | super(); 9 | this.code = code; 10 | } 11 | 12 | public String getCode() { 13 | return code; 14 | } 15 | 16 | public void setCode(String code) { 17 | this.code = code; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/podio/item/AppActivities.java: -------------------------------------------------------------------------------- 1 | package com.podio.item; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonProperty; 6 | 7 | public class AppActivities { 8 | 9 | private List today; 10 | 11 | private List lastWeek; 12 | 13 | public List getToday() { 14 | return today; 15 | } 16 | 17 | public void setToday(List today) { 18 | this.today = today; 19 | } 20 | 21 | public List getLastWeek() { 22 | return lastWeek; 23 | } 24 | 25 | @JsonProperty("last_week") 26 | public void setLastWeek(List lastWeek) { 27 | this.lastWeek = lastWeek; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/podio/item/FieldValuesView.java: -------------------------------------------------------------------------------- 1 | package com.podio.item; 2 | 3 | import java.io.Serializable; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import org.codehaus.jackson.annotate.JsonProperty; 8 | 9 | import com.podio.app.ApplicationFieldType; 10 | 11 | public class FieldValuesView implements Serializable { 12 | 13 | private static final long serialVersionUID = 1L; 14 | 15 | /** 16 | * The id of the field 17 | */ 18 | private int id; 19 | 20 | /** 21 | * The external id of the field 22 | */ 23 | private String externalId; 24 | 25 | /** 26 | * The type of the field 27 | */ 28 | private ApplicationFieldType type; 29 | 30 | /** 31 | * The label of the field 32 | */ 33 | private String label; 34 | 35 | /** 36 | * The values 37 | */ 38 | private List> values; 39 | 40 | public FieldValuesView() { 41 | super(); 42 | } 43 | 44 | @JsonProperty("field_id") 45 | public int getId() { 46 | return id; 47 | } 48 | 49 | @JsonProperty("field_id") 50 | public void setId(int fieldId) { 51 | this.id = fieldId; 52 | } 53 | 54 | @JsonProperty("external_id") 55 | public String getExternalId() { 56 | return externalId; 57 | } 58 | 59 | @JsonProperty("external_id") 60 | public void setExternalId(String externalId) { 61 | this.externalId = externalId; 62 | } 63 | 64 | public ApplicationFieldType getType() { 65 | return type; 66 | } 67 | 68 | public void setType(ApplicationFieldType type) { 69 | this.type = type; 70 | } 71 | 72 | public String getLabel() { 73 | return label; 74 | } 75 | 76 | public void setLabel(String label) { 77 | this.label = label; 78 | } 79 | 80 | public List> getValues() { 81 | return values; 82 | } 83 | 84 | public void setValues(List> values) { 85 | this.values = values; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/main/java/com/podio/item/ItemActivityType.java: -------------------------------------------------------------------------------- 1 | package com.podio.item; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonValue; 5 | 6 | /** 7 | * The type of activity 8 | */ 9 | public enum ItemActivityType { 10 | 11 | CREATION, 12 | UPDATE, 13 | DELETE, 14 | COMMENT, 15 | FILE, 16 | RATING; 17 | 18 | @Override 19 | @JsonValue 20 | public String toString() { 21 | return name().toLowerCase(); 22 | } 23 | 24 | @JsonCreator 25 | public static ItemActivityType getByName(String value) { 26 | return valueOf(value.toUpperCase()); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/podio/item/ItemCreate.java: -------------------------------------------------------------------------------- 1 | package com.podio.item; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonProperty; 6 | 7 | public class ItemCreate extends ItemUpdate { 8 | 9 | /** 10 | * Temporary files that have been uploaded and should be attached to this 11 | * item 12 | */ 13 | private List fileIds; 14 | 15 | /** 16 | * The tags to put on the item 17 | */ 18 | private List tags; 19 | 20 | public ItemCreate() { 21 | super(); 22 | } 23 | 24 | public ItemCreate(String externalId, List fields, 25 | List fileIds, List tags) { 26 | super(externalId, fields); 27 | this.fileIds = fileIds; 28 | this.tags = tags; 29 | } 30 | 31 | @JsonProperty("file_ids") 32 | public List getFileIds() { 33 | return fileIds; 34 | } 35 | 36 | @JsonProperty("file_ids") 37 | public void setFileIds(List fileIds) { 38 | this.fileIds = fileIds; 39 | } 40 | 41 | public List getTags() { 42 | return tags; 43 | } 44 | 45 | public void setTags(List tags) { 46 | this.tags = tags; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/podio/item/ItemCreateResponse.java: -------------------------------------------------------------------------------- 1 | package com.podio.item; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | 5 | public class ItemCreateResponse { 6 | 7 | private int id; 8 | 9 | public int getId() { 10 | return id; 11 | } 12 | 13 | @JsonProperty("item_id") 14 | public void setId(int id) { 15 | this.id = id; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/podio/item/ItemFieldDifference.java: -------------------------------------------------------------------------------- 1 | package com.podio.item; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | import org.codehaus.jackson.annotate.JsonProperty; 7 | 8 | import com.podio.app.ApplicationFieldType; 9 | 10 | public class ItemFieldDifference { 11 | 12 | /** 13 | * The id of the field 14 | */ 15 | private int id; 16 | 17 | /** 18 | * The type of the field 19 | */ 20 | private ApplicationFieldType type; 21 | 22 | /** 23 | * The label of the field 24 | */ 25 | private String label; 26 | 27 | /** 28 | * The values at the from revision 29 | */ 30 | private List> from; 31 | 32 | /** 33 | * The values at the to revsion 34 | */ 35 | private List> to; 36 | 37 | public int getId() { 38 | return id; 39 | } 40 | 41 | @JsonProperty("field_id") 42 | public void setId(int fieldId) { 43 | this.id = fieldId; 44 | } 45 | 46 | public ApplicationFieldType getType() { 47 | return type; 48 | } 49 | 50 | public void setType(ApplicationFieldType type) { 51 | this.type = type; 52 | } 53 | 54 | public String getLabel() { 55 | return label; 56 | } 57 | 58 | public void setLabel(String label) { 59 | this.label = label; 60 | } 61 | 62 | public List> getFrom() { 63 | return from; 64 | } 65 | 66 | public void setFrom(List> from) { 67 | this.from = from; 68 | } 69 | 70 | public List> getTo() { 71 | return to; 72 | } 73 | 74 | public void setTo(List> to) { 75 | this.to = to; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/com/podio/item/ItemMicro.java: -------------------------------------------------------------------------------- 1 | package com.podio.item; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | 5 | public class ItemMicro { 6 | 7 | /** 8 | * The id of the item 9 | */ 10 | private int id; 11 | 12 | /** 13 | * The title of the item. This is made of up one of the fields below, or by 14 | * the item name and id 15 | */ 16 | private String title; 17 | 18 | @JsonProperty("item_id") 19 | public int getId() { 20 | return id; 21 | } 22 | 23 | @JsonProperty("item_id") 24 | public void setId(int id) { 25 | this.id = id; 26 | } 27 | 28 | public String getTitle() { 29 | return title; 30 | } 31 | 32 | public void setTitle(String title) { 33 | this.title = title; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/podio/item/ItemMini.java: -------------------------------------------------------------------------------- 1 | package com.podio.item; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | 5 | import com.podio.app.Application; 6 | 7 | public class ItemMini { 8 | 9 | /** 10 | * The id of the item 11 | */ 12 | private int id; 13 | 14 | /** 15 | * The title of the item. This is made of up one of the fields below, or by 16 | * the item name and id 17 | */ 18 | private String title; 19 | 20 | /** 21 | * The information on who created the first revision of the item 22 | */ 23 | private ItemRevision initialRevision; 24 | 25 | /** 26 | * The app where the item belongs 27 | */ 28 | private Application application; 29 | 30 | @JsonProperty("item_id") 31 | public int getId() { 32 | return id; 33 | } 34 | 35 | @JsonProperty("item_id") 36 | public void setId(int id) { 37 | this.id = id; 38 | } 39 | 40 | @JsonProperty("app") 41 | public Application getApplication() { 42 | return application; 43 | } 44 | 45 | @JsonProperty("app") 46 | public void setApplication(Application application) { 47 | this.application = application; 48 | } 49 | 50 | @JsonProperty("initial_revision") 51 | public ItemRevision getInitialRevision() { 52 | return initialRevision; 53 | } 54 | 55 | @JsonProperty("initial_revision") 56 | public void setInitialRevision(ItemRevision initialRevision) { 57 | this.initialRevision = initialRevision; 58 | } 59 | 60 | public String getTitle() { 61 | return title; 62 | } 63 | 64 | public void setTitle(String title) { 65 | this.title = title; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/com/podio/item/ItemReference.java: -------------------------------------------------------------------------------- 1 | package com.podio.item; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonProperty; 6 | 7 | import com.podio.app.Application; 8 | 9 | public class ItemReference { 10 | 11 | private Application application; 12 | 13 | private List items; 14 | 15 | @JsonProperty("app") 16 | public Application getApplication() { 17 | return application; 18 | } 19 | 20 | @JsonProperty("app") 21 | public void setApplication(Application application) { 22 | this.application = application; 23 | } 24 | 25 | public List getItems() { 26 | return items; 27 | } 28 | 29 | public void setItems(List items) { 30 | this.items = items; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/podio/item/ItemRevision.java: -------------------------------------------------------------------------------- 1 | package com.podio.item; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | 5 | import com.podio.common.CreatedBase; 6 | 7 | public class ItemRevision extends CreatedBase { 8 | 9 | private static final long serialVersionUID = 1L; 10 | 11 | /** 12 | * The revision number 13 | */ 14 | private int revision; 15 | 16 | /** 17 | * The revision of the app at the time this item revision was made 18 | */ 19 | private int appRevision; 20 | 21 | public int getRevision() { 22 | return revision; 23 | } 24 | 25 | public void setRevision(int revision) { 26 | this.revision = revision; 27 | } 28 | 29 | @JsonProperty("app_revision") 30 | public int getAppRevision() { 31 | return appRevision; 32 | } 33 | 34 | @JsonProperty("app_revision") 35 | public void setAppRevision(int appRevision) { 36 | this.appRevision = appRevision; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/podio/item/ItemUpdate.java: -------------------------------------------------------------------------------- 1 | package com.podio.item; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import org.codehaus.jackson.annotate.JsonProperty; 7 | 8 | public class ItemUpdate { 9 | 10 | /** 11 | * The external id of the item. This can be used to hold a reference to the 12 | * item in an external system. 13 | */ 14 | private String externalId; 15 | 16 | /** 17 | * The internal revision from podio. 18 | */ 19 | private int revision; 20 | 21 | /** 22 | * The values for each field 23 | */ 24 | private List fields; 25 | 26 | public ItemUpdate() { 27 | super(); 28 | } 29 | 30 | public ItemUpdate(String externalId, List fields) { 31 | super(); 32 | this.externalId = externalId; 33 | this.fields = fields; 34 | } 35 | 36 | @JsonProperty("external_id") 37 | public String getExternalId() { 38 | return externalId; 39 | } 40 | 41 | @JsonProperty("external_id") 42 | public void setExternalId(String externalId) { 43 | this.externalId = externalId; 44 | } 45 | 46 | @JsonProperty("revision") 47 | public int getRevision() { 48 | return revision; 49 | } 50 | 51 | @JsonProperty("revision") 52 | public void setRevision(int revision) { 53 | this.revision = revision; 54 | } 55 | 56 | public List getFields() { 57 | return fields; 58 | } 59 | 60 | public void setFields(List fields) { 61 | this.fields = fields; 62 | } 63 | 64 | public void addField(FieldValuesUpdate field) { 65 | if (this.fields == null) { 66 | this.fields = new ArrayList(); 67 | } 68 | this.fields.add(field); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/main/java/com/podio/item/ItemsResponse.java: -------------------------------------------------------------------------------- 1 | package com.podio.item; 2 | 3 | import java.util.List; 4 | 5 | public class ItemsResponse { 6 | 7 | /** 8 | * Total number of items 9 | */ 10 | private int total; 11 | 12 | /** 13 | * Total number of items matching the filter 14 | */ 15 | private int filtered; 16 | 17 | /** 18 | * The items returned 19 | */ 20 | private List items; 21 | 22 | @Override 23 | public String toString() { 24 | return "ItemsResponse [total=" + total + ", filtered=" + filtered 25 | + ", items=" + items + "]"; 26 | } 27 | 28 | public int getTotal() { 29 | return total; 30 | } 31 | 32 | public void setTotal(int total) { 33 | this.total = total; 34 | } 35 | 36 | public int getFiltered() { 37 | return filtered; 38 | } 39 | 40 | public void setFiltered(int filtered) { 41 | this.filtered = filtered; 42 | } 43 | 44 | public List getItems() { 45 | return items; 46 | } 47 | 48 | public void setItems(List items) { 49 | this.items = items; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/podio/item/filter/Filter.java: -------------------------------------------------------------------------------- 1 | package com.podio.item.filter; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | 5 | public abstract class Filter { 6 | 7 | private final String key; 8 | 9 | Filter(String key) { 10 | this.key = key; 11 | } 12 | 13 | @JsonProperty("values") 14 | public abstract VALUES getValues(); 15 | 16 | @JsonProperty("key") 17 | public String getKey() { 18 | return key; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/podio/item/filter/FilterCreatedOn.java: -------------------------------------------------------------------------------- 1 | package com.podio.item.filter; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | 5 | import java.text.DateFormat; 6 | import java.text.SimpleDateFormat; 7 | import java.util.Date; 8 | 9 | public class FilterCreatedOn extends Filter { 10 | 11 | /** non-static to allow for multi threading */ 12 | private final DateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd"); 13 | 14 | private final FilterInterval values; 15 | 16 | public FilterCreatedOn(Date from, Date to) { 17 | super("created_on"); 18 | values = new FilterInterval(); 19 | values.setFrom(from != null ? DATE_FORMAT.format(from) : null); 20 | values.setTo(to != null ? DATE_FORMAT.format(to) : null); 21 | } 22 | 23 | @Override 24 | @JsonProperty("values") 25 | public FilterInterval getValues() { 26 | return values; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/podio/item/filter/FilterDateField.java: -------------------------------------------------------------------------------- 1 | package com.podio.item.filter; 2 | 3 | import java.text.DateFormat; 4 | import java.text.SimpleDateFormat; 5 | import java.util.Date; 6 | 7 | public class FilterDateField extends FilterFieldValue { 8 | 9 | /** non-static to allow for multi threading */ 10 | private final DateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd"); 11 | 12 | private final FilterInterval values; 13 | 14 | public FilterDateField(int fieldId, Date from, Date to) { 15 | super(fieldId); 16 | values = new FilterInterval(); 17 | values.setFrom(from != null ? DATE_FORMAT.format(from) : null); 18 | values.setTo(to != null ? DATE_FORMAT.format(to) : null); 19 | } 20 | 21 | @Override 22 | public FilterInterval getValues() { 23 | return values; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/podio/item/filter/FilterFieldValue.java: -------------------------------------------------------------------------------- 1 | package com.podio.item.filter; 2 | 3 | public abstract class FilterFieldValue extends Filter { 4 | 5 | public FilterFieldValue(int fieldId) { 6 | super(String.valueOf(fieldId)); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/com/podio/item/filter/FilterInterval.java: -------------------------------------------------------------------------------- 1 | package com.podio.item.filter; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | 5 | public class FilterInterval { 6 | 7 | private String from; 8 | private String to; 9 | 10 | @JsonProperty("from") 11 | public String getFrom() { 12 | return from; 13 | } 14 | 15 | public void setFrom(String from) { 16 | this.from = from; 17 | } 18 | @JsonProperty("to") 19 | public String getTo() { 20 | return to; 21 | } 22 | 23 | public void setTo(String to) { 24 | this.to = to; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/podio/item/map/ExternalId.java: -------------------------------------------------------------------------------- 1 | package com.podio.item.map; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Retention(RetentionPolicy.RUNTIME) 9 | @Target(ElementType.METHOD) 10 | public @interface ExternalId { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/podio/item/map/Field.java: -------------------------------------------------------------------------------- 1 | package com.podio.item.map; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Retention(RetentionPolicy.RUNTIME) 9 | @Target(ElementType.METHOD) 10 | public @interface Field { 11 | 12 | String value() default ""; 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/podio/item/map/MappedItemAPI.java: -------------------------------------------------------------------------------- 1 | package com.podio.item.map; 2 | 3 | import org.apache.commons.beanutils.ConvertUtils; 4 | 5 | import com.podio.APIFactory; 6 | import com.podio.app.AppAPI; 7 | import com.podio.app.Application; 8 | import com.podio.item.ItemAPI; 9 | import com.podio.item.ItemsResponse; 10 | 11 | public class MappedItemAPI { 12 | 13 | private final APIFactory factory; 14 | 15 | private final Application application; 16 | 17 | private final ItemMap map; 18 | 19 | public MappedItemAPI(APIFactory factory, int appId, Class cls) { 20 | super(); 21 | this.factory = factory; 22 | this.application = factory.getAPI(AppAPI.class).getApp(appId); 23 | this.map = ItemMap.get(application, cls); 24 | } 25 | 26 | public int insert(T object, boolean silent) { 27 | return factory.getAPI(ItemAPI.class).addItem(application.getId(), 28 | map.getCreate(object), silent); 29 | } 30 | 31 | public void update(T object, boolean silent) { 32 | factory.getAPI(ItemAPI.class).updateItem(-1, map.getUpdate(object), 33 | silent, false); 34 | } 35 | 36 | public T get(Object externalId) { 37 | String stringExternalId = (String) ConvertUtils.convert(externalId, 38 | String.class); 39 | 40 | ItemsResponse item = factory.getAPI(ItemAPI.class) 41 | .getItemsByExternalId(application.getId(), stringExternalId); 42 | if (item.getFiltered() == 1) { 43 | return map.getView(item.getItems().get(0)); 44 | } else if (item.getFiltered() == 0) { 45 | return null; 46 | } else { 47 | throw new RuntimeException( 48 | "Multiple items found with the external id " + externalId); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/podio/item/map/MoneyField.java: -------------------------------------------------------------------------------- 1 | package com.podio.item.map; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Retention(RetentionPolicy.RUNTIME) 9 | @Target(ElementType.METHOD) 10 | public @interface MoneyField { 11 | 12 | String currency(); 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/podio/item/map/NameUtil.java: -------------------------------------------------------------------------------- 1 | package com.podio.item.map; 2 | 3 | public final class NameUtil { 4 | 5 | private NameUtil() { 6 | } 7 | 8 | public static String toJava(String name) { 9 | String out = ""; 10 | boolean nextUpper = false; 11 | for (int i = 0; i < name.length(); i++) { 12 | char next = name.charAt(i); 13 | if (next == '-') { 14 | nextUpper = true; 15 | } else { 16 | if (nextUpper) { 17 | next = Character.toUpperCase(next); 18 | } 19 | out += next; 20 | nextUpper = false; 21 | } 22 | } 23 | 24 | return out; 25 | } 26 | 27 | public static String toAPI(String name) { 28 | String out = ""; 29 | for (int i = 0; i < name.length(); i++) { 30 | char next = name.charAt(i); 31 | if (Character.isUpperCase(next)) { 32 | out += '-'; 33 | next = Character.toLowerCase(next); 34 | } 35 | out += next; 36 | } 37 | 38 | return out; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/podio/item/map/Transient.java: -------------------------------------------------------------------------------- 1 | package com.podio.item.map; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Retention(RetentionPolicy.RUNTIME) 9 | @Target(ElementType.METHOD) 10 | public @interface Transient { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/podio/item/map/converter/CategoryConverter.java: -------------------------------------------------------------------------------- 1 | package com.podio.item.map.converter; 2 | 3 | import java.util.Collections; 4 | import java.util.HashMap; 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | import org.apache.commons.beanutils.ConvertUtils; 9 | 10 | import com.podio.app.CategoryOption; 11 | 12 | public class CategoryConverter implements FieldConverter { 13 | 14 | private final List options; 15 | 16 | public CategoryConverter(List options) { 17 | super(); 18 | this.options = options; 19 | } 20 | 21 | @Override 22 | public Map fromModel(Object value) { 23 | String stringValue; 24 | if (value.getClass().isEnum()) { 25 | stringValue = value.toString(); 26 | stringValue = stringValue.replace(' ', '_'); 27 | } else { 28 | stringValue = (String) ConvertUtils.convert(value, 29 | String.class); 30 | } 31 | 32 | CategoryOption option = getOptionByText(stringValue); 33 | if (option != null) { 34 | return Collections.singletonMap("value", option.getId()); 35 | } 36 | 37 | throw new RuntimeException("No state with name " + stringValue 38 | + " found"); 39 | } 40 | 41 | private CategoryOption getOptionByText(String text) { 42 | for (CategoryOption option : options) { 43 | if (option.getText().equalsIgnoreCase(text)) { 44 | return option; 45 | } 46 | } 47 | 48 | return null; 49 | } 50 | 51 | @Override 52 | public Object toModel(Map map, Class modelClass) { 53 | Map option = (Map) map.get("value"); 54 | 55 | String stringValue = (String) option.get("text"); 56 | 57 | if (modelClass.isEnum()) { 58 | return Enum.valueOf(modelClass, stringValue.toUpperCase()); 59 | } else { 60 | return ConvertUtils.convert(stringValue, modelClass); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/podio/item/map/converter/CategoryConverterProvider.java: -------------------------------------------------------------------------------- 1 | package com.podio.item.map.converter; 2 | 3 | import java.lang.reflect.AnnotatedElement; 4 | 5 | import com.podio.app.ApplicationField; 6 | import com.podio.app.ApplicationFieldType; 7 | 8 | public class CategoryConverterProvider implements FieldConverterProvider { 9 | 10 | @Override 11 | public boolean isSupported(ApplicationFieldType fieldType) { 12 | return fieldType == ApplicationFieldType.CATEGORY; 13 | } 14 | 15 | @Override 16 | public FieldConverter getConverter(ApplicationField field, 17 | AnnotatedElement element) { 18 | return new CategoryConverter(field.getConfiguration().getSettings().getOptions()); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/podio/item/map/converter/ExternalIdConverter.java: -------------------------------------------------------------------------------- 1 | package com.podio.item.map.converter; 2 | 3 | import java.beans.PropertyDescriptor; 4 | 5 | import org.apache.commons.beanutils.ConvertUtils; 6 | 7 | public class ExternalIdConverter { 8 | 9 | private final PropertyDescriptor descriptor; 10 | 11 | public ExternalIdConverter(PropertyDescriptor descriptor) { 12 | super(); 13 | this.descriptor = descriptor; 14 | } 15 | 16 | public String fromModel(Object model) { 17 | Object value; 18 | try { 19 | value = descriptor.getReadMethod().invoke(model); 20 | } catch (Exception e) { 21 | throw new RuntimeException("Unable to get external id"); 22 | } 23 | if (value == null) { 24 | return null; 25 | } 26 | 27 | return (String) ConvertUtils.convert(value, String.class); 28 | } 29 | 30 | public void toModel(String externalId, Object model) { 31 | Object value = ConvertUtils.convert(externalId, 32 | descriptor.getPropertyType()); 33 | 34 | try { 35 | descriptor.getWriteMethod().invoke(model, value); 36 | } catch (Exception e) { 37 | throw new RuntimeException("Unable to set external id", e); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/podio/item/map/converter/FieldConverter.java: -------------------------------------------------------------------------------- 1 | package com.podio.item.map.converter; 2 | 3 | import java.util.Map; 4 | 5 | public interface FieldConverter { 6 | 7 | Map fromModel(Object value); 8 | 9 | Object toModel(Map map, Class modelClass); 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/podio/item/map/converter/FieldConverterProvider.java: -------------------------------------------------------------------------------- 1 | package com.podio.item.map.converter; 2 | 3 | import java.lang.reflect.AnnotatedElement; 4 | 5 | import com.podio.app.ApplicationField; 6 | import com.podio.app.ApplicationFieldType; 7 | 8 | public interface FieldConverterProvider { 9 | 10 | boolean isSupported(ApplicationFieldType fieldType); 11 | 12 | FieldConverter getConverter(ApplicationField field, AnnotatedElement element); 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/podio/item/map/converter/FieldConverterRegistry.java: -------------------------------------------------------------------------------- 1 | package com.podio.item.map.converter; 2 | 3 | import java.lang.reflect.Method; 4 | import java.util.ArrayList; 5 | import java.util.List; 6 | 7 | import com.podio.app.ApplicationField; 8 | 9 | public class FieldConverterRegistry { 10 | 11 | private static final List REGISTRY = new ArrayList(); 12 | 13 | static { 14 | REGISTRY.add(new MoneyConverterProvider()); 15 | REGISTRY.add(new CategoryConverterProvider()); 16 | REGISTRY.add(new NumberConverterProvider()); 17 | REGISTRY.add(new TextConverterProvider()); 18 | REGISTRY.add(new ProgressConverterProvider()); 19 | } 20 | 21 | private FieldConverterRegistry() { 22 | } 23 | 24 | public static FieldConverter getConverter(ApplicationField field, 25 | Method readMethod) { 26 | for (FieldConverterProvider provider : REGISTRY) { 27 | if (provider.isSupported(field.getType())) { 28 | return provider.getConverter(field, readMethod); 29 | } 30 | } 31 | 32 | throw new RuntimeException("No converter found for field of type " 33 | + field.getType()); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/podio/item/map/converter/MoneyConverter.java: -------------------------------------------------------------------------------- 1 | package com.podio.item.map.converter; 2 | 3 | import java.math.BigDecimal; 4 | import java.math.RoundingMode; 5 | import java.util.HashMap; 6 | import java.util.Map; 7 | 8 | import org.apache.commons.beanutils.ConvertUtils; 9 | import org.joda.money.CurrencyUnit; 10 | import org.joda.money.Money; 11 | 12 | public class MoneyConverter implements FieldConverter { 13 | 14 | private final CurrencyUnit defaultCurrency; 15 | 16 | public MoneyConverter(CurrencyUnit defaultCurrency) { 17 | super(); 18 | this.defaultCurrency = defaultCurrency; 19 | } 20 | 21 | @Override 22 | public Map fromModel(Object value) { 23 | Map map = new HashMap(); 24 | 25 | Class javaClass = value.getClass(); 26 | if (javaClass == Money.class) { 27 | Money moneyValue = (Money) value; 28 | 29 | map.put("value", moneyValue.getAmount().toPlainString()); 30 | map.put("currency", moneyValue.getCurrencyUnit().getCurrencyCode()); 31 | } else { 32 | map.put("value", ((BigDecimal) ConvertUtils.convert(value, 33 | BigDecimal.class)).toPlainString()); 34 | map.put("currency", defaultCurrency.getCurrencyCode()); 35 | } 36 | 37 | return map; 38 | } 39 | 40 | @Override 41 | public Object toModel(Map map, Class modelClass) { 42 | if (modelClass == Money.class) { 43 | BigDecimal amount = new BigDecimal((String) map.get("value")); 44 | CurrencyUnit currency = CurrencyUnit.of((String) map 45 | .get("currency")); 46 | BigDecimal roundedAmount = amount.setScale( 47 | currency.getDecimalPlaces(), RoundingMode.HALF_EVEN); 48 | 49 | return Money.of(currency, roundedAmount); 50 | } else { 51 | return ConvertUtils.convert(map.get("value"), modelClass); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/podio/item/map/converter/MoneyConverterProvider.java: -------------------------------------------------------------------------------- 1 | package com.podio.item.map.converter; 2 | 3 | import java.lang.reflect.AnnotatedElement; 4 | 5 | import org.joda.money.CurrencyUnit; 6 | 7 | import com.podio.app.ApplicationField; 8 | import com.podio.app.ApplicationFieldType; 9 | import com.podio.item.map.MoneyField; 10 | 11 | public class MoneyConverterProvider implements FieldConverterProvider { 12 | 13 | @Override 14 | public boolean isSupported(ApplicationFieldType fieldType) { 15 | return fieldType == ApplicationFieldType.MONEY; 16 | } 17 | 18 | @Override 19 | public FieldConverter getConverter(ApplicationField field, 20 | AnnotatedElement element) { 21 | MoneyField moneyField = element.getAnnotation(MoneyField.class); 22 | 23 | CurrencyUnit defaultCurrency; 24 | if (moneyField != null) { 25 | defaultCurrency = CurrencyUnit.of(moneyField.currency()); 26 | } else { 27 | defaultCurrency = CurrencyUnit.of(field.getConfiguration() 28 | .getSettings().getAllowedCurrencies().get(0)); 29 | } 30 | 31 | return new MoneyConverter(defaultCurrency); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/podio/item/map/converter/NumberConverter.java: -------------------------------------------------------------------------------- 1 | package com.podio.item.map.converter; 2 | 3 | import java.math.BigDecimal; 4 | import java.util.Collections; 5 | import java.util.Map; 6 | 7 | import org.apache.commons.beanutils.ConvertUtils; 8 | 9 | public class NumberConverter implements FieldConverter { 10 | 11 | @Override 12 | public Map fromModel(Object value) { 13 | BigDecimal bdValue = (BigDecimal) ConvertUtils.convert(value, 14 | BigDecimal.class); 15 | 16 | return Collections.singletonMap("value", bdValue.toPlainString()); 17 | } 18 | 19 | @Override 20 | public Object toModel(Map map, Class modelClass) { 21 | BigDecimal bdValue = new BigDecimal((String) map.get("value")); 22 | 23 | return ConvertUtils.convert(bdValue, modelClass); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/podio/item/map/converter/NumberConverterProvider.java: -------------------------------------------------------------------------------- 1 | package com.podio.item.map.converter; 2 | 3 | import java.lang.reflect.AnnotatedElement; 4 | 5 | import com.podio.app.ApplicationField; 6 | import com.podio.app.ApplicationFieldType; 7 | 8 | public class NumberConverterProvider implements FieldConverterProvider { 9 | 10 | @Override 11 | public boolean isSupported(ApplicationFieldType fieldType) { 12 | return fieldType == ApplicationFieldType.NUMBER; 13 | } 14 | 15 | @Override 16 | public FieldConverter getConverter(ApplicationField field, 17 | AnnotatedElement element) { 18 | return new NumberConverter(); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/podio/item/map/converter/ProgressConverter.java: -------------------------------------------------------------------------------- 1 | package com.podio.item.map.converter; 2 | 3 | import java.util.Collections; 4 | import java.util.Map; 5 | 6 | import org.apache.commons.beanutils.ConvertUtils; 7 | 8 | public class ProgressConverter implements FieldConverter { 9 | 10 | @Override 11 | public Map fromModel(Object value) { 12 | Integer integerValue = (Integer) ConvertUtils.convert(value, 13 | Integer.class); 14 | 15 | return Collections.singletonMap("value", integerValue); 16 | } 17 | 18 | @Override 19 | public Object toModel(Map map, Class modelClass) { 20 | Integer value = (Integer) map.get("value"); 21 | 22 | return ConvertUtils.convert(value, modelClass); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/podio/item/map/converter/ProgressConverterProvider.java: -------------------------------------------------------------------------------- 1 | package com.podio.item.map.converter; 2 | 3 | import java.lang.reflect.AnnotatedElement; 4 | 5 | import com.podio.app.ApplicationField; 6 | import com.podio.app.ApplicationFieldType; 7 | 8 | public class ProgressConverterProvider implements FieldConverterProvider { 9 | 10 | @Override 11 | public boolean isSupported(ApplicationFieldType fieldType) { 12 | return fieldType == ApplicationFieldType.PROGRESS; 13 | } 14 | 15 | @Override 16 | public FieldConverter getConverter(ApplicationField field, 17 | AnnotatedElement element) { 18 | return new ProgressConverter(); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/podio/item/map/converter/TextConverter.java: -------------------------------------------------------------------------------- 1 | package com.podio.item.map.converter; 2 | 3 | import java.util.Collections; 4 | import java.util.Map; 5 | 6 | import org.apache.commons.beanutils.ConvertUtils; 7 | 8 | public class TextConverter implements FieldConverter { 9 | 10 | @Override 11 | public Map fromModel(Object value) { 12 | String stringValue = (String) ConvertUtils.convert(value, String.class); 13 | 14 | return Collections. singletonMap("value", stringValue); 15 | } 16 | 17 | @Override 18 | public Object toModel(Map map, Class modelClass) { 19 | return ConvertUtils.convert(map.get("value"), modelClass); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/podio/item/map/converter/TextConverterProvider.java: -------------------------------------------------------------------------------- 1 | package com.podio.item.map.converter; 2 | 3 | import java.lang.reflect.AnnotatedElement; 4 | 5 | import com.podio.app.ApplicationField; 6 | import com.podio.app.ApplicationFieldType; 7 | 8 | public class TextConverterProvider implements FieldConverterProvider { 9 | 10 | @Override 11 | public boolean isSupported(ApplicationFieldType fieldType) { 12 | return fieldType == ApplicationFieldType.TEXT 13 | || fieldType == ApplicationFieldType.LOCATION; 14 | } 15 | 16 | @Override 17 | public FieldConverter getConverter(ApplicationField field, 18 | AnnotatedElement element) { 19 | return new TextConverter(); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/podio/notification/InboxNewCount.java: -------------------------------------------------------------------------------- 1 | package com.podio.notification; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | 5 | public class InboxNewCount { 6 | 7 | private int newNotifications; 8 | 9 | public int getNewNotifications() { 10 | return newNotifications; 11 | } 12 | 13 | @JsonProperty("new") 14 | public void setNewNotifications(int newNotifications) { 15 | this.newNotifications = newNotifications; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/podio/notification/NotificationAPI.java: -------------------------------------------------------------------------------- 1 | package com.podio.notification; 2 | 3 | import java.util.Collection; 4 | import java.util.List; 5 | 6 | import javax.ws.rs.core.MediaType; 7 | 8 | import org.joda.time.DateTime; 9 | 10 | import com.podio.BaseAPI; 11 | import com.podio.ResourceFactory; 12 | import com.podio.common.CSVUtil; 13 | import com.podio.common.Empty; 14 | import com.podio.serialize.DateTimeUtil; 15 | import com.sun.jersey.api.client.GenericType; 16 | import com.sun.jersey.api.client.WebResource; 17 | 18 | /** 19 | * A notification is an information about an event that occured in Podio. A 20 | * notification is directed against a single user, and can have a status of 21 | * either unread or viewed. Notifications have a reference to the action that 22 | * caused the notification. 23 | */ 24 | public class NotificationAPI extends BaseAPI { 25 | 26 | public NotificationAPI(ResourceFactory resourceFactory) { 27 | super(resourceFactory); 28 | } 29 | 30 | /** 31 | * Returns the number of unread notifications 32 | * 33 | * @return The number of unread notifications 34 | */ 35 | public int getInboxNewCount() { 36 | WebResource resource = getResourceFactory().getApiResource( 37 | "/notification/inbox/new/count"); 38 | 39 | return resource.get(InboxNewCount.class).getNewNotifications(); 40 | } 41 | 42 | /** 43 | * Mark the notification as viewed. This will move the notification from the 44 | * inbox to the viewed archive. 45 | * 46 | * @param notificationId 47 | * The id of the notification 48 | */ 49 | public void markAsViewed(int notificationId) { 50 | getResourceFactory() 51 | .getApiResource("/notification/" + notificationId + "/viewed") 52 | .entity(new Empty(), MediaType.APPLICATION_JSON_TYPE).post(); 53 | } 54 | } -------------------------------------------------------------------------------- /src/main/java/com/podio/notification/NotificationContextType.java: -------------------------------------------------------------------------------- 1 | package com.podio.notification; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonValue; 5 | 6 | public enum NotificationContextType { 7 | 8 | STATUS, TASK, PROFILES, SPACE, ITEM, BULLETIN, APP, SHARE, ORG, QUESTION, FILE, BATCH; 9 | 10 | @Override 11 | @JsonValue 12 | public String toString() { 13 | return name().toLowerCase(); 14 | } 15 | 16 | @JsonCreator 17 | public static NotificationContextType getByName(String value) { 18 | return valueOf(value.toUpperCase()); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/podio/notification/NotificationDateType.java: -------------------------------------------------------------------------------- 1 | package com.podio.notification; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonValue; 5 | 6 | public enum NotificationDateType { 7 | 8 | /** 9 | * Ordered by when the notification was created 10 | */ 11 | CREATED, 12 | 13 | /** 14 | * Ordered by when the notification was viewed 15 | */ 16 | VIEWED; 17 | 18 | @Override 19 | @JsonValue 20 | public String toString() { 21 | return name().toLowerCase(); 22 | } 23 | 24 | @JsonCreator 25 | public static NotificationDateType getByName(String value) { 26 | return valueOf(value.toUpperCase()); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/podio/oauth/OAuthAPI.java: -------------------------------------------------------------------------------- 1 | package com.podio.oauth; 2 | 3 | import javax.ws.rs.core.MediaType; 4 | import javax.ws.rs.core.MultivaluedMap; 5 | 6 | import com.podio.BaseAPI; 7 | import com.podio.ResourceFactory; 8 | import com.sun.jersey.api.client.WebResource; 9 | import com.sun.jersey.api.client.filter.HTTPBasicAuthFilter; 10 | import com.sun.jersey.core.util.MultivaluedMapImpl; 11 | 12 | public class OAuthAPI extends BaseAPI { 13 | 14 | public OAuthAPI(ResourceFactory resourceFactory) { 15 | super(resourceFactory); 16 | } 17 | 18 | public OAuthToken getToken(OAuthClientCredentials clientCredentials, 19 | OAuthUserCredentials userCredentials) { 20 | MultivaluedMap parameters = new MultivaluedMapImpl(); 21 | parameters.add("grant_type", userCredentials.getType()); 22 | userCredentials.addParameters(parameters); 23 | 24 | WebResource resource = getResourceFactory().getApiResource( 25 | "/oauth/token", false); 26 | resource.addFilter(new HTTPBasicAuthFilter(clientCredentials 27 | .getClientId(), clientCredentials.getClientSecret())); 28 | return resource.type(MediaType.APPLICATION_FORM_URLENCODED_TYPE).post( 29 | OAuthToken.class, parameters); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/podio/oauth/OAuthAppCredentials.java: -------------------------------------------------------------------------------- 1 | package com.podio.oauth; 2 | 3 | import javax.ws.rs.core.MultivaluedMap; 4 | 5 | public class OAuthAppCredentials implements OAuthUserCredentials { 6 | 7 | private final int appId; 8 | 9 | private final String appToken; 10 | 11 | public OAuthAppCredentials(int appId, String appToken) { 12 | super(); 13 | this.appId = appId; 14 | this.appToken = appToken; 15 | } 16 | 17 | public String getType() { 18 | return "app"; 19 | } 20 | 21 | public void addParameters(MultivaluedMap map) { 22 | map.add("app_id", Integer.toString(appId)); 23 | map.add("app_token", appToken); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/podio/oauth/OAuthClientCredentials.java: -------------------------------------------------------------------------------- 1 | package com.podio.oauth; 2 | 3 | public final class OAuthClientCredentials { 4 | 5 | private final String clientId; 6 | 7 | private final String clientSecret; 8 | 9 | public OAuthClientCredentials(String clientId, String clientSecret) { 10 | super(); 11 | this.clientId = clientId; 12 | this.clientSecret = clientSecret; 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "OAuthClientCredentials [clientId=" + clientId 18 | + ", clientSecret=" + clientSecret + "]"; 19 | } 20 | 21 | public String getClientId() { 22 | return clientId; 23 | } 24 | 25 | public String getClientSecret() { 26 | return clientSecret; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/podio/oauth/OAuthCodeCredentials.java: -------------------------------------------------------------------------------- 1 | package com.podio.oauth; 2 | 3 | import javax.ws.rs.core.MultivaluedMap; 4 | 5 | public class OAuthCodeCredentials implements OAuthUserCredentials { 6 | 7 | private final String code; 8 | 9 | private final String redirectUri; 10 | 11 | public OAuthCodeCredentials(String code, String redirectUri) { 12 | super(); 13 | this.code = code; 14 | this.redirectUri = redirectUri; 15 | } 16 | 17 | public String getCode() { 18 | return code; 19 | } 20 | 21 | @Override 22 | public String getType() { 23 | return "authorization_code"; 24 | } 25 | 26 | public void addParameters(MultivaluedMap map) { 27 | map.add("code", code); 28 | map.add("redirect_uri", redirectUri); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/podio/oauth/OAuthRefreshTokenCredentials.java: -------------------------------------------------------------------------------- 1 | package com.podio.oauth; 2 | 3 | import javax.ws.rs.core.MultivaluedMap; 4 | 5 | public class OAuthRefreshTokenCredentials implements OAuthUserCredentials { 6 | 7 | private final String refreshToken; 8 | 9 | public OAuthRefreshTokenCredentials(String refreshToken) { 10 | super(); 11 | this.refreshToken = refreshToken; 12 | } 13 | 14 | public String getType() { 15 | return "refresh_token"; 16 | } 17 | 18 | public void addParameters(MultivaluedMap map) { 19 | map.add("refresh_token", refreshToken); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/podio/oauth/OAuthToken.java: -------------------------------------------------------------------------------- 1 | package com.podio.oauth; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | 5 | public final class OAuthToken { 6 | 7 | private String accessToken; 8 | 9 | private String refreshToken; 10 | 11 | private int expiresIn; 12 | 13 | @JsonProperty("access_token") 14 | public String getAccessToken() { 15 | return accessToken; 16 | } 17 | 18 | @JsonProperty("access_token") 19 | public void setAccessToken(String accessToken) { 20 | this.accessToken = accessToken; 21 | } 22 | 23 | @JsonProperty("refresh_token") 24 | public String getRefreshToken() { 25 | return refreshToken; 26 | } 27 | 28 | @JsonProperty("refresh_token") 29 | public void setRefreshToken(String refreshToken) { 30 | this.refreshToken = refreshToken; 31 | } 32 | 33 | @JsonProperty("expires_in") 34 | public int getExpiresIn() { 35 | return expiresIn; 36 | } 37 | 38 | @JsonProperty("expires_in") 39 | public void setExpiresIn(int expiresIn) { 40 | this.expiresIn = expiresIn; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/podio/oauth/OAuthUserCredentials.java: -------------------------------------------------------------------------------- 1 | package com.podio.oauth; 2 | 3 | import javax.ws.rs.core.MultivaluedMap; 4 | 5 | public interface OAuthUserCredentials { 6 | 7 | String getType(); 8 | 9 | void addParameters(MultivaluedMap map); 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/podio/oauth/OAuthUsernameCredentials.java: -------------------------------------------------------------------------------- 1 | package com.podio.oauth; 2 | 3 | import javax.ws.rs.core.MultivaluedMap; 4 | 5 | public class OAuthUsernameCredentials implements OAuthUserCredentials { 6 | 7 | private final String username; 8 | 9 | private final String password; 10 | 11 | public OAuthUsernameCredentials(String username, String password) { 12 | super(); 13 | this.username = username; 14 | this.password = password; 15 | } 16 | 17 | public String getUsername() { 18 | return username; 19 | } 20 | 21 | public String getPassword() { 22 | return password; 23 | } 24 | 25 | public String getType() { 26 | return "password"; 27 | } 28 | 29 | public void addParameters(MultivaluedMap map) { 30 | map.add("username", username); 31 | map.add("password", password); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/podio/org/EndMemberInfo.java: -------------------------------------------------------------------------------- 1 | package com.podio.org; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonProperty; 6 | 7 | import com.podio.space.SpaceMemberDetails; 8 | 9 | public class EndMemberInfo { 10 | 11 | /** 12 | * list of spaces the user would just be removed from 13 | */ 14 | private List toRemove; 15 | 16 | /** 17 | * list of spaces where all other users will be promoted to admin 18 | */ 19 | private List toPromote; 20 | 21 | /** 22 | * list of spaces which would be deleted 23 | */ 24 | private List toDelete; 25 | 26 | @JsonProperty("to_remove") 27 | public List getToRemove() { 28 | return toRemove; 29 | } 30 | 31 | @JsonProperty("to_promote") 32 | public List getToPromote() { 33 | return toPromote; 34 | } 35 | 36 | @JsonProperty("to_delete") 37 | public List getToDelete() { 38 | return toDelete; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/podio/org/Organization.java: -------------------------------------------------------------------------------- 1 | package com.podio.org; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | import org.joda.time.DateTime; 5 | 6 | import com.podio.contact.ProfileMini; 7 | 8 | public class Organization extends OrganizationMini { 9 | 10 | /** 11 | * The status of the organization 12 | */ 13 | private OrganizationStatus status; 14 | 15 | /** 16 | * The maximum number of users that are allowed in the organization 17 | */ 18 | private int userLimit; 19 | 20 | /** 21 | * The date and time when the organization was created 22 | */ 23 | private DateTime createdOn; 24 | 25 | /** 26 | * The user that created the organization 27 | */ 28 | private ProfileMini createdBy; 29 | 30 | public OrganizationStatus getStatus() { 31 | return status; 32 | } 33 | 34 | public void setStatus(OrganizationStatus status) { 35 | this.status = status; 36 | } 37 | 38 | public int getUserLimit() { 39 | return userLimit; 40 | } 41 | 42 | @JsonProperty("user_limit") 43 | public void setUserLimit(int userLimit) { 44 | this.userLimit = userLimit; 45 | } 46 | 47 | public DateTime getCreatedOn() { 48 | return createdOn; 49 | } 50 | 51 | @JsonProperty("created_on") 52 | public void setCreatedOn(DateTime createdOn) { 53 | this.createdOn = createdOn; 54 | } 55 | 56 | public ProfileMini getCreatedBy() { 57 | return createdBy; 58 | } 59 | 60 | @JsonProperty("created_by") 61 | public void setCreatedBy(ProfileMini createdBy) { 62 | this.createdBy = createdBy; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/com/podio/org/OrganizationCreate.java: -------------------------------------------------------------------------------- 1 | package com.podio.org; 2 | 3 | public class OrganizationCreate { 4 | 5 | /** 6 | * The name of the new organization 7 | */ 8 | private String name; 9 | 10 | /** 11 | * The file id of the logo of the organization 12 | */ 13 | private Integer logo; 14 | 15 | public OrganizationCreate(String name, Integer logo) { 16 | super(); 17 | this.name = name; 18 | this.logo = logo; 19 | } 20 | 21 | public String getName() { 22 | return name; 23 | } 24 | 25 | public void setName(String name) { 26 | this.name = name; 27 | } 28 | 29 | public Integer getLogo() { 30 | return logo; 31 | } 32 | 33 | public void setLogo(Integer logo) { 34 | this.logo = logo; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/podio/org/OrganizationCreateResponse.java: -------------------------------------------------------------------------------- 1 | package com.podio.org; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | 5 | public class OrganizationCreateResponse { 6 | 7 | /** 8 | * The id of the newly created organization 9 | */ 10 | private int id; 11 | 12 | /** 13 | * The full URL of the organization 14 | */ 15 | private String url; 16 | 17 | public int getId() { 18 | return id; 19 | } 20 | 21 | @JsonProperty("org_id") 22 | public void setId(int id) { 23 | this.id = id; 24 | } 25 | 26 | public String getUrl() { 27 | return url; 28 | } 29 | 30 | public void setUrl(String url) { 31 | this.url = url; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/podio/org/OrganizationMember.java: -------------------------------------------------------------------------------- 1 | package com.podio.org; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | 5 | import com.podio.common.Role; 6 | import com.podio.contact.Profile; 7 | import com.podio.user.User; 8 | 9 | public class OrganizationMember { 10 | 11 | /** 12 | * The user data of the member 13 | */ 14 | private User user; 15 | 16 | /** 17 | * The profile of the member 18 | */ 19 | private Profile profile; 20 | 21 | /** 22 | * True if the member is an employee, false otherwise 23 | */ 24 | private boolean employee; 25 | 26 | /** 27 | * The organization role of the user, if any, either "regular" or "admin" 28 | */ 29 | private Role role; 30 | 31 | /** 32 | * The number of spaces the user is member of in the organization 33 | */ 34 | private int spaceMemberships; 35 | 36 | public User getUser() { 37 | return user; 38 | } 39 | 40 | public void setUser(User user) { 41 | this.user = user; 42 | } 43 | 44 | public Profile getProfile() { 45 | return profile; 46 | } 47 | 48 | public void setProfile(Profile profile) { 49 | this.profile = profile; 50 | } 51 | 52 | public boolean isEmployee() { 53 | return employee; 54 | } 55 | 56 | public void setEmployee(boolean employee) { 57 | this.employee = employee; 58 | } 59 | 60 | public Role getRole() { 61 | return role; 62 | } 63 | 64 | public void setRole(Role role) { 65 | this.role = role; 66 | } 67 | 68 | @JsonProperty("space_memberships") 69 | public int getSpaceMemberships() { 70 | return spaceMemberships; 71 | } 72 | 73 | @JsonProperty("space_memberships") 74 | public void setSpaceMemberships(int spaceMemberships) { 75 | this.spaceMemberships = spaceMemberships; 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /src/main/java/com/podio/org/OrganizationMini.java: -------------------------------------------------------------------------------- 1 | package com.podio.org; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | 5 | public class OrganizationMini { 6 | 7 | /** 8 | * The id of the org 9 | */ 10 | private int id; 11 | 12 | /** 13 | * The name of the org 14 | */ 15 | private String name; 16 | 17 | /** 18 | * The file id of the logo 19 | */ 20 | private Integer logo; 21 | 22 | /** 23 | * The full url of the org 24 | */ 25 | private String url; 26 | 27 | /** 28 | * true if the organization is a premium organization, 29 | * false otherwise 30 | */ 31 | private boolean premium; 32 | 33 | @JsonProperty("org_id") 34 | public int getId() { 35 | return id; 36 | } 37 | 38 | @JsonProperty("org_id") 39 | public void setId(int id) { 40 | this.id = id; 41 | } 42 | 43 | public String getName() { 44 | return name; 45 | } 46 | 47 | public void setName(String name) { 48 | this.name = name; 49 | } 50 | 51 | public Integer getLogo() { 52 | return logo; 53 | } 54 | 55 | public void setLogo(Integer logo) { 56 | this.logo = logo; 57 | } 58 | 59 | public String getUrl() { 60 | return url; 61 | } 62 | 63 | public void setUrl(String url) { 64 | this.url = url; 65 | } 66 | 67 | public boolean isPremium() { 68 | return premium; 69 | } 70 | 71 | public void setPremium(boolean premium) { 72 | this.premium = premium; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/main/java/com/podio/org/OrganizationStatus.java: -------------------------------------------------------------------------------- 1 | package com.podio.org; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonValue; 5 | 6 | public enum OrganizationStatus { 7 | 8 | ACTIVE, 9 | INACTIVE; 10 | 11 | @Override 12 | @JsonValue 13 | public String toString() { 14 | return name().toLowerCase(); 15 | } 16 | 17 | @JsonCreator 18 | public static OrganizationStatus getByName(String value) { 19 | return valueOf(value.toUpperCase()); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/podio/org/OrganizationWithSpaces.java: -------------------------------------------------------------------------------- 1 | package com.podio.org; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonProperty; 6 | 7 | import com.podio.space.SpaceMini; 8 | 9 | public class OrganizationWithSpaces extends OrganizationMini { 10 | 11 | /** 12 | * true if the user has the right to create new spaces, 13 | * false otherwise 14 | */ 15 | private String createRight; 16 | 17 | /** 18 | * The list of spaces in the organization that the user has access to 19 | */ 20 | private List spaces; 21 | 22 | @JsonProperty("create_right") 23 | public String getCreateRight() { 24 | return createRight; 25 | } 26 | 27 | @JsonProperty("create_right") 28 | public void setCreateRight(String createRight) { 29 | this.createRight = createRight; 30 | } 31 | 32 | public List getSpaces() { 33 | return spaces; 34 | } 35 | 36 | public void setSpaces(List spaces) { 37 | this.spaces = spaces; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/podio/rating/Rating.java: -------------------------------------------------------------------------------- 1 | package com.podio.rating; 2 | 3 | import org.joda.time.DateTime; 4 | 5 | import com.podio.contact.ProfileMini; 6 | 7 | public class Rating { 8 | 9 | /** 10 | * The type of rating 11 | */ 12 | private RatingType type; 13 | 14 | /** 15 | * The value of the rating 16 | */ 17 | private int value; 18 | 19 | /** 20 | * The user who gave the rating 21 | */ 22 | private ProfileMini user; 23 | 24 | /** 25 | * The date and time the rating was given 26 | */ 27 | private DateTime time; 28 | 29 | public RatingType getType() { 30 | return type; 31 | } 32 | 33 | public void setType(RatingType type) { 34 | this.type = type; 35 | } 36 | 37 | public int getValue() { 38 | return value; 39 | } 40 | 41 | public void setValue(int value) { 42 | this.value = value; 43 | } 44 | 45 | public ProfileMini getUser() { 46 | return user; 47 | } 48 | 49 | public void setUser(ProfileMini user) { 50 | this.user = user; 51 | } 52 | 53 | public DateTime getTime() { 54 | return time; 55 | } 56 | 57 | public void setTime(DateTime time) { 58 | this.time = time; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/com/podio/rating/RatingCreateResponse.java: -------------------------------------------------------------------------------- 1 | package com.podio.rating; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | 5 | public class RatingCreateResponse { 6 | 7 | private int id; 8 | 9 | public int getId() { 10 | return id; 11 | } 12 | 13 | @JsonProperty("rating_id") 14 | public void setId(int id) { 15 | this.id = id; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/podio/rating/RatingType.java: -------------------------------------------------------------------------------- 1 | package com.podio.rating; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonValue; 5 | 6 | public enum RatingType { 7 | 8 | /** 9 | * Signals that the user approves (0) or disapproves(1) 10 | */ 11 | APPROVED, 12 | 13 | /** 14 | * Indicates that the user can attend (0), cannot attend (1) or can maybe 15 | * attend (2) 16 | */ 17 | RSVP, 18 | 19 | /** 20 | * A rating from 1-5 where 5 is the best 21 | */ 22 | FIVESTAR, 23 | 24 | /** 25 | * Signals the user says yes (0) or no (1) 26 | */ 27 | YESNO, 28 | 29 | /** 30 | * Signals a thumbs up (0) or thumbs down (1) 31 | */ 32 | THUMBS, 33 | 34 | /** 35 | * Signals the user likes the item (1) 36 | */ 37 | LIKE; 38 | 39 | @Override 40 | @JsonValue 41 | public String toString() { 42 | return name().toLowerCase(); 43 | } 44 | 45 | @JsonCreator 46 | public static RatingType getByName(String value) { 47 | return valueOf(value.toUpperCase()); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/podio/rating/RatingTypeKeyDeserializer.java: -------------------------------------------------------------------------------- 1 | package com.podio.rating; 2 | 3 | import java.io.IOException; 4 | 5 | import org.codehaus.jackson.JsonProcessingException; 6 | import org.codehaus.jackson.map.DeserializationContext; 7 | import org.codehaus.jackson.map.KeyDeserializer; 8 | 9 | public class RatingTypeKeyDeserializer extends KeyDeserializer { 10 | 11 | @Override 12 | public Object deserializeKey(String key, DeserializationContext ctxt) 13 | throws IOException, JsonProcessingException { 14 | return RatingType.getByName(key); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/podio/rating/RatingValue.java: -------------------------------------------------------------------------------- 1 | package com.podio.rating; 2 | 3 | public class RatingValue { 4 | 5 | public static final int YESNO_YES = 0; 6 | public static final int YESNO_NO = 1; 7 | 8 | public static final int APPROVED_APPROVES = 0; 9 | public static final int APPROVED_DISAPPROVES = 1; 10 | 11 | public static final int RSVP_ATTEND = 0; 12 | public static final int RSVP_NOT_ATTEND = 1; 13 | public static final int RSVP_MAYBE_ATTEND = 2; 14 | 15 | public static final int FIVESTAR_1_STAR = 1; 16 | public static final int FIVESTAR_2_STARS = 2; 17 | public static final int FIVESTAR_3_STARS = 3; 18 | public static final int FIVESTAR_4_STARS = 4; 19 | public static final int FIVESTAR_5_STARS = 5; 20 | 21 | public static final int THUMBS_UP = 0; 22 | public static final int THUMBS_DOWN = 1; 23 | 24 | public static final int LIKE = 1; 25 | 26 | private RatingValue() { 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/podio/rating/RatingValuesMap.java: -------------------------------------------------------------------------------- 1 | package com.podio.rating; 2 | 3 | import java.io.Serializable; 4 | import java.util.HashMap; 5 | import java.util.Map; 6 | 7 | import org.codehaus.jackson.annotate.JsonAnySetter; 8 | 9 | public class RatingValuesMap implements Serializable { 10 | 11 | private static final long serialVersionUID = 1L; 12 | 13 | private final Map values = new HashMap(); 14 | 15 | public TypeRating get(RatingType type) { 16 | return values.get(type); 17 | } 18 | 19 | @JsonAnySetter 20 | public void set(String type, TypeRating value) { 21 | values.put(RatingType.getByName(type), value); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/podio/rating/SingleRatingValue.java: -------------------------------------------------------------------------------- 1 | package com.podio.rating; 2 | 3 | public class SingleRatingValue { 4 | 5 | private int value; 6 | 7 | public int getValue() { 8 | return value; 9 | } 10 | 11 | public void setValue(int value) { 12 | this.value = value; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/podio/rating/TypeRating.java: -------------------------------------------------------------------------------- 1 | package com.podio.rating; 2 | 3 | import java.io.Serializable; 4 | import java.util.HashMap; 5 | import java.util.Map; 6 | 7 | public class TypeRating implements Serializable { 8 | 9 | private static final long serialVersionUID = 1L; 10 | 11 | private Map counts = new HashMap(); 12 | 13 | private Float average; 14 | 15 | @Override 16 | public String toString() { 17 | return "TypeRating [counts=" + counts + ", average=" + average + "]"; 18 | } 19 | 20 | public ValueRatings getCounts(int value) { 21 | return counts.get(value); 22 | } 23 | 24 | public Map getCounts() { 25 | return counts; 26 | } 27 | 28 | public void setCounts(Map counts) { 29 | this.counts = counts; 30 | } 31 | 32 | public Float getAverage() { 33 | return average; 34 | } 35 | 36 | public void setAverage(Float average) { 37 | this.average = average; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/podio/rating/ValueRatings.java: -------------------------------------------------------------------------------- 1 | package com.podio.rating; 2 | 3 | import java.io.Serializable; 4 | import java.util.List; 5 | 6 | import com.podio.contact.ProfileMini; 7 | 8 | public class ValueRatings implements Serializable { 9 | 10 | private static final long serialVersionUID = 1L; 11 | 12 | private int total; 13 | 14 | private List users; 15 | 16 | @Override 17 | public String toString() { 18 | return "ValueRatings [total=" + total + ", users=" + users + "]"; 19 | } 20 | 21 | public int getTotal() { 22 | return total; 23 | } 24 | 25 | public void setTotal(int total) { 26 | this.total = total; 27 | } 28 | 29 | public List getUsers() { 30 | return users; 31 | } 32 | 33 | public void setUsers(List users) { 34 | this.users = users; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/podio/search/ReferenceTypeSearchInApp.java: -------------------------------------------------------------------------------- 1 | package com.podio.search; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonValue; 5 | 6 | public enum ReferenceTypeSearchInApp { 7 | 8 | APP, CONVERSATION, FILE, ITEM, PROFILE, STATUS, TASK; 9 | 10 | @Override 11 | @JsonValue 12 | public String toString() { 13 | return name().toLowerCase(); 14 | } 15 | 16 | @JsonCreator 17 | public static ReferenceTypeSearchInApp getByName(String value) { 18 | return valueOf(value.toUpperCase()); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/podio/search/SearchInAppResponse.java: -------------------------------------------------------------------------------- 1 | package com.podio.search; 2 | 3 | import java.util.List; 4 | 5 | public class SearchInAppResponse { 6 | 7 | /** 8 | * Counts for each type of object 9 | */ 10 | private Counts counts; 11 | 12 | /** 13 | * The items returned 14 | */ 15 | private List results; 16 | 17 | @Override 18 | public String toString() { 19 | return "SearchInAppResponse [counts=" + counts.toString() + ", results=" + results.toString() + "]"; 20 | } 21 | 22 | public Counts getCounts() { 23 | return counts; 24 | } 25 | 26 | public void setCounts(Counts counts) { 27 | this.counts = counts; 28 | } 29 | 30 | public List getResults() { 31 | return results; 32 | } 33 | 34 | public void setResults(List results) { 35 | this.results = results; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/podio/serialize/DateTimeDeserializer.java: -------------------------------------------------------------------------------- 1 | package com.podio.serialize; 2 | 3 | import java.io.IOException; 4 | 5 | import org.codehaus.jackson.JsonParser; 6 | import org.codehaus.jackson.JsonProcessingException; 7 | import org.codehaus.jackson.map.DeserializationContext; 8 | import org.codehaus.jackson.map.JsonDeserializer; 9 | import org.joda.time.DateTime; 10 | 11 | public class DateTimeDeserializer extends JsonDeserializer { 12 | 13 | @Override 14 | public DateTime deserialize(JsonParser jp, DeserializationContext ctxt) 15 | throws IOException, JsonProcessingException { 16 | return DateTimeUtil.parseDateTime(jp.getText()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/podio/serialize/DateTimeSerializer.java: -------------------------------------------------------------------------------- 1 | package com.podio.serialize; 2 | 3 | import java.io.IOException; 4 | 5 | import org.codehaus.jackson.JsonGenerator; 6 | import org.codehaus.jackson.JsonProcessingException; 7 | import org.codehaus.jackson.map.JsonSerializer; 8 | import org.codehaus.jackson.map.SerializerProvider; 9 | import org.joda.time.DateTime; 10 | 11 | public class DateTimeSerializer extends JsonSerializer { 12 | 13 | @Override 14 | public void serialize(DateTime value, JsonGenerator jgen, 15 | SerializerProvider provider) throws IOException, 16 | JsonProcessingException { 17 | jgen.writeString(DateTimeUtil.formatDateTime(value)); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/podio/serialize/DateTimeUtil.java: -------------------------------------------------------------------------------- 1 | package com.podio.serialize; 2 | 3 | import org.joda.time.DateTime; 4 | import org.joda.time.DateTimeZone; 5 | import org.joda.time.LocalDate; 6 | import org.joda.time.LocalTime; 7 | import org.joda.time.format.DateTimeFormat; 8 | import org.joda.time.format.DateTimeFormatter; 9 | 10 | public final class DateTimeUtil { 11 | 12 | private static final DateTimeFormatter DATE_TIME_FORMAT = DateTimeFormat 13 | .forPattern("yyyy-MM-dd HH:mm:ss").withZone(DateTimeZone.UTC); 14 | 15 | private static final DateTimeFormatter DATE_FORMAT = DateTimeFormat 16 | .forPattern("yyyy-MM-dd").withZone(DateTimeZone.UTC); 17 | 18 | private DateTimeUtil() { 19 | } 20 | 21 | public static DateTime parseDateTime(String text) { 22 | try { 23 | return DATE_TIME_FORMAT.parseDateTime(text); 24 | } catch (IllegalArgumentException e) { 25 | return parseDate(text).toDateTime(new LocalTime(0, 0)); 26 | } 27 | } 28 | 29 | public static String formatDateTime(DateTime dateTime) { 30 | return DATE_TIME_FORMAT.print(dateTime); 31 | } 32 | 33 | public static LocalDate parseDate(String text) { 34 | return DATE_FORMAT.parseDateTime(text).toLocalDate(); 35 | } 36 | 37 | public static String formatDate(LocalDate date) { 38 | return DATE_FORMAT.print(date); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/podio/serialize/LocalDateDeserializer.java: -------------------------------------------------------------------------------- 1 | package com.podio.serialize; 2 | 3 | import java.io.IOException; 4 | 5 | import org.codehaus.jackson.JsonParser; 6 | import org.codehaus.jackson.JsonProcessingException; 7 | import org.codehaus.jackson.map.DeserializationContext; 8 | import org.codehaus.jackson.map.JsonDeserializer; 9 | import org.joda.time.LocalDate; 10 | 11 | public class LocalDateDeserializer extends JsonDeserializer { 12 | 13 | @Override 14 | public LocalDate deserialize(JsonParser jp, DeserializationContext ctxt) 15 | throws IOException, JsonProcessingException { 16 | return DateTimeUtil.parseDate(jp.getText()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/podio/serialize/LocalDateSerializer.java: -------------------------------------------------------------------------------- 1 | package com.podio.serialize; 2 | 3 | import java.io.IOException; 4 | 5 | import org.codehaus.jackson.JsonGenerator; 6 | import org.codehaus.jackson.JsonProcessingException; 7 | import org.codehaus.jackson.map.JsonSerializer; 8 | import org.codehaus.jackson.map.SerializerProvider; 9 | import org.joda.time.LocalDate; 10 | 11 | public class LocalDateSerializer extends JsonSerializer { 12 | 13 | @Override 14 | public void serialize(LocalDate value, JsonGenerator jgen, 15 | SerializerProvider provider) throws IOException, 16 | JsonProcessingException { 17 | jgen.writeString(DateTimeUtil.formatDate(value)); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/podio/serialize/LocaleDeserializer.java: -------------------------------------------------------------------------------- 1 | package com.podio.serialize; 2 | 3 | import java.io.IOException; 4 | import java.util.Locale; 5 | 6 | import org.codehaus.jackson.JsonParser; 7 | import org.codehaus.jackson.JsonProcessingException; 8 | import org.codehaus.jackson.map.DeserializationContext; 9 | import org.codehaus.jackson.map.JsonDeserializer; 10 | 11 | public class LocaleDeserializer extends JsonDeserializer { 12 | 13 | @Override 14 | public Locale deserialize(JsonParser jp, DeserializationContext ctxt) 15 | throws IOException, JsonProcessingException { 16 | return new Locale(jp.getText()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/podio/serialize/LocaleSerializer.java: -------------------------------------------------------------------------------- 1 | package com.podio.serialize; 2 | 3 | import java.io.IOException; 4 | import java.util.Locale; 5 | 6 | import org.codehaus.jackson.JsonGenerator; 7 | import org.codehaus.jackson.JsonProcessingException; 8 | import org.codehaus.jackson.map.JsonSerializer; 9 | import org.codehaus.jackson.map.SerializerProvider; 10 | 11 | public class LocaleSerializer extends JsonSerializer { 12 | 13 | @Override 14 | public void serialize(Locale value, JsonGenerator jgen, 15 | SerializerProvider provider) throws IOException, 16 | JsonProcessingException { 17 | jgen.writeString(value.getLanguage() + "_" + value.getCountry()); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/podio/serialize/TimeZoneDeserializer.java: -------------------------------------------------------------------------------- 1 | package com.podio.serialize; 2 | 3 | import java.io.IOException; 4 | import java.util.TimeZone; 5 | 6 | import org.codehaus.jackson.JsonParser; 7 | import org.codehaus.jackson.JsonProcessingException; 8 | import org.codehaus.jackson.map.DeserializationContext; 9 | import org.codehaus.jackson.map.JsonDeserializer; 10 | 11 | public class TimeZoneDeserializer extends JsonDeserializer { 12 | 13 | @Override 14 | public TimeZone deserialize(JsonParser jp, DeserializationContext ctxt) 15 | throws IOException, JsonProcessingException { 16 | return TimeZone.getTimeZone(jp.getText()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/podio/serialize/TimeZoneSerializer.java: -------------------------------------------------------------------------------- 1 | package com.podio.serialize; 2 | 3 | import java.io.IOException; 4 | import java.util.TimeZone; 5 | 6 | import org.codehaus.jackson.JsonGenerator; 7 | import org.codehaus.jackson.JsonProcessingException; 8 | import org.codehaus.jackson.map.JsonSerializer; 9 | import org.codehaus.jackson.map.SerializerProvider; 10 | 11 | public class TimeZoneSerializer extends JsonSerializer { 12 | 13 | @Override 14 | public void serialize(TimeZone value, JsonGenerator jgen, 15 | SerializerProvider provider) throws IOException, 16 | JsonProcessingException { 17 | jgen.writeString(value.getID()); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/podio/share/Share.java: -------------------------------------------------------------------------------- 1 | package com.podio.share; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | import org.joda.time.DateTime; 5 | 6 | import com.podio.common.Role; 7 | import com.podio.contact.ProfileMini; 8 | 9 | public class Share { 10 | 11 | /** 12 | * The user the object was share with 13 | */ 14 | private ProfileMini user; 15 | 16 | /** 17 | * The role the user has to the object 18 | */ 19 | private Role role; 20 | 21 | /** 22 | * The date and time the object was shared 23 | */ 24 | private DateTime grantedOn; 25 | 26 | /** 27 | * The user who shared the item 28 | */ 29 | private ProfileMini grantedBy; 30 | 31 | public ProfileMini getUser() { 32 | return user; 33 | } 34 | 35 | public void setUser(ProfileMini user) { 36 | this.user = user; 37 | } 38 | 39 | public Role getRole() { 40 | return role; 41 | } 42 | 43 | public void setRole(Role role) { 44 | this.role = role; 45 | } 46 | 47 | @JsonProperty("granted_on") 48 | public DateTime getGrantedOn() { 49 | return grantedOn; 50 | } 51 | 52 | @JsonProperty("granted_on") 53 | public void setGrantedOn(DateTime grantedOn) { 54 | this.grantedOn = grantedOn; 55 | } 56 | 57 | @JsonProperty("granted_by") 58 | public ProfileMini getGrantedBy() { 59 | return grantedBy; 60 | } 61 | 62 | @JsonProperty("granted_by") 63 | public void setGrantedBy(ProfileMini grantedBy) { 64 | this.grantedBy = grantedBy; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/com/podio/space/SpaceCreate.java: -------------------------------------------------------------------------------- 1 | package com.podio.space; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | 5 | public class SpaceCreate extends SpaceUpdate { 6 | 7 | private int orgId; 8 | 9 | public SpaceCreate(String name, boolean postOnNewApp, 10 | boolean postOnNewMember, int orgId) { 11 | super(name, postOnNewApp, postOnNewMember); 12 | this.orgId = orgId; 13 | } 14 | 15 | @JsonProperty("org_id") 16 | public int getOrgId() { 17 | return orgId; 18 | } 19 | 20 | public void setOrgId(int orgId) { 21 | this.orgId = orgId; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/podio/space/SpaceCreateResponse.java: -------------------------------------------------------------------------------- 1 | package com.podio.space; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | 5 | public class SpaceCreateResponse { 6 | 7 | /** 8 | * The id of the newly created space 9 | */ 10 | private int id; 11 | 12 | /** 13 | * The full URL of the new space 14 | */ 15 | private String url; 16 | 17 | public int getId() { 18 | return id; 19 | } 20 | 21 | @JsonProperty("space_id") 22 | public void setId(int id) { 23 | this.id = id; 24 | } 25 | 26 | public String getUrl() { 27 | return url; 28 | } 29 | 30 | public void setUrl(String url) { 31 | this.url = url; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/podio/space/SpaceInvitationUpdate.java: -------------------------------------------------------------------------------- 1 | package com.podio.space; 2 | 3 | public class SpaceInvitationUpdate { 4 | 5 | /** 6 | * The subject to put in the invitation mail to the users 7 | */ 8 | private String subject; 9 | 10 | /** 11 | * The personalized message to put in the invitation 12 | */ 13 | private String message; 14 | 15 | public SpaceInvitationUpdate(String subject, String message) { 16 | super(); 17 | this.subject = subject; 18 | this.message = message; 19 | } 20 | 21 | public String getSubject() { 22 | return subject; 23 | } 24 | 25 | public void setSubject(String subject) { 26 | this.subject = subject; 27 | } 28 | 29 | public String getMessage() { 30 | return message; 31 | } 32 | 33 | public void setMessage(String message) { 34 | this.message = message; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/podio/space/SpaceMember.java: -------------------------------------------------------------------------------- 1 | package com.podio.space; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | import org.joda.time.DateTime; 5 | 6 | import com.podio.common.Role; 7 | import com.podio.contact.ProfileMini; 8 | 9 | public class SpaceMember { 10 | 11 | /** 12 | * The member of the space 13 | */ 14 | private ProfileMini user; 15 | 16 | /** 17 | * The role that the member has 18 | */ 19 | private Role role; 20 | 21 | /** 22 | * The date and time the user was invited 23 | */ 24 | private DateTime invitedOn; 25 | 26 | /** 27 | * The date and time the user accepted the invitation 28 | */ 29 | private DateTime startedOn; 30 | 31 | /** 32 | * The date and item the membership was ended. Only set if membership is 33 | * ended 34 | */ 35 | private DateTime endedOn; 36 | 37 | public ProfileMini getUser() { 38 | return user; 39 | } 40 | 41 | public void setUser(ProfileMini user) { 42 | this.user = user; 43 | } 44 | 45 | public Role getRole() { 46 | return role; 47 | } 48 | 49 | public void setRole(Role role) { 50 | this.role = role; 51 | } 52 | 53 | public DateTime getInvitedOn() { 54 | return invitedOn; 55 | } 56 | 57 | @JsonProperty("invited_on") 58 | public void setInvitedOn(DateTime invitedOn) { 59 | this.invitedOn = invitedOn; 60 | } 61 | 62 | public DateTime getStartedOn() { 63 | return startedOn; 64 | } 65 | 66 | @JsonProperty("started_on") 67 | public void setStartedOn(DateTime startedOn) { 68 | this.startedOn = startedOn; 69 | } 70 | 71 | public DateTime getEndedOn() { 72 | return endedOn; 73 | } 74 | 75 | @JsonProperty("ended_on") 76 | public void setEndedOn(DateTime endedOn) { 77 | this.endedOn = endedOn; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/main/java/com/podio/space/SpaceMemberDetails.java: -------------------------------------------------------------------------------- 1 | package com.podio.space; 2 | 3 | import com.podio.common.Role; 4 | 5 | public class SpaceMemberDetails { 6 | 7 | private Space space; 8 | 9 | private Role role; 10 | 11 | private int grants; 12 | 13 | public Space getSpace() { 14 | return space; 15 | } 16 | 17 | public Role getRole() { 18 | return role; 19 | } 20 | 21 | public int getGrants() { 22 | return grants; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/podio/space/SpaceMemberUpdate.java: -------------------------------------------------------------------------------- 1 | package com.podio.space; 2 | 3 | import com.podio.common.Role; 4 | 5 | public class SpaceMemberUpdate { 6 | 7 | private Role role; 8 | 9 | public SpaceMemberUpdate(Role role) { 10 | super(); 11 | this.role = role; 12 | } 13 | 14 | public Role getRole() { 15 | return role; 16 | } 17 | 18 | public void setRole(Role role) { 19 | this.role = role; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/podio/space/SpaceMini.java: -------------------------------------------------------------------------------- 1 | package com.podio.space; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | 5 | public class SpaceMini { 6 | 7 | /** 8 | * The id of the space 9 | */ 10 | private int id; 11 | 12 | /** 13 | * The name of the space 14 | */ 15 | private String name; 16 | 17 | /** 18 | * The full URL of the space, f.ex. https://company.podio.com/intranet 19 | */ 20 | private String url; 21 | 22 | @JsonProperty("space_id") 23 | public int getId() { 24 | return id; 25 | } 26 | 27 | @JsonProperty("space_id") 28 | public void setId(int id) { 29 | this.id = id; 30 | } 31 | 32 | public String getName() { 33 | return name; 34 | } 35 | 36 | public void setName(String name) { 37 | this.name = name; 38 | } 39 | 40 | public String getUrl() { 41 | return url; 42 | } 43 | 44 | public void setUrl(String url) { 45 | this.url = url; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/podio/space/SpaceStatistics.java: -------------------------------------------------------------------------------- 1 | package com.podio.space; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | import org.joda.time.DateTime; 5 | 6 | public class SpaceStatistics { 7 | 8 | /** 9 | * When the space was created 10 | */ 11 | private DateTime createdOn; 12 | 13 | /** 14 | * The number of active members 15 | */ 16 | private int members; 17 | 18 | /** 19 | * Number of comments 20 | */ 21 | private int comments; 22 | 23 | /** 24 | * Number of active item 25 | */ 26 | private int items; 27 | 28 | /** 29 | * Number of active statuses 30 | */ 31 | private int statuses; 32 | 33 | /** 34 | * Number of active apps 35 | */ 36 | private int apps; 37 | 38 | public DateTime getCreatedOn() { 39 | return createdOn; 40 | } 41 | 42 | @JsonProperty("created_on") 43 | public void setCreatedOn(DateTime createdOn) { 44 | this.createdOn = createdOn; 45 | } 46 | 47 | public int getMembers() { 48 | return members; 49 | } 50 | 51 | public void setMembers(int members) { 52 | this.members = members; 53 | } 54 | 55 | public int getComments() { 56 | return comments; 57 | } 58 | 59 | public void setComments(int comments) { 60 | this.comments = comments; 61 | } 62 | 63 | public int getItems() { 64 | return items; 65 | } 66 | 67 | public void setItems(int items) { 68 | this.items = items; 69 | } 70 | 71 | public int getStatuses() { 72 | return statuses; 73 | } 74 | 75 | public void setStatuses(int statuses) { 76 | this.statuses = statuses; 77 | } 78 | 79 | public int getApps() { 80 | return apps; 81 | } 82 | 83 | public void setApps(int apps) { 84 | this.apps = apps; 85 | } 86 | 87 | } 88 | -------------------------------------------------------------------------------- /src/main/java/com/podio/space/SpaceTopMemberGroup.java: -------------------------------------------------------------------------------- 1 | package com.podio.space; 2 | 3 | import java.util.List; 4 | 5 | import com.podio.contact.ProfileMini; 6 | 7 | public class SpaceTopMemberGroup { 8 | 9 | private List profiles; 10 | 11 | private int left; 12 | 13 | public List getProfiles() { 14 | return profiles; 15 | } 16 | 17 | public void setProfiles(List profiles) { 18 | this.profiles = profiles; 19 | } 20 | 21 | public int getLeft() { 22 | return left; 23 | } 24 | 25 | public void setLeft(int left) { 26 | this.left = left; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/podio/space/SpaceTopMembers.java: -------------------------------------------------------------------------------- 1 | package com.podio.space; 2 | 3 | public class SpaceTopMembers { 4 | 5 | private SpaceTopMemberGroup employee; 6 | 7 | private SpaceTopMemberGroup external; 8 | 9 | public SpaceTopMemberGroup getEmployee() { 10 | return employee; 11 | } 12 | 13 | public void setEmployee(SpaceTopMemberGroup employee) { 14 | this.employee = employee; 15 | } 16 | 17 | public SpaceTopMemberGroup getExternal() { 18 | return external; 19 | } 20 | 21 | public void setExternal(SpaceTopMemberGroup external) { 22 | this.external = external; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/podio/space/SpaceUpdate.java: -------------------------------------------------------------------------------- 1 | package com.podio.space; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | 5 | public class SpaceUpdate { 6 | 7 | /** 8 | * The new name of the space 9 | */ 10 | private String name; 11 | 12 | /** 13 | * true if new apps should be announced with a status update, 14 | * false otherwise 15 | */ 16 | private boolean postOnNewApp; 17 | 18 | /** 19 | * true if new members should be announced with a status 20 | * update, false otherwise 21 | */ 22 | private boolean postOnNewMember; 23 | 24 | public SpaceUpdate(String name, boolean postOnNewApp, 25 | boolean postOnNewMember) { 26 | super(); 27 | this.name = name; 28 | this.postOnNewApp = postOnNewApp; 29 | this.postOnNewMember = postOnNewMember; 30 | } 31 | 32 | public String getName() { 33 | return name; 34 | } 35 | 36 | public void setName(String name) { 37 | this.name = name; 38 | } 39 | 40 | @JsonProperty("post_on_new_app") 41 | public boolean isPostOnNewApp() { 42 | return postOnNewApp; 43 | } 44 | 45 | public void setPostOnNewApp(boolean postOnNewApp) { 46 | this.postOnNewApp = postOnNewApp; 47 | } 48 | 49 | @JsonProperty("post_on_new_member") 50 | public boolean isPostOnNewMember() { 51 | return postOnNewMember; 52 | } 53 | 54 | public void setPostOnNewMember(boolean postOnNewMember) { 55 | this.postOnNewMember = postOnNewMember; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/podio/space/SpaceWithOrganization.java: -------------------------------------------------------------------------------- 1 | package com.podio.space; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | 5 | import com.podio.org.OrganizationWithSpaces; 6 | 7 | public class SpaceWithOrganization extends Space { 8 | 9 | private OrganizationWithSpaces organization; 10 | 11 | @JsonProperty("org") 12 | public OrganizationWithSpaces getOrganization() { 13 | return organization; 14 | } 15 | 16 | @JsonProperty("org") 17 | public void setOrganization(OrganizationWithSpaces organization) { 18 | this.organization = organization; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/podio/status/Status.java: -------------------------------------------------------------------------------- 1 | package com.podio.status; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | 5 | import com.podio.common.CreatedBase; 6 | 7 | /** 8 | * A status message posted by a user to a space 9 | */ 10 | public class Status extends CreatedBase { 11 | 12 | private int statusId; 13 | 14 | private String value; 15 | 16 | /** 17 | * @return The id of the status 18 | */ 19 | public int getStatusId() { 20 | return statusId; 21 | } 22 | 23 | @JsonProperty("status_id") 24 | public void setStatusId(int statusId) { 25 | this.statusId = statusId; 26 | } 27 | 28 | /** 29 | * @return The actual status message 30 | */ 31 | public String getValue() { 32 | return value; 33 | } 34 | 35 | public void setValue(String value) { 36 | this.value = value; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/podio/status/StatusCreate.java: -------------------------------------------------------------------------------- 1 | package com.podio.status; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonProperty; 6 | 7 | public class StatusCreate { 8 | 9 | private String value; 10 | 11 | private List alerts; 12 | 13 | private List fileIds; 14 | 15 | public StatusCreate() { 16 | super(); 17 | } 18 | 19 | public StatusCreate(String value, List alerts, 20 | List fileIds) { 21 | super(); 22 | this.value = value; 23 | this.alerts = alerts; 24 | this.fileIds = fileIds; 25 | } 26 | 27 | public String getValue() { 28 | return value; 29 | } 30 | 31 | /** 32 | * Sets the text value of the status message 33 | * 34 | * @param value 35 | * The text of the status 36 | */ 37 | public void setValue(String value) { 38 | this.value = value; 39 | } 40 | 41 | public List getAlerts() { 42 | return alerts; 43 | } 44 | 45 | /** 46 | * Sets the list of users to alert in this status updated 47 | * 48 | * @param alerts 49 | * The ids of the users to alert 50 | */ 51 | public void setAlerts(List alerts) { 52 | this.alerts = alerts; 53 | } 54 | 55 | @JsonProperty("file_ids") 56 | public List getFileIds() { 57 | return fileIds; 58 | } 59 | 60 | /** 61 | * Sets the files to attach to this status message 62 | * 63 | * @param fileIds 64 | * The id of the files already uploaded that should be attached 65 | * to this status 66 | */ 67 | public void setFileIds(List fileIds) { 68 | this.fileIds = fileIds; 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/com/podio/status/StatusCreateResponse.java: -------------------------------------------------------------------------------- 1 | package com.podio.status; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | 5 | public class StatusCreateResponse { 6 | 7 | private int id; 8 | 9 | @JsonProperty("status_id") 10 | public int getId() { 11 | return id; 12 | } 13 | 14 | @JsonProperty("status_id") 15 | public void setId(int id) { 16 | this.id = id; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/podio/status/StatusUpdate.java: -------------------------------------------------------------------------------- 1 | package com.podio.status; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonProperty; 6 | 7 | public class StatusUpdate { 8 | 9 | private String value; 10 | 11 | private List fileIds; 12 | 13 | public StatusUpdate() { 14 | super(); 15 | } 16 | 17 | public StatusUpdate(String value, List fileIds) { 18 | super(); 19 | this.value = value; 20 | this.fileIds = fileIds; 21 | } 22 | 23 | public String getValue() { 24 | return value; 25 | } 26 | 27 | /** 28 | * Sets the text value of the status message 29 | * 30 | * @param value 31 | * The text of the status 32 | */ 33 | public void setValue(String value) { 34 | this.value = value; 35 | } 36 | 37 | @JsonProperty("file_ids") 38 | public List getFileIds() { 39 | return fileIds; 40 | } 41 | 42 | /** 43 | * Sets the files to attach to this status message 44 | * 45 | * @param fileIds 46 | * The id of the files already uploaded that should be attached 47 | * to this status 48 | */ 49 | public void setFileIds(List fileIds) { 50 | this.fileIds = fileIds; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/podio/stream/StreamActivity.java: -------------------------------------------------------------------------------- 1 | package com.podio.stream; 2 | 3 | import java.util.HashMap; 4 | 5 | import org.codehaus.jackson.annotate.JsonProperty; 6 | 7 | import com.podio.common.CreatedBase; 8 | import com.podio.common.ReferenceType; 9 | 10 | public class StreamActivity extends CreatedBase { 11 | 12 | /** 13 | * The type of object 14 | */ 15 | private ReferenceType type; 16 | 17 | /** 18 | * The id of the object 19 | */ 20 | private int id; 21 | 22 | /** 23 | * The type of activity 24 | */ 25 | private StreamActivityType activityType; 26 | 27 | /** 28 | * The object itself in short form 29 | */ 30 | private HashMap data; 31 | 32 | public ReferenceType getType() { 33 | return type; 34 | } 35 | 36 | public void setType(ReferenceType type) { 37 | this.type = type; 38 | } 39 | 40 | public int getId() { 41 | return id; 42 | } 43 | 44 | public void setId(int id) { 45 | this.id = id; 46 | } 47 | 48 | public StreamActivityType getActivityType() { 49 | return activityType; 50 | } 51 | 52 | @JsonProperty("activity_type") 53 | public void setActivityType(StreamActivityType activityType) { 54 | this.activityType = activityType; 55 | } 56 | 57 | public HashMap getData() { 58 | return data; 59 | } 60 | 61 | public void setData(HashMap data) { 62 | this.data = data; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/com/podio/stream/StreamActivityType.java: -------------------------------------------------------------------------------- 1 | package com.podio.stream; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonValue; 5 | 6 | public enum StreamActivityType { 7 | 8 | COMMENT, FILE, TASK, RATING, CREATION, UPDATE, ANSWER, MEETING, REFERENCE, GRANT, PARTICIPATION, VOTE; 9 | 10 | @Override 11 | @JsonValue 12 | public String toString() { 13 | return name().toLowerCase(); 14 | } 15 | 16 | @JsonCreator 17 | public static StreamActivityType getByName(String value) { 18 | return valueOf(value.toUpperCase()); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/podio/subscription/Subscription.java: -------------------------------------------------------------------------------- 1 | package com.podio.subscription; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | import org.joda.time.DateTime; 5 | 6 | import com.podio.common.Reference; 7 | 8 | public class Subscription { 9 | 10 | /** 11 | * When the subscription started 12 | */ 13 | private DateTime startedOn; 14 | 15 | /** 16 | * The number of notifications created on this subscription 17 | */ 18 | private int notifications; 19 | 20 | /** 21 | * The object this subscription is on 22 | */ 23 | private Reference reference; 24 | 25 | public DateTime getStartedOn() { 26 | return startedOn; 27 | } 28 | 29 | @JsonProperty("started_on") 30 | public void setStartedOn(DateTime startedOn) { 31 | this.startedOn = startedOn; 32 | } 33 | 34 | public int getNotifications() { 35 | return notifications; 36 | } 37 | 38 | public void setNotifications(int notifications) { 39 | this.notifications = notifications; 40 | } 41 | 42 | @JsonProperty("ref") 43 | public Reference getReference() { 44 | return reference; 45 | } 46 | 47 | @JsonProperty("ref") 48 | public void setReference(Reference reference) { 49 | this.reference = reference; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/podio/tag/TagCount.java: -------------------------------------------------------------------------------- 1 | package com.podio.tag; 2 | 3 | public class TagCount { 4 | 5 | private String text; 6 | 7 | private int count; 8 | 9 | public String getText() { 10 | return text; 11 | } 12 | 13 | public void setText(String text) { 14 | this.text = text; 15 | } 16 | 17 | public int getCount() { 18 | return count; 19 | } 20 | 21 | public void setCount(int count) { 22 | this.count = count; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/podio/tag/TagReference.java: -------------------------------------------------------------------------------- 1 | package com.podio.tag; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | import org.joda.time.DateTime; 5 | 6 | import com.podio.common.ReferenceType; 7 | 8 | public class TagReference { 9 | 10 | /** 11 | * The type of object 12 | */ 13 | private ReferenceType type; 14 | 15 | /** 16 | * The id of the object 17 | */ 18 | private int id; 19 | 20 | /** 21 | * The title of the object 22 | */ 23 | private String title; 24 | 25 | /** 26 | * When the object was created 27 | */ 28 | private DateTime createdOn; 29 | 30 | /** 31 | * The link to the object 32 | */ 33 | private String link; 34 | 35 | public ReferenceType getType() { 36 | return type; 37 | } 38 | 39 | @JsonProperty("type") 40 | public void setType(ReferenceType type) { 41 | this.type = type; 42 | } 43 | 44 | public int getId() { 45 | return id; 46 | } 47 | 48 | @JsonProperty("id") 49 | public void setId(int id) { 50 | this.id = id; 51 | } 52 | 53 | public String getTitle() { 54 | return title; 55 | } 56 | 57 | public void setTitle(String title) { 58 | this.title = title; 59 | } 60 | 61 | public DateTime getCreatedOn() { 62 | return createdOn; 63 | } 64 | 65 | @JsonProperty("created_on") 66 | public void setCreatedOn(DateTime createdOn) { 67 | this.createdOn = createdOn; 68 | } 69 | 70 | public String getLink() { 71 | return link; 72 | } 73 | 74 | public void setLink(String link) { 75 | this.link = link; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/com/podio/task/AssignValue.java: -------------------------------------------------------------------------------- 1 | package com.podio.task; 2 | 3 | public class AssignValue { 4 | 5 | private final int responsible; 6 | 7 | public AssignValue(int responsible) { 8 | super(); 9 | this.responsible = responsible; 10 | } 11 | 12 | public int getResponsible() { 13 | return responsible; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/podio/task/TaskActionType.java: -------------------------------------------------------------------------------- 1 | package com.podio.task; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonValue; 5 | 6 | public enum TaskActionType { 7 | 8 | START, 9 | STOP, 10 | ASSIGN, 11 | COMPLETE, 12 | INCOMPLETE, 13 | UPDATE_TEXT, 14 | UPDATE_DUE_DATE, 15 | UPDATE_PRIVATE; 16 | 17 | @Override 18 | @JsonValue 19 | public String toString() { 20 | return name().toLowerCase(); 21 | } 22 | 23 | @JsonCreator 24 | public static TaskActionType getByName(String value) { 25 | return valueOf(value.toUpperCase()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/podio/task/TaskCreateResponse.java: -------------------------------------------------------------------------------- 1 | package com.podio.task; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | 5 | public class TaskCreateResponse { 6 | 7 | private int id; 8 | 9 | @JsonProperty("task_id") 10 | public int getId() { 11 | return id; 12 | } 13 | 14 | @JsonProperty("task_id") 15 | public void setId(int id) { 16 | this.id = id; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/podio/task/TaskDueDate.java: -------------------------------------------------------------------------------- 1 | package com.podio.task; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | import org.joda.time.LocalDate; 5 | 6 | public class TaskDueDate { 7 | 8 | private final LocalDate dueDate; 9 | 10 | public TaskDueDate(LocalDate dueDate) { 11 | super(); 12 | this.dueDate = dueDate; 13 | } 14 | 15 | @JsonProperty("due_date") 16 | public LocalDate getDueDate() { 17 | return dueDate; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/podio/task/TaskDueStatus.java: -------------------------------------------------------------------------------- 1 | package com.podio.task; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonValue; 5 | 6 | public enum TaskDueStatus { 7 | 8 | OVERDUE, 9 | TODAY, 10 | TOMORROW, 11 | UPCOMING; 12 | 13 | @Override 14 | @JsonValue 15 | public String toString() { 16 | return name().toLowerCase(); 17 | } 18 | 19 | @JsonCreator 20 | public static TaskDueStatus getByName(String value) { 21 | return valueOf(value.toUpperCase()); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/podio/task/TaskPrivate.java: -------------------------------------------------------------------------------- 1 | package com.podio.task; 2 | 3 | 4 | public class TaskPrivate { 5 | 6 | private final boolean priv; 7 | 8 | public TaskPrivate(boolean priv) { 9 | super(); 10 | this.priv = priv; 11 | } 12 | 13 | public boolean isPrivate() { 14 | return priv; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/podio/task/TaskStatus.java: -------------------------------------------------------------------------------- 1 | package com.podio.task; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonValue; 5 | 6 | public enum TaskStatus { 7 | 8 | ACTIVE, COMPLETED, DELETED; 9 | 10 | @Override 11 | @JsonValue 12 | public String toString() { 13 | return name().toLowerCase(); 14 | } 15 | 16 | @JsonCreator 17 | public static TaskStatus getByName(String value) { 18 | return valueOf(value.toUpperCase()); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/podio/task/TaskText.java: -------------------------------------------------------------------------------- 1 | package com.podio.task; 2 | 3 | 4 | public class TaskText { 5 | 6 | private final String text; 7 | 8 | public TaskText(String text) { 9 | super(); 10 | this.text = text; 11 | } 12 | 13 | public String getText() { 14 | return text; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/podio/task/TaskTotal.java: -------------------------------------------------------------------------------- 1 | package com.podio.task; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | 5 | public class TaskTotal { 6 | 7 | /** 8 | * The total number of overdue tasks 9 | */ 10 | private int overDue; 11 | 12 | /** 13 | * The total number tasks due today 14 | */ 15 | private int dueToday; 16 | 17 | /** 18 | * The total number of tasks on which work has started 19 | */ 20 | private int started; 21 | 22 | /** 23 | * The total number of active tasks 24 | */ 25 | private int total; 26 | 27 | @JsonProperty("over_due") 28 | public int getOverDue() { 29 | return overDue; 30 | } 31 | 32 | @JsonProperty("over_due") 33 | public void setOverDue(int overDue) { 34 | this.overDue = overDue; 35 | } 36 | 37 | @JsonProperty("due_today") 38 | public int getDueToday() { 39 | return dueToday; 40 | } 41 | 42 | @JsonProperty("due_today") 43 | public void setDueToday(int dueToday) { 44 | this.dueToday = dueToday; 45 | } 46 | 47 | public int getStarted() { 48 | return started; 49 | } 50 | 51 | public void setStarted(int started) { 52 | this.started = started; 53 | } 54 | 55 | public int getTotal() { 56 | return total; 57 | } 58 | 59 | public void setTotal(int total) { 60 | this.total = total; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/com/podio/task/TaskTotals.java: -------------------------------------------------------------------------------- 1 | package com.podio.task; 2 | 3 | public class TaskTotals { 4 | 5 | /** 6 | * The task totals where the active user is responsible 7 | */ 8 | private TaskTotal responsible; 9 | 10 | /** 11 | * The tasks that the active user have created and delegated to others 12 | */ 13 | private TaskTotal delegated; 14 | 15 | public TaskTotal getResponsible() { 16 | return responsible; 17 | } 18 | 19 | public void setResponsible(TaskTotal responsible) { 20 | this.responsible = responsible; 21 | } 22 | 23 | public TaskTotal getDelegated() { 24 | return delegated; 25 | } 26 | 27 | public void setDelegated(TaskTotal delegated) { 28 | this.delegated = delegated; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/podio/task/TasksByDue.java: -------------------------------------------------------------------------------- 1 | package com.podio.task; 2 | 3 | import java.util.HashMap; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import org.codehaus.jackson.annotate.JsonAnySetter; 8 | 9 | public class TasksByDue { 10 | 11 | private Map> map = new HashMap>(); 12 | 13 | @Override 14 | public String toString() { 15 | return "TasksByDue [map=" + map + "]"; 16 | } 17 | 18 | public List getByDueStatus(TaskDueStatus status) { 19 | return map.get(status); 20 | } 21 | 22 | @JsonAnySetter 23 | public void setByDueStatus(String status, List tasks) { 24 | map.put(TaskDueStatus.getByName(status), tasks); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/podio/task/TasksWithResponsible.java: -------------------------------------------------------------------------------- 1 | package com.podio.task; 2 | 3 | import java.util.List; 4 | 5 | import com.podio.contact.ProfileMini; 6 | 7 | public class TasksWithResponsible { 8 | 9 | private ProfileMini responsible; 10 | 11 | private List tasks; 12 | 13 | public ProfileMini getResponsible() { 14 | return responsible; 15 | } 16 | 17 | public void setResponsible(ProfileMini responsible) { 18 | this.responsible = responsible; 19 | } 20 | 21 | public List getTasks() { 22 | return tasks; 23 | } 24 | 25 | public void setTasks(List tasks) { 26 | this.tasks = tasks; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/podio/user/ProfileFieldMultiValue.java: -------------------------------------------------------------------------------- 1 | package com.podio.user; 2 | 3 | import java.util.Collections; 4 | import java.util.List; 5 | 6 | public class ProfileFieldMultiValue { 7 | 8 | private final List value; 9 | 10 | public ProfileFieldMultiValue(F value) { 11 | this(Collections.singletonList(value)); 12 | } 13 | 14 | public ProfileFieldMultiValue(List value) { 15 | super(); 16 | this.value = value; 17 | } 18 | 19 | public List getValue() { 20 | return value; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/podio/user/ProfileFieldSingleValue.java: -------------------------------------------------------------------------------- 1 | package com.podio.user; 2 | 3 | public class ProfileFieldSingleValue { 4 | 5 | private final F value; 6 | 7 | public ProfileFieldSingleValue(F value) { 8 | super(); 9 | this.value = value; 10 | } 11 | 12 | public F getValue() { 13 | return value; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/podio/user/PropertyValue.java: -------------------------------------------------------------------------------- 1 | package com.podio.user; 2 | 3 | public class PropertyValue { 4 | 5 | private boolean value; 6 | 7 | public PropertyValue() { 8 | super(); 9 | } 10 | 11 | public PropertyValue(boolean value) { 12 | super(); 13 | this.value = value; 14 | } 15 | 16 | public boolean getValue() { 17 | return value; 18 | } 19 | 20 | public void setValue(boolean value) { 21 | this.value = value; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/podio/user/UserMini.java: -------------------------------------------------------------------------------- 1 | package com.podio.user; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | 5 | public class UserMini { 6 | 7 | private int id; 8 | 9 | private String mail; 10 | 11 | @JsonProperty("user_id") 12 | public int getId() { 13 | return id; 14 | } 15 | 16 | @JsonProperty("user_id") 17 | public void setId(int id) { 18 | this.id = id; 19 | } 20 | 21 | public String getMail() { 22 | return mail; 23 | } 24 | 25 | public void setMail(String mail) { 26 | this.mail = mail; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/podio/user/UserStatusType.java: -------------------------------------------------------------------------------- 1 | package com.podio.user; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonValue; 5 | 6 | public enum UserStatusType { 7 | 8 | INACTIVE, 9 | ACTIVE, 10 | BLACKLISTED; 11 | 12 | @Override 13 | @JsonValue 14 | public String toString() { 15 | return name().toLowerCase(); 16 | } 17 | 18 | @JsonCreator 19 | public static UserStatusType getByName(String value) { 20 | return valueOf(value.toUpperCase()); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/podio/user/UserType.java: -------------------------------------------------------------------------------- 1 | package com.podio.user; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonValue; 5 | 6 | public enum UserType { 7 | 8 | LIGHT, 9 | REGULAR, 10 | ADMIN; 11 | 12 | @Override 13 | @JsonValue 14 | public String toString() { 15 | return name().toLowerCase(); 16 | } 17 | 18 | @JsonCreator 19 | public static UserType getByName(String value) { 20 | return valueOf(value.toUpperCase()); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/test/java/com/podio/APIFactoryProvider.java: -------------------------------------------------------------------------------- 1 | package com.podio; 2 | 3 | public final class APIFactoryProvider { 4 | 5 | private APIFactoryProvider() { 6 | } 7 | 8 | public static APIFactory getDefault() { 9 | return new APIFactory(ResourceFactoryProvider.getDefault()); 10 | } 11 | 12 | public static APIFactory get(int userId) { 13 | return new APIFactory(ResourceFactoryProvider.getUser(userId)); 14 | } 15 | 16 | public static APIFactory getApp(int appId) { 17 | return new APIFactory(ResourceFactoryProvider.getApp(appId)); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/test/java/com/podio/device/DeviceAPITest.java: -------------------------------------------------------------------------------- 1 | package com.podio.device; 2 | 3 | import java.util.List; 4 | 5 | import org.junit.Assert; 6 | import org.junit.Test; 7 | 8 | import com.podio.APIFactoryProvider; 9 | 10 | public class DeviceAPITest { 11 | 12 | private DeviceAPI getAPI() { 13 | return APIFactoryProvider.getDefault().getAPI(DeviceAPI.class); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/test/java/com/podio/embed/EmbedAPITest.java: -------------------------------------------------------------------------------- 1 | package com.podio.embed; 2 | 3 | import org.junit.Assert; 4 | import org.junit.Test; 5 | 6 | import com.podio.APIFactoryProvider; 7 | 8 | public class EmbedAPITest { 9 | 10 | private EmbedAPI getAPI() { 11 | return APIFactoryProvider.getDefault().getAPI(EmbedAPI.class); 12 | } 13 | 14 | @Test 15 | public void createEmbed() { 16 | Embed embed = getAPI().createEmbed("https://podio.com"); 17 | 18 | Assert.assertEquals(embed.getUrl(), "https://podio.com"); 19 | Assert.assertEquals(embed.getType(), EmbedType.LINK); 20 | Assert.assertEquals(embed.getTitle(), "Podio - There's a Better Way to Work"); 21 | Assert.assertNotNull(embed.getDescription()); 22 | Assert.assertTrue(embed.getFiles().size() > 0); 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/test/java/com/podio/hook/HookAPITest.java: -------------------------------------------------------------------------------- 1 | package com.podio.hook; 2 | 3 | import java.util.List; 4 | 5 | import junit.framework.Assert; 6 | 7 | import org.junit.Test; 8 | 9 | import com.podio.APIFactoryProvider; 10 | import com.podio.common.Reference; 11 | import com.podio.common.ReferenceType; 12 | 13 | public class HookAPITest { 14 | 15 | private HookAPI getAPI() { 16 | return APIFactoryProvider.getDefault().getAPI(HookAPI.class); 17 | } 18 | 19 | @Test 20 | public void create() { 21 | int id = getAPI().create(new Reference(ReferenceType.APP, 1), 22 | new HookCreate("http://foobar.com/test", HookType.ITEM_CREATE)); 23 | Assert.assertTrue(id > 1); 24 | } 25 | 26 | @Test 27 | public void delete() { 28 | getAPI().delete(1); 29 | } 30 | 31 | @Test 32 | public void requestVerification() { 33 | getAPI().requestVerification(2); 34 | } 35 | 36 | @Test 37 | public void validateVerification() { 38 | getAPI().validateVerification(2, "b9079247"); 39 | } 40 | 41 | @Test 42 | public void get() { 43 | List hooks = getAPI().get(new Reference(ReferenceType.APP, 1)); 44 | 45 | Assert.assertEquals(hooks.size(), 9); 46 | Assert.assertEquals(hooks.get(0).getId(), 1); 47 | Assert.assertEquals(hooks.get(0).getUrl(), "http://foobar.com/nowhere"); 48 | Assert.assertEquals(hooks.get(0).getStatus(), HookStatus.ACTIVE); 49 | Assert.assertEquals(hooks.get(0).getType(), HookType.ITEM_CREATE); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/test/java/com/podio/item/map/BugMap2.java: -------------------------------------------------------------------------------- 1 | package com.podio.item.map; 2 | 3 | import java.math.BigDecimal; 4 | import java.util.List; 5 | 6 | public class BugMap2 { 7 | 8 | private long externalId; 9 | 10 | private List statuses; 11 | 12 | private BigDecimal alottaCash; 13 | 14 | private double importance; 15 | 16 | private Short howFarAreWe; 17 | 18 | public BugMap2() { 19 | super(); 20 | } 21 | 22 | public BugMap2(long externalId, List statuses, 23 | BigDecimal alottaCash, double importance, Short howFarAreWe) { 24 | super(); 25 | this.externalId = externalId; 26 | this.statuses = statuses; 27 | this.alottaCash = alottaCash; 28 | this.importance = importance; 29 | this.howFarAreWe = howFarAreWe; 30 | } 31 | 32 | @ExternalId 33 | public long getExternalId() { 34 | return externalId; 35 | } 36 | 37 | public void setExternalId(long externalId) { 38 | this.externalId = externalId; 39 | } 40 | 41 | @Field("is-hired") 42 | public List getStatuses() { 43 | return statuses; 44 | } 45 | 46 | public void setStatuses(List statuses) { 47 | this.statuses = statuses; 48 | } 49 | 50 | public BigDecimal getAlottaCash() { 51 | return alottaCash; 52 | } 53 | 54 | public void setAlottaCash(BigDecimal amount) { 55 | this.alottaCash = amount; 56 | } 57 | 58 | public double getImportance() { 59 | return importance; 60 | } 61 | 62 | public void setImportance(double importance) { 63 | this.importance = importance; 64 | } 65 | 66 | public Short getHowFarAreWe() { 67 | return howFarAreWe; 68 | } 69 | 70 | public void setHowFarAreWe(Short howFarAreWe) { 71 | this.howFarAreWe = howFarAreWe; 72 | } 73 | } -------------------------------------------------------------------------------- /src/test/java/com/podio/item/map/BugMap3.java: -------------------------------------------------------------------------------- 1 | package com.podio.item.map; 2 | 3 | import java.util.Collection; 4 | 5 | public class BugMap3 { 6 | 7 | private String externalId; 8 | 9 | private Collection statuses; 10 | 11 | private double amount; 12 | 13 | private float importance; 14 | 15 | public BugMap3() { 16 | super(); 17 | } 18 | 19 | public BugMap3(String externalId, Collection statuses, 20 | double amount, float importance) { 21 | super(); 22 | this.externalId = externalId; 23 | this.statuses = statuses; 24 | this.amount = amount; 25 | this.importance = importance; 26 | } 27 | 28 | @ExternalId 29 | public String getExternalId() { 30 | return externalId; 31 | } 32 | 33 | public void setExternalId(String externalId) { 34 | this.externalId = externalId; 35 | } 36 | 37 | @Field("is-hired") 38 | public Collection getStatuses() { 39 | return statuses; 40 | } 41 | 42 | public void setStatuses(Collection statuses) { 43 | this.statuses = statuses; 44 | } 45 | 46 | @MoneyField(currency = "EUR") 47 | @Field("alotta-cash") 48 | public double getAmount() { 49 | return amount; 50 | } 51 | 52 | public void setAmount(double amount) { 53 | this.amount = amount; 54 | } 55 | 56 | public float getImportance() { 57 | return importance; 58 | } 59 | 60 | public void setImportance(float importance) { 61 | this.importance = importance; 62 | } 63 | } -------------------------------------------------------------------------------- /src/test/java/com/podio/item/map/HireStatus.java: -------------------------------------------------------------------------------- 1 | package com.podio.item.map; 2 | 3 | public enum HireStatus { 4 | 5 | YES, 6 | NO; 7 | } 8 | -------------------------------------------------------------------------------- /src/test/java/com/podio/item/map/MappedItemAPITest.java: -------------------------------------------------------------------------------- 1 | package com.podio.item.map; 2 | 3 | import java.math.BigDecimal; 4 | import java.util.Collections; 5 | 6 | import org.joda.money.CurrencyUnit; 7 | import org.joda.money.Money; 8 | import org.junit.Assert; 9 | import org.junit.Test; 10 | 11 | import com.podio.APIFactoryProvider; 12 | 13 | public class MappedItemAPITest { 14 | 15 | private MappedItemAPI getMappedAPI(Class cls) { 16 | return new MappedItemAPI(APIFactoryProvider.getDefault(), 1, cls); 17 | } 18 | 19 | @Test 20 | public void getItem() { 21 | BugMap1 bug = getMappedAPI(BugMap1.class).get(12); 22 | 23 | Assert.assertEquals(bug.getExternalId(), 12); 24 | Assert.assertTrue(bug.getStatuses().contains(HireStatus.YES)); 25 | Assert.assertEquals(bug.getAlottaCash().getAmount(), new BigDecimal( 26 | "256.50")); 27 | Assert.assertEquals(bug.getAlottaCash().getCurrencyUnit() 28 | .getCurrencyCode(), "DKK"); 29 | Assert.assertEquals(bug.getWriteAJoke(), "

æøå

"); 30 | Assert.assertEquals(bug.getImportance(), new BigDecimal("2.2000")); 31 | Assert.assertEquals(bug.getHowFarAreWe(), 15); 32 | } 33 | 34 | @Test 35 | public void createItem() { 36 | BugMap1 bug = new BugMap1(1, Collections.singleton(HireStatus.YES), 37 | Money.of(CurrencyUnit.EUR, new BigDecimal("123.45")), 38 | "A mexican in a bar", new BigDecimal("1.2"), 30, "Ignored"); 39 | int itemId = getMappedAPI(BugMap1.class).insert(bug, true); 40 | Assert.assertTrue(itemId > 0); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/test/java/com/podio/item/map/NameUtilTest.java: -------------------------------------------------------------------------------- 1 | package com.podio.item.map; 2 | 3 | import org.junit.Assert; 4 | import org.junit.Test; 5 | 6 | public class NameUtilTest { 7 | 8 | @Test 9 | public void toJava() { 10 | Assert.assertEquals(NameUtil.toJava("is-hired"), "isHired"); 11 | Assert.assertEquals(NameUtil.toJava("hired"), "hired"); 12 | Assert.assertEquals(NameUtil.toJava("is-hired-ok"), "isHiredOk"); 13 | } 14 | 15 | @Test 16 | public void toAPI() { 17 | Assert.assertEquals(NameUtil.toAPI("isHired"), "is-hired"); 18 | Assert.assertEquals(NameUtil.toAPI("hired"), "hired"); 19 | Assert.assertEquals(NameUtil.toAPI("isHiredOk"), "is-hired-ok"); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/com/podio/item/map/converter/MoneyConverterTest.java: -------------------------------------------------------------------------------- 1 | package com.podio.item.map.converter; 2 | 3 | import java.math.BigDecimal; 4 | import java.util.Map; 5 | 6 | import org.joda.money.CurrencyUnit; 7 | import org.joda.money.Money; 8 | import org.junit.Assert; 9 | import org.junit.Test; 10 | 11 | public class MoneyConverterTest { 12 | 13 | @Test 14 | public void fromModel() { 15 | MoneyConverter converter = new MoneyConverter(CurrencyUnit.of("DKK")); 16 | 17 | Map result = converter.fromModel(Money.of( 18 | CurrencyUnit.of("EUR"), new BigDecimal("123.45"))); 19 | Assert.assertEquals(result.get("value"), "123.45"); 20 | Assert.assertEquals(result.get("currency"), "EUR"); 21 | 22 | result = converter.fromModel(new BigDecimal("123.45")); 23 | Assert.assertEquals(result.get("value"), "123.45"); 24 | Assert.assertEquals(result.get("currency"), "DKK"); 25 | 26 | result = converter.fromModel(123l); 27 | Assert.assertEquals(result.get("value"), "123"); 28 | Assert.assertEquals(result.get("currency"), "DKK"); 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/test/java/com/podio/notification/NotificationAPITest.java: -------------------------------------------------------------------------------- 1 | package com.podio.notification; 2 | 3 | import org.junit.Assert; 4 | import org.junit.Test; 5 | 6 | import com.podio.APIFactoryProvider; 7 | 8 | public class NotificationAPITest { 9 | 10 | private NotificationAPI getAPI() { 11 | return APIFactoryProvider.getDefault().getAPI(NotificationAPI.class); 12 | } 13 | 14 | @Test 15 | public void getInboxNewCount() { 16 | int count = getAPI().getInboxNewCount(); 17 | 18 | Assert.assertEquals(count, 59); 19 | } 20 | 21 | @Test 22 | public void markAsViewed() { 23 | getAPI().markAsViewed(3); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/test/java/com/podio/rating/RatingAPITest.java: -------------------------------------------------------------------------------- 1 | package com.podio.rating; 2 | 3 | import org.junit.Assert; 4 | import org.junit.Test; 5 | 6 | import com.podio.APIFactoryProvider; 7 | import com.podio.common.Reference; 8 | import com.podio.common.ReferenceType; 9 | 10 | public class RatingAPITest { 11 | 12 | private RatingAPI getAPI() { 13 | return APIFactoryProvider.getDefault().getAPI(RatingAPI.class); 14 | } 15 | 16 | @Test 17 | public void createRating() { 18 | int ratingId = getAPI().createRating( 19 | new Reference(ReferenceType.STATUS, 1), RatingType.LIKE, 20 | RatingValue.LIKE); 21 | 22 | Assert.assertTrue(ratingId > 1); 23 | } 24 | 25 | @Test 26 | public void getAllRatings() { 27 | RatingValuesMap ratings = getAPI().getAllRatings( 28 | new Reference(ReferenceType.STATUS, 1)); 29 | 30 | Assert.assertEquals(ratings.get(RatingType.LIKE).getCounts(1) 31 | .getTotal(), 1); 32 | Assert.assertEquals(ratings.get(RatingType.LIKE).getCounts(1) 33 | .getUsers().get(0).getUserId().intValue(), 4); 34 | } 35 | 36 | @Test 37 | public void getRatings() { 38 | TypeRating ratings = getAPI().getRatings( 39 | new Reference(ReferenceType.STATUS, 1), RatingType.LIKE); 40 | 41 | Assert.assertEquals(ratings.getCounts(1).getTotal(), 1); 42 | } 43 | 44 | @Test 45 | public void getRating() { 46 | int value = getAPI().getRating(new Reference(ReferenceType.STATUS, 1), 47 | RatingType.LIKE, 4); 48 | 49 | Assert.assertEquals(value, 1); 50 | } 51 | 52 | @Test 53 | public void deleteRating() { 54 | getAPI().deleteRating(new Reference(ReferenceType.ITEM, 1), 55 | RatingType.APPROVED); 56 | } 57 | } 58 | --------------------------------------------------------------------------------