Skip to content

Instantly share code, notes, and snippets.

🇯🇵
Vacationing

Nicola Corti cortinico

🇯🇵
Vacationing
Block or report user

Report or block cortinico

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@cortinico
cortinico / DefaultApi.kt
Created Oct 30, 2019
Example of a common parameter swapping scenario with swagger-gradle-codegen
View DefaultApi.kt
interface DefaultApi {
/**
* Find a Business by its owner name and surname.
*/
@GET("/business/owner")
fun getBusinessByOwner(
@retrofit2.http.Query("surname") surname: String
@retrofit2.http.Query("name") name: String
): Single<List<Business>>
}
View IdToInfoForPhotoUploadSuggestionMapToBusinessReviewMap.kt
data class IdToInfoForPhotoUploadSuggestionMapToBusinessReviewMap(
// ...
)
@cortinico
cortinico / build.gradle
Created Oct 30, 2019
Implementation dependencies for swagger-gradle-codegen generated artifacts
View build.gradle
implementation "com.yelp.android.apis:mobileapi:13.20191020212515.0"
implementation "com.yelp.android.apis:bizapp:13.20191020212515.0"
@cortinico
cortinico / DefaultApi.kt
Created Oct 30, 2019
Generated Retrofit interface from swagger-gradle-codegen
View DefaultApi.kt
interface DefaultApi {
/**
* Find business by ID
* Returns a single Business by its ID
* @param businessId ID of Business to return (required)
*/
@GET("/business/{businessId}")
fun getBusinessById(
@retrofit2.http.Path("businessId") businessId: Long
): Single<Business>
@cortinico
cortinico / Business.kt
Created Oct 30, 2019
Generated Business class from swagger-gradle-codegen
View Business.kt
/**
* Represents a specific Business on Yelp
* @property category Optional category of the business
* @property id Unique ID of this Business
* @property name Name of this specific Business
* @property photoUrls Photo URls for this Business
* @property status Status of this Business on Yelp
*/
data class Business (
@Json(name = "id") var id: Long,
@cortinico
cortinico / Category.kt
Created Oct 30, 2019
Generated Category classes from swagger-gradle-codegen
View Category.kt
/**
* A Category used to group businesses on Yelp
* @property id Unique ID of the Category
* @property name Name of this category
*/
data class Category(
@Json(name = "id") var id: Long? = null,
@Json(name = "name") var name: String? = null
)
@cortinico
cortinico / build.gradle
Created Oct 30, 2019
swagger-gradle-codegen Configuring generate swagger to depend on preBuild
View build.gradle
preBuild.dependsOn(tasks.getByName(“generateSwagger"))
@cortinico
cortinico / build.gradle
Created Oct 30, 2019
swagger-gradle-codegen Gradle Configuration Block
View build.gradle
plugins {
id("com.yelp.codegen.plugin") version "<latest_version>"
}
generateSwagger {
platform = "kotlin"
packageName = "com.yelp.codegen.samples"
inputFile = file("./sample_specs.json")
outputDir = file("./src/main/java/")
}
@cortinico
cortinico / sample-yelp-api-specs.json
Created Oct 21, 2019
Sample Swagger Spec for a Yelp API
View sample-yelp-api-specs.json
{
"definitions": {
"Category": {
"description": "A Category used to group businesses",
"properties": {
"id": {
"description": "Unique ID of the Category",
"format": "int64",
"type": "integer"
},
@cortinico
cortinico / default.generated.config
Created Jan 18, 2019
Jetifier default config file
View default.generated.config
# Copyright (C) 2018 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
You can’t perform that action at this time.