-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathimpl.java.tmpl
More file actions
42 lines (37 loc) · 2.02 KB
/
Copy pathimpl.java.tmpl
File metadata and controls
42 lines (37 loc) · 2.02 KB
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
// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
package com.databricks.sdk.service.{{.Package.Name}};
import java.io.IOException;
import java.util.Collection;
import java.util.Map;
import org.apache.http.client.methods.*;
import com.databricks.sdk.client.ApiClient;
import com.databricks.sdk.client.DatabricksException;
import com.databricks.sdk.support.Generated;
/** Package-local implementation of {{.PascalName}} */
@Generated
class {{.PascalName}}Impl implements {{.PascalName}}Service {
private final ApiClient apiClient;
public {{.PascalName}}Impl(ApiClient apiClient) {
this.apiClient = apiClient;
}
{{range .Methods}}
@Override
public {{if .Response -}}{{template "type" .Response}}{{else}}void{{end}} {{.CamelName}}{{if .IsNameReserved}}Content{{end}}({{if .Request}}{{template "type" .Request}} request{{end}}) {
String path = {{if .PathParts -}}
String.format("{{range .PathParts}}{{.Prefix}}{{if or .Field .IsAccountId}}%s{{end}}{{ end }}"{{ range .PathParts }}{{if .Field}}, request.get{{.Field.PascalName}}(){{ else if .IsAccountId }}, apiClient.configuredAccountID(){{end}}{{ end }})
{{- else}}"{{.Path}}"{{end}};
{{if .Response -}}
{{- if .Response.ArrayValue -}} return apiClient.getCollection(path, null, {{template "type" .Response.ArrayValue}}.class);
{{- else if .Response.MapValue -}} return apiClient.getStringMap(path, request);
{{- else -}} return apiClient.{{.Verb}}(path{{if .Request}}, request{{end}}{{if .Response -}}, {{if .Response.ArrayValue }}Collection
{{- else if .Response.MapValue }}Map
{{- else}}{{template "type" .Response}}
{{- end -}}{{else}}, Void{{end}}.class);{{end}}
{{- else -}}apiClient.{{.Verb}}(path{{if .Request}}, request{{end}}{{if .Response -}}, {{if .Response.ArrayValue }}Collection
{{- else if .Response.MapValue }}Map
{{- else}}{{template "type" .Response}}
{{- end -}}{{else}}, Void{{end}}.class);
{{end}}
}
{{end}}
}