How to use the sgqlc.types.non_null function in sgqlc

To help you get started, we’ve selected a few sgqlc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github chaoss / grimoirelab-sortinghat / sortinghat / cli / client / schema.py View on Github external
__schema__ = sh_schema
    __field_names__ = ('entities', 'page_info')
    entities = sgqlc.types.Field(sgqlc.types.list_of('OperationType'), graphql_name='entities')
    page_info = sgqlc.types.Field('PaginationType', graphql_name='pageInfo')


class OperationType(sgqlc.types.Type):
    __schema__ = sh_schema
    __field_names__ = ('ouid', 'op_type', 'entity_type', 'target', 'trx', 'timestamp', 'args')
    ouid = sgqlc.types.Field(sgqlc.types.non_null(String), graphql_name='ouid')
    op_type = sgqlc.types.Field(sgqlc.types.non_null(OperationOpType), graphql_name='opType')
    entity_type = sgqlc.types.Field(sgqlc.types.non_null(String), graphql_name='entityType')
    target = sgqlc.types.Field(sgqlc.types.non_null(String), graphql_name='target')
    trx = sgqlc.types.Field(sgqlc.types.non_null('TransactionType'), graphql_name='trx')
    timestamp = sgqlc.types.Field(sgqlc.types.non_null(DateTime), graphql_name='timestamp')
    args = sgqlc.types.Field(sgqlc.types.non_null(OperationArgsType), graphql_name='args')


class OrganizationPaginatedType(sgqlc.types.Type):
    __schema__ = sh_schema
    __field_names__ = ('entities', 'page_info')
    entities = sgqlc.types.Field(sgqlc.types.list_of('OrganizationType'), graphql_name='entities')
    page_info = sgqlc.types.Field('PaginationType', graphql_name='pageInfo')


class OrganizationType(sgqlc.types.Type):
    __schema__ = sh_schema
    __field_names__ = ('id', 'created_at', 'last_modified', 'name', 'domains', 'enrollments')
    id = sgqlc.types.Field(sgqlc.types.non_null(ID), graphql_name='id')
    created_at = sgqlc.types.Field(sgqlc.types.non_null(DateTime), graphql_name='createdAt')
    last_modified = sgqlc.types.Field(sgqlc.types.non_null(DateTime), graphql_name='lastModified')
    name = sgqlc.types.Field(sgqlc.types.non_null(String), graphql_name='name')
github chaoss / grimoirelab-sortinghat / sortinghat / cli / client / schema.py View on Github external
page = sgqlc.types.Field(Int, graphql_name='page')
    page_size = sgqlc.types.Field(Int, graphql_name='pageSize')
    num_pages = sgqlc.types.Field(Int, graphql_name='numPages')
    has_next = sgqlc.types.Field(Boolean, graphql_name='hasNext')
    has_prev = sgqlc.types.Field(Boolean, graphql_name='hasPrev')
    start_index = sgqlc.types.Field(Int, graphql_name='startIndex')
    end_index = sgqlc.types.Field(Int, graphql_name='endIndex')
    total_results = sgqlc.types.Field(Int, graphql_name='totalResults')


class ProfileType(sgqlc.types.Type):
    __schema__ = sh_schema
    __field_names__ = (
        'created_at', 'last_modified', 'id', 'individual', 'name', 'email', 'gender', 'gender_acc', 'is_bot', 'country'
    )
    created_at = sgqlc.types.Field(sgqlc.types.non_null(DateTime), graphql_name='createdAt')
    last_modified = sgqlc.types.Field(sgqlc.types.non_null(DateTime), graphql_name='lastModified')
    id = sgqlc.types.Field(sgqlc.types.non_null(ID), graphql_name='id')
    individual = sgqlc.types.Field(sgqlc.types.non_null('IndividualType'), graphql_name='individual')
    name = sgqlc.types.Field(String, graphql_name='name')
    email = sgqlc.types.Field(String, graphql_name='email')
    gender = sgqlc.types.Field(String, graphql_name='gender')
    gender_acc = sgqlc.types.Field(Int, graphql_name='genderAcc')
    is_bot = sgqlc.types.Field(sgqlc.types.non_null(Boolean), graphql_name='isBot')
    country = sgqlc.types.Field(CountryType, graphql_name='country')


