mandatory

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidDeviceType = fmt.Errorf("invalid device")

ErrInvalidDeviceType error invalid device type.

Functions

func Context

func Context(ctx context.Context, mandatoryRequest Request) context.Context

Context function to create context with mandatory.

Types

type Authorization

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

Authorization object of mandatory request.

func (Authorization) ApiKey

func (a Authorization) ApiKey() string

ApiKey getter function to get mandatory Authorization ApiKey.

func (Authorization) Authorization

func (a Authorization) Authorization() string

Authorization getter function to get mandatory Authorization.

func (Authorization) ServiceID

func (a Authorization) ServiceID() string

ServiceID getter function to get mandatory Authorization ServiceID.

func (Authorization) ServiceSecret

func (a Authorization) ServiceSecret() string

ServiceSecret getter function to get mandatory Authorization ServiceSecret.

func (Authorization) Token

func (a Authorization) Token() string

Token getter function to get mandatory Authorization Token.

type Builder

type Builder struct {
	Request
	// contains filtered or unexported fields
}

Builder builder object for Request.

func NewMandatoryRequestBuilder

func NewMandatoryRequestBuilder() (Builder, error)

NewMandatoryRequestBuilder initialize builder object for Request.

func (Builder) Build

func (m Builder) Build() Request

Build initialize builder object for Request.

func (Builder) WithApiKey

func (m Builder) WithApiKey(apiKey string) Builder

WithApiKey getter function to set ApiKey.

func (Builder) WithApplication

func (m Builder) WithApplication(deviceID, appsVersion string) Builder

WithApplication getter function to set Application.

func (Builder) WithAuthorization

func (m Builder) WithAuthorization(authorization string) Builder

WithAuthorization getter function to set Authorization.

func (Builder) WithDeviceType

func (m Builder) WithDeviceType(deviceType string) Builder

WithDeviceType getter function to set DeviceType.

func (Builder) WithIpAddresses

func (m Builder) WithIpAddresses(ipAddress []string) Builder

WithIpAddresses getter function to set IpAddresses.

func (Builder) WithLanguage

func (m Builder) WithLanguage(language string) Builder

WithLanguage getter function to set Language.

func (Builder) WithPhone

func (m Builder) WithPhone(ID uint64, phone string) Builder

WithPhone getter function to set Phone.

func (Builder) WithServiceSecret

func (m Builder) WithServiceSecret(ID, secret string) Builder

WithServiceSecret getter function to set ServiceSecret.

func (Builder) WithTraceID

func (m Builder) WithTraceID(traceID string) Builder

WithTraceID getter function to set TraceID.

func (Builder) WithUser

func (m Builder) WithUser(ID uint64, email string) Builder

WithUser getter function to set User.

func (Builder) WithUserAgent

func (m Builder) WithUserAgent(userAgent string) Builder

WithUserAgent getter function to set UserAgent.

func (Builder) WithUserPhone

func (m Builder) WithUserPhone(ID uint64, email string, phone string) Builder

WithUserPhone getter function to set UserPhone.

type Device

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

Device object of mandatory request.

func (Device) AppVersion

func (d Device) AppVersion() string

AppVersion getter function to get mandatory Device AppVersion.

func (Device) Brand

func (d Device) Brand() string

Brand getter function to get mandatory Device Brand.

func (Device) DeviceID

func (d Device) DeviceID() string

DeviceID getter function to get mandatory Device DeviceID.

func (Device) Family

func (d Device) Family() string

Family getter function to get mandatory Device Family.

func (Device) Model

func (d Device) Model() string

Model getter function to get mandatory Device Model.

type DeviceInfo

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

DeviceInfo object device.

func (DeviceInfo) Code

func (d DeviceInfo) Code() string

Code getter function to get code.

func (DeviceInfo) ID

func (d DeviceInfo) ID() DeviceType

ID getter function to get id.

func (DeviceInfo) Name

func (d DeviceInfo) Name() string

Name getter function to get name.

type DeviceType

type DeviceType int

DeviceType enum of device type.

