or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

api-infrastructure.mdapps-cards.mdcloud-platform.mdcommon-types.mdindex.mdlongrunning-operations.mdrpc-status.md
tile.json

tessl/maven-com-google-api-grpc--proto-google-common-protos

Java Protocol Buffer classes for Google's common protos, providing type-safe access to core Google Cloud API structures and gRPC service definitions

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
mavenpkg:maven/com.google.api.grpc/proto-google-common-protos@2.58.x

To install, run

npx @tessl/cli install tessl/maven-com-google-api-grpc--proto-google-common-protos@2.58.0

index.mddocs/

Proto Google Common Protos

Protocol Buffer classes for Google's common protos, providing Java implementations of standardized message types and service definitions used across Google APIs and services. This library enables type-safe access to core Google Cloud API structures, gRPC service definitions, and common data types.

Package Information

  • Package Name: proto-google-common-protos
  • Package Type: maven
  • Language: Java
  • Installation: implementation 'com.google.api.grpc:proto-google-common-protos:2.57.0'

Core Imports

import com.google.api.Http;
import com.google.api.HttpRule;
import com.google.rpc.Status;
import com.google.rpc.Code;
import com.google.type.Money;
import com.google.type.Date;
import com.google.longrunning.Operation;

Basic Usage

// Working with HTTP rules for REST API mapping
HttpRule rule = HttpRule.newBuilder()
    .setGet("/api/v1/users/{user_id}")
    .build();

// Creating error status responses
Status errorStatus = Status.newBuilder()
    .setCode(Code.INVALID_ARGUMENT.getNumber())
    .setMessage("Invalid user ID provided")
    .build();

// Working with monetary values
Money price = Money.newBuilder()
    .setCurrencyCode("USD")
    .setUnits(29)
    .setNanos(990000000) // $29.99
    .build();

// Handling long-running operations
Operation operation = Operation.newBuilder()
    .setName("operations/my-operation-id")
    .setDone(false)
    .build();

Architecture

Proto Google Common Protos is structured around Protocol Buffer message definitions organized into functional packages:

  • Core API Infrastructure (com.google.api): Service configuration, HTTP mappings, authentication, and API annotations
  • RPC Framework (com.google.rpc, com.google.rpc.context): Standard error handling, status codes, and context information for gRPC services
  • Common Data Types (com.google.type): Reusable types like Money, Date, Color, and geographic coordinates
  • Operations Management (com.google.longrunning): Support for asynchronous operations with status tracking
  • Cloud Services (com.google.cloud): Cloud platform audit logging and location services
  • Application Framework (com.google.apps): Google Apps Card UI components and interactions
  • Geographic Types (com.google.geo.type): Viewport and geographic data structures
  • Logging Types (com.google.logging.type): HTTP request logging and severity levels
  • Shopping Types (com.google.shopping.type): E-commerce related data types like Channel, Price, Weight

All classes follow Protocol Buffer Java conventions with message classes, OrBuilder interfaces, and Proto descriptor classes providing type-safe access to structured data.

Capabilities

API Infrastructure and Configuration

Core service configuration including HTTP mappings, authentication rules, quota management, and API annotations. Essential for defining gRPC services with REST endpoints.

class Service {
  String getName();
  repeated Api getApisList();
  Http getHttp();
  Authentication getAuthentication();
  Quota getQuota();
  Documentation getDocumentation();
  // Additional configuration methods
}

class Http {
  repeated HttpRule getRulesList();
  boolean getFullyDecodeReservedExpansion();
}

class HttpRule {
  String getSelector();
  String getGet();
  String getPost();
  String getPut();
  String getDelete();
  String getPatch();
  HttpRule getCustom();
  String getBody();
  String getResponseBody();
  repeated HttpRule getAdditionalBindingsList();
}

API Infrastructure

RPC Status and Error Handling

Standard error model and status codes for consistent error handling across gRPC services. Includes structured error details and context information.

class Status {
  int getCode();
  String getMessage();
  repeated Any getDetailsList();
  
  static Status.Builder newBuilder();
  Status.Builder toBuilder();
}

enum Code {
  OK(0),
  CANCELLED(1),
  UNKNOWN(2),
  INVALID_ARGUMENT(3),
  DEADLINE_EXCEEDED(4),
  NOT_FOUND(5),
  ALREADY_EXISTS(6),
  PERMISSION_DENIED(7),
  RESOURCE_EXHAUSTED(8),
  FAILED_PRECONDITION(9),
  ABORTED(10),
  OUT_OF_RANGE(11),
  UNIMPLEMENTED(12),
  INTERNAL(13),
  UNAVAILABLE(14),
  DATA_LOSS(15),
  UNAUTHENTICATED(16);
}