class Query(sgqlc.types.Type):
    __schema__ = sh_schema
    __field_names__ = ('countries', 'organizations', 'individuals', 'transactions', 'operations')
    countries = sgqlc.types.Field(
        CountryPaginatedType, graphql_name='countries', args=sgqlc.types.ArgDict((
github chaoss / grimoirelab-sortinghat / sortinghat / cli / client / schema.py View on Github external
__field_names__ = ('token',)
    token = sgqlc.types.Field(String, graphql_name='token')


class OperationPaginatedType(sgqlc.types.Type):
    __schema__ = sh_schema
    __field_names__ = ('entities', 'page_info')
    entities = sgqlc.types.Field(sgqlc.types.list_of('OperationType'), graphql_name='entities')
    page_info = sgqlc.types.Field('PaginationType', graphql_name='pageInfo')


class OperationType(sgqlc.types.Type):
    __schema__ = sh_schema
    __field_names__ = ('ouid', 'op_type', 'entity_type', 'target', 'trx', 'timestamp', 'args')
    ouid = sgqlc.types.Field(sgqlc.types.non_null(String), graphql_name='ouid')
    op_type = sgqlc.types.Field(sgqlc.types.non_null(OperationOpType), graphql_name='opType')
    entity_type = sgqlc.types.Field(sgqlc.types.non_null(String), graphql_name='entityType')
    target = sgqlc.types.Field(sgqlc.types.non_null(String), graphql_name='target')
    trx = sgqlc.types.Field(sgqlc.types.non_null('TransactionType'), graphql_name='trx')
    timestamp = sgqlc.types.Field(sgqlc.types.non_null(DateTime), graphql_name='timestamp')
    args = sgqlc.types.Field(sgqlc.types.non_null(OperationArgsType), graphql_name='args')


class OrganizationPaginatedType(sgqlc.types.Type):
    __schema__ = sh_schema
    __field_names__ = ('entities', 'page_info')
    entities = sgqlc.types.Field(sgqlc.types.list_of('OrganizationType'), graphql_name='entities')
    page_info = sgqlc.types.Field('PaginationType', graphql_name='pageInfo')


class OrganizationType(sgqlc.types.Type):
    __schema__ = sh_schema
github chaoss / grimoirelab-sortinghat / sortinghat / cli / client / schema.py View on Github external
individual = sgqlc.types.Field('IndividualType', graphql_name='individual')


class DeleteOrganization(sgqlc.types.Type):
    __schema__ = sh_schema
    __field_names__ = ('organization',)
    organization = sgqlc.types.Field('OrganizationType', graphql_name='organization')


class DomainType(sgqlc.types.Type):
    __schema__ = sh_schema
    __field_names__ = ('created_at', 'last_modified', 'id', 'domain', 'is_top_domain', 'organization')
    created_at = sgqlc.types.Field(sgqlc.types.non_null(DateTime), graphql_name='createdAt')
    last_modified = sgqlc.types.Field(sgqlc.types.non_null(DateTime), graphql_name='lastModified')
    id = sgqlc.types.Field(sgqlc.types.non_null(ID), graphql_name='id')
    domain = sgqlc.types.Field(sgqlc.types.non_null(String), graphql_name='domain')
    is_top_domain = sgqlc.types.Field(sgqlc.types.non_null(Boolean), graphql_name='isTopDomain')
    organization = sgqlc.types.Field(sgqlc.types.non_null('OrganizationType'), graphql_name='organization')


class Enroll(sgqlc.types.Type):
    __schema__ = sh_schema
    __field_names__ = ('uuid', 'individual')
    uuid = sgqlc.types.Field(String, graphql_name='uuid')
    individual = sgqlc.types.Field('IndividualType', graphql_name='individual')


class EnrollmentType(sgqlc.types.Type):
    __schema__ = sh_schema
    __field_names__ = ('created_at', 'last_modified', 'id', 'individual', 'organization', 'start', 'end')
    created_at = sgqlc.types.Field(sgqlc.types.non_null(DateTime), graphql_name='createdAt')
    last_modified = sgqlc.types.Field(sgqlc.types.non_null(DateTime), graphql_name='lastModified')
github profusion / sgqlc / sgqlc / types / relay.py View on Github external
:license: ISC
'''

__docformat__ = 'reStructuredText en'

__all__ = ('Node', 'PageInfo', 'Connection', 'connection_args')

from . import Type, Interface, non_null, ArgDict, String, Int


class Node(Interface):
    '''Global Object Identification based on Relay specification.

    https://facebook.github.io/relay/graphql/objectidentification.htm
    '''
    id = non_null(id)  # noqa: A003


class PageInfo(Type):
    ''':class:`Connection` page information.

    https://facebook.github.io/relay/graphql/connections.htm
    '''
    end_cursor = str
    start_cursor = str
    has_next_page = non_null(bool)
    has_previous_page = non_null(bool)


class Connection(Type):
    '''Cursor Connections based on Relay specification.
github chaoss / grimoirelab-sortinghat / sortinghat / cli / client / schema.py View on Github external
('organization', sgqlc.types.Arg(String, graphql_name='organization', default=None)),
            ('to_date', sgqlc.types.Arg(DateTime, graphql_name='toDate', default=None)),
            ('uuid', sgqlc.types.Arg(String, graphql_name='uuid', default=None)),
        ))
    )
    withdraw = sgqlc.types.Field(
        'Withdraw', graphql_name='withdraw', args=sgqlc.types.ArgDict((
            ('from_date', sgqlc.types.Arg(DateTime, graphql_name='fromDate', default=None)),
            ('organization', sgqlc.types.Arg(String, graphql_name='organization', default=None)),
            ('to_date', sgqlc.types.Arg(DateTime, graphql_name='toDate', default=None)),
            ('uuid', sgqlc.types.Arg(String, graphql_name='uuid', default=None)),
        ))
    )
    token_auth = sgqlc.types.Field(
        ObtainJSONWebToken, graphql_name='tokenAuth', args=sgqlc.types.ArgDict((
            ('username', sgqlc.types.Arg(sgqlc.types.non_null(String), graphql_name='username', default=None)),
            ('password', sgqlc.types.Arg(sgqlc.types.non_null(String), graphql_name='password', default=None)),
        ))
    )
    verify_token = sgqlc.types.Field(
        'Verify', graphql_name='verifyToken', args=sgqlc.types.ArgDict((
            ('token', sgqlc.types.Arg(sgqlc.types.non_null(String), graphql_name='token', default=None)),
        ))
    )
    refresh_token = sgqlc.types.Field(
        Refresh, graphql_name='refreshToken', args=sgqlc.types.ArgDict((
            ('token', sgqlc.types.Arg(sgqlc.types.non_null(String), graphql_name='token', default=None)),
        ))
    )


