MCPcopy Create free account
hub / github.com/Flagsmith/flagsmith / save

Method save

api/integrations/slack/serializers.py:15–32  ·  view source on GitHub ↗
(self, **kwargs)

Source from the content-addressed store, hash-verified

13 fields = ("id", "channel_id", "enabled")
14
15 def save(self, **kwargs): # type: ignore[no-untyped-def]
16 try:
17 slack_configuration = SlackConfiguration.objects.get(
18 project=kwargs.get("environment").project # type: ignore[union-attr]
19 )
20 except ObjectDoesNotExist as e:
21 raise serializers.ValidationError(
22 "Slack api token not found. Please generate the token using oauth"
23 ) from e
24 kwargs.update(slack_configuration=slack_configuration)
25 try:
26 SlackWrapper( # type: ignore[no-untyped-call]
27 api_token=slack_configuration.api_token,
28 channel_id=self.validated_data.get("channel_id"),
29 ).join_channel()
30 except SlackChannelJoinError as e:
31 raise serializers.ValidationError(e) from e # type: ignore[arg-type]
32 return super().save(**kwargs)
33
34
35class SlackChannelSerializer(serializers.Serializer): # type: ignore[type-arg]

Callers 12

_complete_import_requestFunction · 0.45
mark_as_failureMethod · 0.45
perform_createMethod · 0.45
perform_createMethod · 0.45
update_resource_metadataFunction · 0.45
perform_createMethod · 0.45
perform_updateMethod · 0.45
perform_createMethod · 0.45
perform_updateMethod · 0.45
perform_createMethod · 0.45
perform_updateMethod · 0.45

Calls 4

SlackWrapperClass · 0.85
join_channelMethod · 0.80
getMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected