<commit_before>%%%-------------------------------------------------------------------
%%% @author <NAME>
%%% @copyright (C) 2019 ACK CYFRONET AGH
%%% This software is released under the MIT license
%%% cited in 'LICENSE.txt'.
%%% @end
%%%-------------------------------------------------------------------
%%% @doc
%%% This module handles translation of op logic results concerning
%%% provider entities into GUI GRAPH SYNC responses.
%%% @end
%%%-------------------------------------------------------------------
-module(provider_gui_gs_translator).
-author("<NAME>").

-include("middleware/middleware.hrl").

%% API
-export([translate_resource/2]).


%%%===================================================================
%%% API
%%%===================================================================


-spec translate_resource(gri:gri(), Data :: term()) ->
    gs_protocol:data() | fun((aai:auth()) -> gs_protocol:data()).
translate_resource(#gri{aspect = instance, scope = protected}, #od_provider{
    name = Name
}) ->
    #{
        <<"name">> => Name
    }.<commit_msg>VFS-5930 return more info for gs get op_provider.instance:protected<commit_after>%%%-------------------------------------------------------------------
%%% @author <NAME>
%%% @copyright (C) 2019 ACK CYFRONET AGH
%%% This software is released under the MIT license
%%% cited in 'LICENSE.txt'.
%%% @end
%%%-------------------------------------------------------------------
%%% @doc
%%% This module handles translation of op logic results concerning
%%% provider entities into GUI GRAPH SYNC responses.
%%% @end
%%%-------------------------------------------------------------------
-module(provider_gui_gs_translator).
-author("<NAME>").

-include("middleware/middleware.hrl").

%% API
-export([translate_resource/2]).


%%%===================================================================
%%% API
%%%===================================================================


-spec translate_resource(gri:gri(), Data :: term()) ->
    gs_protocol:data() | fun((aai:auth()) -> gs_protocol:data()).
translate_resource(#gri{aspect = instance, scope = protected}, #od_provider{
    name = Name,
    latitude = Latitude,
    longitude = Longitude,
    online = Online
}) ->
    #{
        <<"name">> => Name,
        <<"latitude">> => Latitude,
        <<"longitude">> => Longitude,
        <<"online">> => Online
    }.
{'fraction_non_alphanumeric': 0.41942235244872333, 'fraction_numerical': 0.0058601925491837585, 'mean_word_length': 2.22972972972973, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3634103', 'n_tokens_mistral': 624, 'n_tokens_neox': 582, 'n_words': 141}