Skip to content

TheLe0/bacon-ipsum-api-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bacon Ipsum .NET API Client

Unit and Integration Tests

bacon-ipsum-banner1

Introduction

This is a .NET package for random text generation. Good for testing the responsivity of front-end applications to see the behaviour of the layouts, if it grows and decreases in the ideal proportion.

Packages

Package Version Downloads Workflow
Bacon.Ipsum.API.Client NuGet Version NuGet Downloads Deploy
Bacon.Ipsum.API.Client.DependencyInjection NuGet Version NuGet Downloads Deploy

Endpoints

  1. GenerateSentenceAsync: Generate a text with a specific amount of sentences;
var response = await client.TextGenerator
    .GenerateSentenceAsync(1)
    .ConfigureAwait(false);
);
  1. GenerateParagraphAsync: Generate a text with a specific amount of paragraphs;
var response = await client.TextGenerator
    .GenerateParagraphAsync(1)
    .ConfigureAwait(false);
);

Configuration

This Api integration is ver simple, there is no authentication/authorization requirements, you can use it with almost no configurations.

You can instanciate this client in three different ways:

  1. Using default configs (This uses the values inside the Configurations resource file):
var client = new BaconIpsumApiClient();

or by dependency injection:

services.AddBaconIpsumApiClient();
  1. Only configurating the API base url:
var client = new BaconIpsumApiClient(baseUrl);

or by dependency injection:

services.AddBaconIpsumApiClient(baseUrl);
  1. And setup manually all configurations with your preferences:
var configs = new BaconIpsumApiClientConfiguration
{
    BaseUrl = baseUrl,
    MaxTimeout = maxTimeOut,
    ThrowOnAnyError = throwOnErrors,
    StartWithLorem = true,
    Type = TextContentType.MEAT_AND_FILLER
};

var client = new BaconIpsumApiClient(configs);

or by dependency injection:

var configs = new BaconIpsumApiClientConfiguration
{
    BaseUrl = baseUrl,
    MaxTimeout = maxTimeOut,
    ThrowOnAnyError = throwOnErrors,
    StartWithLorem = true,
    Type = TextContentType.MEAT_AND_FILLER
};

services.AddBaconIpsumApiClient(configs);