class TransactionPaginatedType(sgqlc.types.Type):
github chaoss / grimoirelab-sortinghat / sortinghat / cli / client / schema.py View on Github external
args = sgqlc.types.Field(sgqlc.types.non_null(OperationArgsType), graphql_name='args')


class OrganizationPaginatedType(sgqlc.types.Type):
    __schema__ = sh_schema
    __field_names__ = ('entities', 'page_info')
    entities = sgqlc.types.Field(sgqlc.types.list_of('OrganizationType'), graphql_name='entities')
    page_info = sgqlc.types.Field('PaginationType', graphql_name='pageInfo')


class OrganizationType(sgqlc.types.Type):
    __schema__ = sh_schema
    __field_names__ = ('id', 'created_at', 'last_modified', 'name', 'domains', 'enrollments')
    id = sgqlc.types.Field(sgqlc.types.non_null(ID), graphql_name='id')
    created_at = sgqlc.types.Field(sgqlc.types.non_null(DateTime), graphql_name='createdAt')
    last_modified = sgqlc.types.Field(sgqlc.types.non_null(DateTime), graphql_name='lastModified')
    name = sgqlc.types.Field(sgqlc.types.non_null(String), graphql_name='name')
    domains = sgqlc.types.Field(sgqlc.types.list_of(DomainType), graphql_name='domains')
    enrollments = sgqlc.types.Field(sgqlc.types.list_of(EnrollmentType), graphql_name='enrollments')


class PaginationType(sgqlc.types.Type):
    __schema__ = sh_schema
    __field_names__ = (
        'page', 'page_size', 'num_pages', 'has_next', 'has_prev', 'start_index', 'end_index', 'total_results'
    )
    page = sgqlc.types.Field(Int, graphql_name='page')
    page_size = sgqlc.types.Field(Int, graphql_name='pageSize')
    num_pages = sgqlc.types.Field(Int, graphql_name='numPages')
    has_next = sgqlc.types.Field(Boolean, graphql_name='hasNext')
    has_prev = sgqlc.types.Field(Boolean, graphql_name='hasPrev')
    start_index = sgqlc.types.Field(Int, graphql_name='startIndex')
github profusion / sgqlc / sgqlc / types / relay.py View on Github external
'''Global Object Identification based on Relay specification.

    https://facebook.github.io/relay/graphql/objectidentification.htm
    '''
    id = non_null(id)  # noqa: A003


