api

package
v1.73.2-bclone Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package api contains definitions for using the alldebrid API

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

Error represents an API error response

func (*Error) Error

func (e *Error) Error() string

Error satisfies the error interface

type HistoryDeleteResponse

type HistoryDeleteResponse struct {
	Response
	Data struct {
		Message string `json:"message"`
	} `json:"data"`
}

HistoryDeleteResponse represents the response from /v4/user/history/delete

type HistoryResponse

type HistoryResponse struct {
	Response
	Data struct {
		Links []Link `json:"links"`
	} `json:"data"`
}

HistoryResponse represents the response from /v4/user/history

type Link struct {
	Link     string `json:"link"`
	Filename string `json:"filename"`
	Size     int64  `json:"size"`
	Date     int64  `json:"date"`
	Host     string `json:"host"`
}

Link represents a saved or history link

type LinkDelayed

type LinkDelayed struct {
	Status   int    `json:"status"`
	TimeLeft int    `json:"time_left"`
	Link     string `json:"link,omitempty"`
}

LinkDelayed represents a delayed link status

type LinkDelayedResponse

type LinkDelayedResponse struct {
	Response
	Data LinkDelayed `json:"data"`
}

LinkDelayedResponse represents the response from /v4/link/delayed

type LinkDeleteResponse

type LinkDeleteResponse struct {
	Response
	Data struct {
		Message string `json:"message"`
	} `json:"data"`
}

LinkDeleteResponse represents the response from /v4/user/links/delete

type LinkSaveResponse

type LinkSaveResponse struct {
	Response
	Data struct {
		Message string `json:"message"`
	} `json:"data"`
}

LinkSaveResponse represents the response from /v4/user/links/save

type LinkUnlock

type LinkUnlock struct {
	Link       string   `json:"link"`
	Filename   string   `json:"filename"`
	Host       string   `json:"host"`
	Streams    []Stream `json:"streams,omitempty"`
	Paws       bool     `json:"paws"`
	Filesize   int64    `json:"filesize"`
	ID         string   `json:"id"`
	HostDomain string   `json:"hostDomain"`
	Delayed    int      `json:"delayed,omitempty"`
}

LinkUnlock represents an unlocked link

type LinkUnlockResponse

type LinkUnlockResponse struct {
	Response
	Data LinkUnlock `json:"data"`
}

LinkUnlockResponse represents the response from /v4/link/unlock

type LinksResponse

type LinksResponse struct {
	Response
	Data struct {
		Links []Link `json:"links"`
	} `json:"data"`
}

LinksResponse represents the response from /v4/user/links

type Magnet

type Magnet struct {
	ID             int    `json:"id"`
	Filename       string `json:"filename"`
	Size           int64  `json:"size"`
	Status         string `json:"status"`
	StatusCode     int    `json:"statusCode"`
	Downloaded     int64  `json:"downloaded"`
	Uploaded       int64  `json:"uploaded"`
	Seeders        int    `json:"seeders"`
	DownloadSpeed  int64  `json:"downloadSpeed"`
	UploadSpeed    int64  `json:"uploadSpeed"`
	UploadDate     int64  `json:"uploadDate"`
	CompletionDate int64  `json:"completionDate"`
	NBLinks        int    `json:"nbLinks"`
}

Magnet represents a magnet download

type MagnetDeleteResponse

type MagnetDeleteResponse struct {
	Response
	Data struct {
		Message string `json:"message"`
	} `json:"data"`
}

MagnetDeleteResponse represents the response from /v4/magnet/delete

type MagnetFile

type MagnetFile struct {
	Name    string       `json:"n"`
	Size    int64        `json:"s,omitempty"`
	Link    string       `json:"l,omitempty"`
	Entries []MagnetFile `json:"e,omitempty"`
}

MagnetFile represents a file within a magnet

type MagnetFiles

type MagnetFiles struct {
	ID    string       `json:"id"`
	Files []MagnetFile `json:"files"`
	Error *Error       `json:"error,omitempty"`
}

MagnetFiles represents files for a specific magnet

type MagnetFilesResponse

