Skip to content
This repository was archived by the owner on Feb 1, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/main/java/com/podio/app/ApplicationViewType.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ public enum ApplicationViewType {
NODE,
CALENDAR,
GALLERY,
CARD;
CARD,
STREAM;

@Override
@JsonValue
Expand Down
33 changes: 21 additions & 12 deletions src/main/java/com/podio/contact/ContactAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ public void deleteSpaceContact(int profileId, boolean silent) {
/**
* Returns all the contact details about the user with the given id.
*
* @param userId
* The id of the user
* @param profileId
* The profile id of the user
* @return The contact profile
*/
public Profile getContact(int userId) {
return getResourceFactory().getApiResource("/contact/" + userId).get(
public Profile getContact(int profileId) {
return getResourceFactory().getApiResource("/contact/" + profileId + "/v2").get(
Profile.class);
}

Expand Down Expand Up @@ -140,15 +140,17 @@ public ContactTotal getContactTotal() {
* The format in which the contacts should be returned
* @param order
* How the contacts should be ordered
* @param contactType
* The type of contacts to be returned
* @return The list of contacts
*/
public <T, F, R> List<T> getContacts(ProfileField<F, R> key, F value,
Integer limit, Integer offset, ProfileType<T> type,
ContactOrder order) {
ContactOrder order, ContactType contactType) {
WebResource resource = getResourceFactory().getApiResource("/contact/");

return getContactsCommon(resource, key, value, limit, offset, type,
order);
order, contactType);
}

/**
Expand All @@ -169,16 +171,18 @@ public <T, F, R> List<T> getContacts(ProfileField<F, R> key, F value,
* The format in which the contacts should be returned
* @param order
* How the contacts should be ordered
* @param contactType
* The type of contacts to be returned
* @return The list of contacts
*/
public <T, F, R> List<T> getOrganizationContacts(int organizationId,
ProfileField<F, R> key, F value, Integer limit, Integer offset,
ProfileType<T> type, ContactOrder order) {
ProfileType<T> type, ContactOrder order, ContactType contactType) {
WebResource resource = getResourceFactory().getApiResource(
"/contact/org/" + organizationId);

return getContactsCommon(resource, key, value, limit, offset, type,
order);
order, contactType);
}

/**
Expand All @@ -198,21 +202,23 @@ public <T, F, R> List<T> getOrganizationContacts(int organizationId,
* The format in which the contacts should be returned
* @param order
* How the contacts should be ordered
* @param contactType
* The type of contacts to be returned
* @return The list of contacts
*/
public <T, F, R> List<T> getSpaceContacts(int spaceId,
ProfileField<F, R> key, F value, Integer limit, Integer offset,
ProfileType<T> type, ContactOrder order) {
ProfileType<T> type, ContactOrder order, ContactType contactType) {
WebResource resource = getResourceFactory().getApiResource(
"/contact/space/" + spaceId);

return getContactsCommon(resource, key, value, limit, offset, type,
order);
order, contactType);
}

private <T, F, R> List<T> getContactsCommon(WebResource resource,
ProfileField<F, R> key, F value, Integer limit, Integer offset,
final ProfileType<T> type, ContactOrder order) {
final ProfileType<T> type, ContactOrder order, ContactType contactType) {
if (key != null && value != null) {
resource = resource.queryParam("key", key.getName().toLowerCase())
.queryParam("value", key.format(value).toString());
Expand All @@ -227,7 +233,10 @@ private <T, F, R> List<T> getContactsCommon(WebResource resource,
if (order != null) {
resource = resource.queryParam("order", order.name().toLowerCase());
}

if (contactType != null) {
resource = resource.queryParam("contact_type", contactType.name().toLowerCase());
}

return resource.get(getGenericType(type));
}

Expand Down
14 changes: 14 additions & 0 deletions src/main/java/com/podio/contact/ContactType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.podio.contact;

public enum ContactType {

/**
* Contact of type user
*/
USER,

/**
* A space contact
*/
SPACE;
}
52 changes: 52 additions & 0 deletions src/main/java/com/podio/contact/ProfileUpdate.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,26 @@ public class ProfileUpdate {
*/
private String about;

/**
* The zip code of the address
*/
private String zip;

/**
* The name of the city
*/
private String city;

/**
* The name of the state, only applicable in some countries
*/
private String state;

/**
* The name of the country
*/
private String country;

/**
* The addresses where the person lives or work
*/
Expand Down Expand Up @@ -135,6 +155,38 @@ public void setAbout(String about) {
this.about = about;
}

public String getZip() {
return zip;
}

public void setZip(String zip) {
this.zip = zip;
}

public String getCity() {
return city;
}

public void setCity(String city) {
this.city = city;
}

public String getState() {
return state;
}

public void setState(String state) {
this.state = state;
}

public String getCountry() {
return country;
}

public void setCountry(String country) {
this.country = country;
}

@JsonProperty("address")
public List<String> getAddresses() {
return addresses;
Expand Down