FreeDictionaryAPI-sdk-go

module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2025 License: AGPL-3.0

README

FreeDictionaryAPI-sdk-go

An unofficial Go SDK for Free Dictionary API.

Example

package test

import (
	"testing"

	"gitcode.com/astral-sphere/FreeDictionaryAPI-sdk-go/base"
	"gitcode.com/astral-sphere/FreeDictionaryAPI-sdk-go/entries"
	"golang.org/x/text/language"
)

func TestRequest(t *testing.T) {
	var word_request = entries.WordRequest{
		// This cannot be omitted!
		Options:  base.DefaultRequestOptions(),
		Word:     "example",
		Language: language.English,
	}

	_, err := word_request.Request()
	if err != nil {
		t.Errorf("Request failed: %v", err)
	}
}

func TestRequestWithTranslations(t *testing.T) {
	var word_request = entries.WordRequest{
		Options:      base.DefaultRequestOptions(),
		Word:         "example",
		Language:     language.English,
		Translations: true,
	}

	_, err := word_request.Request()
	if err != nil {
		t.Errorf("Request failed: %v", err)
	}
}

Directories

Path Synopsis
Retrieves dictionary entries for a specified word for a specific language or all available languages.
Retrieves dictionary entries for a specified word for a specific language or all available languages.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL