rest

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HandlersInterfaces

type HandlersInterfaces interface {
	VerifySignUpPhoneNumber() http.HandlerFunc
	CreateUserWithPhoneNumber() http.HandlerFunc
	UserRecoveryPhoneNumbers() http.HandlerFunc
	SetPrimaryPhoneNumber() http.HandlerFunc
	LoginByPhone() http.HandlerFunc
	LoginAnonymous() http.HandlerFunc
	RequestPINReset() http.HandlerFunc
	ResetPin() http.HandlerFunc
	SendOTP() http.HandlerFunc
	SendRetryOTP() http.HandlerFunc
	RefreshToken() http.HandlerFunc
	RemoveUserByPhoneNumber() http.HandlerFunc
	GetUserProfileByUID() http.HandlerFunc
	GetUserProfileByPhoneOrEmail() http.HandlerFunc
	ProfileAttributes() http.HandlerFunc
	RegisterPushToken() http.HandlerFunc
	AddAdminPermsToUser() http.HandlerFunc
	RemoveAdminPermsToUser() http.HandlerFunc
	AddRoleToUser() http.HandlerFunc
	RemoveRoleToUser() http.HandlerFunc
	UpdateUserProfile() http.HandlerFunc
	SwitchFlaggedFeaturesHandler() http.HandlerFunc
	PollServices() http.HandlerFunc
	CheckHasPermission() http.HandlerFunc

	CreateRole() http.HandlerFunc
	AssignRole() http.HandlerFunc
	RemoveRoleByName() http.HandlerFunc

	RegisterUser() http.HandlerFunc
}

HandlersInterfaces represents all the REST API logic

func NewHandlersInterfaces

func NewHandlersInterfaces(infrastructure infrastructure.Infrastructure, usecases usecases.Interactor) HandlersInterfaces

NewHandlersInterfaces initializes a new rest handlers usecase

type HandlersInterfacesImpl

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

HandlersInterfacesImpl represents the usecase implementation object

func (*HandlersInterfacesImpl) AddAdminPermsToUser

func (h *HandlersInterfacesImpl) AddAdminPermsToUser() http.HandlerFunc

AddAdminPermsToUser is authenticated endpoint that adds admin permissions to a whose phone number, either PRIMARY PHONE NUMBER or SECONDARY PHONE NUMBERS,matches the provided phone number in the request.

func (*HandlersInterfacesImpl) AddRoleToUser

func (h *HandlersInterfacesImpl) AddRoleToUser() http.HandlerFunc

AddRoleToUser is authenticated endpoint that adds role and role based permissions to a user whose PRIMARY PHONE NUMBER matches the provided phone number in the request.

func (*HandlersInterfacesImpl) AssignRole added in v0.0.2

func (h *HandlersInterfacesImpl) AssignRole() http.HandlerFunc

AssignRole assigns a role to the provided user

func (*HandlersInterfacesImpl) CheckHasPermission added in v0.0.2

func (h *HandlersInterfacesImpl) CheckHasPermission() http.HandlerFunc

CheckHasPermission checks if the user has a permission

func (*HandlersInterfacesImpl) CreateRole added in v0.0.2

func (h *HandlersInterfacesImpl) CreateRole() http.HandlerFunc

CreateRole creates a new role given the required role creation input

func (*HandlersInterfacesImpl) CreateUserWithPhoneNumber

func (h *HandlersInterfacesImpl) CreateUserWithPhoneNumber() http.HandlerFunc

CreateUserWithPhoneNumber is an unauthenticated endpoint that is called to create

func (*HandlersInterfacesImpl) GetUserProfileByPhoneOrEmail added in v0.0.2

func (h *HandlersInterfacesImpl) GetUserProfileByPhoneOrEmail() http.HandlerFunc

GetUserProfileByPhoneOrEmail fetches and returns a user profile via REST ISC

func (*HandlersInterfacesImpl) GetUserProfileByUID

func (h *HandlersInterfacesImpl) GetUserProfileByUID() http.HandlerFunc

GetUserProfileByUID fetches and returns a user profile via REST ISC

func (*HandlersInterfacesImpl) LoginAnonymous

func (h *HandlersInterfacesImpl) LoginAnonymous() http.HandlerFunc

LoginAnonymous is an unauthenticated endpoint that returns only auth credentials for anonymous users

func (*HandlersInterfacesImpl) LoginByPhone

func (h *HandlersInterfacesImpl) LoginByPhone() http.HandlerFunc

LoginByPhone is an unauthenticated endpoint that: Collects a phonenumber and pin from the user and checks if the phonenumber is an existing PRIMARY PHONENUMBER. If it does then it fetches the PIN that belongs to the profile and returns auth credentials to allow the user to login

func (*HandlersInterfacesImpl) PollServices

func (h *HandlersInterfacesImpl) PollServices() http.HandlerFunc

PollServices polls registered services for their status

func (*HandlersInterfacesImpl) ProfileAttributes

