acaseSdk

package module
v0.0.0-...-22fe2ff Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2019 License: MIT Imports: 13 Imported by: 0

README

Unofficial golang SDK for integration with hotels reservation API, powered by "Academ service" provider.

master MIT Licensed

This SDK is used to connect to the Academservice and use it methods for a 3-rd party API.

Installation
go get -u github.com/tmconsulting/acase-golang-sdk

or using dep

dep ensure -add github.com/tmconsulting/acase-golang-sdk
Get started

To start you will need to have credentials for the Academservice.
Import package

import "github.com/tmconsulting/acase-golang-sdk"

Api initialization

credentials := acaseSdk.Auth{
	BuyerId:"BuyerId",
	UserId:"UserId",
	Password:"Password",
	Language:"RU",
}
api := acaseSdk.NewApi(credentials, "http://test-www.acase.ru/xml/form.jsp")

Now you can call methods, for example list of citizenships:

result, err := api.CitizenshipListRequest()

As a result, the pointer to structure is returned. In the example above: *acaseSts.CitizenshipListType. Every method the second value return an error object of type *AcaseResponseError or nil.

API Reference

Implemented methods:

Method name Description
AdmUnit1Request Returns the list of administrative units of the first level
AdmUnit2Request Returns the list of administrative units of the second level
CitizenshipListRequest Returns the list of citizenships
CityDescriptionRequest Returns the detailed description of the selected city
CityListRequest Returns the list of cities where Academservice sells hotels
CountryDescriptionRequest Returns the detailed description of the selected country
ClientCategoryListRequest Returns the list of client categories
CountryListRequest Returns the list of countries where Academservice sells hotels
CurrencyListRequest Returns the list of available currencies
CustomerRequestCreate Allows to create end customer
CustomerRequestUpdate Allows to update end customer
CustomerRequestDelete Allows to delete end customer
CustomerRequestList Allows to get list of end customer
CustomerRequestInfo Allows to get information about end customer
HotelAmenityListRequest Returns the list of hotel amenities
HotelDescriptionRequest Returns the detailed description of the selected hotel
HotelListRequest Returns the list of hotels to sell
HotelPricingRequest2 Returns the calculated price of the accommodation for the specified accommodation plan
HotelProductRequest Returns the calculated price of the accommodation
HotelSearchRequest Returns the list of tour products which meet the specified criteria
MealRequest Returns the list of meal
MealTypeRequest Returns the list of meal types
ObjectRequest Returns the list of objects
ObjectSubTypeRequest Returns the list of object's subtypes
ObjectTypeRequest Returns the list of object's types
ObjTypeListRequest List of types accommodation object
OrderDocRequest Allows to get reservation documents on request
OrderInfoNotifyRequest Notify buyer's computer system about changes in orders
OrderInfoAwocNotifyRequest Notify buyer's computer system about changes in orders (Hotels with prices on request)
OrderListRequest Returns the list of orders which meet the specified criteria
OrderRequest Create, amend or cancel an order
OrderAwocRequest Create, amend or cancel an order (Hotels with prices on request)
RateGroupRequest Returns the list of group of rates
RouteRequest Returns the list of route
PenaltyReasonRequest Returns the list of penalty reasons
SpecialOfferTypeRequest Returns the list of type of action
StarListRequest Returns the list of hotel categories
StatusListRequest Returns the list of technological statuses services
TypeOfPlaceRequest Returns the list of settlements type

All methos of Academservice describe here

Contact us

If you have any issues or questions regarding the API or the SDK it self, you are welcome to create an issue, or You can write an Email to atkachev@gmail.com or roquie0@gmail.com

License.

SDK is released under the MIT License.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AcaseResponseError

type AcaseResponseError struct {
	Message string
	Code    string
}

func ResponseError

func ResponseError(item acaseSts.BaseResponse) *AcaseResponseError

func (*AcaseResponseError) Error

func (ar *AcaseResponseError) Error() string

func (*AcaseResponseError) ErrorCode

func (ar *AcaseResponseError) ErrorCode() string

type Api

type Api struct {
	EventListener

	ApiUrl string
	// contains filtered or unexported fields
}

func NewApi

func NewApi(auth Auth, apiUrl string) *Api

func (*Api) AdmUnit1Request

func (a *Api) AdmUnit1Request(ctx context.Context, countryCode int, admUnitCode, admUnitName string) (*acaseSts.AdmUnit1ListType, *AcaseResponseError)

func (*Api) AdmUnit2Request

