Skip to content

Person pb2

Protocol buffer message and service definitions for the AddressBook pedagogical example.

This module is auto-generated from the person.proto file using the protobuf compiler. It provides Python classes for all messages and services defined in the proto file, and is intended for use in educational and demonstration contexts.

Note

This file is generated code. Manual changes (except for documentation improvements) will be overwritten if the file is regenerated.

Attributes

DESCRIPTOR: _descriptor.FileDescriptor = _descriptor_pool.Default().AddSerializedFile(b'\n\x0cperson.proto\x12\x06person"\x9f\x02\n\x06Person\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\n\n\x02id\x18\x02 \x01(\x05\x12\r\n\x05email\x18\x03 \x01(\t\x12*\n\x06phones\x18\x04 \x03(\x0b2\x1a.person.Person.PhoneNumber\x1aV\n\x0bPhoneNumber\x12\x0e\n\x06number\x18\x01 \x01(\t\x127\n\x04type\x18\x02 \x01(\x0e2\x18.person.Person.PhoneType:\x0fPHONE_TYPE_HOME"h\n\tPhoneType\x12\x1a\n\x16PHONE_TYPE_UNSPECIFIED\x10\x00\x12\x15\n\x11PHONE_TYPE_MOBILE\x10\x01\x12\x13\n\x0fPHONE_TYPE_HOME\x10\x02\x12\x13\n\x0fPHONE_TYPE_WORK\x10\x03"-\n\x0bAddressBook\x12\x1e\n\x06people\x18\x01 \x03(\x0b2\x0e.person.Person"%\n\x10GetPersonRequest\x12\x11\n\tperson_id\x18\x01 \x01(\x05"3\n\x11GetPersonResponse\x12\x1e\n\x06person\x18\x01 \x01(\x0b2\x0e.person.Person"\x13\n\x11ListPeopleRequest"4\n\x12ListPeopleResponse\x12\x1e\n\x06people\x18\x01 \x03(\x0b2\x0e.person.Person"2\n\x10AddPersonRequest\x12\x1e\n\x06person\x18\x01 \x01(\x0b2\x0e.person.Person"3\n\x11AddPersonResponse\x12\x1e\n\x06person\x18\x01 \x01(\x0b2\x0e.person.Person2\xdd\x01\n\x12AddressBookService\x12@\n\tGetPerson\x12\x18.person.GetPersonRequest\x1a\x19.person.GetPersonResponse\x12C\n\nListPeople\x12\x19.person.ListPeopleRequest\x1a\x1a.person.ListPeopleResponse\x12@\n\tAddPerson\x12\x18.person.AddPersonRequest\x1a\x19.person.AddPersonResponseb\x08editionsp\xe8\x07') module-attribute

Classes

AddPersonRequest(person: _Optional[_Union[Person, _Mapping]] = ...)

Bases: Message


              flowchart TD
              examples.plugins.proto.person_pb2.AddPersonRequest[AddPersonRequest]

              

              click examples.plugins.proto.person_pb2.AddPersonRequest href "" "examples.plugins.proto.person_pb2.AddPersonRequest"
            

Request message for adding a new person to the address book.

PARAMETER DESCRIPTION
person

The Person object to add.

TYPE: Person | Mapping | None DEFAULT: ...

Attributes

PERSON_FIELD_NUMBER: int class-attribute
person: Person instance-attribute

AddPersonResponse(person: _Optional[_Union[Person, _Mapping]] = ...)

Bases: Message


              flowchart TD
              examples.plugins.proto.person_pb2.AddPersonResponse[AddPersonResponse]

              

              click examples.plugins.proto.person_pb2.AddPersonResponse href "" "examples.plugins.proto.person_pb2.AddPersonResponse"
            

Response message confirming the addition of a person.

PARAMETER DESCRIPTION
person

The Person object that was added.

TYPE: Person | Mapping | None DEFAULT: ...

Attributes

PERSON_FIELD_NUMBER: int class-attribute
person: Person instance-attribute

AddressBook(people: _Optional[_Iterable[_Union[Person, _Mapping]]] = ...)

Bases: Message


              flowchart TD
              examples.plugins.proto.person_pb2.AddressBook[AddressBook]

              

              click examples.plugins.proto.person_pb2.AddressBook href "" "examples.plugins.proto.person_pb2.AddressBook"
            

Represents an address book containing multiple people.

PARAMETER DESCRIPTION
people

A list of Person objects in the address book.

TYPE: Iterable[Person | Mapping] | None DEFAULT: ...

Attributes

PEOPLE_FIELD_NUMBER: int class-attribute
people: _containers.RepeatedCompositeFieldContainer[Person] instance-attribute

GetPersonRequest(person_id: _Optional[int] = ...)

Bases: Message


              flowchart TD
              examples.plugins.proto.person_pb2.GetPersonRequest[GetPersonRequest]

              

              click examples.plugins.proto.person_pb2.GetPersonRequest href "" "examples.plugins.proto.person_pb2.GetPersonRequest"
            

Request message for retrieving a person by ID.

PARAMETER DESCRIPTION
person_id

The unique identifier of the person to retrieve.

TYPE: int | None DEFAULT: ...

Attributes

PERSON_ID_FIELD_NUMBER: int class-attribute
person_id: int instance-attribute

