PlantBook 1.2.0

dotnet add package PlantBook --version 1.2.0
NuGet\Install-Package PlantBook -Version 1.2.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PlantBook" Version="1.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PlantBook --version 1.2.0
#r "nuget: PlantBook, 1.2.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install PlantBook as a Cake Addin
#addin nuget:?package=PlantBook&version=1.2.0

// Install PlantBook as a Cake Tool
#tool nuget:?package=PlantBook&version=1.2.0

PlantBook

.Build status Coverage Status NuGet License

What does it do?

This library adds support for the PlantBook API. See https://plantbook.io for more info.

Auth

You will need to create a account on https://open.plantbook.io and generate a ClientId and Secret.

Examples

Searching for plants:

var plantbook = new PlantBook(new("auth cliend id", "auth secret"));
var searchResult = await plantbook.SearchAsync("pancake");

Console.WriteLine(searchResult.Results[0].DisplayPid);

// Output:
//   Pilea peperomioides

Get more info about a plant:

var plantbook = new PlantBook(new("auth cliend id", "auth secret"));
var plant = await plantbook.GetAsync("pilea peperomioides");

Console.WriteLine(plant.Alias);
Console.WriteLine(plant.MinTemp);
Console.WriteLine(plant.ImageUrl);

// Output:
//   pancake plant
//   10
//   https://opb-img.plantbook.io/pilea%20peperomioides.jpg

Interface

public interface IPlantBook
{
    /// <summary>
    /// Create new user plant or modify public plant
    /// </summary>
    /// <param name="plant"><display_pid>: Scientific name of the plant. Based on this attribute <pid> (Plant ID) attribute will be automatically generated by lowering case of this attribute.
    /// E.g: <display_pid>="Tomato Red" will result in <pid>="tomato red"</param>
    Task<Plant> CreateAsync(Plant plant, CancellationToken cancellationToken = default);

    /// <summary>
    /// Delete plant from user-plants. Public-plants cannot be removed.
    /// </summary>
    Task DeleteAsync(string pid, CancellationToken cancellationToken = default);

    /// <summary>
    /// Retrieve plant details using "pid" (Plant ID)
    /// </summary>
    Task<Plant> GetDetailsAsync(string pid, CancellationToken cancellationToken = default);

    /// <summary>
    /// Search any occurrences of text in "display_pid" and "alias" fields.
    /// </summary>
    /// <param name="alias">search string - MINIMUM LENGHT is 3 characters</param>
    /// <param name="userplant">true - search and return only user-plants, false - search and return only public-plants, if omitted - combined search across user and public plants</param>
    Task<SearchResult> SearchAsync(string alias, int? offset = null, int? limit = null, bool? userplant = null, CancellationToken cancellationToken = default);

    /// <summary>
    /// Method updates either user-plant or public-plant using JSON payload. User-plant is attempted to update first. If user-plant not found then API searches 'pid' in public-plants. If found in public-plants then the public plant will be cloned and saved as user-plant with requested changes.
    /// </summary>
    Task<Plant> UpdateAsync(Plant plant, CancellationToken cancellationToken = default);
}

Tools and Products Used

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.0 86 4/18/2024
1.1.0 342 3/23/2023
1.0.0 223 2/25/2023