heyuntao
2023-05-05 cc09b6fe6ffac34a4eeeb26d313b187713cae0de
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
using com.alibaba.openapi.client;
using com.alibaba.openapi.client.entity;
using com.alibaba.openapi.client.policy;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
using com.alibaba.china.openapi.client.example.param.apiexample;
 
namespace com.alibaba.china.openapi.client.example
{
 
    public class ExampleFacade
    {
        private ClientPolicy clientPolicy;
 
        public ExampleFacade(ClientPolicy clientPolicy)
        {
            this.clientPolicy = clientPolicy;
        }
 
        private SyncAPIClient getAPIClient()
        {
            return new SyncAPIClient(clientPolicy);
        }
 
        public AuthorizationToken getToken(string code)
        {
 
            return getAPIClient().getToken(code);
 
        }
 
        public AuthorizationToken refreshToken(String refreshToken)
        {
            return getAPIClient().refreshToken(refreshToken);
        }
 
                    
                       
           
        public ExampleFamilyGetResult exampleFamilyGet(ExampleFamilyGetParam param) {
            RequestPolicy reqPolicy = new RequestPolicy();
            reqPolicy.HttpMethod="POST";
            reqPolicy.NeedAuthorization=false;
            reqPolicy.RequestSendTimestamp=false;
            reqPolicy.UseHttps=false;
            reqPolicy.UseSignture=false;
            reqPolicy.AccessPrivateApi=false;
           
            AlibabaRequest request = new AlibabaRequest ();
            APIId apiId = new APIId();
            apiId.Name = "example.family.get";
            apiId.NamespaceValue = "api.example";
            apiId.Version = 1;
            request.ApiId = apiId;
                
            request.RequestEntity=param;            
                        
            return this.getAPIClient().send<ExampleFamilyGetResult>(request, reqPolicy);
        }
                    
                       
           
        public ExampleFamilyPostResult exampleFamilyPost(ExampleFamilyPostParam param,  string accessToken) {
            RequestPolicy reqPolicy = new RequestPolicy();
            reqPolicy.HttpMethod="POST";
            reqPolicy.NeedAuthorization=true;
            reqPolicy.RequestSendTimestamp=false;
            reqPolicy.UseHttps=false;
            reqPolicy.UseSignture=true;
            reqPolicy.AccessPrivateApi=false;
           
            AlibabaRequest request = new AlibabaRequest ();
            APIId apiId = new APIId();
            apiId.Name = "example.family.post";
            apiId.NamespaceValue = "api.example";
            apiId.Version = 1;
            request.ApiId = apiId;
                
            request.RequestEntity=param;            
            request.AccessToken=accessToken;            
            return this.getAPIClient().send<ExampleFamilyPostResult>(request, reqPolicy);
        }
           }
}