const (
	Android DeviceType = iota + 1
	Ios
	Web
	MobileWeb
)

func DeviceFromString

func DeviceFromString(str string) (DeviceType, error)

DeviceFromString function to get DeviceType from string.

func DeviceFromStringCode

func DeviceFromStringCode(str string) (DeviceType, error)

DeviceFromStringCode function to get DeviceType from string code.

func (DeviceType) Info

func (s DeviceType) Info() DeviceInfo

Info function to get DeviceInfo.

func (DeviceType) MarshalJSON

func (s DeviceType) MarshalJSON() ([]byte, error)

MarshalJSON implements the marshaller interface.

func (*DeviceType) UnmarshalJSON

func (s *DeviceType) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the un marshaller interface.

func (DeviceType) Valid added in v1.0.1

func (s DeviceType) Valid() bool

Valid getter function to get code.

type OS

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

OS object of mandatory OS.

func (OS) Family

func (o OS) Family() string

Family getter function to get OS family.

func (OS) Major

func (o OS) Major() string

Major getter function to get OS major version.

func (OS) Minor

func (o OS) Minor() string

Minor getter function to get OS minor version.

func (OS) Name

func (o OS) Name() string

Name getter function to get OS name.

func (OS) Patch

func (o OS) Patch() string

Patch getter function to get OS patch version.

func (OS) PatchMinor

func (o OS) PatchMinor() string

PatchMinor getter function to get OS patch minor version.

func (OS) Version

func (o OS) Version() string

Version getter function to get OS version.

type Request

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

Request object of mandatory request.

func FromContext

func FromContext(ctx context.Context) Request

FromContext function to get mandatory from context.

func (Request) Authorization

func (m Request) Authorization() Authorization

Authorization getter function to get authorization.

func (Request) Device

func (m Request) Device() Device

Device getter function to get device.

func (Request) DeviceType

func (m Request) DeviceType() DeviceType

DeviceType getter function to get device type.

func (Request) IpAddresses

func (m Request) IpAddresses() []string

IpAddresses getter function to get ip addresses.

func (Request) IsMobileApp

func (m Request) IsMobileApp() bool

IsMobileApp getter function to check Request object is MobileApp.

func (Request) IsUserLogin

func (m Request) IsUserLogin() bool

IsUserLogin getter function to check Request object is Login User.

func (Request) IsWebApp

func (m Request) IsWebApp() bool

IsWebApp getter function to check Request object is WebApp.

func (Request) Language

func (m Request) Language() string

Language getter function to get language.

func (Request) OS

func (m Request) OS() OS

OS getter function to get os.

func (Request) TraceID

func (m Request) TraceID() string

TraceID getter function to get trace id.

func (Request) User

func (m Request) User() User

User getter function to get user.

func (Request) UserAgent

func (m Request) UserAgent() UserAgent

UserAgent getter function to get user agent.

func (Request) Valid

func (m Request) Valid() bool

Valid getter function to check Request object is valid.

type User

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

User object of mandatory User.

func (User) Email

func (u User) Email() string

Email getter function of mandatory user Email.

func (User) ID

func (u User) ID() uint64

ID getter function of mandatory user ID.

func (User) IsLogin

func (u User) IsLogin() bool

IsLogin getter function of mandatory user IsLogin.

func (User) Phone

func (u User) Phone() string

Phone getter function of mandatory user Phone.

type UserAgent

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

UserAgent object of mandatory UserAgent.

func (UserAgent) Family

func (u UserAgent) Family() string

Family getter function to get mandatory UserAgent Family.

func (UserAgent) Major

func (u UserAgent) Major() string

Major getter function to get mandatory UserAgent Major.

func (UserAgent) Minor

func (u UserAgent) Minor() string

Minor getter function to get mandatory UserAgent Minor.

func (UserAgent) Patch

func (u UserAgent) Patch() string

Patch getter function to get mandatory UserAgent Patch.

func (UserAgent) Value

func (u UserAgent) Value() string

Value getter function to get mandatory UserAgent Value.

Jump to

Keyboard shortcuts

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