mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Add GraphQL for extras
This commit is contained in:
0
netbox/extras/graphql/__init__.py
Normal file
0
netbox/extras/graphql/__init__.py
Normal file
30
netbox/extras/graphql/schema.py
Normal file
30
netbox/extras/graphql/schema.py
Normal file
@@ -0,0 +1,30 @@
|
||||
import graphene
|
||||
|
||||
from netbox.graphql.fields import ObjectField, ObjectListField
|
||||
from .types import *
|
||||
|
||||
|
||||
class ExtrasQuery(graphene.ObjectType):
|
||||
config_context = ObjectField(ConfigContextType)
|
||||
config_contexts = ObjectListField(ConfigContextType)
|
||||
|
||||
custom_field = ObjectField(CustomFieldType)
|
||||
custom_fields = ObjectListField(CustomFieldType)
|
||||
|
||||
custom_link = ObjectField(CustomLinkType)
|
||||
custom_links = ObjectListField(CustomLinkType)
|
||||
|
||||
export_template = ObjectField(ExportTemplateType)
|
||||
export_templates = ObjectListField(ExportTemplateType)
|
||||
|
||||
image_attachment = ObjectField(ImageAttachmentType)
|
||||
image_attachments = ObjectListField(ImageAttachmentType)
|
||||
|
||||
journal_entry = ObjectField(JournalEntryType)
|
||||
journal_entries = ObjectListField(JournalEntryType)
|
||||
|
||||
tag = ObjectField(TagType)
|
||||
tags = ObjectListField(TagType)
|
||||
|
||||
webhook = ObjectField(WebhookType)
|
||||
webhooks = ObjectListField(WebhookType)
|
||||
77
netbox/extras/graphql/types.py
Normal file
77
netbox/extras/graphql/types.py
Normal file
@@ -0,0 +1,77 @@
|
||||
from extras import filtersets, models
|
||||
from netbox.graphql.types import BaseObjectType
|
||||
|
||||
__all__ = (
|
||||
'ConfigContextType',
|
||||
'CustomFieldType',
|
||||
'CustomLinkType',
|
||||
'ExportTemplateType',
|
||||
'ImageAttachmentType',
|
||||
'JournalEntryType',
|
||||
'TagType',
|
||||
'WebhookType',
|
||||
)
|
||||
|
||||
|
||||
class ConfigContextType(BaseObjectType):
|
||||
|
||||
class Meta:
|
||||
model = models.ConfigContext
|
||||
fields = '__all__'
|
||||
filterset_class = filtersets.ConfigContextFilterSet
|
||||
|
||||
|
||||
class CustomFieldType(BaseObjectType):
|
||||
|
||||
class Meta:
|
||||
model = models.CustomField
|
||||
fields = '__all__'
|
||||
filterset_class = filtersets.CustomFieldFilterSet
|
||||
|
||||
|
||||
class CustomLinkType(BaseObjectType):
|
||||
|
||||
class Meta:
|
||||
model = models.CustomLink
|
||||
fields = '__all__'
|
||||
filterset_class = filtersets.CustomLinkFilterSet
|
||||
|
||||
|
||||
class ExportTemplateType(BaseObjectType):
|
||||
|
||||
class Meta:
|
||||
model = models.ExportTemplate
|
||||
fields = '__all__'
|
||||
filterset_class = filtersets.ExportTemplateFilterSet
|
||||
|
||||
|
||||
class ImageAttachmentType(BaseObjectType):
|
||||
|
||||
class Meta:
|
||||
model = models.ImageAttachment
|
||||
fields = '__all__'
|
||||
filterset_class = filtersets.ImageAttachmentFilterSet
|
||||
|
||||
|
||||
class JournalEntryType(BaseObjectType):
|
||||
|
||||
class Meta:
|
||||
model = models.JournalEntry
|
||||
fields = '__all__'
|
||||
filterset_class = filtersets.JournalEntryFilterSet
|
||||
|
||||
|
||||
class TagType(BaseObjectType):
|
||||
|
||||
class Meta:
|
||||
model = models.Tag
|
||||
fields = '__all__'
|
||||
filterset_class = filtersets.TagFilterSet
|
||||
|
||||
|
||||
class WebhookType(BaseObjectType):
|
||||
|
||||
class Meta:
|
||||
model = models.Webhook
|
||||
fields = '__all__'
|
||||
filterset_class = filtersets.WebhookFilterSet
|
||||
Reference in New Issue
Block a user