1package event23const (4 KIND_PROFILE = 05 KIND_DELETION = 56 KIND_VANISH = 627 KIND_AUTH = 222428 KIND_DM = 149 KIND_WRAP = 105910 KIND_REPORT = 198411 KIND_NOSTR_CONNECT = 2413312 KIND_APP_DATA = 3007813 KIND_VIEW = KIND_APP_DATA14 KIND_PRESENCE = 2007815 KIND_MEMBER_ADDED = 800016 KIND_MEMBER_REMOVED = 800117 KIND_ROSTER = 1353418 KIND_ROLE_DEF = 3353419 KIND_NIP43_JOIN = 2893420 KIND_NIP43_INVITE = 2893521 KIND_NIP43_LEAVE = 2893622 KIND_PUT_USER = 900023 KIND_REMOVE_USER = 900124 KIND_EDIT_METADATA = 900225 KIND_DELETE_EVENT = 900526 KIND_CREATE_GROUP = 900727 KIND_DELETE_GROUP = 900828 KIND_CREATE_INVITE = 900929 KIND_PINS = 901030 KIND_JOIN = 902131 KIND_LEAVE = 902232 KIND_GROUP_METADATA = 3900033 KIND_GROUP_ADMINS = 3900134 KIND_GROUP_MEMBERS = 3900235 KIND_GROUP_ROLES = 3900336 KIND_GROUP_PINS = 3900537 KIND_RELAY_DISCOVERY = 3016638 KIND_SITE = 1512839 KIND_NAMED_SITE = 3512840 KIND_SITE_SNAPSHOT = 512841 KIND_MARMOT_GROUP = 44542 KIND_MARMOT_KEY_PACKAGE = 3044343 KIND_REPO = 3061744 KIND_REPO_STATE = 3061845 KIND_GIT_PATCH = 161746 KIND_GIT_PR = 161847 KIND_GIT_PR_UPDATE = 161948 KIND_GIT_ISSUE = 162149 KIND_PUSH_REGISTRATION = 3039050 KIND_CHAT = 951 KIND_THREAD = 1152 KIND_THREAD_REPLY = 1253 KIND_ROOM_PRESENCE = 2000154 KIND_ROOM_TYPING = 2000255 KIND_RICH_CONTENT = 4000256 KIND_CONTENT_EDIT = 4000357 KIND_ROOM_MEMBER_ADDED = 4410058 KIND_ROOM_MEMBER_REMOVED = 441015960 // NIP-54 wiki: articles, merge requests and redirects.61 KIND_WIKI_ARTICLE = 3081862 KIND_WIKI_MERGE = 81863 KIND_WIKI_REDIRECT = 3081964 KIND_AGENT_GRANT = 3039265)6667// NIP-90 long tasks use request kinds 5000 to 5127 and 5129 to 5999.68// Each request is answered by a result kind 1000 higher and by feedback69// of kind 7000. Kind 5128 belongs to NIP-5A site snapshots.70const (71 KIND_JOB_REQUEST_MIN = 500072 KIND_JOB_REQUEST_MAX = 599973 KIND_JOB_RESULT_MIN = 600074 KIND_JOB_RESULT_MAX = 699975 KIND_JOB_FEEDBACK = 700076)7778// JobFeedbackStatuses is the NIP-90 vocabulary of the feedback status tag.79var JobFeedbackStatuses = []string{"payment-required", "processing", "error", "success", "partial"}8081// JobInputTypes is the NIP-90 vocabulary of the i tag's input type.82var JobInputTypes = []string{"url", "event", "job", "text"}8384// IsJobRequest reports whether kind belongs to long-task requests.85// NIP-5A site snapshots have their own admission and manifest rules.86func IsJobRequest(kind int) bool {87 return kind >= KIND_JOB_REQUEST_MIN && kind <= KIND_JOB_REQUEST_MAX && kind != KIND_SITE_SNAPSHOT88}8990// IsJobResult reports whether kind is a NIP-90 result kind.91func IsJobResult(kind int) bool { return kind >= KIND_JOB_RESULT_MIN && kind <= KIND_JOB_RESULT_MAX }9293// IsJobKind reports whether the kind is a job request, result or feedback.94func IsJobKind(kind int) bool {95 return IsJobRequest(kind) || IsJobResult(kind) || kind == KIND_JOB_FEEDBACK96}9798// JobResultKind returns the result kind for a request kind, or 0 for other99// kinds.100func JobResultKind(request int) int {101 if !IsJobRequest(request) {102 return 0103 }104 return request + 1000105}106107// IsJobFeedbackStatus reports whether status is in the NIP-90 feedback108// vocabulary.109func IsJobFeedbackStatus(status string) bool {110 for _, known := range JobFeedbackStatuses {111 if known == status {112 return true113 }114 }115 return false116}117118// IsJobInputType reports whether kind is a supported NIP-90 input type.119func IsJobInputType(kind string) bool {120 for _, known := range JobInputTypes {121 if known == kind {122 return true123 }124 }125 return false126}