You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2022/03/17 03:50:53 UTC

[GitHub] [dolphinscheduler] zwZjut edited a comment on pull request #8946: [Feature-7946] add java sdk

zwZjut edited a comment on pull request #8946:
URL: https://github.com/apache/dolphinscheduler/pull/8946#issuecomment-1070255141


   The PR logic of Java SDK:It is divided into three layers. 
   (1)encapsulate a client for okhttp; 
   (2)encapsulate the call parameters; 
   (3)encapsulate a dolphin client as dsclient, and each dolphin's OpenAPI corresponds to a request and response; 
   All newly added interfaces should be implemented in the way that they have been implemented, combined with the open API document of dolphin, and just follow the example. At present, more than 50 of the main interfaces we use have been implemented, and others can be added as needed. Use token  of dolphin to make HTTP call.
   
   use dsclient to create project example:
   
    DSClient dsClient = DSClientHelper.getClient("xxx","xxxx"); //  (1) token; (2) endpoint
    CreateProjectRequest request = new CreateProjectRequest();
    request.body.projectName = "xxxx";
    request.body.description = "xxxx";
    CreateProjectResponse response = dsClient.createProject(request);
   
   add a http call example:
   (1)add XXXRequest.java  
   (2)add XXXResponse.java
   (3)add two method in DSClinet.java  
       public XXXResponse XXX(XXXRequest request) throws Exception {
           return this.XXXWithOptions(request, new RuntimeOptions());
       }
   public XXXResponse XXXWithOptions(XXXRequest request, RuntimeOptions runtime) throws Exception {
           Params params = new Params().setAction("XXX")
                   .setPathname("/dolphinscheduler/XXX")
           return TeaModel.toModel(this.doRequest(request, params, runtime), XXXResponse.class);
       }
   RuntimeOptions used to set http run time params, default is good enough
   
   
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org