Skip to content

Instantly share code, notes, and snippets.

@keithweaver
Created June 13, 2023 18:01
Show Gist options
  • Save keithweaver/ec0fa44d12f26a08be86b3ee8c229126 to your computer and use it in GitHub Desktop.
Save keithweaver/ec0fa44d12f26a08be86b3ee8c229126 to your computer and use it in GitHub Desktop.
Upstream Basic V1
{
"swagger": "2.0",
"info": {
"title": "API",
"contact": {}
},
"host": "http://localhost:9000",
"paths": {
"/basics/cars/upstream": {
"get": {
"description": "Returns a list of cars",
"tags": [
"Cars"
],
"operationId": "list-upstream-cars",
"parameters": [
{
"type": "integer",
"description": "Page number",
"name": "page",
"in": "query"
},
{
"type": "integer",
"description": "Number of cars per page",
"name": "perPage",
"in": "query"
},
{
"type": "string",
"description": "Model of the car",
"name": "model",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/cars.CarListResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/common.Error"
}
}
}
}
},
"/basics/cars/upstream/inventory": {
"post": {
"description": "Adjust the car inventory amount",
"tags": [
"Cars"
],
"operationId": "inventory-upstream-cars",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/cars.AdjustInventoryResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/common.Error"
}
}
}
}
}
},
"definitions": {
"cars.AdjustInventoryResponse": {
"type": "object",
"properties": {
"message": {
"type": "string"
}
}
},
"cars.Body": {
"type": "object",
"properties": {
"doors": {
"type": "integer"
},
"type": {
"type": "string"
}
}
},
"cars.Car": {
"type": "object",
"properties": {
"body": {
"$ref": "#/definitions/cars.Body"
},
"color": {
"type": "string"
},
"id": {
"type": "string"
},
"inventory": {
"type": "integer"
},
"make": {
"type": "string"
},
"model": {
"type": "string"
},
"topSpeed": {
"type": "integer"
},
"year": {
"type": "integer"
},
"zeroToSixty": {
"type": "number"
}
}
},
"cars.CarListResponse": {
"type": "object",
"properties": {
"cars": {
"type": "array",
"items": {
"$ref": "#/definitions/cars.Car"
}
},
"message": {
"type": "string"
}
}
},
"cars.DownstreamCar": {
"type": "object",
"properties": {
"bodyType": {
"type": "string"
},
"color": {
"type": "string"
},
"doors": {
"type": "integer"
},
"id": {
"type": "string"
},
"inventory": {
"type": "number"
},
"make": {
"type": "string"
},
"model": {
"type": "string"
},
"performance": {
"$ref": "#/definitions/cars.DownstreamPerformance"
},
"year": {
"type": "string"
}
}
},
"cars.DownstreamPerformance": {
"type": "object",
"properties": {
"topSpeed": {
"type": "integer"
},
"zeroToSixty": {
"type": "number"
}
}
},
"cars.ListDownstreamResponse": {
"type": "object",
"properties": {
"cursor": {
"type": "string"
},
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/cars.DownstreamCar"
}
},
"message": {
"type": "string"
}
}
},
"cars.NewCarResponse": {
"type": "object",
"properties": {
"car": {
"$ref": "#/definitions/cars.DownstreamCar"
},
"message": {
"type": "string"
}
}
},
"common.Error": {
"type": "object",
"properties": {
"code": {
"$ref": "#/definitions/common.ErrorCode"
},
"message": {
"type": "string"
},
"statusCode": {
"type": "integer"
}
}
},
"common.ErrorCode": {
"type": "string",
"enum": [
"validate_password_empty",
"check_if_user_exists",
"get_encrypted_password",
"save_user",
"send_verification_email",
"sign_in_fetch_user",
"sign_in_failed_to_fetch_user",
"sign_in_invalid_password",
"sign_in_account_locked",
"sign_in_validation_failed",
"sign_in_invalid_session",
"save_new_session",
"save_new_company",
"failed_to_list_companies",
"verify_referral_code_invalid",
"failed_to_list_platforms"
],
"x-enum-varnames": [
"ValidatePasswordEmpty",
"CheckIfUserExists",
"GetEncryptedPassword",
"SaveUser",
"SendVerificationEmail",
"SignInFetchUser",
"SignInFailedToFetchUser",
"SignInInvalidPassword",
"SignInAccountLocked",
"SignInValidationFailed",
"SignInInvalidSession",
"SaveNewSession",
"SaveNewCompany",
"FailedToListCompanies",
"VerifyReferralCodeInvalid",
"FailedToListPlatforms"
]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment