GKARLOZ / Gian-SDK

SDK for the-one-api. Install SDK package.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gollum LOTR SDK Design

This SDK will let developers search for information using THE ONE API. Developers can use this SDK to look up books, characters, quotes, and movies. The get method can get all or a specific object by id.

πŸ§™β€β™‚οΈ Instructions:

These are the following steps to use this SDK:

▫️ 1. Open your Comand Prompt

▫️ 2. Go to the directory you would like to install the package.

▫️ 3. Create a virtual environment: for Windows type:

py -m venv EnvironmentName

▫️ 4. Activate the environment type:

EnvironmentName\Scripts\activate

▫️ 5. Install requests in your environment: for Windows type:

pip install requests

▫️ 6. Hurry! Now lets install the SDK package. type:

pip install Gian-lotr

▫️ 7. Lets code some python type:

python

▫️ 8. Cograts! Now lets import TestingClient type:

from Gian_lotr.rest import TestingClient

▫️ 9. Lets create a client type:

client = TestingClient(location="lotr")

▫️ 10. Let's see all the movies: type:

client.movie.get()

▫️ 11. Lets find a movie by id type:

client.movie.get(object_id="5cd95395de30eff6ebccde56")

This SDK will let developers search for information using THE ONE API. Developers can use this SDK to look up books, characters, quotes, and movies. The get method can get all or a specific object by id.

🌳 File Structure:

FolderInstalledGian-SDK\Lib\site-packages\Gian_lotr

Gian_lotr/
└── rest/
    └── book/
        β”œβ”€β”€ __init__.py
    └── character/
        β”œβ”€β”€ __init__.py
    └── movie/
        β”œβ”€β”€ __init__.py
    └── quote/
        β”œβ”€β”€ __init__.py
    └── __init__.py
       	

In the init for the rest folder, you will find a class() with a few methods. The purpose of this class is to create an object that can contain different information. This will come in handy when adding various API endpoints or filtering information. This file also contains an APIRequester class for different APIs and a PathBuilder class to create more complex Strings in the future.

The book, character, movie, and quote folder contain an init file as well. Each one creates an object of a different class.

🏹 Details:

The first step is to create a client object with the name of the location of the API. At the moment "lotr" (https://the-one-api.dev/v2/) is the only API endpoint that is being used. However, this application is designed to add many APIs very easily.

Example: 

name of object           variable name 
  |      initialize class   |     name of API
            |               |      |
client = TestingClient(location="lotr")

Then what type of information is going to be retrieved such as a book or quote. After, add the get() or get(object_id="ID HERE") to find the right information.

Example: 

object      method 
  | location |          id
        |               |
client.movie.get(object_id="ID here") 

πŸ—‘οΈ Other Examples:

client.book.get(object_id ="5cf5805fb53e011a64671582")

client.book.get()

client.charater.get()

client.quote.get()

About

SDK for the-one-api. Install SDK package.


Languages

Language:Python 100.0%