requests

package
v0.0.0-...-4958f1d Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APIRequest

func APIRequest(name string, email string, password string, APIkey string) (models.WriteStruct, error)

APIRequest uses Call to make a request to the API. Here is our main worker

func AsyncAPIRequest

func AsyncAPIRequest(users []string, email string, password string, numberOfWorkers int, APIkey string) ([]models.WriteStruct, error)

AsyncAPIRequest uses go wait groups to run parallel routines on APIRequest, how many is set by numberOfWorkers.

all requests are organized by StreamInputs
all responses are returned as []models.WriteStruct to be uses by readFile function

func Call

func Call(url, method string, email string, password string, APIkey string) (*http.Response, error)

Call creates a http.Client passing KEY on the header

func Login

func Login(email string, password string) (*http.Cookie, error)

Login on the API returning the cookie

func StreamInputs

func StreamInputs(done <-chan struct{}, inputs []string) <-chan string

StreamInputs receives a slice of strings as inputs and a "done" channel to signal when to stop processing.

It returns a channel that streams each input string in the slice sequentially.
If the "done" channel is closed prematurely (due to an error midway), it closes the input channel and returns.
This function is designed to be used in a pipeline with other functions that process the input stream.

Types

This section is empty.

Jump to

Keyboard shortcuts

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