django_socio_grpc.protobuf.message_name_constructor

Module Contents

Classes

MessageNameConstructor

DefaultMessageNameConstructor

API

class django_socio_grpc.protobuf.message_name_constructor.MessageNameConstructor

Bases: abc.ABC

action_name: str

None

service: type[django_socio_grpc.services.Service]

None

action_request: str | type[rest_framework.serializers.BaseSerializer] | list[django_socio_grpc.protobuf.proto_classes.FieldDict] | None

None

request_name: str | None

None

action_response: str | type[rest_framework.serializers.BaseSerializer] | list[django_socio_grpc.protobuf.proto_classes.FieldDict] | None

None

response_name: str | None

None

__post_init__()
classmethod get_base_name_from_serializer(serializer: type[rest_framework.serializers.BaseSerializer]) str

Get the name that will be displayed for the message in a .proto file for a specific Serializer. It is the name of the serializer class without “ProtoSerializer” or “Serializer” at the end if any.

classmethod get_base_name_from_serializer_with_suffix(serializer: type[rest_framework.serializers.BaseSerializer], suffix: str = '') str

Add the correct suffix (“REQUEST”, “RESPONSE”, “”) to the name from the serializer (see get_base_name_from_serializer)

abstract construct_request_list_name()

Inherit from this method to get the name of the request list message as displayed in the proto file

abstract construct_response_list_name()

Inherit from this method to get the name of the response list message as displayed in the proto file

abstract construct_request_name(before_suffix: str = '')

Inherit from this method to get the name of the request as displayed in the proto file

abstract construct_response_name(before_suffix: str = '')

Inherit from this method to get the name of the response as displayed in the proto file

class django_socio_grpc.protobuf.message_name_constructor.DefaultMessageNameConstructor

Bases: django_socio_grpc.protobuf.message_name_constructor.MessageNameConstructor

__post_init__()
construct_base_name(is_request: bool = True)
construct_name(is_request: bool = True, before_suffix: str = '')

Construct the ProtoMessage name from the message and potentialy the name the user specified

construct_request_list_name()

Get the name of the request list message as displayed in the proto file

construct_response_list_name()

Get the name of the response list message as displayed in the proto file

construct_request_name(before_suffix: str = '')

Get the name of the request as displayed in the proto file

construct_response_name(before_suffix: str = '')

Get the name of the response as displayed in the proto file