func (a *Api) AdmUnit2Request(ctx context.Context, countryCode, admUnit1Code, admUnit2Code int, admUnit1Name, admUnit2Name string) (*acaseSts.AdmUnit2ListType, *AcaseResponseError)

func (*Api) CitizenshipListRequest

func (a *Api) CitizenshipListRequest(ctx context.Context) (*acaseSts.CitizenshipListType, *AcaseResponseError)

func (*Api) CityDescriptionRequest

func (a *Api) CityDescriptionRequest(ctx context.Context, cityCode int64) (*acaseSts.CityDescriptionType, *AcaseResponseError)

func (*Api) CityListRequest

func (a *Api) CityListRequest(ctx context.Context, countryName, cityName string, countryCode, cityCode int64) (*acaseSts.CityListType, *AcaseResponseError)

func (*Api) ClientCategoryListRequest

func (a *Api) ClientCategoryListRequest(ctx context.Context, categoryCode int, categoryName string) (*acaseSts.ClientCategoryListType, *AcaseResponseError)

func (*Api) CountryDescriptionRequest

func (a *Api) CountryDescriptionRequest(ctx context.Context, countryCode int64) (*acaseSts.CountryDescriptionType, *AcaseResponseError)

func (*Api) CountryListRequest

func (a *Api) CountryListRequest(ctx context.Context, countryCode int64, countryName string) (*acaseSts.CountryListType, *AcaseResponseError)

func (*Api) CurrencyListRequest

func (a *Api) CurrencyListRequest(ctx context.Context, currencyCode int, currencyName, options string) (*acaseSts.CurrencyListResponseType, *AcaseResponseError)

func (*Api) CustomerRequestCreate

func (a *Api) CustomerRequestCreate(ctx context.Context, fullName, zipCode, address, piAddress, inn, kpp, phone, name, buyerTypeName,
	countryName, cityName string, buyerTypeCode, countryCode, cityCode int) (*acaseSts.CustomerResponseCreateType, *AcaseResponseError)

func (*Api) CustomerRequestDelete

func (a *Api) CustomerRequestDelete(ctx context.Context, customerCode int) (*acaseSts.CustomerResponseDeleteType, *AcaseResponseError)

func (*Api) CustomerRequestInfo

func (a *Api) CustomerRequestInfo(ctx context.Context, customerCode int) (*acaseSts.CustomerResponseInfoType, *AcaseResponseError)

func (*Api) CustomerRequestList

func (a *Api) CustomerRequestList(ctx context.Context, sort, actualOnly int) (*acaseSts.CustomerResponseListType, *AcaseResponseError)

func (*Api) CustomerRequestUpdate

func (a *Api) CustomerRequestUpdate(ctx context.Context, fullName, zipCode, address, piAddress, inn, kpp, phone, name, buyerTypeName,
	countryName, cityName string, customerCode, buyerTypeCode, countryCode, cityCode int) (*acaseSts.CustomerResponseUpdateType, *AcaseResponseError)

func (*Api) HotelAmenityListRequest

func (a *Api) HotelAmenityListRequest(ctx context.Context, hotelAmenityCode int64, hotelAmenityName string) (*acaseSts.HotelAmenityListResponseType, *AcaseResponseError)

func (*Api) HotelDescriptionRequest

func (a *Api) HotelDescriptionRequest(ctx context.Context, hotelCode, currencyCode int64) (*acaseSts.HotelDescriptionResponseType, *AcaseResponseError)

func (*Api) HotelListRequest

func (a *Api) HotelListRequest(ctx context.Context, hotelCode, countryCode, cityCode, hotelRatingCode int64, hotelName, options string) (*acaseSts.HotelListResponseType, *AcaseResponseError)

func (*Api) HotelPricingRequest2

func (a *Api) HotelPricingRequest2(ctx context.Context, productCode, currency, whereToPay, numberOfGuests, meal, numberOfExtraBedsAdult,
	numberOfExtraBedsChild, numberOfExtraBedsInfant, hotel int,
	arrivalDate, departureDate, arrivalTime, departureTime, id, accommodationId string) (*acaseSts.HotelPricingResponse2Type, *AcaseResponseError)

func (*Api) HotelProductRequest

func (a *Api) HotelProductRequest(ctx context.Context, currency, whereToPay, numberOfGuests, numberOfExtraBedsAdult,
	numberOfExtraBedsChild, numberOfExtraBedsInfant, hotel int,
	arrivalDate, departureDate, id, accommodationId string) (*acaseSts.HotelProductResponseType, *AcaseResponseError)

func (*Api) HotelSearchRequest

