File tree Expand file tree Collapse file tree
ai/generativelanguage/apiv1beta Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ # Script to generate info.go.
4+
5+ outfile=${1:-/ dev/ stdout}
6+
7+ cat << 'EOF ' > $outfile
8+ // Copyright 2023 Google LLC
9+ //
10+ // Licensed under the Apache License, Version 2.0 (the "License");
11+ // you may not use this file except in compliance with the License.
12+ // You may obtain a copy of the License at
13+ //
14+ // http://www.apache.org/licenses/LICENSE-2.0
15+ //
16+ // Unless required by applicable law or agreed to in writing, software
17+ // distributed under the License is distributed on an "AS IS" BASIS,
18+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19+ // See the License for the specific language governing permissions and
20+ // limitations under the License.
21+
22+ // SetGoogleClientInfo sets the name and version of the application in
23+ // the `x-goog-api-client` header passed on each request. Also passes any
24+ // provided key-value pairs. Intended for use by Google-written clients.
25+ //
26+ // Internal use only.
27+
28+ package generativelanguage
29+
30+ //go:generate ./gen_info.sh info.go
31+
32+ EOF
33+
34+ awk ' /^func \(c \*[A-Z].*\) setGoogleClientInfo/ {
35+ printf("func (c %s SetGoogleClientInfo(keyval ...string) {\n", $3);
36+ printf(" c.setGoogleClientInfo(keyval...)\n");
37+ printf("}\n\n");
38+ }' * _client.go >> $outfile
39+
40+ gofmt -w $outfile
Original file line number Diff line number Diff line change 2020
2121package generativelanguage
2222
23+ //go:generate ./gen_info.sh info.go
24+
25+ func (c * DiscussClient ) SetGoogleClientInfo (keyval ... string ) {
26+ c .setGoogleClientInfo (keyval ... )
27+ }
28+
29+ func (c * FileClient ) SetGoogleClientInfo (keyval ... string ) {
30+ c .setGoogleClientInfo (keyval ... )
31+ }
32+
2333func (c * GenerativeClient ) SetGoogleClientInfo (keyval ... string ) {
2434 c .setGoogleClientInfo (keyval ... )
2535}
36+
37+ func (c * ModelClient ) SetGoogleClientInfo (keyval ... string ) {
38+ c .setGoogleClientInfo (keyval ... )
39+ }
40+
41+ func (c * PermissionClient ) SetGoogleClientInfo (keyval ... string ) {
42+ c .setGoogleClientInfo (keyval ... )
43+ }
44+
45+ func (c * RetrieverClient ) SetGoogleClientInfo (keyval ... string ) {
46+ c .setGoogleClientInfo (keyval ... )
47+ }
48+
49+ func (c * TextClient ) SetGoogleClientInfo (keyval ... string ) {
50+ c .setGoogleClientInfo (keyval ... )
51+ }
You can’t perform that action at this time.
0 commit comments