1// Copyright YEAR Google LLC. 2// Use of this source code is governed by a BSD-style 3// license that can be found in the LICENSE file. 4 5// Code generated file. DO NOT EDIT. 6 7// Package healthcare provides access to the Cloud Healthcare API. 8// 9// For product documentation, see: https://cloud.google.com/healthcare 10// 11// Creating a client 12// 13// Usage example: 14// 15// import "google.golang.org/api/healthcare/v1beta1" 16// ... 17// ctx := context.Background() 18// healthcareService, err := healthcare.NewService(ctx) 19// 20// In this example, Google Application Default Credentials are used for authentication. 21// 22// For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials. 23// 24// Other authentication options 25// 26// To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey: 27// 28// healthcareService, err := healthcare.NewService(ctx, option.WithAPIKey("AIza...")) 29// 30// To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource: 31// 32// config := &oauth2.Config{...} 33// // ... 34// token, err := config.Exchange(ctx, ...) 35// healthcareService, err := healthcare.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) 36// 37// See https://godoc.org/google.golang.org/api/option/ for details on options. 38package healthcare // import "google.golang.org/api/healthcare/v1beta1" 39 40import ( 41 "bytes" 42 "context" 43 "encoding/json" 44 "errors" 45 "fmt" 46 "io" 47 "net/http" 48 "net/url" 49 "strconv" 50 "strings" 51 52 gensupport "google.golang.org/api/gensupport" 53 googleapi "google.golang.org/api/googleapi" 54 option "google.golang.org/api/option" 55 htransport "google.golang.org/api/transport/http" 56) 57 58// Always reference these packages, just in case the auto-generated code 59// below doesn't. 60var _ = bytes.NewBuffer 61var _ = strconv.Itoa 62var _ = fmt.Sprintf 63var _ = json.NewDecoder 64var _ = io.Copy 65var _ = url.Parse 66var _ = gensupport.MarshalJSON 67var _ = googleapi.Version 68var _ = errors.New 69var _ = strings.Replace 70var _ = context.Canceled 71 72const apiId = "healthcare:v1beta1" 73const apiName = "healthcare" 74const apiVersion = "v1beta1" 75const basePath = "https://healthcare.googleapis.com/" 76 77// OAuth2 scopes used by this API. 78const ( 79 // View and manage your data across Google Cloud Platform services 80 CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform" 81) 82 83// NewService creates a new Service. 84func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { 85 scopesOption := option.WithScopes( 86 "https://www.googleapis.com/auth/cloud-platform", 87 ) 88 // NOTE: prepend, so we don't override user-specified scopes. 89 opts = append([]option.ClientOption{scopesOption}, opts...) 90 client, endpoint, err := htransport.NewClient(ctx, opts...) 91 if err != nil { 92 return nil, err 93 } 94 s, err := New(client) 95 if err != nil { 96 return nil, err 97 } 98 if endpoint != "" { 99 s.BasePath = endpoint 100 } 101 return s, nil 102} 103 104// New creates a new Service. It uses the provided http.Client for requests. 105// 106// Deprecated: please use NewService instead. 107// To provide a custom HTTP client, use option.WithHTTPClient. 108// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. 109func New(client *http.Client) (*Service, error) { 110 if client == nil { 111 return nil, errors.New("client is nil") 112 } 113 s := &Service{client: client, BasePath: basePath} 114 s.Projects = NewProjectsService(s) 115 return s, nil 116} 117 118type Service struct { 119 client *http.Client 120 BasePath string // API endpoint base URL 121 UserAgent string // optional additional User-Agent fragment 122 123 Projects *ProjectsService 124} 125 126func (s *Service) userAgent() string { 127 if s.UserAgent == "" { 128 return googleapi.UserAgent 129 } 130 return googleapi.UserAgent + " " + s.UserAgent 131} 132 133func NewProjectsService(s *Service) *ProjectsService { 134 rs := &ProjectsService{s: s} 135 rs.Locations = NewProjectsLocationsService(s) 136 return rs 137} 138 139type ProjectsService struct { 140 s *Service 141 142 Locations *ProjectsLocationsService 143} 144 145func NewProjectsLocationsService(s *Service) *ProjectsLocationsService { 146 rs := &ProjectsLocationsService{s: s} 147 rs.Datasets = NewProjectsLocationsDatasetsService(s) 148 return rs 149} 150 151type ProjectsLocationsService struct { 152 s *Service 153 154 Datasets *ProjectsLocationsDatasetsService 155} 156 157func NewProjectsLocationsDatasetsService(s *Service) *ProjectsLocationsDatasetsService { 158 rs := &ProjectsLocationsDatasetsService{s: s} 159 rs.FhirStores = NewProjectsLocationsDatasetsFhirStoresService(s) 160 return rs 161} 162 163type ProjectsLocationsDatasetsService struct { 164 s *Service 165 166 FhirStores *ProjectsLocationsDatasetsFhirStoresService 167} 168 169func NewProjectsLocationsDatasetsFhirStoresService(s *Service) *ProjectsLocationsDatasetsFhirStoresService { 170 rs := &ProjectsLocationsDatasetsFhirStoresService{s: s} 171 rs.Fhir = NewProjectsLocationsDatasetsFhirStoresFhirService(s) 172 return rs 173} 174 175type ProjectsLocationsDatasetsFhirStoresService struct { 176 s *Service 177 178 Fhir *ProjectsLocationsDatasetsFhirStoresFhirService 179} 180 181func NewProjectsLocationsDatasetsFhirStoresFhirService(s *Service) *ProjectsLocationsDatasetsFhirStoresFhirService { 182 rs := &ProjectsLocationsDatasetsFhirStoresFhirService{s: s} 183 return rs 184} 185 186type ProjectsLocationsDatasetsFhirStoresFhirService struct { 187 s *Service 188} 189 190// HttpBody: Message that represents an arbitrary HTTP body. It should 191// only be used for 192// payload formats that can't be represented as JSON, such as raw binary 193// or 194// an HTML page. 195// 196// 197// This message can be used both in streaming and non-streaming API 198// methods in 199// the request as well as the response. 200// 201// It can be used as a top-level request field, which is convenient if 202// one 203// wants to extract parameters from either the URL or HTTP template into 204// the 205// request fields and also want access to the raw HTTP body. 206// 207// Example: 208// 209// message GetResourceRequest { 210// // A unique request id. 211// string request_id = 1; 212// 213// // The raw HTTP body is bound to this field. 214// google.api.HttpBody http_body = 2; 215// } 216// 217// service ResourceService { 218// rpc GetResource(GetResourceRequest) returns 219// (google.api.HttpBody); 220// rpc UpdateResource(google.api.HttpBody) returns 221// (google.protobuf.Empty); 222// } 223// 224// Example with streaming methods: 225// 226// service CaldavService { 227// rpc GetCalendar(stream google.api.HttpBody) 228// returns (stream google.api.HttpBody); 229// rpc UpdateCalendar(stream google.api.HttpBody) 230// returns (stream google.api.HttpBody); 231// } 232// 233// Use of this type only changes how the request and response bodies 234// are 235// handled, all other features will continue to work unchanged. 236type HttpBody struct { 237 // ContentType: The HTTP Content-Type header value specifying the 238 // content type of the body. 239 ContentType string `json:"contentType,omitempty"` 240 241 // Data: The HTTP request/response body as raw binary. 242 Data string `json:"data,omitempty"` 243 244 // Extensions: Application specific response metadata. Must be set in 245 // the first response 246 // for streaming APIs. 247 Extensions []googleapi.RawMessage `json:"extensions,omitempty"` 248 249 // ServerResponse contains the HTTP response code and headers from the 250 // server. 251 googleapi.ServerResponse `json:"-"` 252 253 // ForceSendFields is a list of field names (e.g. "ContentType") to 254 // unconditionally include in API requests. By default, fields with 255 // empty values are omitted from API requests. However, any non-pointer, 256 // non-interface field appearing in ForceSendFields will be sent to the 257 // server regardless of whether the field is empty or not. This may be 258 // used to include empty fields in Patch requests. 259 ForceSendFields []string `json:"-"` 260 261 // NullFields is a list of field names (e.g. "ContentType") to include 262 // in API requests with the JSON null value. By default, fields with 263 // empty values are omitted from API requests. However, any field with 264 // an empty value appearing in NullFields will be sent to the server as 265 // null. It is an error if a field in this list has a non-empty value. 266 // This may be used to include null fields in Patch requests. 267 NullFields []string `json:"-"` 268} 269 270func (s *HttpBody) MarshalJSON() ([]byte, error) { 271 type NoMethod HttpBody 272 raw := NoMethod(*s) 273 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 274} 275 276// method id "healthcare.projects.locations.datasets.fhirStores.fhir.createResource": 277 278type ProjectsLocationsDatasetsFhirStoresFhirCreateResourceCall struct { 279 s *Service 280 parent string 281 type_ string 282 body_ io.Reader 283 urlParams_ gensupport.URLParams 284 ctx_ context.Context 285 header_ http.Header 286} 287 288// CreateResource: Creates a FHIR resource. 289// 290func (r *ProjectsLocationsDatasetsFhirStoresFhirService) CreateResource(parent string, type_ string, body_ io.Reader) *ProjectsLocationsDatasetsFhirStoresFhirCreateResourceCall { 291 c := &ProjectsLocationsDatasetsFhirStoresFhirCreateResourceCall{s: r.s, urlParams_: make(gensupport.URLParams)} 292 c.parent = parent 293 c.type_ = type_ 294 c.body_ = body_ 295 return c 296} 297 298// Fields allows partial responses to be retrieved. See 299// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 300// for more information. 301func (c *ProjectsLocationsDatasetsFhirStoresFhirCreateResourceCall) Fields(s ...googleapi.Field) *ProjectsLocationsDatasetsFhirStoresFhirCreateResourceCall { 302 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 303 return c 304} 305 306// Context sets the context to be used in this call's Do method. Any 307// pending HTTP request will be aborted if the provided context is 308// canceled. 309func (c *ProjectsLocationsDatasetsFhirStoresFhirCreateResourceCall) Context(ctx context.Context) *ProjectsLocationsDatasetsFhirStoresFhirCreateResourceCall { 310 c.ctx_ = ctx 311 return c 312} 313 314// Header returns an http.Header that can be modified by the caller to 315// add HTTP headers to the request. 316func (c *ProjectsLocationsDatasetsFhirStoresFhirCreateResourceCall) Header() http.Header { 317 if c.header_ == nil { 318 c.header_ = make(http.Header) 319 } 320 return c.header_ 321} 322 323func (c *ProjectsLocationsDatasetsFhirStoresFhirCreateResourceCall) doRequest(alt string) (*http.Response, error) { 324 reqHeaders := make(http.Header) 325 for k, v := range c.header_ { 326 reqHeaders[k] = v 327 } 328 reqHeaders.Set("User-Agent", c.s.userAgent()) 329 var body io.Reader = nil 330 body = c.body_ 331 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+parent}/fhir/{+type}") 332 urls += "?" + c.urlParams_.Encode() 333 req, err := http.NewRequest("POST", urls, body) 334 if err != nil { 335 return nil, err 336 } 337 req.Header = reqHeaders 338 googleapi.Expand(req.URL, map[string]string{ 339 "parent": c.parent, 340 "type": c.type_, 341 }) 342 return gensupport.SendRequest(c.ctx_, c.s.client, req) 343} 344 345// Do executes the "healthcare.projects.locations.datasets.fhirStores.fhir.createResource" call. 346func (c *ProjectsLocationsDatasetsFhirStoresFhirCreateResourceCall) Do(opts ...googleapi.CallOption) (*http.Response, error) { 347 gensupport.SetOptions(c.urlParams_, opts...) 348 return c.doRequest("") 349 // { 350 // "description": "Creates a FHIR resource.\n", 351 // "flatPath": "v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/fhirStores/{fhirStoresId}/fhir/{fhirId}", 352 // "httpMethod": "POST", 353 // "id": "healthcare.projects.locations.datasets.fhirStores.fhir.createResource", 354 // "parameterOrder": [ 355 // "parent", 356 // "type" 357 // ], 358 // "parameters": { 359 // "parent": { 360 // "description": "The name of the FHIR store this resource belongs to.", 361 // "location": "path", 362 // "pattern": "^projects/[^/]+/locations/[^/]+/datasets/[^/]+/fhirStores/[^/]+$", 363 // "required": true, 364 // "type": "string" 365 // }, 366 // "type": { 367 // "description": "The type of the resource to create.", 368 // "location": "path", 369 // "pattern": "^[^/]+$", 370 // "required": true, 371 // "type": "string" 372 // } 373 // }, 374 // "path": "v1beta1/{+parent}/fhir/{+type}", 375 // "request": { 376 // "$ref": "HttpBody" 377 // }, 378 // "response": { 379 // "$ref": "HttpBody" 380 // }, 381 // "scopes": [ 382 // "https://www.googleapis.com/auth/cloud-platform" 383 // ] 384 // } 385 386} 387 388// method id "healthcare.projects.locations.datasets.fhirStores.fhir.read": 389 390type ProjectsLocationsDatasetsFhirStoresFhirReadCall struct { 391 s *Service 392 name string 393 urlParams_ gensupport.URLParams 394 ifNoneMatch_ string 395 ctx_ context.Context 396 header_ http.Header 397} 398 399// Read: Gets the contents of a FHIR resource. 400// 401// Implements the FHIR standard 402// [read 403// interaction](http://hl7.org/implement/standards/fhir/STU3/http.h 404// tml#read). 405// 406// Also supports the FHIR standard [conditional 407// read 408// interaction](http://hl7.org/implement/standards/fhir/STU3/http.ht 409// ml#cread) 410// specified by supplying an `If-Modified-Since` header with a date/time 411// value 412// or an `If-None-Match` header with an ETag value. 413// 414// On success, the response body will contain a JSON-encoded 415// representation 416// of the resource. 417// Errors generated by the FHIR store will contain a 418// JSON-encoded 419// `OperationOutcome` resource describing the reason for the error. If 420// the 421// request cannot be mapped to a valid API method on a FHIR store, a 422// generic 423// GCP error might be returned instead. 424func (r *ProjectsLocationsDatasetsFhirStoresFhirService) Read(name string) *ProjectsLocationsDatasetsFhirStoresFhirReadCall { 425 c := &ProjectsLocationsDatasetsFhirStoresFhirReadCall{s: r.s, urlParams_: make(gensupport.URLParams)} 426 c.name = name 427 return c 428} 429 430// Fields allows partial responses to be retrieved. See 431// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 432// for more information. 433func (c *ProjectsLocationsDatasetsFhirStoresFhirReadCall) Fields(s ...googleapi.Field) *ProjectsLocationsDatasetsFhirStoresFhirReadCall { 434 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 435 return c 436} 437 438// IfNoneMatch sets the optional parameter which makes the operation 439// fail if the object's ETag matches the given value. This is useful for 440// getting updates only after the object has changed since the last 441// request. Use googleapi.IsNotModified to check whether the response 442// error from Do is the result of In-None-Match. 443func (c *ProjectsLocationsDatasetsFhirStoresFhirReadCall) IfNoneMatch(entityTag string) *ProjectsLocationsDatasetsFhirStoresFhirReadCall { 444 c.ifNoneMatch_ = entityTag 445 return c 446} 447 448// Context sets the context to be used in this call's Do method. Any 449// pending HTTP request will be aborted if the provided context is 450// canceled. 451func (c *ProjectsLocationsDatasetsFhirStoresFhirReadCall) Context(ctx context.Context) *ProjectsLocationsDatasetsFhirStoresFhirReadCall { 452 c.ctx_ = ctx 453 return c 454} 455 456// Header returns an http.Header that can be modified by the caller to 457// add HTTP headers to the request. 458func (c *ProjectsLocationsDatasetsFhirStoresFhirReadCall) Header() http.Header { 459 if c.header_ == nil { 460 c.header_ = make(http.Header) 461 } 462 return c.header_ 463} 464 465func (c *ProjectsLocationsDatasetsFhirStoresFhirReadCall) doRequest(alt string) (*http.Response, error) { 466 reqHeaders := make(http.Header) 467 for k, v := range c.header_ { 468 reqHeaders[k] = v 469 } 470 reqHeaders.Set("User-Agent", c.s.userAgent()) 471 if c.ifNoneMatch_ != "" { 472 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 473 } 474 var body io.Reader = nil 475 c.urlParams_.Set("alt", alt) 476 c.urlParams_.Set("prettyPrint", "false") 477 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}") 478 urls += "?" + c.urlParams_.Encode() 479 req, err := http.NewRequest("GET", urls, body) 480 if err != nil { 481 return nil, err 482 } 483 req.Header = reqHeaders 484 googleapi.Expand(req.URL, map[string]string{ 485 "name": c.name, 486 }) 487 return gensupport.SendRequest(c.ctx_, c.s.client, req) 488} 489 490// Do executes the "healthcare.projects.locations.datasets.fhirStores.fhir.read" call. 491func (c *ProjectsLocationsDatasetsFhirStoresFhirReadCall) Do(opts ...googleapi.CallOption) (*http.Response, error) { 492 gensupport.SetOptions(c.urlParams_, opts...) 493 return c.doRequest("") 494 // { 495 // "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.", 496 // "flatPath": "v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/fhirStores/{fhirStoresId}/fhir/{fhirId}/{fhirId1}", 497 // "httpMethod": "GET", 498 // "id": "healthcare.projects.locations.datasets.fhirStores.fhir.read", 499 // "parameterOrder": [ 500 // "name" 501 // ], 502 // "parameters": { 503 // "name": { 504 // "description": "The name of the resource to retrieve.", 505 // "location": "path", 506 // "pattern": "^projects/[^/]+/locations/[^/]+/datasets/[^/]+/fhirStores/[^/]+/fhir/[^/]+/[^/]+$", 507 // "required": true, 508 // "type": "string" 509 // } 510 // }, 511 // "path": "v1beta1/{+name}", 512 // "response": { 513 // "$ref": "HttpBody" 514 // }, 515 // "scopes": [ 516 // "https://www.googleapis.com/auth/cloud-platform" 517 // ] 518 // } 519 520} 521