Stubs

Module

stubs/petstore

A demo API: a small pet store's pets and orders, to show what a module, its docs and its SDKs look like.

OfficialPublic
1.8 KB
syntax = "proto3";

package petstore.v1;

import "google/protobuf/field_mask.proto";
import "petstore/v1/pet.proto";

// Manages the store's pets.
service PetService {
  // Gets one pet.
  rpc GetPet(GetPetRequest) returns (GetPetResponse);
  // Lists the pets, a page at a time, newest first.
  rpc ListPets(ListPetsRequest) returns (ListPetsResponse);
  // Adds a pet to the store.
  rpc CreatePet(CreatePetRequest) returns (CreatePetResponse);
  // Changes the fields of a pet that the update mask names.
  rpc UpdatePet(UpdatePetRequest) returns (UpdatePetResponse);
  // Removes a pet from the store.
  rpc DeletePet(DeletePetRequest) returns (DeletePetResponse);
}

message GetPetRequest {
  // The pet's ID.
  string id = 1;
}

message GetPetResponse {
  Pet pet = 1;
}

message ListPetsRequest {
  // At most this many pets; the store picks a size when it's 0.
  int32 page_size = 1;
  // The next_page_token of the page before, or empty for the first page.
  string page_token = 2;
  // Only pets of this species, unless it's unspecified.
  Species species = 3;
  // Only pets with this status, unless it's unspecified.
  PetStatus status = 4;
}

message ListPetsResponse {
  repeated Pet pets = 1;
  // The token for the next page, or empty on the last one.
  string next_page_token = 2;
}

message CreatePetRequest {
  // The new pet: the store sets its id and create_time.
  Pet pet = 1;
}

message CreatePetResponse {
  Pet pet = 1;
}

message UpdatePetRequest {
  // The pet, with its ID and the new values.
  Pet pet = 1;
  // The fields to change, such as "status" or "price_minor_units".
  google.protobuf.FieldMask update_mask = 2;
}

message UpdatePetResponse {
  Pet pet = 1;
}

message DeletePetRequest {
  // The pet's ID.
  string id = 1;
}

message DeletePetResponse {}