Class BlossomEndpoint


  • public class BlossomEndpoint
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      BlossomEndpoint​(java.lang.String url)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.ngengine.platform.AsyncTask<BlossomResponse> delete​(java.lang.String sha256, SignedNostrEvent authEvent)
      Delete a blob by its SHA256 hash
      boolean equals​(java.lang.Object o)  
      org.ngengine.platform.AsyncTask<java.lang.Boolean> exists​(java.lang.String sha256OrPath, SignedNostrEvent authEvent)
      Check if a blob exists
      org.ngengine.platform.AsyncTask<BlossomBlobResponse> get​(java.lang.String sha256OrPath, int[] byteRange, SignedNostrEvent authEvent)
      Get blob by SHA256
      int hashCode()  
      org.ngengine.platform.AsyncTask<org.ngengine.platform.transport.NGEHttpResponse> httpRequest​(java.lang.String endpoint, java.lang.String method, java.util.Map<java.lang.String,​java.lang.String> headers, byte[] body, SignedNostrEvent authEvent)  
      org.ngengine.platform.AsyncTask<BlossomResponse> list​(NostrPublicKey pubkey, java.time.Instant since, java.time.Instant until, SignedNostrEvent authEvent)
      List blobs uploaded by a given public key
      java.lang.String toString()  
      org.ngengine.platform.AsyncTask<BlossomResponse> upload​(byte[] data, java.lang.String mimeType, SignedNostrEvent authEvent)
      Upload a blob
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • BlossomEndpoint

        public BlossomEndpoint​(java.lang.String url)
    • Method Detail

      • get

        public org.ngengine.platform.AsyncTask<BlossomBlobResponse> get​(java.lang.String sha256OrPath,
                                                                        int[] byteRange,
                                                                        @Nullable
                                                                        SignedNostrEvent authEvent)
        Get blob by SHA256
        Parameters:
        sha256OrPath - can be just sha256 or sha256.ext
        byteRange - optional, the range of bytes to fetch, can be null for full range
        authEvent - optional, can be null
        Returns:
      • exists

        public org.ngengine.platform.AsyncTask<java.lang.Boolean> exists​(java.lang.String sha256OrPath,
                                                                         @Nullable
                                                                         SignedNostrEvent authEvent)
        Check if a blob exists
        Parameters:
        sha256OrPath - can be just sha256 or sha256.ext
        authEvent - optional, can be null
        Returns:
        an AsyncTask that returns true if the blob exists, false if it does not
      • upload

        public org.ngengine.platform.AsyncTask<BlossomResponse> upload​(byte[] data,
                                                                       @Nullable
                                                                       java.lang.String mimeType,
                                                                       @Nullable
                                                                       SignedNostrEvent authEvent)
        Upload a blob
        Parameters:
        data - the byte array to upload
        mimeType - (optional), the MIME type of the blob, can be null for application/octet-stream
        authEvent - (optional), a SignedNostrEvent for authorization, can be null
        Returns:
        an AsyncTask that returns a BlossomResponse containing the BlobDescriptor and the HTTP response
      • list

        public org.ngengine.platform.AsyncTask<BlossomResponse> list​(NostrPublicKey pubkey,
                                                                     @Nullable
                                                                     java.time.Instant since,
                                                                     @Nullable
                                                                     java.time.Instant until,
                                                                     @Nullable
                                                                     SignedNostrEvent authEvent)
        List blobs uploaded by a given public key
        Parameters:
        pubkey - the public key of the user whose blobs you want to list
        since - (optional) the start time for the listing, can be null
        until - (optional) the end time for the listing, can be null
        authEvent - (optional) a SignedNostrEvent for authorization, can be null
        Returns:
        an AsyncTask that returns a BlossomResponse containing a list of BlobDescriptors and the HTTP response
      • delete

        public org.ngengine.platform.AsyncTask<BlossomResponse> delete​(java.lang.String sha256,
                                                                       @Nullable
                                                                       SignedNostrEvent authEvent)
        Delete a blob by its SHA256 hash
        Parameters:
        sha256 -
        authEvent -
        Returns:
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • httpRequest

        public org.ngengine.platform.AsyncTask<org.ngengine.platform.transport.NGEHttpResponse> httpRequest​(java.lang.String endpoint,
                                                                                                            java.lang.String method,
                                                                                                            @Nullable
                                                                                                            java.util.Map<java.lang.String,​java.lang.String> headers,
                                                                                                            @Nullable
                                                                                                            byte[] body,
                                                                                                            @Nullable
                                                                                                            SignedNostrEvent authEvent)