Search

CN-121996439-A - Calling method and device of SDK interface, storage medium and electronic equipment

CN121996439ACN 121996439 ACN121996439 ACN 121996439ACN-121996439-A

Abstract

The application discloses a calling method, a device, a storage medium and electronic equipment of an SDK interface, wherein the method comprises the steps of receiving a data request sent by a client through an abstract interface, wherein the abstract interface is a universal interface which is uniformly researched and developed when the abstract interface is researched and developed for various clients, the data request comprises a target client identifier, inquiring an interface mapping table according to the target client identifier to obtain a target SDK interface, the interface mapping table comprises mapping relations between different client identifiers and the SDK interface, the target SDK interface is the SDK interface corresponding to the target client identifier, and processing the data request by calling the target SDK interface. Therefore, no matter whether the original actual interface of the SDK is changed or a new SDK interface is added, the client is not influenced, the interface of the client is not changed along with the change of the actual interface of the SDK, convenience is brought to the research and development or development of the client, and the expandability and maintainability of the system are improved.

Inventors

  • Cao Yingpei
  • DING TAO
  • FU LIANGCHENG
  • LI HAO

Assignees

  • 魔门塔(苏州)科技有限公司

Dates

Publication Date
20260508
Application Date
20241105

Claims (10)

  1. 1. A method for calling an SDK interface, wherein the method is applied to any software development kit SDK, the method comprising: Receiving a data request sent by a client through an abstract interface, wherein the abstract interface is a universal interface which is uniformly developed when the abstract interface is developed for various clients, and the data request comprises a target client identifier; Inquiring an interface mapping table according to the target client identifier to obtain a target SDK interface, wherein the interface mapping table comprises mapping relations between different client identifiers and the SDK interfaces, and the target SDK interface is the SDK interface corresponding to the target client identifier; and processing the data request by calling the target SDK interface.
  2. 2. The method of claim 1, wherein the code generation method of the SDK comprises: receiving an interface configuration file, wherein the interface configuration file comprises interface information of the SDK; and processing the interface information of the SDK by using an automatic code generation tool, and automatically generating the SDK code corresponding to the interface information.
  3. 3. The method of claim 2, wherein the interface information comprises at least one of a request method, a uniform resource locator URL, a protocol, a request header, a request body.
  4. 4. A method according to any of claims 1-3, characterized in that before receiving a data request sent by a client over an abstract interface, the method further comprises: and submitting interface information of the SDK and a client identifier of the SDK to a registry during initialization of the SDK, so that the registry writes the mapping relation between the interface information of the SDK and the client identifier of the SDK into the interface mapping table.
  5. 5. The method of claim 4, wherein querying an interface mapping table based on the target client identification obtains a target SDK interface, comprising: sending an interface query request carrying the target client identifier to the registry; And receiving the target SDK interface corresponding to the target client identifier queried by the registry in the interface mapping table.
  6. 6. A call device of an SDK interface, wherein the device is applied to any software development kit SDK, the device comprising: The system comprises a receiving unit, a processing unit and a processing unit, wherein the receiving unit is used for receiving a data request sent by a client through an abstract interface, the abstract interface is a universal interface which is uniformly developed when the abstract interface is developed for a plurality of clients, and the data request comprises a target client identifier; The query unit is used for querying an interface mapping table according to the target client identifier to obtain a target SDK interface, wherein the interface mapping table comprises mapping relations between different client identifiers and the SDK interfaces, and the target SDK interface is the SDK interface corresponding to the target client identifier; and the calling unit is used for processing the data request by calling the target SDK interface.
  7. 7. The apparatus of claim 6, wherein the code generation process of the SDK comprises receiving an interface configuration file, wherein the interface configuration file comprises interface information of the SDK, and processing the interface information of the SDK by an automated code generation tool to automatically generate an SDK code corresponding to the interface information.
  8. 8. The apparatus according to claim 6 or 7, characterized in that the apparatus further comprises: And the registration unit is used for submitting the interface information of the SDK and the client identification of the SDK to a registration center during initialization before receiving a data request sent by the client through the abstract interface, so that the registration center writes the mapping relation between the interface information of the SDK and the client identification of the SDK into the interface mapping table.
  9. 9. A computer readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any of claims 1-5.
  10. 10. An electronic device, the electronic device comprising: One or more processors; The processor is coupled with a storage device for storing one or more programs; The one or more programs, when executed by the one or more processors, cause the electronic device to implement the method of any of claims 1-5.

Description

Calling method and device of SDK interface, storage medium and electronic equipment Technical Field The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for calling an SDK interface, a storage medium, and an electronic device. Background In software development, SDKs (Software Development Kit, software development kits) are widely used to reduce repetition coding and improve development efficiency as a set of modules providing specific functions or data processing capabilities. However, due to the diversity of platforms or languages and the complexity of software business requirements, there may be problems of incompatibility of interfaces, high integration difficulty and the like between different SDKs. These problems increase the complexity of software development and maintenance costs. The conventional solution is to customize the version of the client corresponding to the SDK for each platform or language, but doing so may result in code redundancy, and when the SDK interface changes (including the original interface change and the newly added interface) due to the service requirement change, the interface of the corresponding client needs to be updated, which increases the maintenance difficulty. Disclosure of Invention The application provides a call method, a call device, a storage medium and electronic equipment of an SDK interface, which can simplify the development flow of a client corresponding to the SDK and improve the development efficiency and the expandability and maintainability of a system. The specific technical scheme is as follows: In a first aspect, an embodiment of the present application provides a method for calling an SDK interface, where the method is applied to any software development kit SDK, and the method includes: Receiving a data request sent by a client through an abstract interface, wherein the abstract interface is a universal interface which is uniformly developed when the abstract interface is developed for various clients, and the data request comprises a target client identifier; Inquiring an interface mapping table according to the target client identifier to obtain a target SDK interface, wherein the interface mapping table comprises mapping relations between different client identifiers and the SDK interfaces, and the target SDK interface is the SDK interface corresponding to the target client identifier; and processing the data request by calling the target SDK interface. According to the scheme, the abstract interface is configured for each client in advance, when the client sends the data request to the SDK, the data request can be directly sent through the abstract interface, the SDK can inquire the interface mapping table according to the target client identification in the data request, and the actual interface of the SDK is obtained to be called, so that on the basis of ensuring normal communication between the client and the SDK, no matter whether the original actual interface of the SDK is changed or not, or a new SDK interface is added, the influence on the client is avoided, the interface of the client is not changed along with the change of the actual interface of the SDK, the call flow of a client application program to the SDK interface is simplified, the underlying implementation details are not required to be concerned, the study cost and the integration time of a developer are reduced, and the expandability and maintainability of the system are improved. In one possible implementation manner, the code generation method of the SDK includes: receiving an interface configuration file, wherein the interface configuration file comprises interface information of the SDK; and processing the interface information of the SDK by using an automatic code generation tool, and automatically generating the SDK code corresponding to the interface information. According to the scheme, the embodiment of the application automatically generates the complete SDK code through the interface configuration file and the automatic code generation tool, and a technician only needs to fill in interface information required to be configured without writing the complete SDK code, so that the error rate and the workload of manually writing the code are reduced, the manpower is saved, and the progress of software development is accelerated. In one possible implementation manner, the interface information includes at least one of a request method, a uniform resource locator URL, a protocol, a request header, and a request body. In one possible implementation, before receiving a data request sent by a client through an abstract interface, the method further includes: and submitting interface information of the SDK and a client identifier of the SDK to a registry during initialization of the SDK, so that the registry writes the mapping relation between the interface information of the SDK and the client identifier of