// Copyright YEAR Google LLC. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Code generated file. DO NOT EDIT. // Package healthcare provides access to the Cloud Healthcare API. // // For product documentation, see: https://cloud.google.com/healthcare // // Creating a client // // Usage example: // // import "google.golang.org/api/healthcare/v1beta1" // ... // ctx := context.Background() // healthcareService, err := healthcare.NewService(ctx) // // In this example, Google Application Default Credentials are used for authentication. // // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials. // // Other authentication options // // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey: // // healthcareService, err := healthcare.NewService(ctx, option.WithAPIKey("AIza...")) // // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource: // // config := &oauth2.Config{...} // // ... // token, err := config.Exchange(ctx, ...) // healthcareService, err := healthcare.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) // // See https://godoc.org/google.golang.org/api/option/ for details on options. package healthcare // import "google.golang.org/api/healthcare/v1beta1" import ( "bytes" "context" "encoding/json" "errors" "fmt" "io" "net/http" "net/url" "strconv" "strings" googleapi "google.golang.org/api/googleapi" internal "google.golang.org/api/internal" gensupport "google.golang.org/api/internal/gensupport" option "google.golang.org/api/option" internaloption "google.golang.org/api/option/internaloption" htransport "google.golang.org/api/transport/http" ) // Always reference these packages, just in case the auto-generated code // below doesn't. var _ = bytes.NewBuffer var _ = strconv.Itoa var _ = fmt.Sprintf var _ = json.NewDecoder var _ = io.Copy var _ = url.Parse var _ = gensupport.MarshalJSON var _ = googleapi.Version var _ = errors.New var _ = strings.Replace var _ = context.Canceled var _ = internaloption.WithDefaultEndpoint const apiId = "healthcare:v1beta1" const apiName = "healthcare" const apiVersion = "v1beta1" const basePath = "https://healthcare.googleapis.com/" const mtlsBasePath = "https://healthcare.mtls.googleapis.com/" // OAuth2 scopes used by this API. const ( // View and manage your data across Google Cloud Platform services CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform" ) // NewService creates a new Service. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { scopesOption := internaloption.WithDefaultScopes( "https://www.googleapis.com/auth/cloud-platform", ) // NOTE: prepend, so we don't override user-specified scopes. opts = append([]option.ClientOption{scopesOption}, opts...) opts = append(opts, internaloption.WithDefaultEndpoint(basePath)) opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath)) client, endpoint, err := htransport.NewClient(ctx, opts...) if err != nil { return nil, err } s, err := New(client) if err != nil { return nil, err } if endpoint != "" { s.BasePath = endpoint } return s, nil } // New creates a new Service. It uses the provided http.Client for requests. // // Deprecated: please use NewService instead. // To provide a custom HTTP client, use option.WithHTTPClient. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. func New(client *http.Client) (*Service, error) { if client == nil { return nil, errors.New("client is nil") } s := &Service{client: client, BasePath: basePath} s.Projects = NewProjectsService(s) return s, nil } type Service struct { client *http.Client BasePath string // API endpoint base URL UserAgent string // optional additional User-Agent fragment Projects *ProjectsService } func (s *Service) userAgent() string { if s.UserAgent == "" { return googleapi.UserAgent } return googleapi.UserAgent + " " + s.UserAgent } func NewProjectsService(s *Service) *ProjectsService { rs := &ProjectsService{s: s} rs.Locations = NewProjectsLocationsService(s) return rs } type ProjectsService struct { s *Service Locations *ProjectsLocationsService } func NewProjectsLocationsService(s *Service) *ProjectsLocationsService { rs := &ProjectsLocationsService{s: s} rs.Datasets = NewProjectsLocationsDatasetsService(s) return rs } type ProjectsLocationsService struct { s *Service Datasets *ProjectsLocationsDatasetsService } func NewProjectsLocationsDatasetsService(s *Service) *ProjectsLocationsDatasetsService { rs := &ProjectsLocationsDatasetsService{s: s} rs.FhirStores = NewProjectsLocationsDatasetsFhirStoresService(s) return rs } type ProjectsLocationsDatasetsService struct { s *Service FhirStores *ProjectsLocationsDatasetsFhirStoresService } func NewProjectsLocationsDatasetsFhirStoresService(s *Service) *ProjectsLocationsDatasetsFhirStoresService { rs := &ProjectsLocationsDatasetsFhirStoresService{s: s} rs.Fhir = NewProjectsLocationsDatasetsFhirStoresFhirService(s) return rs } type ProjectsLocationsDatasetsFhirStoresService struct { s *Service Fhir *ProjectsLocationsDatasetsFhirStoresFhirService } func NewProjectsLocationsDatasetsFhirStoresFhirService(s *Service) *ProjectsLocationsDatasetsFhirStoresFhirService { rs := &ProjectsLocationsDatasetsFhirStoresFhirService{s: s} return rs } type ProjectsLocationsDatasetsFhirStoresFhirService struct { s *Service } // HttpBody: Message that represents an arbitrary HTTP body. It should // only be used for // payload formats that can't be represented as JSON, such as raw binary // or // an HTML page. // // // This message can be used both in streaming and non-streaming API // methods in // the request as well as the response. // // It can be used as a top-level request field, which is convenient if // one // wants to extract parameters from either the URL or HTTP template into // the // request fields and also want access to the raw HTTP body. // // Example: // // message GetResourceRequest { // // A unique request id. // string request_id = 1; // // // The raw HTTP body is bound to this field. // google.api.HttpBody http_body = 2; // } // // service ResourceService { // rpc GetResource(GetResourceRequest) returns // (google.api.HttpBody); // rpc UpdateResource(google.api.HttpBody) returns // (google.protobuf.Empty); // } // // Example with streaming methods: // // service CaldavService { // rpc GetCalendar(stream google.api.HttpBody) // returns (stream google.api.HttpBody); // rpc UpdateCalendar(stream google.api.HttpBody) // returns (stream google.api.HttpBody); // } // // Use of this type only changes how the request and response bodies // are // handled, all other features will continue to work unchanged. type HttpBody struct { // ContentType: The HTTP Content-Type header value specifying the // content type of the body. ContentType string `json:"contentType,omitempty"` // Data: The HTTP request/response body as raw binary. Data string `json:"data,omitempty"` // Extensions: Application specific response metadata. Must be set in // the first response // for streaming APIs. Extensions []googleapi.RawMessage `json:"extensions,omitempty"` // ServerResponse contains the HTTP response code and headers from the // server. googleapi.ServerResponse `json:"-"` // ForceSendFields is a list of field names (e.g. "ContentType") to // unconditionally include in API requests. By default, fields with // empty or default values are omitted from API requests. However, any // non-pointer, non-interface field appearing in ForceSendFields will be // sent to the server regardless of whether the field is empty or not. // This may be used to include empty fields in Patch requests. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "ContentType") to include // in API requests with the JSON null value. By default, fields with // empty values are omitted from API requests. However, any field with // an empty value appearing in NullFields will be sent to the server as // null. It is an error if a field in this list has a non-empty value. // This may be used to include null fields in Patch requests. NullFields []string `json:"-"` } func (s *HttpBody) MarshalJSON() ([]byte, error) { type NoMethod HttpBody raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } // method id "healthcare.projects.locations.datasets.fhirStores.fhir.createResource": type ProjectsLocationsDatasetsFhirStoresFhirCreateResourceCall struct { s *Service parent string type_ string body_ io.Reader urlParams_ gensupport.URLParams ctx_ context.Context header_ http.Header } // CreateResource: Creates a FHIR resource. // // // - parent: The name of the FHIR store this resource belongs to. // - type: The type of the resource to create. func (r *ProjectsLocationsDatasetsFhirStoresFhirService) CreateResource(parent string, type_ string, body_ io.Reader) *ProjectsLocationsDatasetsFhirStoresFhirCreateResourceCall { c := &ProjectsLocationsDatasetsFhirStoresFhirCreateResourceCall{s: r.s, urlParams_: make(gensupport.URLParams)} c.parent = parent c.type_ = type_ c.body_ = body_ return c } // Fields allows partial responses to be retrieved. See // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse // for more information. func (c *ProjectsLocationsDatasetsFhirStoresFhirCreateResourceCall) Fields(s ...googleapi.Field) *ProjectsLocationsDatasetsFhirStoresFhirCreateResourceCall { c.urlParams_.Set("fields", googleapi.CombineFields(s)) return c } // Context sets the context to be used in this call's Do method. Any // pending HTTP request will be aborted if the provided context is // canceled. func (c *ProjectsLocationsDatasetsFhirStoresFhirCreateResourceCall) Context(ctx context.Context) *ProjectsLocationsDatasetsFhirStoresFhirCreateResourceCall { c.ctx_ = ctx return c } // Header returns an http.Header that can be modified by the caller to // add HTTP headers to the request. func (c *ProjectsLocationsDatasetsFhirStoresFhirCreateResourceCall) Header() http.Header { if c.header_ == nil { c.header_ = make(http.Header) } return c.header_ } func (c *ProjectsLocationsDatasetsFhirStoresFhirCreateResourceCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) for k, v := range c.header_ { reqHeaders[k] = v } reqHeaders.Set("User-Agent", c.s.userAgent()) var body io.Reader = nil body = c.body_ urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+parent}/fhir/{+type}") urls += "?" + c.urlParams_.Encode() req, err := http.NewRequest("POST", urls, body) if err != nil { return nil, err } req.Header = reqHeaders googleapi.Expand(req.URL, map[string]string{ "parent": c.parent, "type": c.type_, }) return gensupport.SendRequest(c.ctx_, c.s.client, req) } // Do executes the "healthcare.projects.locations.datasets.fhirStores.fhir.createResource" call. func (c *ProjectsLocationsDatasetsFhirStoresFhirCreateResourceCall) Do(opts ...googleapi.CallOption) (*http.Response, error) { gensupport.SetOptions(c.urlParams_, opts...) return c.doRequest("") // { // "description": "Creates a FHIR resource.\n", // "flatPath": "v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/fhirStores/{fhirStoresId}/fhir/{fhirId}", // "httpMethod": "POST", // "id": "healthcare.projects.locations.datasets.fhirStores.fhir.createResource", // "parameterOrder": [ // "parent", // "type" // ], // "parameters": { // "parent": { // "description": "The name of the FHIR store this resource belongs to.", // "location": "path", // "pattern": "^projects/[^/]+/locations/[^/]+/datasets/[^/]+/fhirStores/[^/]+$", // "required": true, // "type": "string" // }, // "type": { // "description": "The type of the resource to create.", // "location": "path", // "pattern": "^[^/]+$", // "required": true, // "type": "string" // } // }, // "path": "v1beta1/{+parent}/fhir/{+type}", // "request": { // "$ref": "HttpBody" // }, // "response": { // "$ref": "HttpBody" // }, // "scopes": [ // "https://www.googleapis.com/auth/cloud-platform" // ] // } } // method id "healthcare.projects.locations.datasets.fhirStores.fhir.read": type ProjectsLocationsDatasetsFhirStoresFhirReadCall struct { s *Service name string urlParams_ gensupport.URLParams ifNoneMatch_ string ctx_ context.Context header_ http.Header } // Read: Gets the contents of a FHIR resource. // // Implements the FHIR standard read // interaction // (http://hl7.org/implement/standards/fhir/STU3/http.html#read). // // Also supports the FHIR standard conditional read // interaction // (http://hl7.org/implement/standards/fhir/STU3/http.html#cread) // specified by supplying an `If-Modified-Since` header with a date/time // value // or an `If-None-Match` header with an ETag value. // // On success, the response body will contain a JSON-encoded // representation // of the resource. // Errors generated by the FHIR store will contain a // JSON-encoded // `OperationOutcome` resource describing the reason for the error. If // the // request cannot be mapped to a valid API method on a FHIR store, a // generic // GCP error might be returned instead. // // - name: The name of the resource to retrieve. func (r *ProjectsLocationsDatasetsFhirStoresFhirService) Read(name string) *ProjectsLocationsDatasetsFhirStoresFhirReadCall { c := &ProjectsLocationsDatasetsFhirStoresFhirReadCall{s: r.s, urlParams_: make(gensupport.URLParams)} c.name = name return c } // Fields allows partial responses to be retrieved. See // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse // for more information. func (c *ProjectsLocationsDatasetsFhirStoresFhirReadCall) Fields(s ...googleapi.Field) *ProjectsLocationsDatasetsFhirStoresFhirReadCall { c.urlParams_.Set("fields", googleapi.CombineFields(s)) return c } // IfNoneMatch sets the optional parameter which makes the operation // fail if the object's ETag matches the given value. This is useful for // getting updates only after the object has changed since the last // request. Use googleapi.IsNotModified to check whether the response // error from Do is the result of In-None-Match. func (c *ProjectsLocationsDatasetsFhirStoresFhirReadCall) IfNoneMatch(entityTag string) *ProjectsLocationsDatasetsFhirStoresFhirReadCall { c.ifNoneMatch_ = entityTag return c } // Context sets the context to be used in this call's Do method. Any // pending HTTP request will be aborted if the provided context is // canceled. func (c *ProjectsLocationsDatasetsFhirStoresFhirReadCall) Context(ctx context.Context) *ProjectsLocationsDatasetsFhirStoresFhirReadCall { c.ctx_ = ctx return c } // Header returns an http.Header that can be modified by the caller to // add HTTP headers to the request. func (c *ProjectsLocationsDatasetsFhirStoresFhirReadCall) Header() http.Header { if c.header_ == nil { c.header_ = make(http.Header) } return c.header_ } func (c *ProjectsLocationsDatasetsFhirStoresFhirReadCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) for k, v := range c.header_ { reqHeaders[k] = v } reqHeaders.Set("User-Agent", c.s.userAgent()) if c.ifNoneMatch_ != "" { reqHeaders.Set("If-None-Match", c.ifNoneMatch_) } var body io.Reader = nil c.urlParams_.Set("alt", alt) c.urlParams_.Set("prettyPrint", "false") urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}") urls += "?" + c.urlParams_.Encode() req, err := http.NewRequest("GET", urls, body) if err != nil { return nil, err } req.Header = reqHeaders googleapi.Expand(req.URL, map[string]string{ "name": c.name, }) return gensupport.SendRequest(c.ctx_, c.s.client, req) } // Do executes the "healthcare.projects.locations.datasets.fhirStores.fhir.read" call. func (c *ProjectsLocationsDatasetsFhirStoresFhirReadCall) Do(opts ...googleapi.CallOption) (*http.Response, error) { gensupport.SetOptions(c.urlParams_, opts...) return c.doRequest("") // { // "description": "Gets the contents of a FHIR resource.\n\nImplements the FHIR standard [read\ninteraction](http://hl7.org/implement/standards/fhir/STU3/http.html#read).\n\nAlso supports the FHIR standard [conditional read\ninteraction](http://hl7.org/implement/standards/fhir/STU3/http.html#cread)\nspecified by supplying an `If-Modified-Since` header with a date/time value\nor an `If-None-Match` header with an ETag value.\n\nOn success, the response body will contain a JSON-encoded representation\nof the resource.\nErrors generated by the FHIR store will contain a JSON-encoded\n`OperationOutcome` resource describing the reason for the error. If the\nrequest cannot be mapped to a valid API method on a FHIR store, a generic\nGCP error might be returned instead.", // "flatPath": "v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/fhirStores/{fhirStoresId}/fhir/{fhirId}/{fhirId1}", // "httpMethod": "GET", // "id": "healthcare.projects.locations.datasets.fhirStores.fhir.read", // "parameterOrder": [ // "name" // ], // "parameters": { // "name": { // "description": "The name of the resource to retrieve.", // "location": "path", // "pattern": "^projects/[^/]+/locations/[^/]+/datasets/[^/]+/fhirStores/[^/]+/fhir/[^/]+/[^/]+$", // "required": true, // "type": "string" // } // }, // "path": "v1beta1/{+name}", // "response": { // "$ref": "HttpBody" // }, // "scopes": [ // "https://www.googleapis.com/auth/cloud-platform" // ] // } }