http

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package http implements the logic to create API request It use in api module to get data from API

Index

Constants

View Source
const (
	// FMPBaseURL represents the base URL for the financialmodelingprep.com API.
	FMPBaseURL string = "https://financialmodelingprep.com/api/v3"

	// EmptyResponseBody is the response given by the API
	EmptyResponseBody string = "[]"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientInterface

type ClientInterface interface {
	DoRequest(method, url string, body []byte) ([]byte, error)
}

ClientInterface is the contract that must be follow to create a new HTTP client that will be used by API to get data

type FMPHandler

type FMPHandler struct {
	APIKey     string // APIKey represents the API key used for authentication.
	MaxAttempt uint   // MaxAttempt represents the maximum number of attempts for API requests.
}

FMPHandler represents a handler for interacting with the financialmodelingprep.com API. It contains fields for storing the API key and defining the maximum number of attempts to make when communicating with the API.

func (*FMPHandler) DoRequest

func (httpHandler *FMPHandler) DoRequest(method, url string, body []byte) ([]byte, error)

DoRequest performs an HTTP request to the financialmodelingprep.com API. It takes the HTTP method, URL, and request body as input parameters and returns the response body as a byte slice and an error, if any.

Jump to

Keyboard shortcuts

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