예제 #1
0
파일: api_fields.py 프로젝트: grouan/udata
        fields.ISODateTime(readonly=True,
                           description='The resource creation date'),
        'published':
        fields.ISODateTime(description='The resource publication date'),
        'last_modified':
        fields.ISODateTime(attribute='modified',
                           readonly=True,
                           description='The resource last modification date'),
        'metrics':
        fields.Raw(description='The resource metrics', readonly=True),
    })

upload_fields = api.extend(
    'UploadedResource', resource_fields, {
        'success':
        fields.Boolean(description='Whether the upload succeeded or not.',
                       readonly=True,
                       default=True),
    })

resources_order = api.as_list(fields.String(description='Resource ID'))

temporal_coverage_fields = api.model(
    'TemporalCoverage', {
        'start':
        fields.ISODateTime(description='The temporal coverage start date',
                           required=True),
        'end':
        fields.ISODateTime(description='The temporal coverage end date',
                           required=True),
    })
예제 #2
0
    'mime': fields.String(description='The resource mime type'),
    'created_at': fields.ISODateTime(
        readonly=True, description='The resource creation date'),
    'published': fields.ISODateTime(
        description='The resource publication date'),
    'last_modified': fields.ISODateTime(
        attribute='modified', readonly=True,
        description='The resource last modification date'),
    'metrics': fields.Raw(description='The resource metrics', readonly=True),
    'is_available': fields.Raw(
        description='The resource availability', readonly=True),
})

upload_fields = api.extend('UploadedResource', resource_fields, {
    'success': fields.Boolean(
        description='Whether the upload succeeded or not.',
        readonly=True, default=True),
})

resources_order = api.as_list(fields.String(description='Resource ID'))

temporal_coverage_fields = api.model('TemporalCoverage', {
    'start': fields.ISODateTime(description='The temporal coverage start date',
                                required=True),
    'end': fields.ISODateTime(description='The temporal coverage end date',
                              required=True),
})

dataset_ref_fields = api.inherit('DatasetReference', base_reference, {
    'title': fields.String(description='The dataset title', readonly=True),
    'uri': fields.UrlFor(
예제 #3
0
파일: api.py 프로젝트: yohanboniface/udata
        'deleted':
        fields.ISODateTime(description='The source deletion date'),
    })

backend_fields = api.model(
    'HarvestBackend', {
        'id': fields.String(description='The backend identifier'),
        'label': fields.String(description='The backend display name')
    })

preview_dataset_fields = api.extend(
    'DatasetPreview', dataset_fields, {
        'uri':
        fields.UrlFor('api.dataset',
                      lambda o: {'dataset': 'not-available'},
                      description='The dataset API URI (fake)'),
        'page':
        fields.UrlFor('datasets.show',
                      lambda o: {'dataset': 'not-available'},
                      description='The dataset page URL (fake)'),
    })

preview_item_fields = api.extend(
    'HarvestItemPreview', item_fields, {
        'dataset':
        fields.Nested(preview_dataset_fields,
                      description='The processed dataset',
                      allow_null=True),
    })

preview_job_fields = api.extend(
예제 #4
0
파일: api.py 프로젝트: anukat2015/udata
    'owner': fields.Nested(user_ref_fields, allow_null=True,
                           description='The owner information'),
    'organization': fields.Nested(org_ref_fields, allow_null=True,
                                  description='The producer organization'),
    'deleted': fields.ISODateTime(description='The source deletion date'),
})

backend_fields = api.model('HarvestBackend', {
    'id': fields.String(description='The backend identifier'),
    'label': fields.String(description='The backend display name')
})

preview_dataset_fields = api.extend('DatasetPreview', dataset_fields, {
    'uri': fields.UrlFor(
        'api.dataset', lambda o: {'dataset': 'not-available'},
        description='The dataset API URI (fake)'),
    'page': fields.UrlFor(
        'datasets.show', lambda o: {'dataset': 'not-available'},
        description='The dataset page URL (fake)'),
})

preview_item_fields = api.extend('HarvestItemPreview', item_fields, {
    'dataset': fields.Nested(preview_dataset_fields,
                             description='The processed dataset',
                             allow_null=True),
})

preview_job_fields = api.extend('HarvestJobPreview', job_fields, {
    'items': fields.List(fields.Nested(preview_item_fields),
                         description='The job collected items'),
})
예제 #5
0
    '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'),
    'mime': fields.String(description='The resource mime type'),
    'created_at': fields.ISODateTime(description='The resource creation date', readonly=True),
    'last_modified': fields.ISODateTime(attribute='modified',
        description='The resource last modification date', readonly=True),
    'metrics': fields.Raw(description='The resource metrics', readonly=True),
})

upload_fields = api.extend('UploadedResource', resource_fields, {
    'success': fields.Boolean(description='Whether the upload succeeded or not.', readonly=True, default=True),
    # 'error': fields.String(description='An error message if success is false', readonly=True),
})

resources_order = api.as_list(fields.String(description='Resource ID'))

temporal_coverage_fields = api.model('TemporalCoverage', {
    'start': fields.ISODateTime(description='The temporal coverage start date', required=True),
    'end': fields.ISODateTime(description='The temporal coverage end date', required=True),
})

dataset_fields = api.model('Dataset', {
    'id': fields.String(description='The dataset identifier', readonly=True),
    'title': fields.String(description='The dataset title', required=True),
    '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),
예제 #6
0
        "checksum": fields.Nested(checksum_fields, allow_null=True, description="A checksum to validate file validity"),
        "filesize": fields.Integer(description="The resource file size in bytes"),
        "mime": fields.String(description="The resource mime type"),
        "created_at": fields.ISODateTime(readonly=True, description="The resource creation date"),
        "published": fields.ISODateTime(description="The resource publication date"),
        "last_modified": fields.ISODateTime(
            attribute="modified", readonly=True, description="The resource last modification date"
        ),
        "metrics": fields.Raw(description="The resource metrics", readonly=True),
        "is_available": fields.Raw(description="The resource availability", readonly=True),
    },
)

upload_fields = api.extend(
    "UploadedResource",
    resource_fields,
    {"success": fields.Boolean(description="Whether the upload succeeded or not.", readonly=True, default=True)},
)

resources_order = api.as_list(fields.String(description="Resource ID"))

temporal_coverage_fields = api.model(
    "TemporalCoverage",
    {
        "start": fields.ISODateTime(description="The temporal coverage start date", required=True),
        "end": fields.ISODateTime(description="The temporal coverage end date", required=True),
    },
)

dataset_ref_fields = api.inherit(
    "DatasetReference",