npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

whalecloud-dxp-api-react-native

v1.0.2

Published

This section explains how to use the SDK and illustrates it with an example: - This chapter is essential to learn - For specific business development, see [Bussiness Scenario](https://www.digchan.info/en-US/dxp/user-sso/sign-up) - The Business Scenario pr

Downloads

67

Readme

DXP API SDK

This section explains how to use the SDK and illustrates it with an example:

  • This chapter is essential to learn
  • For specific business development, see Bussiness Scenario
    • The Business Scenario provides detailed business interface call processes, which can guide your development based on the flowcharts.
  • For interface details, see Experience Api
    • The interface details include specific input parameters, output parameters, and exception information
    • To call an interface in the SDK: const response = DXPRequest.BusinessCategory.SpecificInterface(inputParameters)
    • During development, some common interfaces are available: Common Api

Integration

  1. Add the npm package reference to the package.json in your project, for example:

    	"dependencies": {
    		"whalecloud-dxp-api-react-native": "1.0.0"
    	}
  2. Run yarn add whalecloud-dxp-api-react-native --registry=https://verdaccio.digchan.info/ in the root directory of your project to install the new dependency.

  3. Rebuild and run your React Native project.

Configuration

Modify the network request configuration object Set the request URL(basePath),Initialize using the DXPRequest.initConfig method

import { DXPRequest } from "./DXPHttpRequest";
// Create configuration object
const configuration = new Configuration({
     basePath: 'https://demo.com/path', // Replace with your API base URL
});
// Initialize configuration information
DXPRequest.initConfig(configuration);

Set Auth Token

DXP provides various user authentication methods. This section explains how to configure user login authentication using a username and password. For more details, please refer to this link

import { DXPRequest } from "./DXPHttpRequest";
const request={
  loginAcct: "account number",
  password: "password"
}
DXPRequest.pwdLogin(request)
  .then(response=>{
    // response contains information returned after login
    // response.resultMsg is a message returned by the backend upon successful login
    console.log(response.resultMsg);
    // A token is returned upon successful user login
    console.log(response.data.token);
    // User information, such as mobile
    console.log(response.data.userInfo.mobile);
    // Set the obtained token information to a global variable (this step might be omitted later)
    DXPRequest.setToken({accessToken:"token"});
})
  .catch(error=>{
    // Exception information obtained when login fails
    console.log(error.resultMsg);    
  });

Usage Example

After a successful user login, call Query Account Detail to get account details.

import { DXPRequest } from "./DXPHttpRequest";
const acctNbr='12345678';
DXPRequest.AccountManagement.queryAccountDetail(acctNbr)
  .then(response=>{
    // response contains the query result object
    // response.resultMsg is a message returned upon successful query
    console.log(response.resultMsg);
    // Account name retrieved from the query
    console.log(response.data.acctName);
  })
  .catch(error=>{
    // Exception information obtained when the call fails
    console.log(error.resultMsg);
  });

Advanced Features

How to Set Interceptors

Interceptors can be used to perform various operations:

  • Request Interceptor
    • You can add request headers uniformly through a request interceptor
import { DXPRequest } from "./DXPHttpRequest";
	  DXPRequest.interceptors.request.use(
	  config => {
	    // Add dynamic properties to request headers before sending the request
	    config.headers = {
	      ...config.headers,
        language:"English"
	      ,
	    };
	    return config;
	  },
	  error => {
	    // Do something with request error
	    return Promise.reject(error);
  }
  );
  • Response Interceptor
import { DXPRequest } from "./DXPHttpRequest";
	// Add response interceptors
DXPRequest.interceptors.response.use(
	  response => {
	    // Do something with response data
	    return response;
	  },
	  error => {
	    // Do something with response error
	    console.log(error);
      return error;
	  }
);