
Product
Rust Support Now in Beta
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
@orbis-systems/accounts-ts-sdk
Advanced tools
AMT SDK is designed to help clients consume Account Management API with ease. AMT SDK takes care of all the heavy lifting and provides out of the box ready to use object.
AMT SDK is designed to help clients consume Account Management API with ease. AMT SDK takes care of all the heavy lifting and provides out of the box ready to use object.
//APIConfigure.ts
import configureSDK from '@orbis-systems/accounts-ts-sdk';
const SDK = SDKClient({
environment: 'development'
});
export default SDK;
//App.ts
import SDK from '../api/APIConfigure';
class App extends React.Component<IProps> {
state: {
applications: [],
}
public async componentDidMount(): Promise<void> {
const user = SDK.rest.client.login('username', 'password', ['user.role']);
SDK.rest.client.autoRenewToken();`_**~~``~~**_`
const res = SDK.rest.applications.list();
if(res.success){
this.setState({
applications: res.data.applications,
});
}else{
res.error // handle error
}
}
public render(): JSX.Element {
return (
<>
{
this.state.applications.map(application => {
return (
//Render what's needed
);
})
}
</>
)
};
}
interface IConfig {
tokenExpired?: Function
onUnauthorized?: Function
onEndpointError?: Function
environment: 'production' | 'sandbox'
storage?: 'local' | 'session'
}
AMT SDK must be configured before use. It provides a configure function that takes a configuration object with options.
tokenExpired?: Function
optional
onUnauthorized?: Function
optional
onEndpointError?: Function
optional
environment: 'production' | 'sandbox'
required
storage?: local' | 'session
default: session
optional
import configureSDK from './index';
const SDK = configureSDK({
environment: 'production',
onEndpointError: (err): void => {
store.dispatch({
type: actionTypes.API_ERROR,
payload: err
});
},
onUnauthorized: (): void => {
store.dispatch({
type: actionTypes.AUTH_UNAUTHORIZED,
})
},
tokenExpired: (): void => {
localStorage.clear();
store.dispatch({
type: actionTypes.AUTH_LOGOUT,
});
},
storage: 'local'
});
AMT SDK provides a client
object that is used to authenticate with Accounts Management API. On a successful authentication AMT SDK stores the token provided into session storage for later use. All endpoints that are protected must be used after the client has authenticated, otherwise the onUnauthorized
function with be called. client
object has three methods.
login(email: string, password: string, includes?: Array<string>)
//Includes (`['user.role']`) is not required but if needed, please refer to Accounts Management API for available includes
const user = await SDK.rest.client.login('email', 'password', ['user.role']);
logout()
await SDK.rest.client.logout();
autoRenewToken(): boolean
//Called at root of application in order to start auto token renewal counter, otherwise tokenExpired() will be called when the token has expired
const success = SDK.rest.client.autoRenewToken();
Besides authentication all endpoints have the same structure.
To call an endpoint you must use the SDK.rest
object and then add the endpoint name.
/
becomes a .
-
is removed and word is camel cased//POST {{domain}}/api/applications/get-application-types
SDK.rest.applications.getApplicationTypes();
//POST {{domain}}/api/applications/submit
SDK.rest.applications.submit();
endpoint(data?: object, config?: IRequestConfig ) => Promise<any>
data
optional
is anything that is required by Accounts Management API{
with: [''], //Anything that your client needs
user_id: 1 //Or anything else required for given endpoint
}
config
optional
can be used to override defaults{
method?: string; //Default: 'POST'
urlQuery?: string | Array<string>; //Default: ''
params?: object; //Default {}
headers?: object; //Default { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json' }
}
interface Response {
data: any,
status: number | null,
success: boolean,
messages: { [key: string]: Array<string> },
error: {} | null
}
FAQs
AMT SDK is designed to help clients consume Account Management API with ease. AMT SDK takes care of all the heavy lifting and provides out of the box ready to use object.
The npm package @orbis-systems/accounts-ts-sdk receives a total of 53 weekly downloads. As such, @orbis-systems/accounts-ts-sdk popularity was classified as not popular.
We found that @orbis-systems/accounts-ts-sdk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.