django_socio_grpc.protobuf.proto_classes
Module Contents
Classes
This class is used to represent a comment in a proto file. It allows adding a comment in a serializer field help_text. |
|
Represents a field in a proto message. |
|
Represents a proto message with its fields and comments |
|
Represent a RPC method in a service |
|
Represents a service in a proto file |
Functions
Return the proto type of a field, fields can either implement a |
Data
API
- django_socio_grpc.protobuf.proto_classes.logger
None
- class django_socio_grpc.protobuf.proto_classes.ProtoComment(comments)
This class is used to represent a comment in a proto file. It allows adding a comment in a serializer field help_text.
Initialization
- __iter__()
- __bool__()
- class django_socio_grpc.protobuf.proto_classes.ProtoField
Represents a field in a proto message.
{comments} {cardinality} {field_type} {name} = {index};
- field_type: Union[str, ProtoMessage]
None
- cardinality: django_socio_grpc.protobuf.typing.FieldCardinality
None
- classmethod _get_cardinality(field: rest_framework.serializers.Field)
- classmethod from_field_dict(field_dict: django_socio_grpc.protobuf.typing.FieldDict) django_socio_grpc.protobuf.proto_classes.ProtoField
- classmethod from_field(field: rest_framework.serializers.Field) django_socio_grpc.protobuf.proto_classes.ProtoField
- classmethod from_serializer(field: rest_framework.serializers.Serializer, to_message: Callable, parent_serializer: rest_framework.serializers.Serializer = None, name_if_recursive: str = None) django_socio_grpc.protobuf.proto_classes.ProtoField
Create a ProtoField from a Serializer, which will be converted to a ProtoMessage with
to_message
- classmethod _from_serializer_method_field(field: rest_framework.serializers.SerializerMethodField) django_socio_grpc.protobuf.proto_classes.ProtoField
- class django_socio_grpc.protobuf.proto_classes.ProtoMessage
Represents a proto message with its fields and comments
{comments} message {name} { [{fields}] }
- fields: List[django_socio_grpc.protobuf.proto_classes.ProtoField]
None
- get_all_messages() Dict[str, django_socio_grpc.protobuf.proto_classes.ProtoMessage]
- set_indices(indices: Dict[int, str]) None
Set the field index that is writed in the proto file while trying to keep the same order that the one passed in the incides parameter :param indices: dictionnary mapping the field number with the field name that we want to keep order too. Usually it come from the lecture of the previous proto file before it is generated again
- classmethod create_name(base_name: str, suffixable: bool, prefixable: bool) str
This method only exist for stopping serializer recursion and using the correct ProtoMessage name
- classmethod get_base_name_from_serializer(serializer: Type[rest_framework.serializers.BaseSerializer]) str
- classmethod create(value: Optional[Union[Type[rest_framework.serializers.BaseSerializer], List[django_socio_grpc.protobuf.typing.FieldDict], str]], base_name: str, appendable_name: bool, prefix: str = '') Union[django_socio_grpc.protobuf.proto_classes.ProtoMessage, str]
- classmethod from_field_dicts(fields: List[django_socio_grpc.protobuf.typing.FieldDict], base_name: str, appendable_name: bool = True, prefix: str = '') django_socio_grpc.protobuf.proto_classes.ProtoMessage
- classmethod from_serializer(serializer: Type[rest_framework.serializers.BaseSerializer], name: Optional[str] = None) django_socio_grpc.protobuf.proto_classes.ProtoMessage
- classmethod skip_field(field: Union[rest_framework.serializers.Field, rest_framework.serializers.BaseSerializer], pk_name: str) bool
- classmethod as_list_message(base_message: django_socio_grpc.protobuf.proto_classes.ProtoMessage, base_name: Optional[str] = None, list_field_name: Optional[str] = None) django_socio_grpc.protobuf.proto_classes.ProtoMessage
- __getitem__(key: str) django_socio_grpc.protobuf.proto_classes.ProtoField
- class django_socio_grpc.protobuf.proto_classes.RequestProtoMessage
Bases:
django_socio_grpc.protobuf.proto_classes.ProtoMessage
- class django_socio_grpc.protobuf.proto_classes.ResponseProtoMessage
Bases:
django_socio_grpc.protobuf.proto_classes.ProtoMessage
- django_socio_grpc.protobuf.proto_classes.EmptyMessage
None
- django_socio_grpc.protobuf.proto_classes.StructMessage
None
- class django_socio_grpc.protobuf.proto_classes.ProtoRpc
Represent a RPC method in a service
rpc {name}({request_stream?} {request.name}) returns ({response_stream?} {response.name}) {}- request: Union[django_socio_grpc.protobuf.proto_classes.ProtoMessage, str]
None
- response: Union[django_socio_grpc.protobuf.proto_classes.ProtoMessage, str]
None
- get_all_messages() Dict[str, django_socio_grpc.protobuf.proto_classes.ProtoMessage]
- class django_socio_grpc.protobuf.proto_classes.ProtoService
Represents a service in a proto file
service {name} { [{rpcs}] }
- add_rpc(rpc: django_socio_grpc.protobuf.proto_classes.ProtoRpc)
- get_all_messages() Dict[str, django_socio_grpc.protobuf.proto_classes.ProtoMessage]
- django_socio_grpc.protobuf.proto_classes.get_proto_type(field: Union[django.db.models.Field, rest_framework.serializers.Field], default='string') str
Return the proto type of a field, fields can either implement a
proto_typeattribute or be a subclass of a known field type.
- django_socio_grpc.protobuf.proto_classes.FIELDS_TO_PROTO_TYPES
None
- django_socio_grpc.protobuf.proto_classes.PRIMITIVE_TYPES
None
- django_socio_grpc.protobuf.proto_classes.TYPING_TO_PROTO_TYPES
None