Skip to content
This repository was archived by the owner on Feb 17, 2026. It is now read-only.

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Memex SDK for Go

Go SDK for interacting with the Memex API.

Installation

go get github.com/MemeXtar/memex-sdk

Getting Started

Initialize the SDK

Using a hardcoded token

package main

import (
    "fmt"
    "github.com/MemeXtar/memex-sdk"
)

func main() {
    // Create a new SDK instance with your auth token
    sdk := memex.NewSDK("your-auth-token-here")

    // Get current user info
    userInfo, err := sdk.User.GetMyInfo()
    if err != nil {
        panic(err)
    }
    fmt.Printf("Username: %s\n", userInfo.UserName)
}

Using an environment variable

package main

import (
    "fmt"
    "os"
    "github.com/MemeXtar/memex-sdk"
)

func main() {
    // Get auth token from environment variable
    authToken := os.Getenv("MEMEX_AUTH_TOKEN")
    if authToken == "" {
        panic("MEMEX_AUTH_TOKEN environment variable is not set")
    }

    // Create a new SDK instance
    sdk := memex.NewSDK(authToken)

    // Get current user info
    userInfo, err := sdk.User.GetMyInfo()
    if err != nil {
        panic(err)
    }
    fmt.Printf("Username: %s\n", userInfo.UserName)
}

Set the environment variable before running:

export MEMEX_AUTH_TOKEN="your-auth-token-here"
go run main.go

Available Services

The SDK provides the following services:

  • User: User management and profile operations
  • Post: Create and manage posts
  • Point: Points and rewards
  • Search: Search posts, hashtags, and users
  • Price: Token price information
  • Memekathon: Memekathon-specific operations

Examples

Get User Information

// Get your own info
myInfo, err := sdk.User.GetMyInfo()

// Get another user's info
userInfo, err := sdk.User.GetUserInfo("username", "usernametag")

Work with Posts

// Get latest posts
posts, err := sdk.Post.GetLatestPosts(&memex.GetLatestPostsOptions{
    Limit: intPtr(10),
})

// Get a specific post
post, err := sdk.Post.GetSpecificPost("contentId", nil)

// Like a post
result, err := sdk.Post.SetLike("contentId")

Search

// Search posts
results, err := sdk.Search.GetSearchPosts("query", 10, nil)

// Search hashtags
hashtags, err := sdk.Search.SearchHashTags("query")

Get Token Price

// Get latest price by token address
price, err := sdk.Price.GetLatestPriceByAddress("token-address")

Helper Functions

func intPtr(i int) *int {
    return &i
}

func stringPtr(s string) *string {
    return &s
}

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages