Shobdo Logo

SDKs & Libraries

We provide official client libraries in 10 different programming languages to make integrating with the Shobdo API as seamless as possible. All of our SDKs are strongly typed and include built-in features like retry logic and rate limit handling.

Supported Languages

LanguagePackageStatus
JavaScript / TypeScript@shobdo/js✅ Available
Pythonshobdo-python✅ Available
Gogithub.com/shobdopbc/ShobdoGo✅ Available
Javacom.shobdo:shobdo-java✅ Available
Kotlincom.shobdo:shobdo-kotlin✅ Available
SwiftShobdoSwift✅ Available
C# / .NETShobdo.Api✅ Available
Rubyshobdo_ruby✅ Available
PHPshobdopbc/shobdo-php✅ Available
Rustshobdo-rust✅ Available

Official SDKs

JavaScript / TypeScript

The official JavaScript and TypeScript client is available on npm. It works in Node.js 18+ and modern browsers out of the box.

npm install @shobdo/js
# or
yarn add @shobdo/js
# or
pnpm add @shobdo/js

Basic Usage

Import the ShobdoClient and initialize it with your API key from the Shobdo Console.

import { ShobdoClient } from '@shobdo/js';
 
const client = new ShobdoClient({ 
  apiKey: process.env.SHOBDO_API_KEY,
});
 
// Search across all dictionaries
const response = await client.search("hello", {
  lang: "en",             // Filter by language
  limit: 10,              // Pagination limit
  matchType: "prefix",    // Match type
});
 
console.log(`Found ${response.meta.total} results`);
response.data.forEach(result => {
  console.log(`${result.word} - ${result.preview}`);
});
 
// Retrieve a specific entry
const entry = await client.getEntryByWord("shobdo_en_us_bn_bd", "ধন্যবাদ");
console.log(entry.data.htmlContent);
 
// Fast autocomplete for search bars
const suggestions = await client.autocomplete("hel", { lang: "en" });
console.log(suggestions.data); // ["hello", "helmet", "help", ...]
 
// Get synonyms and antonyms
const thesaurus = await client.thesaurus("happy", { lang: "en" });
 
// Get a random word
const randomWord = await client.random();
 
// Query the GraphQL endpoint
const gqlResponse = await client.graphql(`
  query {
    search(query: "fast", limit: 5) {
      word
      preview
    }
  }
`);
 
// Check API quota
const usage = await client.getUsage();
console.log(`Remaining calls: ${usage.data.remaining}`);
 
// Get Audio URLs
const audioUrl = client.getAudioUrl("dictionary_id", "entry_id");
const audio = new Audio(audioUrl);
audio.play();

Python

The official Python client is available on PyPI. It provides synchronous and asynchronous capabilities out of the box, with full Pydantic model support for strongly-typed data validation.

pip install shobdo-python

Basic Usage

import os
import shobdo_python
from shobdo_python.rest import ApiException
 
# Configure API key authorization
configuration = shobdo_python.Configuration(
    host = "https://api.shobdo.me/api/v1"
)
configuration.api_key['Authorization'] = os.environ["SHOBDO_API_KEY"]
configuration.api_key_prefix['Authorization'] = 'Bearer'
 
# Enter a context with an instance of the API client
with shobdo_python.ApiClient(configuration) as api_client:
    api_instance = shobdo_python.DefaultApi(api_client)
    
    try:
        # Search dictionaries
        api_response = api_instance.api_v1_api_search_get(q="hello", limit=10, lang="en")
        print(f"Found {api_response.meta.total} results")
        
        for item in api_response.data:
            print(f"{item.word}: {item.preview}")
            
    except ApiException as e:
        print("Exception when calling DefaultApi: %s\n" % e)

Go

The official Go client is available via standard go modules.

go get github.com/shobdopbc/ShobdoGo@v1.0.0

Basic Usage

Import the client and initialize it. Note that shobdogo is the package name.

package main
 
import (
    "context"
    "fmt"
    "os"
    "github.com/shobdopbc/ShobdoGo"
)
 
func main() {
    config := shobdogo.NewConfiguration()
    config.AddDefaultHeader("Authorization", "Bearer " + os.Getenv("SHOBDO_API_KEY"))
    client := shobdogo.NewAPIClient(config)
 
    // Search across dictionaries
    req := client.DefaultAPI.ApiV1ApiSearchGet(context.Background()).Q("hello").Limit(10).Lang("en").MatchType("prefix")
    response, _, err := client.DefaultAPI.ApiV1ApiSearchGetExecute(req)
    if err != nil {
        fmt.Println("Error:", err)
        return
    }
 
    fmt.Printf("Found %v results\n", len(response.Data))
}

Java

Designed for enterprise backend services and Android applications, our Java SDK utilizes Retrofit2 and OkHttp under the hood for maximum stability and performance.

Installation (Maven)

<dependency>
  <groupId>com.shobdo</groupId>
  <artifactId>shobdo-java</artifactId>
  <version>1.0.0</version>
  <scope>compile</scope>
</dependency>

Basic Usage

import com.shobdo.api.ApiClient;
import com.shobdo.api.Configuration;
import com.shobdo.api.auth.ApiKeyAuth;
import com.shobdo.api.DefaultApi;
 
public class Main {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        
        // Configure API key
        ApiKeyAuth bearerAuth = (ApiKeyAuth) defaultClient.getAuthentication("bearerAuth");
        bearerAuth.setApiKey(System.getenv("SHOBDO_API_KEY"));
        bearerAuth.setApiKeyPrefix("Bearer");
 
        DefaultApi apiInstance = new DefaultApi(defaultClient);
        
        try {
            Object result = apiInstance.apiV1ApiSearchGet("apple", 10, 0, "en", null, null, null, null);
            System.out.println(result);
        } catch (Exception e) {
            System.err.println("Exception when calling API");
            e.printStackTrace();
        }
    }
}

