Skip to content

Commit

Permalink
Updated to change pagination-related parameters to use underscores (e…
Browse files Browse the repository at this point in the history
….g. starts_with instead of startswith).
  • Loading branch information
AlanSimmons committed Nov 8, 2023
1 parent 80126f8 commit b1faaee
Show file tree
Hide file tree
Showing 6 changed files with 154 additions and 153 deletions.
78 changes: 39 additions & 39 deletions hs-ontology-api-spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -358,19 +358,19 @@ paths:
- name: page
in: query
required: false
description: Offset set of genes of count=genesperpage. Can be a non-negative number or the words "first" or "last".
description: Offset set of genes of count=genes_per_page. Can be a non-negative number or the words "first" or "last".
schema:
type: string
default: 1
example: 1
- name: genesperpage
- name: genes_per_page
in: query
required: false
description: Number of genes per "page" to return. Can be a nonzero number.
schema:
type: string
default: 10
- name: startswith
- name: starts_with
in: query
required: false
description: Optional string by which to filter by gene symbol.
Expand All @@ -387,9 +387,9 @@ paths:
items:
$ref: '#/components/schemas/GeneListResponse'
'400':
description: Invalid parameter--e.g., *genesperpage* is either non-numeric or a negative number; *page* is something other than a non-negative number or the words 'first' or 'last'
description: Invalid parameter--e.g., *genes_per_page* is either non-numeric or a negative number; *page* is something other than a non-negative number or the words 'first' or 'last'
'404':
description: No genes that satisfied the criteria were found. This usually means that there are no genes with HGNC approved symbols that start with the string specified in the *startswith* parameter.
description: No genes that satisfied the criteria were found. This usually means that there are no genes with HGNC approved symbols that start with the string specified in the *starts_with* parameter.
'5XX':
description: Unexpected error
/genes/{id}:
Expand Down Expand Up @@ -425,19 +425,19 @@ paths:
- name: page
in: query
required: false
description: Offset set of proteins of count=proteinsperpage. Can be a non-negative number or the words "first" or "last".
description: Offset set of proteins of count=proteins_per_page. Can be a non-negative number or the words "first" or "last".
schema:
type: string
default: 1
example: 1
- name: proteinsperpage
- name: proteins_per_page
in: query
required: false
description: Number of proteins per "page" to return. Can be a nonzero number.
schema:
type: string
default: 10
- name: startswith
- name: starts_with
in: query
required: false
description: Optional *case-insensitive* string by which to filter by UniProtKB protein name.
Expand All @@ -454,9 +454,9 @@ paths:
items:
$ref: '#/components/schemas/ProteinListResponse'
'400':
description: Invalid parameter--e.g., *proteinsperpage* is either non-numeric or a negative number; *page* is something other than a non-negative number or the words 'first' or 'last'
description: Invalid parameter--e.g., *proteins_per_page* is either non-numeric or a negative number; *page* is something other than a non-negative number or the words 'first' or 'last'
'404':
description: No proteins that satisfied the criteria were found. This usually means that there are no proteins with UniprotKB names that start with the string specified in the *startswith* parameter.
description: No proteins that satisfied the criteria were found. This usually means that there are no proteins with UniprotKB names that start with the string specified in the *starts_with* parameter.
'5XX':
description: Unexpected error
/proteins/{id}:
Expand Down Expand Up @@ -492,19 +492,19 @@ paths:
- name: page
in: query
required: false
description: Offset set of genes of count=celltypesperpage. Can be a non-negative number or the words "first" or "last".
description: Offset set of genes of count=celltypes_per_page. Can be a non-negative number or the words "first" or "last".
schema:
type: string
default: 1
example: 1
- name: celltypesperpage
- name: celltypes_per_page
in: query
required: false
description: Number of cell types per "page" to return. Can be a nonzero number.
schema:
type: string
default: 10
- name: startswith
- name: starts_with
in: query
required: false
description: Optional *case-insensitive* string by which to filter by cell type name.
Expand All @@ -521,9 +521,9 @@ paths:
items:
$ref: '#/components/schemas/CellTypeListResponse'
'400':
description: Invalid parameter--e.g., *celltypesperpage* is either non-numeric or a negative number; *page* is something other than a non-negative number or the words 'first' or 'last'
description: Invalid parameter--e.g., *celltypes_per_page* is either non-numeric or a negative number; *page* is something other than a non-negative number or the words 'first' or 'last'
'404':
description: No cell types that satisfied the criteria were found. This usually means that there are no cell types with names that start with the string specified in the *startswith* parameter.
description: No cell types that satisfied the criteria were found. This usually means that there are no cell types with names that start with the string specified in the *starts_with* parameter.
'5XX':
description: Unexpected error
/celltypes/{id}:
Expand Down Expand Up @@ -874,25 +874,25 @@ components:
type: object
description: pagination statistics
properties:
itemsperpage:
items_per_page:
type: number
description: original value of genesperpage request parameter
description: original value of genes_per_page request parameter
example: 3
page:
type: number
description: original value of page request parameter
example: 1
totalpages:
total_pages:
type: number
description: calculated total number of "pages" (blocks) based on the values of itemsperpage and the total number of items
description: calculated total number of "pages" (blocks) based on the values of items_per_page and the total number of items
example: 14381
startswith:
starts_with:
type: string
description: original value of startswith request parameter
description: original value of starts_with request parameter
example: M
itemcount:
item_count:
type: number
description: Calculated count of items. If startswith is non-null, the count is that of the genes with approved HGNC symbols that start with the value of starts_with.
description: Calculated count of items. If starts_with is non-null, the count is that of the genes with approved HGNC symbols that start with the value of starts_with.
example: 500
GeneDetailResponse: # JAS Sept 2023
type: object
Expand Down Expand Up @@ -1024,25 +1024,25 @@ components:
type: object
description: pagination statistics
properties:
itemsperpage:
items_per_page:
type: number
description: original value of proteinsperpage request parameter
description: original value of proteins_per_page request parameter
example: 3
page:
type: number
description: original value of page request parameter
example: 1
totalpages:
total_pages:
type: number
description: calculated total number of "pages" (blocks) based on the values of proteinsperpage and the total number of proteins
description: calculated total number of "pages" (blocks) based on the values of proteins_per_page and the total number of proteins
example: 14381
startswith:
starts_with:
type: string
description: original value of startswith request parameter
description: original value of starts_with request parameter
example: M
itemcount:
item_count:
type: number
description: Count of proteins. If startswith is non-null, the count is that of the proteins with names that start with the value of startswith.
description: Count of proteins. If starts_with is non-null, the count is that of the proteins with names that start with the value of starts_with.
example: 500
ProteinDetailResponse:
type: object
Expand Down Expand Up @@ -1122,25 +1122,25 @@ components:
type: object
description: pagination statistics
properties:
itemsperpage:
items_per_page:
type: number
description: original value of celltypesperpage request parameter
description: original value of celltypes_per_page request parameter
example: 3
page:
type: number
description: original value of page request parameter
example: 1
totalpages:
total_pages:
type: number
description: calculated total number of "pages" (blocks) based on the values of celltypesperpage and the total number of celltypes
description: calculated total number of "pages" (blocks) based on the values of celltypes_per_page and the total number of celltypes
example: 14381
startswith:
starts_with:
type: string
description: original value of startswith request parameter
description: original value of starts_with request parameter
example: E
itemcount:
item_count:
type: number
description: calculated count of cell types. If startswith is non-null, the count is that of the cell types with names that start with the value of startswith.
description: calculated count of cell types. If starts_with is non-null, the count is that of the cell types with names that start with the value of starts_with.
example: 500
CellTypeDetailResponse:
type: object
Expand Down
22 changes: 11 additions & 11 deletions src/hs_ontology_api/models/genelist.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,25 @@
from hs_ontology_api.models.pagination import Pagination

