Skip to content

TextSharer

Sub classes

Name Children Inherits
GistSharer
anyenv.text_sharing.github_gist
Share text via GitHub Gists.
    OpenCodeSharer
    anyenv.text_sharing.opencode
    OpenCode text sharing service.
      PasteRsSharer
      anyenv.text_sharing.paste_rs
      Share text via paste.rs.
        PastebinSharer
        anyenv.text_sharing.pastebin
        Share text via Pastebin.com.
          ShittyCodingAgentSharer
          anyenv.text_sharing.shittycodingagent
          Share text via GitHub Gists with shittycodingagent.ai preview URL.

            Base classes

            Name Children Inherits
            ABC
            abc
            Helper class that provides a standard way to create an ABC using

            ⋔ Inheritance diagram

            graph TD
              2782231920["base.TextSharer"]
              925645236["abc.ABC"]
              2751680898["builtins.object"]
              925645236 --> 2782231920
              2751680898 --> 925645236

            🛈 DocStrings

            Bases: ABC

            Base class for text sharing services.

            Source code in src/anyenv/text_sharing/base.py
            class TextSharer(abc.ABC):
                """Base class for text sharing services."""
            
                @property
                @abc.abstractmethod
                def name(self) -> str:
                    """Name of the sharing service."""
            
                @abc.abstractmethod
                async def share(
                    self,
                    content: str,
                    *,
                    title: str | None = None,
                    syntax: str | None = None,
                    visibility: Visibility = "unlisted",
                    expires_in: int | None = None,
                ) -> ShareResult:
                    """Share text content.
            
                    Args:
                        content: The text content to share
                        title: Optional title/filename for the content
                        syntax: Syntax highlighting hint (e.g. "python", "markdown")
                        visibility: Visibility level (not all providers support all levels)
                        expires_in: Expiration time in seconds (not supported by all providers)
            
                    Returns:
                        ShareResult with URL and metadata
                    """
            
                def share_sync(
                    self,
                    content: str,
                    *,
                    title: str | None = None,
                    syntax: str | None = None,
                    visibility: Visibility = "unlisted",
                    expires_in: int | None = None,
                ) -> ShareResult:
                    """Synchronous version of share."""
                    from anyenv import run_sync
            
                    async def wrapper() -> ShareResult:
                        return await self.share(
                            content,
                            title=title,
                            syntax=syntax,
                            visibility=visibility,
                            expires_in=expires_in,
                        )
            
                    return run_sync(wrapper())
            

            name abstractmethod property

            name: str
            

            Name of the sharing service.

            share abstractmethod async

            share(
                content: str,
                *,
                title: str | None = None,
                syntax: str | None = None,
                visibility: Visibility = "unlisted",
                expires_in: int | None = None,
            ) -> ShareResult
            

            Share text content.

            Parameters:

            Name Type Description Default
            content str

            The text content to share

            required
            title str | None

            Optional title/filename for the content

            None
            syntax str | None

            Syntax highlighting hint (e.g. "python", "markdown")

            None
            visibility Visibility

            Visibility level (not all providers support all levels)

            'unlisted'
            expires_in int | None

            Expiration time in seconds (not supported by all providers)

            None

            Returns:

            Type Description
            ShareResult

            ShareResult with URL and metadata

            Source code in src/anyenv/text_sharing/base.py
            @abc.abstractmethod
            async def share(
                self,
                content: str,
                *,
                title: str | None = None,
                syntax: str | None = None,
                visibility: Visibility = "unlisted",
                expires_in: int | None = None,
            ) -> ShareResult:
                """Share text content.
            
                Args:
                    content: The text content to share
                    title: Optional title/filename for the content
                    syntax: Syntax highlighting hint (e.g. "python", "markdown")
                    visibility: Visibility level (not all providers support all levels)
                    expires_in: Expiration time in seconds (not supported by all providers)
            
                Returns:
                    ShareResult with URL and metadata
                """
            

            share_sync

            share_sync(
                content: str,
                *,
                title: str | None = None,
                syntax: str | None = None,
                visibility: Visibility = "unlisted",
                expires_in: int | None = None,
            ) -> ShareResult
            

            Synchronous version of share.

            Source code in src/anyenv/text_sharing/base.py
            def share_sync(
                self,
                content: str,
                *,
                title: str | None = None,
                syntax: str | None = None,
                visibility: Visibility = "unlisted",
                expires_in: int | None = None,
            ) -> ShareResult:
                """Synchronous version of share."""
                from anyenv import run_sync
            
                async def wrapper() -> ShareResult:
                    return await self.share(
                        content,
                        title=title,
                        syntax=syntax,
                        visibility=visibility,
                        expires_in=expires_in,
                    )
            
                return run_sync(wrapper())
            

            :fa-brands-github: Show source on GitHub