Skip to content

Instantly share code, notes, and snippets.

@pavelkeyzik
Last active December 14, 2021 12:00
Show Gist options
  • Select an option

  • Save pavelkeyzik/92314f6d7953e18e113de0957742dd9d to your computer and use it in GitHub Desktop.

Select an option

Save pavelkeyzik/92314f6d7953e18e113de0957742dd9d to your computer and use it in GitHub Desktop.
VS Code Snippets Aibolit
{
"GET with Query Params": {
"prefix": "api-get-with-query-params",
"body": [
"async function ${1/(.)/${1:/downcase}/}${2} (variables: ${1}${2}Parameters) {",
" const queryParams = setQueryParams<${1}${2}Parameters>(",
" variables,",
" );",
"",
" const response = await ${3|service,platformService,plus3DPhysicianService,plus3DRadiologistService,plus3DAdminService,plus3DService,adminService|}.get<",
" ${1}${2}Response<200, 'application/json'>",
" >(`/${1}/${2}\\${queryParams}`);",
"",
" return response.data;",
"}"
],
"description": "GET with Query Params"
},
"POST with Request Data": {
"prefix": "api-post-with-request-data",
"body": [
"async function ${1/(.)/${1:/downcase}/}${2} (variables: ${1}${2}Request) {",
" const response = await ${3|service,platformService,plus3DPhysicianService,plus3DRadiologistService,plus3DAdminService,plus3DService,adminService|}.post<",
" ${1}${2}Response<200, 'application/json'>",
" >('/${1}/${2}', variables);",
"",
" return response.data;",
"}"
],
"description": "POST with Request Data"
},
"POST with Request Data And Progress Helper": {
"prefix": "api-post-with-request-data-and-progress-helper",
"body": [
"async function ${1/(.)/${1:/downcase}/}${2} (variables: {",
" data: ${1}${2}Request;",
" onProgress?: PercentageHelperCallback;",
"}) {",
" const progressHelper = getPercentageCountHelper(variables.onProgress);",
"",
" const response = await ${3|service,platformService,plus3DPhysicianService,plus3DRadiologistService,plus3DAdminService,plus3DService,adminService|}.post<",
" ${1}${2}Response<200, 'application/json'>",
" >('/${1}/${2}', variables.data, progressHelper);",
"",
" return response.data;",
"}"
],
"description": "POST with Request Data And Progress Helper"
},
"POST with Query Params": {
"prefix": "api-post-with-query-params",
"body": [
"async function ${1/(.)/${1:/downcase}/}${2} (variables: ${1}${2}Parameters) {",
" const queryParams = setQueryParams<${1}${2}Parameters>(",
" variables,",
" );",
"",
" const response = await ${3|service,platformService,plus3DPhysicianService,plus3DRadiologistService,plus3DAdminService,plus3DService,adminService|}.post<",
" ${1}${2}Response<200, 'application/json'>",
" >(`/${1}/${2}\\${queryParams}`);",
"",
" return response.data;",
"}"
],
"description": "POST with Query Params"
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment