Skip to content

pierre-emmanuelJ/open-alldebrid

Repository files navigation

Open Alldebrid

Alldebrid OpenAPI Golang wrapper

The Golang wrapper is generated from an OpenAPI3 spec based on the official Alldebrid.com Documentation

Open Alldebrid Swagger-ui Visit here

This OpenAPI spec can be used to generate client library in other languages!

Overview

This API client was generated by the OpenAPI Generator project.

  • API version: 4.0.0
  • Package version: 1.0.0

Installation

Install the following dependencies:

go get "github.com/pierre-emmanuelJ/open-alldebrid"

Add the following import:

import "github.com/pierre-emmanuelJ/open-alldebrid/client"

Examples

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/pierre-emmanuelJ/open-alldebrid/client"
)

func main() {
	agent := "agent_example" // Your software user-agent. (default to "open-alldebrid")

	configuration := client.NewConfiguration()
	configuration.AddDefaultHeader("Authorization", "Bearer ApiKeyFromAlldebrid")
	api_client := client.NewAPIClient(configuration)

	resp, r, err := api_client.DefaultApi.UserGet(context.Background()).Agent(agent).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `DefaultApi.UserGet``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	fmt.Printf("%#v\n", resp)
}

Possible to add Bearer Token from context

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/pierre-emmanuelJ/open-alldebrid/client"
)

func main() {
	agent := "agent_example" // Your software user-agent. (default to "open-alldebrid")
	auth := context.WithValue(
		context.Background(),
		openapiclient.ContextAccessToken, "ApiKeyFromAlldebrid",
	)

	configuration := client.NewConfiguration()
	api_client := client.NewAPIClient(configuration)

	resp, r, err := api_client.DefaultApi.UserGet(auth).Agent(agent).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `DefaultApi.UserGet``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	fmt.Printf("%#v\n", resp)
}

Documentation for API Endpoints

Find all the API Documentation here

Swagger UI here

You can execute HTTP request from the UI with your Alldebrid ApiKey

Documentation For Authorization

bearerAuth

  • Type: HTTP Bearer token authentication

Example

auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ApiKeyFromAlldebrid")

configuration := client.NewConfiguration()
api_client := client.NewAPIClient(configuration)

resp, r, err := api_client.DefaultApi.UserGet(auth).Agent(agent).Execute()

Powered by