type MagnetFilesResponse struct {
	Response
	Data struct {
		Magnets []MagnetFiles `json:"magnets"`
	} `json:"data"`
}

MagnetFilesResponse represents the response from /v4/magnet/files

type MagnetRestart

type MagnetRestart struct {
	Magnet  string `json:"magnet"`
	Message string `json:"message,omitempty"`
	Error   *Error `json:"error,omitempty"`
}

MagnetRestart represents the result of restarting a magnet

type MagnetRestartResponse

type MagnetRestartResponse struct {
	Response
	Data struct {
		Message string          `json:"message,omitempty"`
		Magnets []MagnetRestart `json:"magnets,omitempty"`
	} `json:"data"`
}

MagnetRestartResponse represents the response from /v4/magnet/restart

type MagnetStatusResponse

type MagnetStatusResponse struct {
	Response
	Data struct {
		Magnets  []Magnet `json:"magnets"`
		Counter  int      `json:"counter,omitempty"`
		Fullsync bool     `json:"fullsync,omitempty"`
	} `json:"data"`
}

MagnetStatusResponse represents the response from /v4.1/magnet/status

type MagnetUpload

type MagnetUpload struct {
	Magnet string `json:"magnet"`
	Hash   string `json:"hash,omitempty"`
	Name   string `json:"name,omitempty"`
	Size   int64  `json:"size,omitempty"`
	Ready  bool   `json:"ready,omitempty"`
	ID     int    `json:"id,omitempty"`
	Error  *Error `json:"error,omitempty"`
}

MagnetUpload represents the result of uploading a magnet

type MagnetUploadFile

type MagnetUploadFile struct {
	File  string `json:"file"`
	Name  string `json:"name,omitempty"`
	Size  int64  `json:"size,omitempty"`
	Hash  string `json:"hash,omitempty"`
	Ready bool   `json:"ready,omitempty"`
	ID    int    `json:"id,omitempty"`
	Error *Error `json:"error,omitempty"`
}

MagnetUploadFile represents the result of uploading a torrent file

type MagnetUploadFileResponse

type MagnetUploadFileResponse struct {
	Response
	Data struct {
		Files []MagnetUploadFile `json:"files"`
	} `json:"data"`
}

MagnetUploadFileResponse represents the response from /v4/magnet/upload/file

type MagnetUploadResponse

type MagnetUploadResponse struct {
	Response
	Data struct {
		Magnets []MagnetUpload `json:"magnets"`
	} `json:"data"`
}

MagnetUploadResponse represents the response from /v4/magnet/upload

type Response

type Response struct {
	Status string `json:"status"`
	Error  *Error `json:"error,omitempty"`
	Data   any    `json:"data,omitempty"`
}

Response is returned by all messages and embedded in the structures below

func (*Response) AsErr

func (r *Response) AsErr() error

AsErr checks the status and returns an err if bad or nil if good

type Stream

type Stream struct {
	ID       string `json:"id"`
	Ext      string `json:"ext"`
	Quality  string `json:"quality"`
	Filesize int64  `json:"filesize"`
	Proto    string `json:"proto"`
	Name     string `json:"name"`
}

Stream represents a streaming option

type User

type User struct {
	Username             string         `json:"username"`
	Email                string         `json:"email"`
	IsPremium            bool           `json:"isPremium"`
	IsSubscribed         bool           `json:"isSubscribed"`
	IsTrial              bool           `json:"isTrial"`
	PremiumUntil         int64          `json:"premiumUntil"`
	Lang                 string         `json:"lang"`
	PreferedDomain       string         `json:"preferedDomain"`
	FidelityPoints       int            `json:"fidelityPoints"`
	LimitedHostersQuotas map[string]int `json:"limitedHostersQuotas"`
	Notifications        []string       `json:"notifications"`
	RemainingTrialQuota  *int           `json:"remainingTrialQuota,omitempty"`
}

User represents user information

type UserResponse

type UserResponse struct {
	Response
	Data struct {
		User User `json:"user"`
	} `json:"data"`
}

UserResponse represents the response from /v4/user

Jump to

Keyboard shortcuts

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