func (a *Api) HotelSearchRequest(ctx context.Context, arrivalDate, departureDate, options, hotelName, destListCode string,
	freeSaleOnly, hotelCategory, currency, whereToPay, numberOfGuests, hotelCode, distance, distTypeCode, distCode, guestsAdults, city int,
	priceFrom, priceTo float64, starCodes, minorAges []int) (*acaseSts.HotelSearchResponseType, *AcaseResponseError)

func (*Api) MealRequest

func (a *Api) MealRequest(ctx context.Context, mealCode, mealTypeCode int64, mealName string) (*acaseSts.MealResponseType, *AcaseResponseError)

func (*Api) MealTypeRequest

func (a *Api) MealTypeRequest(ctx context.Context, mealTypeCode int64, mealName string) (*acaseSts.MealTypeResponseType, *AcaseResponseError)

func (*Api) ObjTypeListRequest

func (a *Api) ObjTypeListRequest(ctx context.Context, objTypeCode, objTypeName string) (*acaseSts.ObjTypeListResponseType, *AcaseResponseError)

func (*Api) ObjectRequest

func (a *Api) ObjectRequest(ctx context.Context, objectTypeCode, objectSubTypeCode, cityCode int64) (*acaseSts.ObjectResponseType, *AcaseResponseError)

func (*Api) ObjectSubTypeRequest

func (a *Api) ObjectSubTypeRequest(ctx context.Context, objectTypeCode int64) (*acaseSts.ObjectSubTypeResponseType, *AcaseResponseError)

func (*Api) ObjectTypeRequest

func (a *Api) ObjectTypeRequest(ctx context.Context, objectTypeCode int64) (*acaseSts.GeoObjectTypeResponseType, *AcaseResponseError)

func (*Api) OrderDocRequest

func (a *Api) OrderDocRequest(ctx context.Context, actionName acaseSts.OrderDocActionName, taskId, docId, code int) (*acaseSts.OrderDocsResponseType, *AcaseResponseError)

func (*Api) OrderListRequest

func (a *Api) OrderListRequest(ctx context.Context, arrivalDateFrom, arrivalDateTo, departureDateFrom, departureDateTo, deadlineDateFrom,
	deadlineDateTo, registrationDateFrom, registrationDateTo, accommodationDateFrom, accommodationDateTo, hotelName,
	lastName string, hotel int) (*acaseSts.OrderListResponseType, *AcaseResponseError)

func (*Api) PenaltyReasonRequest

func (a *Api) PenaltyReasonRequest(ctx context.Context) (*acaseSts.PenaltyReasonResponseType, *AcaseResponseError)

func (*Api) RateGroupRequest

func (a *Api) RateGroupRequest(ctx context.Context, items []string) (*acaseSts.RateGroupResponseType, *AcaseResponseError)

func (*Api) RouteRequest

func (a *Api) RouteRequest(ctx context.Context, fromName, toName string, fromCode, toCode, fromTypeCode, toTypeCode int) (*acaseSts.RouteResponseType, *AcaseResponseError)

func (*Api) SpecialOfferTypeRequest

func (a *Api) SpecialOfferTypeRequest(ctx context.Context, code int, name string) (*acaseSts.SpecialOfferTypeResponseType, *AcaseResponseError)

func (*Api) StarListRequest

func (a *Api) StarListRequest(ctx context.Context, code int64, name, options string) (*acaseSts.StarListResponseType, *AcaseResponseError)

func (*Api) StatusListRequest

func (a *Api) StatusListRequest(ctx context.Context) (*acaseSts.StatusListResponseType, *AcaseResponseError)

func (*Api) TypeOfPlaceRequest

func (a *Api) TypeOfPlaceRequest(ctx context.Context, typeOfPlaceCode int64, typeOfPlaceName string) (*acaseSts.TypeOfPlaceResponseType, *AcaseResponseError)

type Auth

type Auth struct {
	BuyerId  string
	UserId   string
	Password string
	Language string
}

type EventHandler

type EventHandler func(ctx context.Context, methodName, query, mimeType string, data []byte)

type EventListener

type EventListener struct {
	// contains filtered or unexported fields
}

func (*EventListener) Init

func (o *EventListener) Init()

func (*EventListener) RegisterEventHandler

func (o *EventListener) RegisterEventHandler(et EventType, handler EventHandler) *EventListener

type EventType

type EventType int
const (
	BeforeRequestSend    EventType = 1
	AfterResponseReceive EventType = 2
)

type RespError

type RespError struct {
	Message string
	Code    string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL