1# frozen_string_literal: true
2
3module Gitlab
4  module GitalyClient
5    class WikiPage
6      ATTRS = %i(title format url_path path name historical raw_data).freeze
7
8      include AttributesBag
9      include Gitlab::EncodingHelper
10
11      def initialize(params)
12        super
13
14        # All gRPC strings in a response are frozen, so we get an unfrozen
15        # version here so appending to `raw_data` doesn't blow up.
16        @raw_data = @raw_data.dup
17
18        @title = encode_utf8(@title)
19        @path = encode_utf8(@path)
20        @name = encode_utf8(@name)
21      end
22
23      def historical?
24        @historical
25      end
26
27      def format
28        @format.to_sym
29      end
30    end
31  end
32end
33