Skip to content

Instantly share code, notes, and snippets.

@drewwells
Last active November 9, 2015 20:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drewwells/443dcaa2d8f07a204f42 to your computer and use it in GitHub Desktop.
Save drewwells/443dcaa2d8f07a204f42 to your computer and use it in GitHub Desktop.
{
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"schemes": [
"http",
"https"
],
"swagger": "2.0",
"info": {
"description": "the purpose of this application is to provide an application\nthat is using plain go code to define an API",
"title": "API.",
"contact": {
"name": "Drew Wells",
"url": "http://fitkiq.com",
"email": "drew@fitkiq.com"
},
"version": "0.0.1"
},
"host": "skillful-elf-105206.appspot.com",
"basePath": "/v1",
"paths": {
"/admin/bookings/": {
"get": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"schemes": [
"http",
"https"
],
"tags": [
"booking"
],
"summary": "Bookings lists all the appointments that have been made on the site.",
"operationId": "Bookings",
"responses": {
"200": {
"$ref": "#/responses/BookingResponses"
}
}
}
},
"/admin/bookings/{id}": {
"delete": {
"description": "Removes a booking",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"schemes": [
"http",
"https"
],
"tags": [
"booking"
],
"operationId": "BookingDelete",
"parameters": [
{
"type": "string",
"x-go-name": "ID",
"description": "ID of the booking",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"$ref": "#/responses/BookingResponse"
}
}
}
},
"/bookings/": {
"post": {
"description": "Create a new booking. It must match an available slot on a service",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"schemes": [
"http",
"https"
],
"tags": [
"booking"
],
"operationId": "MakeBooking",
"parameters": [
{
"description": "Booking to be created",
"name": "Booking",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/Booking"
}
}
],
"responses": {
"200": {
"$ref": "#/responses/BookingResponse"
}
}
}
},
"/services/{id}/slots/": {
"get": {
"description": "Gets all the time slots",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"schemes": [
"http",
"https"
],
"tags": [
"schedule"
],
"summary": "Gets available time slots for the requested Service",
"operationId": "ServiceSlot",
"parameters": [
{
"type": "string",
"x-go-name": "ID",
"description": "ID of the service",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"x-go-name": "From",
"description": "Starting time to query for slots\n\nin: url",
"name": "from",
"in": "query"
},
{
"type": "string",
"x-go-name": "To",
"description": "Ending time to query for slots\n\nin: url",
"name": "to",
"in": "query"
}
],
"responses": {
"200": {
"$ref": "#/responses/SlotResponse"
}
}
}
},
"/signup": {
"post": {
"description": "Signup a new user or trainer",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"schemes": [
"http",
"https"
],
"tags": [
"user"
],
"operationId": "Signup",
"parameters": [
{
"x-go-name": "User",
"description": "User to submit",
"name": "user",
"in": "body",
"schema": {
"$ref": "#/definitions/User"
}
}
],
"responses": {
"200": {
"$ref": "#/responses/UserResponse"
}
}
}
},
"/trainers/": {
"get": {
"description": "Retrieves all the trainers",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"schemes": [
"http",
"https"
],
"tags": [
"trainer"
],
"summary": "Gets available trainers",
"operationId": "Trainers",
"responses": {
"200": {
"$ref": "#/responses/TrainerResponse"
}
}
}
}
},
"definitions": {
"Booking": {
"type": "object",
"properties": {
"booked_from": {
"x-go-name": "BookedFrom",
"$ref": "#/definitions/Time"
},
"booked_to": {
"x-go-name": "BookedTo",
"$ref": "#/definitions/Time"
},
"count": {
"type": "number",
"format": "int64",
"x-go-name": "Count"
},
"created_at": {
"x-go-name": "CreatedAt",
"$ref": "#/definitions/Time"
},
"custom_data": {
"type": "object",
"additionalProperties": {},
"x-go-name": "CustomData"
},
"expires_at": {
"x-go-name": "ExpiresAt",
"$ref": "#/definitions/Time"
},
"external_id": {
"type": "string",
"x-go-name": "ExternalID"
},
"id": {
"type": "number",
"format": "int64",
"x-go-name": "ID"
},
"notes": {
"type": "string",
"x-go-name": "Notes"
},
"person_id": {
"type": "number",
"format": "int64",
"x-go-name": "PersonID"
},
"public_booking": {
"type": "boolean",
"x-go-name": "PublicBooking"
},
"resource_id": {
"type": "number",
"format": "int64",
"x-go-name": "ResourceID"
},
"service_id": {
"type": "number",
"format": "int64",
"x-go-name": "ServiceID"
},
"state": {
"type": "string",
"x-go-name": "State"
},
"updated_at": {
"x-go-name": "UpdatedAt",
"$ref": "#/definitions/Time"
}
},
"x-go-package": "github.com/drewwells/makeplans"
},
"Duration": {
"description": "A Duration represents the elapsed time between two instants\nas an int64 nanosecond count. The representation limits the\nlargest representable duration to approximately 290 years.",
"x-go-package": "time"
},
"Month": {
"title": "A Month specifies a month of the year (January = 1, ...).",
"x-go-package": "time"
},
"Resource": {
"description": "Resource is the makeplans description of a trainer",
"type": "object",
"properties": {
"capacity": {
"type": "number",
"format": "int64",
"x-go-name": "Capacity"
},
"created_at": {
"x-go-name": "CreatedAt",
"$ref": "#/definitions/Time"
},
"custom_data": {
"x-go-name": "CustomData"
},
"id": {
"type": "number",
"format": "int64",
"x-go-name": "ID"
},
"opening_hours_fri": {
"type": "array",
"items": {
"type": "string"
},
"x-go-name": "OpeningHoursFri"
},
"opening_hours_mon": {
"type": "array",
"items": {
"type": "string"
},
"x-go-name": "OpeningHoursMon"
},
"opening_hours_sat": {
"type": "array",
"items": {
"type": "string"
},
"x-go-name": "OpeningHoursSat"
},
"opening_hours_sun": {
"type": "array",
"items": {
"type": "string"
},
"x-go-name": "OpeningHoursSun"
},
"opening_hours_thu": {
"type": "array",
"items": {
"type": "string"
},
"x-go-name": "OpeningHoursThu"
},
"opening_hours_tue": {
"type": "array",
"items": {
"type": "string"
},
"x-go-name": "OpeningHoursTue"
},
"opening_hours_wed": {
"type": "array",
"items": {
"type": "string"
},
"x-go-name": "OpeningHoursWed"
},
"services": {
"type": "array",
"items": {
"$ref": "#/definitions/Service"
},
"x-go-name": "Services"
},
"title": {
"type": "string",
"x-go-name": "Title"
},
"updated_at": {
"x-go-name": "UpdatedAt",
"$ref": "#/definitions/Time"
}
},
"x-go-package": "github.com/drewwells/makeplans"
},
"Service": {
"type": "object",
"properties": {
"active": {
"type": "boolean",
"x-go-name": "Active"
},
"booking_capacity": {
"type": "number",
"format": "int64",
"x-go-name": "BookingCapacity"
},
"booking_type_id": {
"type": "number",
"format": "int64",
"x-go-name": "BookingTypeID"
},
"created_at": {
"x-go-name": "CreatedAt",
"$ref": "#/definitions/Time"
},
"custom_data": {
"x-go-name": "CustomData"
},
"day_booking_specify_time": {
"x-go-name": "DayBookingSpecifyTime"
},
"description": {
"type": "string",
"x-go-name": "Description"
},
"has_day_booking": {
"type": "boolean",
"x-go-name": "HasDayBooking"
},
"id": {
"type": "number",
"format": "int64",
"x-go-name": "ID"
},
"interval": {
"type": "number",
"format": "int64",
"x-go-name": "Interval"
},
"mail_confirmation": {
"x-go-name": "MailConfirmation"
},
"mail_verification": {
"x-go-name": "MailVerification"
},
"max_slots": {
"type": "number",
"format": "int64",
"x-go-name": "MaxSlots"
},
"price": {
"type": "string",
"x-go-name": "Price"
},
"same_day": {
"type": "boolean",
"x-go-name": "SameDay"
},
"sms_confirmation": {
"x-go-name": "SmsConfirmation"
},
"sms_reminder": {
"x-go-name": "SmsReminder"
},
"sms_verification": {
"x-go-name": "SmsVerification"
},
"template": {
"x-go-name": "Template"
},
"title": {
"type": "string",
"x-go-name": "Title"
},
"updated_at": {
"x-go-name": "UpdatedAt",
"$ref": "#/definitions/Time"
}
},
"x-go-package": "github.com/drewwells/makeplans"
},
"Slot": {
"description": "Slot describes an available time for a booking. It combines a trainer\nwith the service they provide so a booking can be made.",
"type": "object",
"properties": {
"available_resources": {
"type": "array",
"items": {
"type": "number",
"format": "int64"
},
"x-go-name": "AvailableResources"
},
"formatted_timestamp": {
"type": "string",
"x-go-name": "FormattedTimestamp"
},
"formatted_timestamp_end": {
"type": "string",
"x-go-name": "FormattedTimestampEnd"
},
"free": {
"type": "number",
"format": "int64",
"x-go-name": "Free"
},
"open_resources": {
"type": "array",
"items": {
"type": "number",
"format": "int64"
},
"x-go-name": "OpenResources"
},
"timestamp": {
"x-go-name": "Timestamp",
"$ref": "#/definitions/Time"
},
"timestamp_end": {
"x-go-name": "TimestampEnd",
"$ref": "#/definitions/Time"
}
},
"x-go-package": "github.com/drewwells/makeplans"
},
"Time": {
"description": "Programs using times should typically store and pass them as values,\nnot pointers. That is, time variables and struct fields should be of\ntype time.Time, not *time.Time. A Time value can be used by\nmultiple goroutines simultaneously.\n\nTime instants can be compared using the Before, After, and Equal methods.\nThe Sub method subtracts two instants, producing a Duration.\nThe Add method adds a Time and a Duration, producing a Time.\n\nThe zero value of type Time is January 1, year 1, 00:00:00.000000000 UTC.\nAs this time is unlikely to come up in practice, the IsZero method gives\na simple way of detecting a time that has not been initialized explicitly.\n\nEach Time has associated with it a Location, consulted when computing the\npresentation form of the time, such as in the Format, Hour, and Year methods.\nThe methods Local, UTC, and In return a Time with a specific location.\nChanging the location in this way changes only the presentation; it does not\nchange the instant in time being denoted and therefore does not affect the\ncomputations described in earlier paragraphs.\n\nNote that the Go == operator compares not just the time instant but also the\nLocation. Therefore, Time values should not be used as map or database keys\nwithout first guaranteeing that the identical Location has been set for all\nvalues, which can be achieved through use of the UTC or Local method.",
"type": "object",
"title": "A Time represents an instant in time with nanosecond precision.",
"x-go-package": "time"
},
"Trainer": {
"description": "Trainer is a type of user with an associated Resource",
"type": "object",
"properties": {
"resource": {
"description": "Resource from makeplans associated with trainer\nin: body",
"x-go-name": "Resource",
"$ref": "#/definitions/Resource"
},
"user": {
"description": "User associated with the trainer\n\nin: body",
"x-go-name": "User",
"$ref": "#/definitions/User"
}
},
"x-go-package": "bitbucket.org/fitkiq/api/types"
},
"User": {
"description": "User is an actor in the system. User can have 3 different roles\nadmin, trainer, client",
"type": "object",
"properties": {
"email": {
"type": "string",
"x-go-name": "Email"
},
"first_name": {
"type": "string",
"x-go-name": "FirstName"
},
"id": {
"type": "string",
"x-go-name": "ID"
},
"last_name": {
"type": "string",
"x-go-name": "LastName"
},
"password": {
"type": "string",
"x-go-name": "Password"
},
"person_id": {
"type": "number",
"format": "int64",
"x-go-name": "PersonID"
},
"resource_id": {
"type": "number",
"format": "int64",
"x-go-name": "ResourceID"
},
"role": {
"type": "string",
"x-go-name": "Role"
},
"token": {
"type": "string",
"x-go-name": "Token"
},
"username": {
"type": "string",
"x-go-name": "Username"
}
},
"x-go-package": "bitbucket.org/fitkiq/api/types"
},
"Weekday": {
"title": "A Weekday specifies a day of the week (Sunday = 0, ...).",
"x-go-package": "time"
},
"resourceWrap": {
"type": "object",
"properties": {
"resource": {
"x-go-name": "Resource",
"$ref": "#/definitions/Resource"
}
},
"x-go-package": "github.com/drewwells/makeplans"
},
"serviceWrap": {
"type": "object",
"properties": {
"service": {
"x-go-name": "Service",
"$ref": "#/definitions/Service"
}
},
"x-go-package": "github.com/drewwells/makeplans"
},
"slotWrap": {
"type": "object",
"properties": {
"slot": {
"x-go-name": "Slot",
"$ref": "#/definitions/Slot"
}
},
"x-go-package": "github.com/drewwells/makeplans"
},
"wrapBooking": {
"type": "object",
"properties": {
"booking": {
"x-go-name": "Booking",
"$ref": "#/definitions/Booking"
}
},
"x-go-package": "github.com/drewwells/makeplans"
}
},
"responses": {
"BookingResponse": {
"description": "BookingResponse represents a scheduled appointment",
"schema": {
"$ref": "#/definitions/Booking"
}
},
"BookingResponses": {
"description": "BookingResponses is a slice of bookings",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Booking"
}
}
},
"SlotResponse": {
"description": "SlotResponse responds with the the available time slot for a booking",
"schema": {
"$ref": "#/definitions/Slot"
}
},
"TrainerResponse": {
"description": "TrainerResponse describes a user of type Trainer",
"schema": {
"$ref": "#/definitions/Trainer"
}
},
"UserResponse": {
"description": "UserResponse",
"schema": {
"$ref": "#/definitions/User"
}
},
"response": {
"description": "Response is the default HTTP response for all routes",
"headers": {
"error": {
"type": "string"
},
"success": {
"type": "string"
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment