Japan Search Gallery Tools
================

<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

## Install

``` sh
pip install jps_gallery_tools
```

## How to use

[See the
documentation](https://nakamura196.github.io/jps_gallery_tools/api.html)
for full details of the Japan Search Gallery API Client.

``` python
from jps_gallery_tools.api import JPSGalleryClient
gallery = JPSGalleryClient()
```

``` python
gallery.setMetadata('title', 'ja', '日本語タイトル')
gallery.setMetadata('summary', 'ja', '日本語の概要')
gallery.setMetadata("responsibility", "ja", "中村覚")
gallery.addTag("はじめてのタグ")
gallery.addTag("二つ目のタグ")
```

# トップ画像

``` python
original_url = "https://blogger.googleusercontent.com/img/a/AVvXsEiTjjaWkCHeCslxeKujaQotjuR_HvhOHen7Ql7rQV8nmQl4ivLRF_CSabMY-JLJHNL-xHMe3VDyA9F-iv1RtQ2jFTk1Vnjck-veKLUZPdYqCcjzHkc8SGKb1fyZ_x8W66aTrSXQ78UN3CnyBakwwmmH_hmPKeEsTzq8J3e2zzUMylmDjCZ0LClPByBRRw=s400"
thumbnail_url = "https://blogger.googleusercontent.com/img/a/AVvXsEiTjjaWkCHeCslxeKujaQotjuR_HvhOHen7Ql7rQV8nmQl4ivLRF_CSabMY-JLJHNL-xHMe3VDyA9F-iv1RtQ2jFTk1Vnjck-veKLUZPdYqCcjzHkc8SGKb1fyZ_x8W66aTrSXQ78UN3CnyBakwwmmH_hmPKeEsTzq8J3e2zzUMylmDjCZ0LClPByBRRw=s180-c"
title = "初日の出のキャラクター"
source = "いらすとや"
top_image = UrlImage(original_url, title, source, thumbnail_url)
gallery.setImage(top_image)
```

``` python
# part = ListPart("tile")
part = ListPart("tile")
part.setMetadata("title", "ja", "リストのタイトル")
part.setMetadata("title", "en", "List Title")
gallery.addPart(part)
```

``` python
# item = ListExternalLinkPart()
# item.setUrl("https://www.irasutoya.com/2021/11/blog-post_91.html")
# part.addPart(item)
```

``` python
# part.addPart(top_image)
item = ListExternalLinkPart()
part.addPart(item)
item.setMetadata("title", "ja", "外部リンクのタイトル")

item.setImage(top_image)
```

``` python
from pprint import pprint
pprint(gallery.export())
```

    {'curationType': 'GALLERY',
     'edit': {'action': 'CREATE',
              'date': 1675830770680,
              'orgId': 'jpsws',
              'userId': 'system'},
     'id': 'aaa',
     'image': {'contentsRightsType': 'various',
               'cover': None,
               'imgType': 'URL',
               'source': {'ja': 'いらすとや'},
               'sourceUrl': None,
               'thumbnailUrl': 'https://blogger.googleusercontent.com/img/a/AVvXsEiTjjaWkCHeCslxeKujaQotjuR_HvhOHen7Ql7rQV8nmQl4ivLRF_CSabMY-JLJHNL-xHMe3VDyA9F-iv1RtQ2jFTk1Vnjck-veKLUZPdYqCcjzHkc8SGKb1fyZ_x8W66aTrSXQ78UN3CnyBakwwmmH_hmPKeEsTzq8J3e2zzUMylmDjCZ0LClPByBRRw=s180-c',
               'title': {'ja': '初日の出のキャラクター'},
               'url': 'https://blogger.googleusercontent.com/img/a/AVvXsEiTjjaWkCHeCslxeKujaQotjuR_HvhOHen7Ql7rQV8nmQl4ivLRF_CSabMY-JLJHNL-xHMe3VDyA9F-iv1RtQ2jFTk1Vnjck-veKLUZPdYqCcjzHkc8SGKb1fyZ_x8W66aTrSXQ78UN3CnyBakwwmmH_hmPKeEsTzq8J3e2zzUMylmDjCZ0LClPByBRRw=s400'},
     'parts': [{'cpid': 'a',
                'parts': [{'cpid': 'a',
                           'image': {'contentsRightsType': 'various',
                                     'cover': None,
                                     'imgType': 'URL',
                                     'source': {'ja': 'いらすとや'},
                                     'sourceUrl': None,
                                     'thumbnailUrl': 'https://blogger.googleusercontent.com/img/a/AVvXsEiTjjaWkCHeCslxeKujaQotjuR_HvhOHen7Ql7rQV8nmQl4ivLRF_CSabMY-JLJHNL-xHMe3VDyA9F-iv1RtQ2jFTk1Vnjck-veKLUZPdYqCcjzHkc8SGKb1fyZ_x8W66aTrSXQ78UN3CnyBakwwmmH_hmPKeEsTzq8J3e2zzUMylmDjCZ0LClPByBRRw=s180-c',
                                     'title': {'ja': '初日の出のキャラクター'},
                                     'url': 'https://blogger.googleusercontent.com/img/a/AVvXsEiTjjaWkCHeCslxeKujaQotjuR_HvhOHen7Ql7rQV8nmQl4ivLRF_CSabMY-JLJHNL-xHMe3VDyA9F-iv1RtQ2jFTk1Vnjck-veKLUZPdYqCcjzHkc8SGKb1fyZ_x8W66aTrSXQ78UN3CnyBakwwmmH_hmPKeEsTzq8J3e2zzUMylmDjCZ0LClPByBRRw=s400'},
                           'title': {'ja': '外部リンクのタイトル'},
                           'type': 'jps-curation-list-external-link'}],
                'title': {'en': 'List Title', 'ja': 'リストのタイトル'},
                'type': 'jps-curation-list',
                'viewType': 'tile'}],
     'permission': {'level': 'ADMIN', 'publicationLevel': 'WORKSPACE'},
     'primaryTerm': 1,
     'responsibility': {'ja': '中村覚'},
     'rights': {},
     'rightsType': 'ccby',
     'seqNo': 0,
     'summary': {'ja': '日本語の概要'},
     'title': {'ja': '日本語タイトル'},
     'version': 1,
     'workspace': 'abc',
     'workspaceTags': ['はじめてのタグ', '二つ目のタグ']}

``` python
gallery.save("tmp/gallery.json")
```

``` python
b = gallery.encode()
print(b)
```

     
