requests

package
v0.0.0-...-1b61e27 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CONTENT_ENCRYPTED    = "1"
	PARAM_AUTHENTICATION = "Basic c3dvcmQ6c3dvcmRfc2VjcmV0"
	TENANT_ID            = "459771"
	USER_TYPE            = "app"
	BASE_URL_P           = "https://gateway-mg-eu.soimt.com/api.app/v1/"
)

Variables

This section is empty.

Functions

func CalculateRequestVerification

func CalculateRequestVerification(
	resourcePath string,
	sendDate int64,
	tenant,
	contentType,
	bodyEncrypted,
	token string,
) string

func CalculateResponseVerification

func CalculateResponseVerification(str, str2, str3 string) string

func CreateRequest

func CreateRequest(
	endpoint string,
	httpMethod string,
	request string,
	contentType string,
	token string,
	eventId string,
) (*http.Request, error)

func Decorate

func Decorate(req *http.Request) error

func Decrypt

func Decrypt(cipherText, hexKey, hexIV string) string

func DecryptAnswer

func DecryptAnswer(resp *http.Response) ([]byte, error)

func DecryptRequest

func DecryptRequest(url string, time int64, tenant, token, body, contentType string) string

func DecryptResponse

func DecryptResponse(timeStamp, contentType, cipherText string) string

func Encrypt

func Encrypt(plainText, hexKey, hexIV string) string

func EncryptRequest

func EncryptRequest(url string, time int64, tenant, token, body, contentType string) string

func HmacSha256

func HmacSha256(secret string, message string) string

func Md5

func Md5(value string) string

func PKCS5Padding

func PKCS5Padding(ciphertext []byte, blockSize int) []byte

func PKCS5Trimming

func PKCS5Trimming(encrypt []byte) []byte

func Sha1

func Sha1(value string) string

func Sha256

func Sha256(value string) string

Types

type Answer

type Answer struct {
	Code    int         `json:"code"`
	Data    interface{} `json:"data,omitempty"`
	Message string      `json:"message"`
}

type ChargeStatus

type ChargeStatus struct {
	RvsChargeStatus struct {
		MileageSinceLastCharge    int
		TotalBatteryCapacity      int
		WorkingVoltage            int
		ChargingDuration          int
		ChargingType              int
		LastChargeEndingPower     int
		FuelRangeElec             int64 // Value / 10 = Range
		RealtimePower             int
		WorkingCurrent            int
		ChargingGunState          int // Gun connected
		MileageOfDay              int
		StartTime                 int64
		EndTime                   int64
		PowerUsageOfDay           int
		PowerUsageSinceLastCharge int
		Mileage                   uint // Odometer
	}
	ChrgMgmtData struct {
		BmsChrgOtptCrntReqV       int
		CcuOnbdChrgrPlugOn        int
		BmsPTCHeatResp            int
		BmsChrgSts                int
		ChrgngAddedElecRngV       int
		BmsPackSOCDsp             int // SOC in per mille
		CcuOffBdChrgrPlugOn       int
		BmsPackCrnt               int
		ImcuChrgngEstdElecRng     int
		ChrgngSpdngTimeV          int
		BmsReserStMintueDspCmd    int
		BmsDsChrgSpRsn            int
		ImcuChrgngEstdElecRngV    int
		BmsPackVol                int
		BmsPackCrntV              int
		ImcuVehElecRngV           int
		BmsReserSpHourDspCmd      int
		BmsAdpPubChrgSttnDspCmd   int
		BmsReserSpMintueDspCmd    int
		BmsAltngChrgCrntDspCmd    int
		DisChrgngRmnngTimeV       int
		ImcuDschrgngEstdElecRngV  int
		BmsChrgSpRsn              int
		DisChrgngRmnngTime        int
		ChrgngAddedElecRng        int
		ClstrElecRngToEPT         int // Range
		BmsPTCHeatReqDspCmd       int
		CcuEleccLckCtrlDspCmd     int
		BmsChrgCtrlDspCmd         int
		BmsOnBdChrgTrgtSOCDspCmd  int
		OnBdChrgrAltrCrntInptCrnt int
		BmsEstdElecRng            int
		ChrgngDoorOpenCnd         int
		BmsReserCtrlDspCmd        int
		BmsChrgOtptCrntReq        int
		ChrgngDoorPosSts          int
		BmsReserStHourDspCmd      int
		ImcuVehElecRng            int // Range
		ChrgngSpdngTime           int
		ChrgngRmnngTimeV          int
		ImcuDschrgngEstdElecRng   int
		ChrgngRmnngTime           int64 // Charging remaining time
		OnBdChrgrAltrCrntInptVol  int
	}
}

type LoginData

type LoginData struct {
	Tenant_id     string
	LanguageType  string
	User_name     string
	Avatar        string
	Token_type    string `json:"token_type,omitempty"`
	Client_id     string
	Access_token  string `json:"access_token"`
	Role_name     string
	Refresh_token string `json:"refresh_token,omitempty"`
	License       string
	Post_id       string
	User_id       string
	Role_id       string
	Scope         string
	Oauth_id      string
	Detail        struct {
		LanguageType string
	}
	Dept_id    string
	Expires_in int64 `json:"expires_in,omitempty"`
	Aaccount   string
	Jti        string
}

Jump to

Keyboard shortcuts

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