|
| 1 | +# google-api-go-generator |
| 2 | + |
| 3 | +This package is the discovery client generator for Go. It is used to generate |
| 4 | +all of the client libraries in this repository |
| 5 | + |
| 6 | +## Flags |
| 7 | + |
| 8 | +- `api` (`string`): The API ID to generate, like 'tasks:v1'. A value of `*` means |
| 9 | + all. (default "*") |
| 10 | +- `api_json_file` (`string`): If non-empty, the path to a local file on disk |
| 11 | + containing the API to generate. Exclusive with setting --api. |
| 12 | +- `api_pkg_base` (`string`):Go package prefix to use for all generated APIs. |
| 13 | + (default "google.golang.org/api") |
| 14 | +- `base_url` (`string`): (optional) Override the default service API URL. If empty, |
| 15 | + the service's root URL will be used. |
| 16 | +- `build` (`bool`): Compile generated packages. |
| 17 | +- `cache` (`bool`): Use cache of discovered Google API discovery documents. |
| 18 | + (default true) |
| 19 | +- `copyright_year` (`string`): Year for copyright. (default "2024") |
| 20 | +- `discoveryurl` (`string`): URL to root discovery document (default |
| 21 | + "www.googleapis.com/discovery/v1/apis") |
| 22 | +- `gendir` (`string`): Directory to use to write out generated Go files |
| 23 | +- `gensupport_pkg` (`string`): Go package path of the 'api/internal/gensupport' |
| 24 | + support package. (default "google.golang.org/api/internal/gensupport") |
| 25 | +- `googleapi_pkg` (`string`): Go package path of the 'api/googleapi' support |
| 26 | + package. (default "google.golang.org/api/googleapi") |
| 27 | +- `header_path` (`string`): If non-empty, prepend the contents of this file to |
| 28 | + generated services. |
| 29 | +- `htransport_pkg` (`string`): Go package path of the 'api/transport/http' support |
| 30 | + package. (default "google.golang.org/api/transport/http") |
| 31 | +- `install` (`bool`): Install generated packages. |
| 32 | +- `internal_pkg` (`string`): Go package path of the 'internal' support package. |
| 33 | + (default "google.golang.org/api/internal") |
| 34 | +- `internaloption_pkg` (`string`): Go package path of the |
| 35 | + 'api/option/internaloption' support package. (default |
| 36 | + "google.golang.org/api/option/internaloption") |
| 37 | +- `option_pkg` (`string`): Go package path of the 'api/option' support package. |
| 38 | + (default "google.golang.org/api/option") |
| 39 | +- `output` (`string`): (optional) Path to source output file. If not specified, |
| 40 | + the API name and version are used to construct an output path (e.g. tasks/v1). |
| 41 | +- `publiconly` (`bool`): Only build public, released APIs. Only applicable for |
| 42 | + Google employees. (default true) |
| 43 | + |
| 44 | +## Automated usage |
| 45 | + |
| 46 | +This generator runs daily via the automated bash script: |
| 47 | +[discogen.sh](../internal/kokoro/discogen.sh). |
| 48 | + |
| 49 | +## Example local usage |
| 50 | + |
| 51 | +### Run same command the automation uses |
| 52 | + |
| 53 | +`make all` |
| 54 | + |
| 55 | +### Generate a client from a local discovery document |
| 56 | + |
| 57 | +`go build -o google-api-go-generator && ./google-api-go-generator -cache=true -install -api_json_file=/path/to/file` |
| 58 | + |
| 59 | +### Refresh an existing client |
| 60 | + |
| 61 | +`go build -o google-api-go-generator && ./google-api-go-generator -cache=false -install -api=sevicename:vsomething -gendir=..` |
0 commit comments