Skip to content

Commit

Permalink
feat: support extends query parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
yndu13 authored and JacksonTian committed Jul 15, 2024
1 parent b8547c3 commit ed8f1ba
Show file tree
Hide file tree
Showing 18 changed files with 325 additions and 50 deletions.
82 changes: 77 additions & 5 deletions csharp/core/Client.cs

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions csharp/core/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@
// Build Number
// Revision
//
[assembly : AssemblyVersion("0.1.9.0")]
[assembly : AssemblyFileVersion("0.1.9.0")]
[assembly : AssemblyVersion("0.1.10.0")]
[assembly : AssemblyFileVersion("0.1.10.0")]
2 changes: 1 addition & 1 deletion csharp/core/client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="AlibabaCloud.TeaUtil" Version="0.1.18"/>
<PackageReference Include="AlibabaCloud.TeaUtil" Version="0.1.19"/>
<PackageReference Include="Aliyun.Credentials" Version="1.3.2"/>
<PackageReference Include="AlibabaCloud.OpenApiUtil" Version="1.1.1"/>
<PackageReference Include="Tea" Version="1.0.11"/>
Expand Down
34 changes: 32 additions & 2 deletions golang/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -674,12 +674,17 @@ func (client *Client) DoRPCRequest(action *string, version *string, protocol *st
}

extendsHeaders := make(map[string]*string)
extendsQueries := make(map[string]*string)
if !tea.BoolValue(util.IsUnset(runtime.ExtendsParameters)) {
extendsParameters := runtime.ExtendsParameters
if !tea.BoolValue(util.IsUnset(extendsParameters.Headers)) {
extendsHeaders = extendsParameters.Headers
}

if !tea.BoolValue(util.IsUnset(extendsParameters.Queries)) {
extendsQueries = extendsParameters.Queries
}

}

