Exemple #1
0
            description='Date date on which validation was performed'),
        'comment':
        fields.String(
            description='A comment about the validation. Required on rejection'
        )
    })

source_fields = api.model(
    'HarvestSource', {
        'id':
        fields.String(description='The source unique identifier',
                      readonly=True),
        'name':
        fields.String(description='The source display name', required=True),
        'description':
        fields.Markdown(description='The source description'),
        'url':
        fields.String(description='The source base URL', required=True),
        'backend':
        fields.String(description='The source backend',
                      enum=backends_ids,
                      required=True),
        'config':
        fields.Raw(description='The configuration as key-value pairs'),
        'created_at':
        fields.ISODateTime(description='The source creation date',
                           required=True),
        'active':
        fields.Boolean(
            description='Is this source active', required=True, default=False),
        'validation':
Exemple #2
0
from .forms import PostForm

ns = api.namespace('posts', 'Posts related operations')

post_fields = api.model(
    'Post', {
        'id':
        fields.String(description='The post identifier'),
        'name':
        fields.String(description='The post name', required=True),
        'slug':
        fields.String(description='The post permalink string', readonly=True),
        'headline':
        fields.String(description='The post headline', required=True),
        'content':
        fields.Markdown(description='The post content in Markdown',
                        required=True),
        'image':
        fields.ImageField(description='The post image'),
        'credit_to':
        fields.String(
            description='An optionnal credit line (associated to the image)'),
        'credit_url':
        fields.String(
            description='An optionnal link associated to the credits'),
        'tags':
        fields.List(fields.String,
                    description='Some keywords to help in search'),
        'datasets':
        fields.List(fields.Nested(dataset_ref_fields),
                    description='The post datasets'),
        'reuses':
Exemple #3
0
badge_fields = api.model(
    'DatasetBadge', {
        'kind':
        fields.String(description='Kind of badge (pivotal-data, etc)',
                      required=True,
                      enum=DATASET_BADGE_KINDS.keys()),
    })

resource_fields = api.model(
    'Resource', {
        'id':
        fields.String(description='The resource unique ID', readonly=True),
        'title':
        fields.String(description='The resource title', required=True),
        'description':
        fields.Markdown(description='The resource markdown description'),
        'type':
        fields.String(description=('Whether the resource is an uploaded file, '
                                   'a remote file or an API'),
                      required=True,
                      enum=RESOURCE_TYPES.keys()),
        'format':
        fields.String(description='The resource format', required=True),
        'url':
        fields.String(description='The resource URL', required=True),
        'checksum':
        fields.Nested(checksum_fields,
                      allow_null=True,
                      description='A checksum to validate file validity'),
        'size':
        fields.Integer(description='The resource file size in bytes'),
Exemple #4
0
BIGGEST_IMAGE_SIZE = IMAGE_SIZES[0]

reuse_fields = api.model('Reuse', {
    'id':
    fields.String(description='The reuse identifier', readonly=True),
    'title':
    fields.String(description='The reuse title', required=True),
    'slug':
    fields.String(description='The reuse permalink string', readonly=True),
    'type':
    fields.String(
        description='The reuse type', required=True, enum=list(REUSE_TYPES)),
    'url':
    fields.String(description='The reuse remote URL (website)', required=True),
    'description':
    fields.Markdown(description='The reuse description in Markdown',
                    required=True),
    'tags':
    fields.List(fields.String, description='Some keywords to help in search'),
    'badges':
    fields.List(fields.Nested(badge_fields),
                description='The reuse badges',
                readonly=True),
    'topic':
    fields.String(
        description='The reuse topic', required=True, enum=list(REUSE_TOPICS)),
    'featured':
    fields.Boolean(description='Is the reuse featured', readonly=True),
    'private':
    fields.Boolean(
        description='Is the reuse private to the owner or the organization'),
    'image':
Exemple #5
0
    'user': fields.Nested(user_ref_fields),
    'role': fields.String(
        description='The member role in the organization', required=True,
        enum=ORG_ROLES.keys())
})

org_fields = api.model('Organization', {
    'id': fields.String(
        description='The organization identifier', required=True),
    'name': fields.String(description='The organization name', required=True),
    'acronym': fields.String(description='The organization acronym'),
    'url': fields.String(description='The organization website URL'),
    'slug': fields.String(
        description='The organization string used as permalink',
        required=True),
    'description': fields.Markdown(
        description='The organization description in Markdown', required=True),
    'created_at': fields.ISODateTime(
        description='The organization creation date', readonly=True),
    'last_modified': fields.ISODateTime(
        description='The organization last modification date', readonly=True),
    'deleted': fields.ISODateTime(
        description='The organization deletion date if deleted',
        readonly=True),
    'metrics': fields.Raw(
        description='The organization metrics', readonly=True),
    'uri': fields.UrlFor(
        'api.organization', lambda o: {'org': o},
        description='The organization API URI', readonly=True),
    'page': fields.UrlFor(
        'organizations.show', lambda o: {'org': o},
        description='The organization page URL', readonly=True),
Exemple #6
0
resources_parser.add_argument(
    'q', type=str, location='args',
    help='query string to search through resources titles')

common_doc = {
    'params': {'dataset': 'The dataset ID or slug'}
}


dataset_fields = apiv2.model('Dataset', {
    'id': fields.String(description='The dataset identifier', readonly=True),
    'title': fields.String(description='The dataset title', required=True),
    'acronym': fields.String(description='An optional dataset acronym'),
    'slug': fields.String(
        description='The dataset permalink string', required=True),
    'description': fields.Markdown(
        description='The dataset description in markdown', required=True),
    'created_at': fields.ISODateTime(
        description='The dataset creation date', required=True),
    'last_modified': fields.ISODateTime(
        description='The dataset last modification date', required=True),
    'deleted': fields.ISODateTime(description='The deletion date if deleted'),
    'archived': fields.ISODateTime(description='The archival date if archived'),
    'featured': fields.Boolean(description='Is the dataset featured'),
    'private': fields.Boolean(
        description='Is the dataset private to the owner or the organization'),
    'tags': fields.List(fields.String),
    'badges': fields.List(fields.Nested(badge_fields),
                          description='The dataset badges',
                          readonly=True),
    'resources': fields.Raw(attribute=lambda o: {
        'rel': 'subsection',
Exemple #7
0

from udata.core.organization.api_fields import org_ref_fields

user_fields = api.model('User', {
    'id': fields.String(
        description='The user identifier', required=True),
    'slug': fields.String(
        description='The user permalink string', required=True),
    'first_name': fields.String(
        description='The user first name', required=True),
    'last_name': fields.String(
        description='The user last name', required=True),
    'avatar': fields.ImageField(description='The user avatar URL'),
    'website': fields.String(description='The user website'),
    'about': fields.Markdown(description='The user self description'),
    'roles': fields.List(fields.String, description='Site wide user roles'),
    'organizations': fields.List(
        fields.Nested(org_ref_fields),
        description='The organization the user belongs to'),
    'metrics': fields.Raw(description='Th last user metrics'),
    'since': fields.ISODateTime(
        attribute='created_at',
        description='The registeration date', required=True),
    'page': fields.UrlFor(
        'users.show', lambda u: {'user': u},
        description='The user profile page URL', readonly=True),
    'uri': fields.UrlFor(
        'api.user', lambda o: {'user': o},
        description='The user API URI', required=True),
})
Exemple #8
0
from .models import Topic
from .forms import TopicForm

ns = api.namespace('topics', 'Topics related operations')

topic_fields = api.model(
    'Topic', {
        'id':
        fields.String(description='The topic identifier'),
        'name':
        fields.String(description='The topic name', required=True),
        'slug':
        fields.String(description='The topic permalink string', readonly=True),
        'description':
        fields.Markdown(description='The topic description in Markdown',
                        required=True),
        'tags':
        fields.List(fields.String,
                    description='Some keywords to help in search',
                    required=True),
        'datasets':
        fields.List(fields.Nested(dataset_fields),
                    description='The topic datasets'),
        'reuses':
        fields.List(fields.Nested(reuse_fields),
                    description='The topic reuses'),
        'featured':
        fields.Boolean(description='Is the topic featured'),
        'private':
        fields.Boolean(description='Is the topic private'),
        'created_at':