Package google.api

색인

HttpBody

임의의 HTTP 본문을 나타내는 메시지입니다. 원시 바이너리나 HTML 페이지와 같이 JSON으로 표현할 수 없는 페이로드 형식에만 사용해야 합니다.

이 메시지는 요청과 응답에서 스트리밍 및 스트리밍이 아닌 API 메소드에 모두 사용될 수 있습니다.

또한 최상위 요청 필드로 사용할 수 있으며, URL 또는 HTTP 템플릿에서 요청 필드로 매개변수를 추출하려는 경우와 원시 HTTP 본문에 액세스하려는 경우 편리하게 사용할 수 있습니다.

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);
}

스트리밍 메소드의 예:

service CaldavService {
  rpc GetCalendar(stream google.api.HttpBody)
    returns (stream google.api.HttpBody);
  rpc UpdateCalendar(stream google.api.HttpBody)
    returns (stream google.api.HttpBody);
}

이 유형을 사용하면 요청 및 응답 본문을 처리하는 방법만 변경되며, 다른 모든 기능은 변경되지 않고 계속 작동합니다.

필드
content_type

string

본문의 콘텐츠 유형을 나타내는 HTTP 콘텐츠 유형 문자열입니다.

data

bytes

HTTP 본문 바이너리 데이터입니다.

extensions[]

Any

애플리케이션별 응답 메타데이터입니다. 스트리밍 API의 첫 번째 응답에서 설정되어야 합니다.