Skip to content

Commit

Permalink
Updated : Docs which make more sense
Browse files Browse the repository at this point in the history
  • Loading branch information
shivam1608 committed Jun 19, 2024
1 parent b619bfe commit 202c928
Show file tree
Hide file tree
Showing 9 changed files with 300 additions and 59 deletions.
265 changes: 212 additions & 53 deletions src/main/java/me/shivzee/JMailTM.java

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions src/main/java/me/shivzee/adapters/TokenAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@

import java.io.IOException;

/**
* The TokenAdapter tries to push bearerToken field during deserialization of the json
*
* @see com.google.gson.TypeAdapterFactory
*/
public class TokenAdapter implements TypeAdapterFactory {

private String bearerToken;
Expand Down
56 changes: 55 additions & 1 deletion src/main/java/me/shivzee/callbacks/EventListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,70 @@
import me.shivzee.util.Message;

/**
* EventListener Interface to listen to Events : delete,received, etc
* Interface for handling various events such as message deletion, reception, account updates, and errors.
*/
public interface EventListener {
/**
* Invoked when the listener is ready to start receiving events.
*/
default void onReady(){}


/**
* Invoked when the listener is closed or stopped.
*/
default void onClose(){}

/**
* Invoked when a comment is received as part of SSE (Server-Sent Events).
*
* @param comment the SSE comment received
*/
default void onSSEComment(String comment){}

/**
* Invoked when a new message is received.
*
* @param message the received message
* @see me.shivzee.util.Message
*/
default void onMessageReceived(Message message){}

/**
* Invoked when a message is deleted.
*
* @param id the ID of the deleted message
*/
default void onMessageDelete(String id){}

/**
* Invoked when a message is seen by the recipient.
*
* @param message the seen message
* @see me.shivzee.util.Message
*/
default void onMessageSeen(Message message){}

/**
* Invoked when an account is deleted.
*
* @param account the deleted account
* @see me.shivzee.util.Account
*/
default void onAccountDelete(Account account){}

/**
* Invoked when an account is updated.
*
* @param account the updated account
* @see me.shivzee.util.Account
*/
default void onAccountUpdate(Account account){}

/**
* Invoked when an error occurs.
*
* @param error the error message
*/
void onError(String error);
}
16 changes: 15 additions & 1 deletion src/main/java/me/shivzee/callbacks/MessageFetchedCallback.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,23 @@
import java.util.List;

/**
* Then Interface for Callback When Message is Fetched From the source
* Interface for handling callbacks when messages are fetched from a source.
*/
public interface MessageFetchedCallback {

/**
* Called when messages are successfully fetched.
*
* @param messages the list of fetched messages
* @see me.shivzee.util.Message
*/
void onMessagesFetched(List<Message> messages);

/**
* Called when an error occurs during message fetching.
*
* @param error the error response indicating the reason for the failure
* @see me.shivzee.util.Response
*/
void onError(Response error);
}
1 change: 1 addition & 0 deletions src/main/java/me/shivzee/callbacks/MessageListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/**
* The Message Listener Callback. Runs when some new message or email has arrived
*/
@Deprecated
public interface MessageListener {
default void onReady(){
// Do What you want
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/me/shivzee/callbacks/WorkCallback.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
package me.shivzee.callbacks;

/**
* The WorkStatus of a Method
* Functional interface for handling the status of a work operation.
*/
@FunctionalInterface
public interface WorkCallback {

/**
* Called to indicate the status of a work operation.
*
* @param status {@code true} if the work operation was successful, {@code false} otherwise
*/
void workStatus(boolean status);
}
2 changes: 1 addition & 1 deletion src/main/java/me/shivzee/util/Domain.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public String getId() {
}

/**
* Get DomainName (eg. tempexample.xyz)
* Get DomainName (eg. example.com)
* @return the domain name
*/
public String getDomainName() {
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/me/shivzee/util/Domains.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

/**
* The Domains Class Static functions for Domain Operations
* Check https://api.mail.tm for more info
* <br />
* Check <a href="https://api.mail.tm">API Docs</a> for more info
*/
public class Domains {

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/me/shivzee/util/Message.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ public String getId() {

/**
* Get the MSGID
* @link {https://api.mail.tm} Check for more info
* <br />
* Check <a href="https://api.mail.tm">API Docs</a> for more info
* @return String
*/
public String getMsgid() {
Expand Down

0 comments on commit 202c928

Please sign in to comment.