Skip to content

Latest commit

 

History

History
255 lines (181 loc) · 18 KB

README.md

File metadata and controls

255 lines (181 loc) · 18 KB

Apps

(apps)

Overview

Available Operations

  • list - List all available apps
  • get - Get details of a specific app
  • install - Install an app for a company

list

List all available apps

Example Usage

import { Pushpress } from "pushpress";

const pushpress = new Pushpress({
  apiKey: process.env["PUSHPRESS_API_KEY"] ?? "",
});

async function run() {
  const result = await pushpress.apps.list();

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { PushpressCore } from "pushpress/core.js";
import { appsList } from "pushpress/funcs/appsList.js";

// Use `PushpressCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const pushpress = new PushpressCore({
  apiKey: process.env["PUSHPRESS_API_KEY"] ?? "",
});

async function run() {
  const res = await appsList(pushpress);

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

Parameters

Parameter Type Required Description
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<components.App[]>

Errors

Error Type Status Code Content Type
errors.BadRequest 400, 413, 414, 415, 422, 431, 510 application/json
errors.Unauthorized 401, 403, 407, 511 application/json
errors.NotFound 404, 501, 505 application/json
errors.Timeout 408, 504 application/json
errors.RateLimited 429 application/json
errors.InternalServerError 500, 502, 503, 506, 507, 508 application/json
errors.APIError 4XX, 5XX */*

get

Get details of a specific app

Example Usage

import { Pushpress } from "pushpress";

const pushpress = new Pushpress({
  apiKey: process.env["PUSHPRESS_API_KEY"] ?? "",
});

async function run() {
  const result = await pushpress.apps.get({
    appId: "<id>",
  });

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { PushpressCore } from "pushpress/core.js";
import { appsGet } from "pushpress/funcs/appsGet.js";

// Use `PushpressCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const pushpress = new PushpressCore({
  apiKey: process.env["PUSHPRESS_API_KEY"] ?? "",
});

async function run() {
  const res = await appsGet(pushpress, {
    appId: "<id>",
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

Parameters

Parameter Type Required Description
request operations.GetAppRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<components.App>

Errors

Error Type Status Code Content Type
errors.BadRequest 400, 413, 414, 415, 422, 431, 510 application/json
errors.Unauthorized 401, 403, 407, 511 application/json
errors.NotFound 404, 501, 505 application/json
errors.Timeout 408, 504 application/json
errors.RateLimited 429 application/json
errors.InternalServerError 500, 502, 503, 506, 507, 508 application/json
errors.APIError 4XX, 5XX */*

install

Install an app for a company

Example Usage

import { Pushpress } from "pushpress";

const pushpress = new Pushpress({
  apiKey: process.env["PUSHPRESS_API_KEY"] ?? "",
});

async function run() {
  await pushpress.apps.install({
    appId: "<id>",
    requestBody: {
      company: "Hirthe and Sons",
    },
  });


}

run();

Standalone function

The standalone function version of this method:

import { PushpressCore } from "pushpress/core.js";
import { appsInstall } from "pushpress/funcs/appsInstall.js";

// Use `PushpressCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const pushpress = new PushpressCore({
  apiKey: process.env["PUSHPRESS_API_KEY"] ?? "",
});

async function run() {
  const res = await appsInstall(pushpress, {
    appId: "<id>",
    requestBody: {
      company: "Hirthe and Sons",
    },
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  
}

run();

Parameters

Parameter Type Required Description
request operations.InstallAppRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<void>

Errors

Error Type Status Code Content Type
errors.BadRequest 400, 413, 414, 415, 422, 431, 510 application/json
errors.Unauthorized 401, 403, 407, 511 application/json
errors.NotFound 404, 501, 505 application/json
errors.Timeout 408, 504 application/json
errors.RateLimited 429 application/json
errors.InternalServerError 500, 502, 503, 506, 507, 508 application/json
errors.APIError 4XX, 5XX */*