func (h *HandlersInterfacesImpl) ProfileAttributes() http.HandlerFunc

ProfileAttributes retrieves confirmed user profile attributes. These attributes include a user's verified phone numbers, verified emails and verified FCM push tokens

func (*HandlersInterfacesImpl) RefreshToken

func (h *HandlersInterfacesImpl) RefreshToken() http.HandlerFunc

RefreshToken is an unauthenticated endpoint that takes a custom Firebase refresh token and tries to fetch an ID token and returns auth credentials if successful Otherwise, an error is returned

func (*HandlersInterfacesImpl) RegisterPushToken

func (h *HandlersInterfacesImpl) RegisterPushToken() http.HandlerFunc

RegisterPushToken adds a new push token in the users profile if the push token does not exist via REST ISC

func (*HandlersInterfacesImpl) RegisterUser added in v0.0.10

func (h *HandlersInterfacesImpl) RegisterUser() http.HandlerFunc

RegisterUser creates a new user profile using provided input

func (*HandlersInterfacesImpl) RemoveAdminPermsToUser

func (h *HandlersInterfacesImpl) RemoveAdminPermsToUser() http.HandlerFunc

RemoveAdminPermsToUser is authenticated endpoint that removes admin permissions to a whose phone number, either PRIMARY PHONE NUMBER or SECONDARY PHONE NUMBERS,matches the provided phone number in the request.

func (*HandlersInterfacesImpl) RemoveRoleByName added in v0.0.2

func (h *HandlersInterfacesImpl) RemoveRoleByName() http.HandlerFunc

RemoveRoleByName removes a role given a valid name

func (*HandlersInterfacesImpl) RemoveRoleToUser

func (h *HandlersInterfacesImpl) RemoveRoleToUser() http.HandlerFunc

RemoveRoleToUser is authenticated endpoint that removes role and role based permissions to a user whose PRIMARY PHONE NUMBER matches the provided phone number in the request.

func (*HandlersInterfacesImpl) RemoveUserByPhoneNumber

func (h *HandlersInterfacesImpl) RemoveUserByPhoneNumber() http.HandlerFunc

RemoveUserByPhoneNumber is an unauthenticated endpoint that removes a user whose phone number, either PRIMARY PHONE NUMBER or SECONDARY PHONE NUMBERS,matches the provided phone number in the request. This endpoint will ONLY be available under testing environment

func (*HandlersInterfacesImpl) RequestPINReset

func (h *HandlersInterfacesImpl) RequestPINReset() http.HandlerFunc

RequestPINReset is an unauthenticated request that takes in a phone number sends an otp to an msisdn that requests a PIN reset request during login

func (*HandlersInterfacesImpl) ResetPin

func (h *HandlersInterfacesImpl) ResetPin() http.HandlerFunc

ResetPin used to change/update a user's PIN

func (*HandlersInterfacesImpl) SendOTP

SendOTP is an unauthenticated request that takes in a phone number and generates an OTP and sends a valid OTP to the phone number. This API will mostly be used during account recovery workflow

func (*HandlersInterfacesImpl) SendRetryOTP

func (h *HandlersInterfacesImpl) SendRetryOTP() http.HandlerFunc

SendRetryOTP is an unauthenticated request that takes in a phone number and a retry step (1 for sending an OTP via WhatsApp and 2 for Twilio Messages) and generates and sends a valid OTP to the phone number

func (*HandlersInterfacesImpl) SetPrimaryPhoneNumber

func (h *HandlersInterfacesImpl) SetPrimaryPhoneNumber() http.HandlerFunc

SetPrimaryPhoneNumber sets the provided phone number as the primary phone of the profile associated with it

func (*HandlersInterfacesImpl) SwitchFlaggedFeaturesHandler

func (h *HandlersInterfacesImpl) SwitchFlaggedFeaturesHandler() http.HandlerFunc

SwitchFlaggedFeaturesHandler flips the user as opt-in or opt-out to flagged features

func (*HandlersInterfacesImpl) UpdateUserProfile

func (h *HandlersInterfacesImpl) UpdateUserProfile() http.HandlerFunc

UpdateUserProfile is an unauthenticated REST endpoint to update a user's profile

func (*HandlersInterfacesImpl) UserRecoveryPhoneNumbers

func (h *HandlersInterfacesImpl) UserRecoveryPhoneNumbers() http.HandlerFunc

UserRecoveryPhoneNumbers fetches the phone numbers associated with a profile for the purpose of account recovery. The returned phone numbers slice should be masked. E.G +254700***123

func (*HandlersInterfacesImpl) VerifySignUpPhoneNumber

func (h *HandlersInterfacesImpl) VerifySignUpPhoneNumber() http.HandlerFunc

VerifySignUpPhoneNumber is an unauthenticated endpoint that does a check on the supplied phone number asserting whether the phone is associated with a user profile. It check both the PRIMARY PHONE and SECONDARY PHONE NUMBER. If the phone number does not exist, it sends the OTP to the phone number

Jump to

Keyboard shortcuts

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