GetPersonResponse(person: _Optional[_Union[Person, _Mapping]] = ...)

Bases: Message


              flowchart TD
              examples.plugins.proto.person_pb2.GetPersonResponse[GetPersonResponse]

              

              click examples.plugins.proto.person_pb2.GetPersonResponse href "" "examples.plugins.proto.person_pb2.GetPersonResponse"
            

Response message containing a single person.

PARAMETER DESCRIPTION
person

The Person object returned by the service.

TYPE: Person | Mapping | None DEFAULT: ...

Attributes

PERSON_FIELD_NUMBER: int class-attribute
person: Person instance-attribute

ListPeopleRequest()

Bases: Message


              flowchart TD
              examples.plugins.proto.person_pb2.ListPeopleRequest[ListPeopleRequest]

              

              click examples.plugins.proto.person_pb2.ListPeopleRequest href "" "examples.plugins.proto.person_pb2.ListPeopleRequest"
            

Request message for listing all people in the address book.

ListPeopleResponse(people: _Optional[_Iterable[_Union[Person, _Mapping]]] = ...)

Bases: Message


              flowchart TD
              examples.plugins.proto.person_pb2.ListPeopleResponse[ListPeopleResponse]

              

              click examples.plugins.proto.person_pb2.ListPeopleResponse href "" "examples.plugins.proto.person_pb2.ListPeopleResponse"
            

Response message containing a list of people.

PARAMETER DESCRIPTION
people

The list of Person objects returned by the service.

TYPE: Iterable[Person | Mapping] | None DEFAULT: ...

Attributes

PEOPLE_FIELD_NUMBER: int class-attribute
people: _containers.RepeatedCompositeFieldContainer[Person] instance-attribute

Person(name: _Optional[str] = ..., id: _Optional[int] = ..., email: _Optional[str] = ..., phones: _Optional[_Iterable[_Union[Person.PhoneNumber, _Mapping]]] = ...)

Bases: Message


              flowchart TD
              examples.plugins.proto.person_pb2.Person[Person]

              

              click examples.plugins.proto.person_pb2.Person href "" "examples.plugins.proto.person_pb2.Person"
            

Represents a person in the AddressBook example.

PARAMETER DESCRIPTION
name

The person's name.

TYPE: str | None DEFAULT: ...

id

The unique identifier for the person.

TYPE: int | None DEFAULT: ...

email

The person's email address.

TYPE: str | None DEFAULT: ...

phones

A list of phone numbers for the person.

TYPE: Iterable[PhoneNumber | Mapping] | None DEFAULT: ...

Attributes

EMAIL_FIELD_NUMBER: int class-attribute
ID_FIELD_NUMBER: int class-attribute
NAME_FIELD_NUMBER: int class-attribute
PHONES_FIELD_NUMBER: int class-attribute
PHONE_TYPE_HOME: Person.PhoneType instance-attribute
PHONE_TYPE_MOBILE: Person.PhoneType instance-attribute
PHONE_TYPE_UNSPECIFIED: Person.PhoneType instance-attribute
PHONE_TYPE_WORK: Person.PhoneType instance-attribute
email: str instance-attribute
id: int instance-attribute
name: str instance-attribute
phones: _containers.RepeatedCompositeFieldContainer[Person.PhoneNumber] instance-attribute

Classes

PhoneNumber(number: _Optional[str] = ..., type: _Optional[_Union[Person.PhoneType, str]] = ...)

Bases: Message


              flowchart TD
              examples.plugins.proto.person_pb2.Person.PhoneNumber[PhoneNumber]

              

              click examples.plugins.proto.person_pb2.Person.PhoneNumber href "" "examples.plugins.proto.person_pb2.Person.PhoneNumber"
            

Represents a phone number for a person.

PARAMETER DESCRIPTION
number

The phone number as a string.

TYPE: str | None DEFAULT: ...

type

The type of phone number (e.g., mobile, home, work).

TYPE: PhoneType | str | None DEFAULT: ...

Source code in examples/plugins/proto/person_pb2.py
    _globals["_ADDPERSONREQUEST"]._serialized_end = 578
    _globals["_ADDPERSONRESPONSE"]._serialized_start = 580
    _globals["_ADDPERSONRESPONSE"]._serialized_end = 631
    _globals["_ADDRESSBOOKSERVICE"]._serialized_start = 634
    _globals["_ADDRESSBOOKSERVICE"]._serialized_end = 855
# @@protoc_insertion_point(module_scope)
Attributes
NUMBER_FIELD_NUMBER: int class-attribute
TYPE_FIELD_NUMBER: int class-attribute
number: str instance-attribute
type: Person.PhoneType instance-attribute
PhoneType

Bases: int


              flowchart TD
              examples.plugins.proto.person_pb2.Person.PhoneType[PhoneType]

              

              click examples.plugins.proto.person_pb2.Person.PhoneType href "" "examples.plugins.proto.person_pb2.Person.PhoneType"
            

Enum for the type of phone number.

Attributes
PHONE_TYPE_HOME: Person.PhoneType class-attribute
PHONE_TYPE_MOBILE: Person.PhoneType class-attribute
PHONE_TYPE_UNSPECIFIED: Person.PhoneType class-attribute
PHONE_TYPE_WORK: Person.PhoneType class-attribute