class GeneList():
def __init__(self, page=None, totalpages=None, genesperpage=None, genes=None, startswith=None, genecount=None):
def __init__(self, page=None, total_pages=None, genes_per_page=None, genes=None, starts_with=None, gene_count=None):
"""GeneList - a model defined in OpenAPI
:param page: Requested relative "page" (block of genes)
:type page: str
:param totalpages: Calculated total number of "pages" (blocks of genes)
:type totalpages: str
:param total_pages: Calculated total number of "pages" (blocks of genes)
:type total_pages: str
:param genes: List of gene objects for an array
:type genes: List[GeneListDetail]
:param genesperpage: Requested number of genes in each "page" (block)
:type genesperpage: str
:startswith: Optional search string for type ahead
:type startswith: str
:genecount: Calculated count of genes that satisfied the search criteria
:type genecount: str
:param genes_per_page: Requested number of genes in each "page" (block)
:type genes_per_page: str
:starts_with: Optional search string for type ahead
:type starts_with: str
:gene_count: Calculated count of genes that satisfied the search criteria
:type gene_count: str
"""

# The page, totalpages, genesperpage, startswith, and genecount parameters will be used to build a
# The page, total_pages, genes_per_page, starts_with, and gene_count parameters will be used to build a
# Pagination object.
# The genes parameter will be used to build an array of GeneListDetail objects.

Expand All @@ -50,7 +50,7 @@ def __init__(self, page=None, totalpages=None, genesperpage=None, genes=None, st
}
# Property assignments
self._genes = genes
self._pagination = Pagination(page, totalpages, genesperpage, startswith, genecount).serialize()
self._pagination = Pagination(page, total_pages, genes_per_page, starts_with, gene_count).serialize()

def serialize(self):
# Key/value format of response.
Expand Down
Loading

0 comments on commit b1faaee

Please sign in to comment.