@ovh-api/common

  • Version 4.0.2
  • Published
  • 19.8 kB
  • No dependencies
  • MIT license

Install

npm i @ovh-api/common
yarn add @ovh-api/common
pnpm add @ovh-api/common

Overview

common class used to enable Ovh Api new calls Syntax

Index

Functions

function buildOvhProxy

buildOvhProxy: (ovhEngine: OvhRequestable, path: string) => any;
  • Build Ovh API 2.0 Proxy

    Parameter ovhEngine

    Parameter path

Interfaces

interface ICacheOptions

interface ICacheOptions {}
  • params to configure cache

property count

count?: number;
  • max number of entry in your cache

property silotClass

silotClass?: SlotConstructor;
  • explicite silot construtor used to overwrite in memory default silotCache

property size

size?: number;
  • max memmory used to store your cache

property ttl

ttl?: number;
  • Time to live in second

interface ICacheSilot

interface ICacheSilot {}
  • Public interface of a silot you can have one silot per Ovh API call

property options

options: ICacheOptions;

    method discard

    discard: (path: string) => Promise<boolean>;

      method flush

      flush: () => Promise<void>;

        method get

        get: (path: string) => Promise<any | undefined>;

          method store

          store: (path: string, value: any, size: number) => Promise<boolean>;

            interface OvhRequestable

            interface OvhRequestable {}
            • common interface used to call ovh engine

            method cache

            cache: (template: string, param: ICacheOptions | CacheAction) => Promise<any>;
            • cache controle

            method doRequest

            doRequest: (
            httpMethod: string,
            path: string,
            pathTemplate: string,
            params?: any
            ) => Promise<any>;
            • Execute a request on the API with promise

              Parameter httpMethod

              : The HTTP method GET POST PUT DELETE

              Parameter path

              : The request final path

              Parameter pathTemplate

              : The request path with {pathParams}

              Parameter params

              : The request parameters (passed as query string or body params)

            Type Aliases

            type CacheAction

            type CacheAction = 'flush' | 'disable' | string;
            • 'flush' and 'disable' are the main action, other can be add later

            type OvhParamType

            type OvhParamType = {
            [key: string]: any;
            };
            • all type that should be sent as parameter to Ovh calls

            type SlotConstructor

            type SlotConstructor = new (template: string, options: ICacheOptions) => ICacheSilot;
            • constructor for a silot cache

            Package Files (1)

            Dependencies (0)

            No dependencies.

            Dev Dependencies (1)

            Peer Dependencies (0)

            No peer dependencies.

            Badge

            To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

            You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@ovh-api/common.

            • Markdown
              [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@ovh-api/common)
            • HTML
              <a href="https://www.jsdocs.io/package/@ovh-api/common"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>