request_.Query = tea.Merge(map[string]*string{
Expand All @@ -689,6 +694,7 @@ func (client *Client) DoRPCRequest(action *string, version *string, protocol *st
"Timestamp": openapiutil.GetTimestamp(),
"SignatureNonce": util.GetNonce(),
}, globalQueries,
extendsQueries,
request.Query)
headers, _err := client.GetRpcHeaders()
if _err != nil {
Expand Down Expand Up @@ -974,12 +980,17 @@ func (client *Client) DoROARequest(action *string, version *string, protocol *st
}

extendsHeaders := make(map[string]*string)
extendsQueries := make(map[string]*string)
if !tea.BoolValue(util.IsUnset(runtime.ExtendsParameters)) {
extendsParameters := runtime.ExtendsParameters
if !tea.BoolValue(util.IsUnset(extendsParameters.Headers)) {
extendsHeaders = extendsParameters.Headers
}

if !tea.BoolValue(util.IsUnset(extendsParameters.Queries)) {
extendsQueries = extendsParameters.Queries
}

}

request_.Headers = tea.Merge(map[string]*string{
Expand All @@ -1000,7 +1011,8 @@ func (client *Client) DoROARequest(action *string, version *string, protocol *st
request_.Headers["content-type"] = tea.String("application/json; charset=utf-8")
}

request_.Query = globalQueries
request_.Query = tea.Merge(globalQueries,
extendsQueries)
if !tea.BoolValue(util.IsUnset(request.Query)) {
request_.Query = tea.Merge(request_.Query,
request.Query)
Expand Down Expand Up @@ -1251,12 +1263,17 @@ func (client *Client) DoROARequestWithForm(action *string, version *string, prot
}

extendsHeaders := make(map[string]*string)
extendsQueries := make(map[string]*string)
if !tea.BoolValue(util.IsUnset(runtime.ExtendsParameters)) {
extendsParameters := runtime.ExtendsParameters
if !tea.BoolValue(util.IsUnset(extendsParameters.Headers)) {
extendsHeaders = extendsParameters.Headers
}

if !tea.BoolValue(util.IsUnset(extendsParameters.Queries)) {
extendsQueries = extendsParameters.Queries
}

}

request_.Headers = tea.Merge(map[string]*string{
Expand All @@ -1282,7 +1299,8 @@ func (client *Client) DoROARequestWithForm(action *string, version *string, prot
request_.Headers["content-type"] = tea.String("application/x-www-form-urlencoded")
}

request_.Query = globalQueries
request_.Query = tea.Merge(globalQueries,
extendsQueries)
if !tea.BoolValue(util.IsUnset(request.Query)) {
request_.Query = tea.Merge(request_.Query,
request.Query)
Expand Down Expand Up @@ -1533,15 +1551,21 @@ func (client *Client) DoRequest(params *Params, request *OpenApiRequest, runtime
}

extendsHeaders := make(map[string]*string)
extendsQueries := make(map[string]*string)
if !tea.BoolValue(util.IsUnset(runtime.ExtendsParameters)) {
extendsParameters := runtime.ExtendsParameters
if !tea.BoolValue(util.IsUnset(extendsParameters.Headers)) {
extendsHeaders = extendsParameters.Headers
}

if !tea.BoolValue(util.IsUnset(extendsParameters.Queries)) {
extendsQueries = extendsParameters.Queries
}

}

request_.Query = tea.Merge(globalQueries,
extendsQueries,
request.Query)
// endpoint is setted in product client
request_.Headers = tea.Merge(map[string]*string{
Expand Down Expand Up @@ -1863,12 +1887,17 @@ func (client *Client) Execute(params *Params, request *OpenApiRequest, runtime *
}

extendsHeaders := make(map[string]*string)
extendsQueries := make(map[string]*string)
if !tea.BoolValue(util.IsUnset(runtime.ExtendsParameters)) {
extendsParameters := runtime.ExtendsParameters
if !tea.BoolValue(util.IsUnset(extendsParameters.Headers)) {
extendsHeaders = extendsParameters.Headers
}

if !tea.BoolValue(util.IsUnset(extendsParameters.Queries)) {
extendsQueries = extendsParameters.Queries
}

}

requestContext := &spi.InterceptorContextRequest{
Expand All @@ -1877,6 +1906,7 @@ func (client *Client) Execute(params *Params, request *OpenApiRequest, runtime *
request.Headers,
headers),
Query: tea.Merge(globalQueries,
extendsQueries,
request.Query),
Body: request.Body,
Stream: request.Stream,
Expand Down
2 changes: 1 addition & 1 deletion golang/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.4
github.com/alibabacloud-go/openapi-util v0.1.0
github.com/alibabacloud-go/tea v1.2.1
github.com/alibabacloud-go/tea-utils/v2 v2.0.5
github.com/alibabacloud-go/tea-utils/v2 v2.0.6
github.com/alibabacloud-go/tea-xml v1.1.3
github.com/aliyun/credentials-go v1.3.1
github.com/clbanning/mxj/v2 v2.5.5 // indirect
Expand Down
2 changes: 1 addition & 1 deletion java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>tea-util</artifactId>
<version>0.2.22</version>
<version>0.2.23</version>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
Expand Down
38 changes: 36 additions & 2 deletions java/src/main/java/com/aliyun/teaopenapi/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,17 @@ public Client(com.aliyun.teaopenapi.models.Config config) throws Exception {
}

java.util.Map<String, String> extendsHeaders = new java.util.HashMap<>();
java.util.Map<String, String> extendsQueries = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(runtime.extendsParameters)) {
com.aliyun.teautil.models.ExtendsParameters extendsParameters = runtime.extendsParameters;
if (!com.aliyun.teautil.Common.isUnset(extendsParameters.headers)) {
extendsHeaders = extendsParameters.headers;
}

if (!com.aliyun.teautil.Common.isUnset(extendsParameters.queries)) {
extendsQueries = extendsParameters.queries;
}

}

request_.query = TeaConverter.merge(String.class,
Expand All @@ -190,6 +195,7 @@ public Client(com.aliyun.teaopenapi.models.Config config) throws Exception {
new TeaPair("SignatureNonce", com.aliyun.teautil.Common.getNonce())
),
globalQueries,
extendsQueries,
request.query
);
java.util.Map<String, String> headers = this.getRpcHeaders();
Expand Down Expand Up @@ -399,12 +405,17 @@ public Client(com.aliyun.teaopenapi.models.Config config) throws Exception {
}

java.util.Map<String, String> extendsHeaders = new java.util.HashMap<>();
java.util.Map<String, String> extendsQueries = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(runtime.extendsParameters)) {
com.aliyun.teautil.models.ExtendsParameters extendsParameters = runtime.extendsParameters;
if (!com.aliyun.teautil.Common.isUnset(extendsParameters.headers)) {
extendsHeaders = extendsParameters.headers;
}

if (!com.aliyun.teautil.Common.isUnset(extendsParameters.queries)) {
extendsQueries = extendsParameters.queries;
}

}

request_.headers = TeaConverter.merge(String.class,
Expand All @@ -428,7 +439,10 @@ public Client(com.aliyun.teaopenapi.models.Config config) throws Exception {
request_.headers.put("content-type", "application/json; charset=utf-8");
}

request_.query = globalQueries;
request_.query = TeaConverter.merge(String.class,
globalQueries,
extendsQueries
);
if (!com.aliyun.teautil.Common.isUnset(request.query)) {
request_.query = TeaConverter.merge(String.class,
request_.query,
Expand Down Expand Up @@ -606,12 +620,17 @@ public Client(com.aliyun.teaopenapi.models.Config config) throws Exception {
}

java.util.Map<String, String> extendsHeaders = new java.util.HashMap<>();
java.util.Map<String, String> extendsQueries = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(runtime.extendsParameters)) {
com.aliyun.teautil.models.ExtendsParameters extendsParameters = runtime.extendsParameters;
if (!com.aliyun.teautil.Common.isUnset(extendsParameters.headers)) {
extendsHeaders = extendsParameters.headers;
}

if (!com.aliyun.teautil.Common.isUnset(extendsParameters.queries)) {
extendsQueries = extendsParameters.queries;
}

}

request_.headers = TeaConverter.merge(String.class,
Expand All @@ -636,7 +655,10 @@ public Client(com.aliyun.teaopenapi.models.Config config) throws Exception {
request_.headers.put("content-type", "application/x-www-form-urlencoded");
}

request_.query = globalQueries;
request_.query = TeaConverter.merge(String.class,
globalQueries,
extendsQueries
);
if (!com.aliyun.teautil.Common.isUnset(request.query)) {
request_.query = TeaConverter.merge(String.class,
request_.query,
Expand Down Expand Up @@ -812,16 +834,22 @@ public Client(com.aliyun.teaopenapi.models.Config config) throws Exception {
}

java.util.Map<String, String> extendsHeaders = new java.util.HashMap<>();
java.util.Map<String, String> extendsQueries = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(runtime.extendsParameters)) {
com.aliyun.teautil.models.ExtendsParameters extendsParameters = runtime.extendsParameters;
if (!com.aliyun.teautil.Common.isUnset(extendsParameters.headers)) {
extendsHeaders = extendsParameters.headers;
}

if (!com.aliyun.teautil.Common.isUnset(extendsParameters.queries)) {
extendsQueries = extendsParameters.queries;
}

}

request_.query = TeaConverter.merge(String.class,
globalQueries,
extendsQueries,
request.query
);
// endpoint is setted in product client
Expand Down Expand Up @@ -1058,12 +1086,17 @@ public Client(com.aliyun.teaopenapi.models.Config config) throws Exception {
}

java.util.Map<String, String> extendsHeaders = new java.util.HashMap<>();
java.util.Map<String, String> extendsQueries = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(runtime.extendsParameters)) {
com.aliyun.teautil.models.ExtendsParameters extendsParameters = runtime.extendsParameters;
if (!com.aliyun.teautil.Common.isUnset(extendsParameters.headers)) {
extendsHeaders = extendsParameters.headers;
}

if (!com.aliyun.teautil.Common.isUnset(extendsParameters.queries)) {
extendsQueries = extendsParameters.queries;
}

}

com.aliyun.gateway.spi.models.InterceptorContext.InterceptorContextRequest requestContext = com.aliyun.gateway.spi.models.InterceptorContext.InterceptorContextRequest.build(TeaConverter.buildMap(
Expand All @@ -1075,6 +1108,7 @@ public Client(com.aliyun.teaopenapi.models.Config config) throws Exception {
)),
new TeaPair("query", TeaConverter.merge(String.class,
globalQueries,
extendsQueries,
request.query
)),
new TeaPair("body", request.body),
Expand Down
Loading

0 comments on commit ed8f1ba

Please sign in to comment.