Skip to content

Commit

Permalink
Merge pull request #169 from kitcc-org/168-google-books-api
Browse files Browse the repository at this point in the history
グローバル検索のAPIを変更した
  • Loading branch information
kimurash authored Dec 16, 2024
2 parents 88fdea8 + 6284f8d commit cd56efd
Show file tree
Hide file tree
Showing 68 changed files with 1,235 additions and 777 deletions.
119 changes: 75 additions & 44 deletions api/bundle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ tags:
description: 貸出履歴に関するAPI
- name: auth
description: 認証に関するAPI
- name: google-books
description: Google Books から書籍の情報を取得するAPI
paths:
/books:
get:
Expand Down Expand Up @@ -132,7 +134,6 @@ paths:
type: string
publishedDate:
type: string
format: date
description:
type: string
thumbnail:
Expand Down Expand Up @@ -337,12 +338,12 @@ paths:
$ref: '#/components/responses/NotFound'
'500':
$ref: '#/components/responses/InternalServerError'
/books/search:
/googlebooks:
get:
tags:
- book
operationId: searchBooks
summary: 書籍を検索する
- google-books
operationId: searchGoogleBooks
summary: Google Books から書籍を検索する
security: []
parameters:
- name: page
Expand Down Expand Up @@ -409,51 +410,44 @@ paths:
books:
type: array
items:
type: object
properties:
id:
type: string
title:
type: string
authors:
type: array
items:
type: string
publisher:
type: string
publishedDate:
type: string
description:
type: string
thumbnail:
type: string
isbn:
type: string
required:
- id
- title
- authors
$ref: '#/components/schemas/GoogleBook'
required:
- totalBook
- books
example:
totalBook: 30
books:
- id: 5-OgzgEACAAJ
title: 計算機プログラムの構造と解釈
authors:
- Harold Abelson
- Gerald Jay Sussman
- Julie Sussman
publisher: 翔泳社
publishedDate: '2018-07-01'
description: 言わずと知れた計算機科学の古典的名著
thumbnail: http://books.google.com/books/content?id=LlH-oAEACAAJ&printsec=frontcover&img=1&zoom=1&source=gbs_api
isbn: '9784798135984'
'400':
$ref: '#/components/responses/BadRequest'
'500':
$ref: '#/components/responses/InternalServerError'
/googlebooks/{volumeId}:
get:
tags:
- google-books
operationId: getGoogleBook
summary: Google Books から特定の書籍の情報を取得する
security: []
parameters:
- name: volumeId
in: path
description: Google BooksのID
required: true
schema:
type: string
responses:
'200':
description: 情報の取得に成功した
content:
application/json:
schema:
$ref: '#/components/schemas/GoogleBook'
examples:
book:
$ref: '#/components/examples/google-book'
'400':
$ref: '#/components/responses/BadRequest'
'404':
$ref: '#/components/responses/NotFound'
'500':
$ref: '#/components/responses/InternalServerError'
/users:
get:
tags:
Expand Down Expand Up @@ -998,7 +992,6 @@ components:
type: string
publishedDate:
type: string
format: date
description:
type: string
thumbnail:
Expand All @@ -1025,6 +1018,31 @@ components:
type: string
required:
- message
GoogleBook:
type: object
properties:
id:
type: string
title:
type: string
authors:
type: array
items:
type: string
publisher:
type: string
publishedDate:
type: string
description:
type: string
thumbnail:
type: string
isbn:
type: string
required:
- id
- title
- authors
User:
type: object
properties:
Expand Down Expand Up @@ -1109,6 +1127,19 @@ components:
thumbnail: http://books.google.com/books/content?id=LlH-oAEACAAJ&printsec=frontcover&img=1&zoom=1&source=gbs_api
isbn: '9784798135984'
stock: 1
google-book:
value:
id: 5-OgzgEACAAJ
title: 計算機プログラムの構造と解釈
authors:
- Harold Abelson
- Gerald Jay Sussman
- Julie Sussman
publisher: 翔泳社
publishedDate: '2018-07-01'
description: 言わずと知れた計算機科学の古典的名著
thumbnail: http://books.google.com/books/content?id=LlH-oAEACAAJ&printsec=frontcover&img=1&zoom=1&source=gbs_api
isbn: '9784798135984'
user:
value:
id: 1
Expand Down
18 changes: 9 additions & 9 deletions api/components/examples/book.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
value:
id: 1
title: "計算機プログラムの構造と解釈"
title: '計算機プログラムの構造と解釈'
authors:
- "Harold Abelson"
- "Gerald Jay Sussman"
- "Julie Sussman"
publisher: "翔泳社"
publishedDate: "2012-07-06"
description: "言わずと知れた計算機科学の古典的名著"
thumbnail: "http://books.google.com/books/content?id=LlH-oAEACAAJ&printsec=frontcover&img=1&zoom=1&source=gbs_api"
isbn: "9784798135984"
- 'Harold Abelson'
- 'Gerald Jay Sussman'
- 'Julie Sussman'
publisher: '翔泳社'
publishedDate: '2012-07-06'
description: '言わずと知れた計算機科学の古典的名著'
thumbnail: 'http://books.google.com/books/content?id=LlH-oAEACAAJ&printsec=frontcover&img=1&zoom=1&source=gbs_api'
isbn: '9784798135984'
stock: 1
12 changes: 12 additions & 0 deletions api/components/examples/google-book.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
value:
id: 5-OgzgEACAAJ
title: '計算機プログラムの構造と解釈'
authors:
- 'Harold Abelson'
- 'Gerald Jay Sussman'
- 'Julie Sussman'
publisher: '翔泳社'
publishedDate: '2018-07-01'
description: '言わずと知れた計算機科学の古典的名著'
thumbnail: 'http://books.google.com/books/content?id=LlH-oAEACAAJ&printsec=frontcover&img=1&zoom=1&source=gbs_api'
isbn: '9784798135984'
1 change: 0 additions & 1 deletion api/components/schemas/Book.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ properties:
type: string
publishedDate:
type: string
format: date
description:
type: string
thumbnail:
Expand Down
24 changes: 24 additions & 0 deletions api/components/schemas/GoogleBook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
type: object
properties:
id:
type: string
title:
type: string
authors:
type: array
items:
type: string
publisher:
type: string
publishedDate:
type: string
description:
type: string
thumbnail:
type: string
isbn:
type: string
required:
- id
- title
- authors
29 changes: 17 additions & 12 deletions api/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ info:
title: KITCC Library API
contact:
name: KITCC
url: "https://www.kitcc.org/"
email: "question@kitcc.org"
url: 'https://www.kitcc.org/'
email: 'question@kitcc.org'
license:
name: MIT
url: https://en.wikipedia.org/wiki/MIT_License
version: "1.0.0"
version: '1.0.0'

