@shipengine/connect
Version:
The official developer tooling for building ShipEngine connect apps
52 lines (51 loc) • 2.02 kB
TypeScript
import ShipengineAPIClient from '..';
import { DeploymentType } from '../../app-loader';
import { ConnectApp, PaginatedItems } from '../../types';
export default class Apps {
private client;
constructor(apiClient: ShipengineAPIClient);
/**
* Creates a new App.
* @returns {Promise<ConnectApp>} Promise object that resolves to a ConnectApp object.
*/
create({ appId, name, type, }: {
appId?: string;
name: string;
type: DeploymentType;
}): Promise<ConnectApp>;
/**
* Updates an App.
* @returns {Promise<ConnectApp>} Promise object that resolves to a ConnectApp object.
*/
update(appId: string, name: string, type: string): Promise<ConnectApp>;
/**
* Finds or creates a new app by name
* @returns {Promise<ConnectApp>} Promise object that resolves to a ConnectApp object.
*/
findOrCreateApp({ appId, name, type, }: {
appId?: string;
name: string;
type: DeploymentType;
}): Promise<ConnectApp>;
/**
* Gets all Apps that belong to the given API key.
* @returns {Promise<PaginatedItems<ConnectApp>>} Promise object that resolves to an Array of ConnectApp objects.
*/
getAll(): Promise<PaginatedItems<ConnectApp>>;
/**
* Get an App by its ID.
* @returns {Promise<ConnectApp>} Promise object that resolves to a ConnectApp object.
*/
getById(id: string): Promise<ConnectApp>;
/**
* Get an App by its name.
* @returns {Promise<ConnectApp>} Promise object that resolves to a ConnectApp object.
*/
getByName(name: string): Promise<ConnectApp>;
/**
* @description Returns an app, if an id is provided it will use that, if not it defaults to looking it up by name
* @param name The name of the app (this is bad, we want it to eventually always be the id)
* @param appId The appId found in the manifest of the package.json file
*/
getByIdOrName(name: string, appId?: string): Promise<ConnectApp>;
}