func (c *Client) TorrentAdd(ctx context.Context, payload TorrentAddPayload) (torrent Torrent, err error) {
	if payload.Filename == nil && payload.MetaInfo == nil {
		err = errors.New("fields Filename and MetaInfo can't be both nil")
		return
	}
	var result torrentAddAnswer
	if err = c.rpcCall(ctx, "torrent-add", payload, &result); err != nil {
		err = fmt.Errorf("'torrent-add' rpc method failed: %w", err)
		return
	}
	if result.TorrentAdded != nil {
		torrent = *result.TorrentAdded
	} else if result.TorrentDuplicate != nil {
		torrent = *result.TorrentDuplicate
	} else {
		err = errors.New("RPC call went fine but neither 'torrent-added' nor 'torrent-duplicate' result payload were found")
	}
	return
}
TorrentAdd allows to send an Add payload. If successful (torrent added or duplicate) torrent
return value will only have HashString, ID and Name fields set up.
https://github.com/transmission/transmission/blob/3.00/extras/rpc-spec.txt#L394
package transmissionrpc
import (
	"bytes"
	"context"
	"encoding/base64"
	"encoding/json"
	"errors"
	"fmt"
	"io"
	"os"
	"reflect"
)
func (c *Client) TorrentAddFileDownloadDir(ctx context.Context, filepath, downloaddir string) (torrent Torrent, err error) {
	if filepath == "" {
		err = errors.New("filepath can't be empty")
		return
	}
	if downloaddir == "" {
		err = errors.New("downloaddir can't be empty")
		return
	}
	b64, err := File2Base64(filepath)
	if err != nil {
		err = fmt.Errorf("can't encode '%s' content as base64: %w", filepath, err)
		return
	}
	return c.TorrentAdd(ctx, TorrentAddPayload{MetaInfo: &b64, DownloadDir: &downloaddir})
}
func (c *Client) TorrentAddFile(ctx context.Context, filepath string) (torrent Torrent, err error) {
	if filepath == "" {
		err = errors.New("filepath can't be empty")
		return
	}
	b64, err := File2Base64(filepath)
	if err != nil {
		err = fmt.Errorf("can't encode '%s' content as base64: %w", filepath, err)
		return
	}
	return c.TorrentAdd(ctx, TorrentAddPayload{MetaInfo: &b64})
}