-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
90 changed files
with
5,101 additions
and
3,064 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
src/main/java/com/github/jamesnetherton/zulip/client/api/invitation/Invitation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package com.github.jamesnetherton.zulip.client.api.invitation; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.github.jamesnetherton.zulip.client.api.user.UserRole; | ||
import java.time.Instant; | ||
|
||
/** | ||
* Defines a Zulip invitation. | ||
*/ | ||
public class Invitation { | ||
@JsonProperty | ||
private long id; | ||
|
||
@JsonProperty | ||
private long invitedByUserId; | ||
|
||
@JsonProperty | ||
private Instant invited; | ||
|
||
@JsonProperty | ||
private Instant expiryDate; | ||
|
||
@JsonProperty | ||
private UserRole invitedAs; | ||
|
||
@JsonProperty | ||
private String email; | ||
|
||
@JsonProperty | ||
private boolean notifyReferrerOnJoin; | ||
|
||
@JsonProperty | ||
private String linkUrl; | ||
|
||
@JsonProperty | ||
private boolean isMultiuse; | ||
|
||
public long getId() { | ||
return id; | ||
} | ||
|
||
public long getInvitedByUserId() { | ||
return invitedByUserId; | ||
} | ||
|
||
public Instant getInvited() { | ||
return invited; | ||
} | ||
|
||
public Instant getExpiryDate() { | ||
return expiryDate; | ||
} | ||
|
||
public UserRole getInvitedAs() { | ||
return invitedAs; | ||
} | ||
|
||
public String getEmail() { | ||
return email; | ||
} | ||
|
||
public boolean isNotifyReferrerOnJoin() { | ||
return notifyReferrerOnJoin; | ||
} | ||
|
||
public String getLinkUrl() { | ||
return linkUrl; | ||
} | ||
|
||
public boolean isMultiuse() { | ||
return isMultiuse; | ||
} | ||
} |
99 changes: 99 additions & 0 deletions
99
src/main/java/com/github/jamesnetherton/zulip/client/api/invitation/InvitationService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
package com.github.jamesnetherton.zulip.client.api.invitation; | ||
|
||
import com.github.jamesnetherton.zulip.client.api.core.ZulipService; | ||
import com.github.jamesnetherton.zulip.client.api.invitation.request.CreateReusableInvitationLinkApiRequest; | ||
import com.github.jamesnetherton.zulip.client.api.invitation.request.GetAllInvitationsApiRequest; | ||
import com.github.jamesnetherton.zulip.client.api.invitation.request.ResendEmailInvitationApiRequest; | ||
import com.github.jamesnetherton.zulip.client.api.invitation.request.RevokeEmailInvitationApiRequest; | ||
import com.github.jamesnetherton.zulip.client.api.invitation.request.RevokeReusableInvitationApiRequest; | ||
import com.github.jamesnetherton.zulip.client.api.invitation.request.SendInvitationsApiRequest; | ||
import com.github.jamesnetherton.zulip.client.http.ZulipHttpClient; | ||
import java.util.List; | ||
|
||
/** | ||
* Zulip invitation APIs. | ||
*/ | ||
public class InvitationService implements ZulipService { | ||
|
||
private final ZulipHttpClient client; | ||
|
||
/** | ||
* Constructs a {@link InvitationService}. | ||
* | ||
* @param client The Zulip HTTP client | ||
*/ | ||
public InvitationService(ZulipHttpClient client) { | ||
this.client = client; | ||
} | ||
|
||
/** | ||
* Creates a new invitation link. | ||
* | ||
* @see <a href="https://zulip.com/api/create-invite-link">https://zulip.com/api/create-invite-link</a> | ||
* | ||
* @return The {@link CreateReusableInvitationLinkApiRequest} builder object | ||
*/ | ||
public CreateReusableInvitationLinkApiRequest createReusableInvitationLink() { | ||
return new CreateReusableInvitationLinkApiRequest(client); | ||
} | ||
|
||
/** | ||
* Fetches all unexpired invitations. | ||
* | ||
* @see <a href="https://zulip.com/api/get-invites">https://zulip.com/api/get-invites</a> | ||
* | ||
* @return The {@link GetAllInvitationsApiRequest} builder object | ||
*/ | ||
public GetAllInvitationsApiRequest getAllInvitations() { | ||
return new GetAllInvitationsApiRequest(client); | ||
} | ||
|
||
/** | ||
* Resends an email invitation. | ||
* | ||
* @see <a href="https://zulip.com/api/resend-email-invite">https://zulip.com/api/resend-email-invite</a> | ||
* | ||
* @param invitationId The id of the invitation to resend | ||
* @return The {@link ResendEmailInvitationApiRequest} builder object | ||
*/ | ||
public ResendEmailInvitationApiRequest resendEmailInvitation(long invitationId) { | ||
return new ResendEmailInvitationApiRequest(client, invitationId); | ||
} | ||
|
||
/** | ||
* Revokes an email invitation. | ||
* | ||
* @see <a href="https://zulip.com/api/revoke-email-invite">https://zulip.com/api/revoke-email-invite</a> | ||
* | ||
* @param invitationId The id of the invitation to revoke | ||
* @return The {@link RevokeEmailInvitationApiRequest} builder object | ||
*/ | ||
public RevokeEmailInvitationApiRequest revokeEmailInvitation(long invitationId) { | ||
return new RevokeEmailInvitationApiRequest(client, invitationId); | ||
} | ||
|
||
/** | ||
* Revokes a reusable invitation. | ||
* | ||
* @see <a href="https://zulip.com/api/revoke-invite-link">https://zulip.com/api/revoke-invite-link</a> | ||
* | ||
* @param invitationId The id of the invitation to revoke | ||
* @return The {@link RevokeReusableInvitationApiRequest} builder object | ||
*/ | ||
public RevokeReusableInvitationApiRequest revokeReusableInvitation(long invitationId) { | ||
return new RevokeReusableInvitationApiRequest(client, invitationId); | ||
} | ||
|
||
/** | ||
* Send invitations to specified email addresses. | ||
* | ||
* @see <a href="https://zulip.com/api/send-invites">https://zulip.com/api/send-invites</a> | ||
* | ||
* @param inviteeEmails The list of email addresses to invite | ||
* @param streamIds The list of channel ids that the newly created user will be automatically subscribed to | ||
* @return The {@link SendInvitationsApiRequest} builder object | ||
*/ | ||
public SendInvitationsApiRequest sendInvitations(List<String> inviteeEmails, List<Long> streamIds) { | ||
return new SendInvitationsApiRequest(client, inviteeEmails, streamIds); | ||
} | ||
} |
Oops, something went wrong.