servers:
- url: "https://kitcc-library-api.kitcc.workers.dev"
- url: 'https://kitcc-library-api.kitcc.workers.dev'

tags:
- name: book
Expand All @@ -22,25 +22,30 @@ tags:
description: 貸出履歴に関するAPI
- name: auth
description: 認証に関するAPI
- name: google-books
description: Google Books から書籍の情報を取得するAPI

paths:
/books:
$ref: "./paths/book.yml#/books"
$ref: './paths/book.yml#/books'
/books/{bookId}:
$ref: "./paths/book.yml#/book"
/books/search:
$ref: "./paths/book.yml#/search"
$ref: './paths/book.yml#/book'

/googlebooks:
$ref: paths/google-books.yml#/books
/googlebooks/{volumeId}:
$ref: paths/google-books.yml#/book

/users:
$ref: "./paths/user.yml#/users"
$ref: './paths/user.yml#/users'
/users/{userId}:
$ref: "paths/user.yml#/user"
$ref: 'paths/user.yml#/user'

/loans:
$ref: "./paths/loan.yml#/loans"
$ref: './paths/loan.yml#/loans'

/auth:
$ref: "./paths/auth.yml#/auth"
$ref: './paths/auth.yml#/auth'

components:
securitySchemes:
Expand Down
Loading

0 comments on commit cd56efd

Please sign in to comment.