3.3.0 • Published 6 years ago
@cumulus-consulting/mfgx-io-api-client v3.3.0
@cumulus-consulting/mfgx-io-api-client
API client designed to simplify use of MFGx APIs. Works in Node and browser environments.
Install via npm
npm install --save @cumulus-consulting/mfgx-io-api-client
Quick Start (ES6)
import { apiClient } from '@cumulus-consulting/mfgx-io-api-client';
apiClient.setBaseUrl('https://api.instance.mfgx.io');
await apiClient.signIn({
	email: 'test@email.com',
	password: 'password'
});
const { data: { userMany } } = await apiClient.graphQL({
	query: `{
	  userMany {
	    id
	    email
	  }
	}`
});Documentation
Exports
import { 
  // Pre-constructed API client instance with default options.
  apiClient, 
  // Main API client class, used to construct a new instance or extend the client.
  MFGxClient, 
  // Map of MFGx APIs; see APIs section below
  APIS 
} from '@cumulus-consulting/mfgx-io-api-client'; Constructor Options
{
  // Base MFGx API url (i.e. 'https://api.instance.mfgx.io').  Can also be set
  // or changed via the setBaseUrl function on a client instance.
	url,
	// Promise-returning functions to get, set, and clear a token from storage.
	// Default behavior is to store tokens in a closure; override provides the
	// ability to store tokens in persistent or secure storage.
	tokenStorage: {
		get,
		set,
		clear,
	},
	// When true, token expiration 401 errors will be automatically caught, the
  // token will attempt to be refreshed, and the request retried.  Defaults to
  // false.
	autoRefreshToken: false,
  // Callback called when errors occur, in addition to function throws.  
  // Can be used to display error UI or for global error logging.
	onError,
	// Promise-returning callback used to request device information when
	// needed by the client.  Device information returned should match the
	// format of the DeviceInformationInput type in the signIn API.
	onRequestDeviceInformation,
}APIs
{
	// Primary graphQL sign-in API.
	SIGN_IN:  '/signIn',
	// Main graphQL application API.
	GRAPHQL:  '/graphql',
	// Metadata graphQL API for system data.
	METADATA:  '/metadata',
	OCR: {
		// REST API to execute raw OCR requests; only applicable if OCR is enabled.
		RAW:  '/ocr/raw'
	},
	DOCUMENTS: {
		// REST API to generate PDF documents.
		GENERATE:  '/documents/generate'
	},
	WEBHOOKS: {
		// REST API to publish into a user-defined webhook.
		UDT:  '/webhooks/udt'
	},
	INTEGRATION: {
		// REST API for standardized requests to external systems.
		ENDPOINT:  '/integration/endpoint'
	},
	// Transformation graphQL API for executing MFGx scripts.
	TRANSFORMATION:  '/transformation'
}3.3.0
6 years ago
3.2.0
6 years ago
3.1.1
6 years ago
3.1.0
6 years ago
3.0.0
6 years ago
2.6.0
6 years ago
2.5.0
6 years ago
2.4.2
6 years ago
2.4.1
6 years ago
2.4.0
6 years ago
2.3.0
6 years ago
2.2.6
6 years ago
2.2.5
6 years ago
2.2.4
6 years ago
2.2.3
7 years ago
2.2.2
7 years ago
2.2.1
7 years ago
2.2.0
7 years ago
2.1.0
7 years ago
2.0.6
7 years ago
2.0.5
7 years ago
2.0.4
7 years ago
2.0.3
7 years ago
2.0.2
7 years ago
2.0.1
7 years ago
2.0.0
7 years ago
1.0.9
7 years ago
1.0.8
7 years ago
1.0.7
8 years ago
1.0.6
8 years ago
1.0.5
8 years ago
1.0.4
8 years ago
1.0.3
8 years ago
1.0.2
8 years ago
1.0.1
8 years ago
1.0.0
8 years ago