RPC Status and Error Handling

Common Data Types

Standard data types for representing time, money, geographic coordinates, and other common concepts across Google APIs.

class Money {
  String getCurrencyCode();
  long getUnits();
  int getNanos();
  
  static Money.Builder newBuilder();
}

class Date {
  int getYear();
  int getMonth();
  int getDay();
  
  static Date.Builder newBuilder();
}

class LatLng {
  double getLatitude();
  double getLongitude();
  
  static LatLng.Builder newBuilder();
}

class TimeOfDay {
  int getHours();
  int getMinutes();
  int getSeconds();
  int getNanos();
}

Common Data Types

Long-Running Operations

Support for asynchronous operations that don't complete immediately, providing status tracking, cancellation, and result retrieval.

class Operation {
  String getName();
  Any getMetadata();
  boolean getDone();
  Status getError();
  Any getResponse();
  
  static Operation.Builder newBuilder();
}

class GetOperationRequest {
  String getName();
  
  static GetOperationRequest.Builder newBuilder();
}

class ListOperationsRequest {
  String getName();
  String getFilter();
  int getPageSize();
  String getPageToken();
  
  static ListOperationsRequest.Builder newBuilder();
}

Long-Running Operations

Cloud Platform Types

Cloud-specific types for audit logging, location services, and platform integration.

class AuditLog {
  String getServiceName();
  String getMethodName();
  String getResourceName();
  AuthenticationInfo getAuthenticationInfo();
  repeated AuthorizationInfo getAuthorizationInfoList();
  RequestMetadata getRequestMetadata();
  Struct getRequest();
  Struct getResponse();
  Status getStatus();
}

class Location {
  String getName();
  String getLocationId();
  String getDisplayName();
  Struct getLabels();
  Any getMetadata();
}

Cloud Platform Types

Google Apps Card Framework

UI components and interactions for building cards in Google Workspace applications.

class Card {
  repeated Section getSectionsList();
  CardHeader getHeader();
  String getName();
  CardFixedFooter getFixedFooter();
  DisplayStyle getDisplayStyle();
  
  static Card.Builder newBuilder();
}

class Widget {
  TextParagraph getTextParagraph();
  Image getImage();
  DecoratedText getDecoratedText();
  ButtonList getButtonList();
  TextInput getTextInput();
  SelectionInput getSelectionInput();
  DateTimePicker getDateTimePicker();
  Divider getDivider();
  Grid getGrid();
  Columns getColumns();
}

Google Apps Cards

Protocol Buffer Patterns

Message Construction

All message classes provide builder patterns for construction:

// Create a new message
Status status = Status.newBuilder()
    .setCode(Code.NOT_FOUND.getNumber())
    .setMessage("Resource not found")
    .build();

// Modify existing message  
Status updatedStatus = status.toBuilder()
    .setMessage("Updated message")
    .build();

OrBuilder Interfaces

All message classes implement corresponding OrBuilder interfaces for read access during construction:

public interface StatusOrBuilder extends MessageOrBuilder {
    int getCode();
    String getMessage();
    java.util.List<com.google.protobuf.Any> getDetailsList();
    // Additional getter methods
}

Serialization and Parsing

Standard Protocol Buffer serialization methods:

// Serialize to bytes
byte[] bytes = status.toByteArray();

// Parse from bytes
Status parsed = Status.parseFrom(bytes);

// JSON serialization (requires JsonFormat)
String json = JsonFormat.printer().print(status);
Status fromJson = Status.newBuilder();
JsonFormat.parser().merge(json, fromJson);

Error Handling

Common patterns for working with status and error information:

// Check operation result
if (operation.getDone()) {
    if (operation.hasError()) {
        Status error = operation.getError();
        Code code = Code.forNumber(error.getCode());
        System.err.println("Operation failed: " + error.getMessage());
    } else {
        // Operation completed successfully
        Any response = operation.getResponse();
        // Process response
    }
} else {
    // Operation still in progress
    System.out.println("Operation pending: " + operation.getName());
}

Dependencies

This library requires:

  • com.google.protobuf:protobuf-java - Core Protocol Buffers runtime
  • Java 8 or higher

Commonly used with:

  • gRPC Java libraries for service implementation
  • Google Cloud client libraries for API integration
  • Jackson or Gson for JSON serialization (optional)