Kotlin

The Kotlin SDK provides coroutine support and idiomatic extensions, making it perfect for modern Android development.

Installation (Gradle)

implementation 'com.shobdo:shobdo-kotlin:1.0.0'

Basic Usage

import com.shobdo.api.apis.DefaultApi
import com.shobdo.api.infrastructure.ApiClient
 
suspend fun main() {
    val client = ApiClient(
        baseUrl = "https://api.shobdo.me/api/v1"
    )
    client.addAuthorization("bearerAuth", System.getenv("SHOBDO_API_KEY"))
 
    val api = DefaultApi(client)
    
    try {
        val result = api.apiV1ApiSearchGet(q = "kotlin", limit = 10, lang = "en")
        println("Found results: ${result.data.size}")
    } catch (e: Exception) {
        e.printStackTrace()
    }
}

Swift

The Shobdo Swift SDK provides first-class support for iOS, macOS, tvOS, and watchOS apps. Build stunning dictionary apps native to Apple platforms without worrying about the networking layer!

Installation (Swift Package Manager)

Add the package dependency directly in Xcode or to your Package.swift:

dependencies: [
    .package(url: "https://github.com/shobdopbc/ShobdoSwift.git", .upToNextMajor(from: "1.0.0"))
]

Basic Usage

import ShobdoSwift
 
// Configure the client
ShobdoAPI.customHeaders = ["Authorization": "Bearer \(ProcessInfo.processInfo.environment["SHOBDO_API_KEY"]!)"]
 
// Perform a search
DefaultAPI.apiV1ApiSearchGet(q: "swift", limit: 5) { (response, error) in
    guard error == nil else {
        print(error!)
        return
    }
    
    if let results = response?.data {
        for result in results {
            print(result.word)
        }
    }
}

C# / .NET

The C# SDK supports .NET Standard and .NET Core, providing async methods and Task-based patterns for Unity and enterprise applications.

Installation (NuGet)

dotnet add package Shobdo.Api

Basic Usage

using System;
using System.Diagnostics;
using Shobdo.Api.Api;
using Shobdo.Api.Client;
 
namespace Example
{
    public class Program
    {
        public static async System.Threading.Tasks.Task Main(string[] args)
        {
            Configuration config = new Configuration();
            config.ApiKey.Add("Authorization", Environment.GetEnvironmentVariable("SHOBDO_API_KEY"));
            config.ApiKeyPrefix.Add("Authorization", "Bearer");
 
            var apiInstance = new DefaultApi(config);
            try
            {
                var result = await apiInstance.ApiV1ApiSearchGetAsync(q: "hello", limit: 10, lang: "en");
                Console.WriteLine(result);
            }
            catch (ApiException e)
            {
                Console.WriteLine("Exception when calling API: " + e.Message);
            }
        }
    }
}

Ruby

Perfect for Ruby on Rails applications, the Ruby SDK abstracts away all the HTTP fetching and JSON parsing boilerplate.

Installation

gem install shobdo_ruby

Basic Usage

require 'shobdo_ruby'
 
ShobdoRuby.configure do |config|
  config.api_key['Authorization'] = ENV['SHOBDO_API_KEY']
  config.api_key_prefix['Authorization'] = 'Bearer'
end
 
api_instance = ShobdoRuby::DefaultApi.new
 
begin
  result = api_instance.api_v1_api_search_get(q: 'ruby', limit: 5)
  p result
rescue ShobdoRuby::ApiError => e
  puts "Exception when calling Shobdo API: #{e}"
end

PHP

Easily integrate Shobdo into WordPress, Laravel, or Symfony applications with our PHP SDK.

Installation (Composer)

composer require shobdopbc/shobdo-php

Basic Usage

<?php
require_once(__DIR__ . '/vendor/autoload.php');
 
$config = Shobdo\Configuration::getDefaultConfiguration()
    ->setApiKey('Authorization', getenv('SHOBDO_API_KEY'))
    ->setApiKeyPrefix('Authorization', 'Bearer');
 
$apiInstance = new Shobdo\Api\DefaultApi(
    new GuzzleHttp\Client(),
    $config
);
 
try {
    $result = $apiInstance->apiV1ApiSearchGet("php", 10, null, "en");
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling API: ', $e->getMessage(), PHP_EOL;
}
?>

Rust

For performance-critical systems, the Rust SDK offers blazing-fast dictionary lookups with complete memory safety and async/await support via Tokio and Reqwest.

Installation

[dependencies]
shobdo-rust = "1.0.0"
tokio = { version = "1.0", features = ["full"] }

Basic Usage

use shobdo_rust::apis::configuration::Configuration;
use shobdo_rust::apis::default_api;
use std::env;
 
#[tokio::main]
async fn main() {
    let mut config = Configuration::new();
    config.bearer_access_token = Some(env::var("SHOBDO_API_KEY").unwrap());
 
    // Execute the async request
    match default_api::api_v1_api_search_get(&config, "rust", Some(10), None, None, None, None, None, None).await {
        Ok(response) => println!("Found results!"),
        Err(e) => eprintln!("Error calling API: {:?}", e),
    }
}

Using the API Directly

The REST API is simple enough to use with any HTTP client. Here are minimal examples in popular languages:

cURL
curl -G "https://api.shobdo.me/api/v1/api/search" \
  -H "Authorization: Bearer $SHOBDO_API_KEY" \
  --data-urlencode "q=hello" \
  --data-urlencode "lang=en" \
  --data-urlencode "limit=10"

Community Libraries

If you build a client library for the Shobdo API in any language, let us know and we will feature it here.

Assistant

Hi! I'm the Shobdo Assistant.
Ask me anything about the documentation.