api.fabaccess-api/resource.capnp

117 lines
3.9 KiB
Cap'n Proto
Raw Normal View History

2021-10-01 20:06:06 +02:00
@0x8c2f829df1930cd5;
using CSharp = import "programming_language/csharp.capnp";
$CSharp.namespace("FabAccessAPI.Schema");
using import "notify.capnp".Notifiable;
2022-10-31 15:19:56 +01:00
using import "interest.capnp".Interestable;
2024-04-16 15:03:10 +02:00
using import "interest.capnp".Interest;
2022-10-31 15:19:56 +01:00
using import "claim.capnp".Claimable;
2024-04-16 15:03:10 +02:00
using import "claim.capnp".Claim;
2022-11-01 12:44:33 +01:00
using import "claim.capnp".Lockable;
2024-04-16 15:03:10 +02:00
using import "claim.capnp".Lock;
2024-04-15 16:28:23 +02:00
using import "audit.capnp".Auditable;
2021-10-01 20:06:06 +02:00
2022-10-31 15:19:56 +01:00
using import "utils.capnp".OID;
2022-11-01 12:44:33 +01:00
using import "utils.capnp".L10NString;
using import "utils.capnp".Map;
2024-05-06 13:15:58 +02:00
using import "traits.capnp".Hint;
2024-03-01 15:39:30 +01:00
using import "cache.capnp".Cache;
2024-04-15 16:28:23 +02:00
struct RestoredResource {
resource @0 :Resource;
interest @1 :List(Interest);
claim @2 :Claim;
lock @3 :Lock;
}
struct Resource {
2022-11-01 11:54:01 +01:00
# BFFH's smallest unit of a physical or abstract "thing". A resource can be as simple and
# physical as a table, as complex as a PCB production line or as abstract as "people with
# specific know-how are present".
2024-04-15 16:28:23 +02:00
identifier @0 :Text;
# The unique identifier for this resource
description @1 :Cache(Description);
2024-03-01 15:39:30 +01:00
# Return information about this resource. This information is usually
# static and thus put behind a Cache.
2024-04-15 16:28:23 +02:00
notify @2 :Notifiable;
# NULL if the user does not have permission to read this resource, or if this resource is not
# notifiable
2022-11-01 11:54:01 +01:00
2024-04-15 16:28:23 +02:00
interest @3 :Interestable;
# NULL if this resource is not interestable or the user does not have permission to set
# interests for this resource.
2022-11-01 12:44:33 +01:00
2024-04-15 16:28:23 +02:00
claim @4 :Claimable;
# NULL if the user does not have permission to write to this resource, or if this resource type
# does not support claiming.
2024-04-15 16:28:23 +02:00
lock @5 :Lockable;
# NULL if the user does not have permission to manage this resource, or if this resource type
# does not support claiming or locking.
2024-04-15 16:28:23 +02:00
audit @6 :Auditable;
2024-05-06 13:15:58 +02:00
hint @7 :Hint;
}
struct Description {
2024-04-16 15:03:10 +02:00
name @0 :L10NString;
2022-11-01 12:44:33 +01:00
# A human-facing name for this resource. A name should be short and recognizable, and is meant
# as the primary identifier for users to find a resource.
2024-04-16 15:03:10 +02:00
description @1 :L10NString;
2022-11-01 12:44:33 +01:00
# A human-facing description for this resource. Descriptions are longer-form text that give
# additional information about a resource beyond a name. They are meant to provide either
# further identifying information or important information that users should be actively shown
# when selecting this resource.
2024-04-16 15:03:10 +02:00
types @2 :List(OID);
# The 'type' of Resource. Each OID in the list specifies certain behaviours that this Resource
# follows.
2024-04-16 15:03:10 +02:00
category @3 :Category;
# A category this resource belongs to. If a resource was not assigned a category this is empty,
# see the definition of [`Category`](struct::Category) for details.
2024-04-16 15:03:10 +02:00
metadata @4 :Map(Text, Metadata);
# Metadata associated with this resource. This can be things like links to wikis or similar.
# Common keys are pre-defined as constants in this file.
2021-10-01 20:06:06 +02:00
}
2024-03-01 15:39:30 +01:00
struct Metadata {
# Metadata associated with a specific resource description.
union {
inline :group {
mediaType @0 :Text; # Media type of the value sent (as per https://www.iana.org/assignments/media-types/media-types.xhtml )
value @1 :Data; # The value as BLOB
}
remoteInline @2 :Text;
# URL pointing to the value. A client should fetch it and show it inline
remoteUrl @3 :Text;
# An URL that *is* the value. A client should display this as a clickable link.
}
}
struct Category {
# A category this resource belongs to.
id @0 :Data;
# An unique ID for this category. If a resource was not assigned a category this is NULL.
name @1 :L10NString;
# A human-facing name for this category.
}
const metadataWiki :Text = "wiki";
# An URI to further detailed information about this resource, e.g. in a wiki. This SHOULD be an
# https URL.