32 lines
923 B
Ruby
32 lines
923 B
Ruby
# typed: strict
|
|
# frozen_string_literal: true
|
|
|
|
module Bluesky
|
|
module Graph
|
|
class Subject < T::ImmutableStruct
|
|
extend T::Sig
|
|
include T::Struct::ActsAsComparable
|
|
const :did, String
|
|
const :handle, String
|
|
const :display_name, T.nilable(String)
|
|
const :description, T.nilable(String)
|
|
const :avatar, T.nilable(String)
|
|
const :indexed_at, T.nilable(Time)
|
|
const :created_at, T.nilable(Time)
|
|
|
|
sig { params(json: T::Hash[String, T.untyped]).returns(Subject) }
|
|
def self.from_json(json)
|
|
new(
|
|
did: json["did"],
|
|
handle: json["handle"],
|
|
display_name: json["displayName"],
|
|
description: json["description"],
|
|
avatar: json["avatar"],
|
|
indexed_at: (ia = json["indexedAt"]) && Time.zone.parse(ia),
|
|
created_at: (ca = json["createdAt"]) && Time.zone.parse(ca),
|
|
)
|
|
end
|
|
end
|
|
end
|
|
end
|