class PageInfo(Type):
    ''':class:`Connection` page information.

    https://facebook.github.io/relay/graphql/connections.htm
    '''
    end_cursor = str
    start_cursor = str
    has_next_page = non_null(bool)
    has_previous_page = non_null(bool)


class Connection(Type):
    '''Cursor Connections based on Relay specification.

    https://facebook.github.io/relay/graphql/connections.htm

    .. note::

      This class exposes ``+=`` (in-place addition) operator to append
      information from another connection into this. The usage is as
      follow, if ``obj.connection.page_info.has_next_page``, then you
      should query the next page using
      ``after=obj.connection.page_info.end_cursor``. The resulting
      object should be ``obj.connection += obj2.connection``, this
      will add the contents of ``obj2.connection`` to
github chaoss / grimoirelab-sortinghat / sortinghat / cli / client / schema.py View on Github external
has_next = sgqlc.types.Field(Boolean, graphql_name='hasNext')
    has_prev = sgqlc.types.Field(Boolean, graphql_name='hasPrev')
    start_index = sgqlc.types.Field(Int, graphql_name='startIndex')
    end_index = sgqlc.types.Field(Int, graphql_name='endIndex')
    total_results = sgqlc.types.Field(Int, graphql_name='totalResults')


class ProfileType(sgqlc.types.Type):
    __schema__ = sh_schema
    __field_names__ = (
        'created_at', 'last_modified', 'id', 'individual', 'name', 'email', 'gender', 'gender_acc', 'is_bot', 'country'
    )
    created_at = sgqlc.types.Field(sgqlc.types.non_null(DateTime), graphql_name='createdAt')
    last_modified = sgqlc.types.Field(sgqlc.types.non_null(DateTime), graphql_name='lastModified')
    id = sgqlc.types.Field(sgqlc.types.non_null(ID), graphql_name='id')
    individual = sgqlc.types.Field(sgqlc.types.non_null('IndividualType'), graphql_name='individual')
    name = sgqlc.types.Field(String, graphql_name='name')
    email = sgqlc.types.Field(String, graphql_name='email')
    gender = sgqlc.types.Field(String, graphql_name='gender')
    gender_acc = sgqlc.types.Field(Int, graphql_name='genderAcc')
    is_bot = sgqlc.types.Field(sgqlc.types.non_null(Boolean), graphql_name='isBot')
    country = sgqlc.types.Field(CountryType, graphql_name='country')


class Query(sgqlc.types.Type):
    __schema__ = sh_schema
    __field_names__ = ('countries', 'organizations', 'individuals', 'transactions', 'operations')
    countries = sgqlc.types.Field(
        CountryPaginatedType, graphql_name='countries', args=sgqlc.types.ArgDict((
            ('page_size', sgqlc.types.Arg(Int, graphql_name='pageSize', default=None)),
            ('page', sgqlc.types.Arg(Int, graphql_name='page', default=None)),
            ('filters', sgqlc.types.Arg(CountryFilterType, graphql_name='filters', default=None)),
github profusion / sgqlc / sgqlc / types / relay.py View on Github external
.. note::

      This class exposes ``+=`` (in-place addition) operator to append
      information from another connection into this. The usage is as
      follow, if ``obj.connection.page_info.has_next_page``, then you
      should query the next page using
      ``after=obj.connection.page_info.end_cursor``. The resulting
      object should be ``obj.connection += obj2.connection``, this
      will add the contents of ``obj2.connection`` to
      ``obj.connection``, resetting
      ``obj.connection.page_info.has_next_page``,
      ``obj.connection.page_info.end_cursor`` and
      the JSON backing store, if any.
    '''
    __auto_register = False  # do not expose this in Schema, just subclasses
    page_info = non_null(PageInfo)

    def __iadd__(self, other):
        # NOTE: assign to list, not '+=', so ContainerType.__setattr__()
        # is called to apply to backing store
        has_self_nodes = hasattr(self, 'nodes') and self.nodes is not None
        has_other_nodes = hasattr(other, 'nodes') and other.nodes is not None
        if has_self_nodes and has_other_nodes:
            self.nodes = self.nodes + other.nodes
        elif has_other_nodes:
            self.nodes = other.nodes

        has_self_edges = hasattr(self, 'edges') and self.edges is not None
        has_other_edges = hasattr(other, 'edges') and other.edges is not None
        if has_self_edges and has_other_edges:
            self.edges = self.edges + other.edges
        elif has_other_edges: