api

package
v2.0.7 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package api provides primitives to interact with the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen/v2 version v2.1.0 DO NOT EDIT.

Index

Constants

View Source
const (
	None          string = "None"
	PlayForFree   string = "PlayForFree"
	GuildWars2    string = "GuildWars2"
	HeartOfThorns string = "HeartOfThorns"
	PathOfFire    string = "PathOfFire"
	EndOfDragons  string = "EndOfDragons"
)
View Source
const (
	ACCESS_DENIED_ACCOUNT_NOT_LINKED      = ACCESSDENIEDACCOUNTNOTLINKED
	ACCESS_DENIED_BANNED                  = ACCESSDENIEDBANNED
	ACCESS_DENIED_EXPIRED                 = ACCESSDENIEDEXPIRED
	ACCESS_DENIED_INVALID_WORLD           = ACCESSDENIEDINVALIDWORLD
	ACCESS_DENIED_REQUIREMENT_NOT_MET     = ACCESSDENIEDREQUIREMENTNOTMET
	ACCESS_DENIED_UNKNOWN                 = ACCESSDENIEDUNKNOWN
	ACCESS_GRANTED_HOME_WORLD             = ACCESSGRANTEDHOMEWORLD
	ACCESS_GRANTED_HOME_WORLD_TEMPORARY   = ACCESSGRANTEDHOMEWORLDTEMPORARY
	ACCESS_GRANTED_LINKED_WORLD           = ACCESSGRANTEDLINKEDWORLD
	ACCESS_GRANTED_LINKED_WORLD_TEMPORARY = ACCESSGRANTEDLINKEDWORLDTEMPORARY
)
View Source
const (
	HOME_WORLD   = HOMEWORLD
	LINKED_WORLD = LINKEDWORLD
)
View Source
const (
	BearerAuthScopes = "bearerAuth.Scopes"
)

Variables

This section is empty.

Functions

func GetSwagger

func GetSwagger() (swagger *openapi3.T, err error)

GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.

func PathToRawSpec

func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)

Constructs a synthetic filesystem for resolving external references when loading openapi specifications.

func RegisterHandlers

func RegisterHandlers(router gin.IRouter, si ServerInterface)

RegisterHandlers creates http.Handler with routing matching OpenAPI spec.

func RegisterHandlersWithOptions

func RegisterHandlersWithOptions(router gin.IRouter, si ServerInterface, options GinServerOptions)

RegisterHandlersWithOptions creates http.Handler with additional options

Types

type APIKeyData

type APIKeyData struct {
	// Apikey The api to set for the user
	Apikey string `json:"apikey"`

	// Primary Set if the user should be the primary user of that particular platform. There can only be one per platform per account. Setting a new primary user will override the old one
	Primary bool `json:"primary"`
}

APIKeyData defines model for APIKeyData.

type APIKeyName

type APIKeyName struct {
	// Name The apikey name the user has to name their apikey if apikey name is enforced
	Name string `json:"name"`
}

APIKeyName defines model for APIKeyName.

type AccessType

type AccessType string

AccessType defines model for AccessType.

const (
	HOMEWORLD   AccessType = "HOME_WORLD"
	LINKEDWORLD AccessType = "LINKED_WORLD"
)

Defines values for AccessType.

type Account

type Account struct {
	Access       *[]string `json:"access,omitempty"`
	Age          int       `json:"age"`
	Commander    bool      `json:"commander"`
	Created      time.Time `json:"created"`
	DailyAp      *int      `json:"daily_ap,omitempty"`
	DbCreated    time.Time `bun:",nullzero,notnull,default:current_timestamp,scanonly" json:"db_created,omitempty"`
	DbUpdated    time.Time `bun:",nullzero,notnull,default:current_timestamp" json:"db_updated,omitempty"`
	Expired      *bool     `bun:"-" json:"expired,omitempty"`
	FractalLevel *int      `json:"fractal_level,omitempty"`
	GuildLeader  *[]string `json:"guild_leader,omitempty"`
	Guilds       *[]string `json:"guilds,omitempty"`
	Id           string    `json:"id"`
	MonthlyAp    *int      `json:"monthly_ap,omitempty"`
	Name         string    `json:"name"`
	UserID       int64     `json:"user_id"`
	World        int       `json:"world"`
	WorldStatus  *Status   `bun:"-" json:"world_status,omitempty"`
	WvwRank      *int      `bun:"wv_w_rank" json:"wvw_rank,omitempty"`
}

Account defines model for Account.

func (*Account) BeforeAppendModel

func (m *Account) BeforeAppendModel(ctx context.Context, query bun.Query) error

func (*Account) FromGW2API

func (acc *Account) FromGW2API(gw2Acc gw2api.Account)

type Ban

type Ban struct {
	Reason string    `json:"reason"`
	Until  time.Time `json:"until"`
	UserID int64     `json:"user_id"`
}

Ban defines model for Ban.

type ChannelMetadata

type ChannelMetadata struct {
	Name  string                `json:"name"`
	Users []ChannelUserMetadata `json:"users"`
}

ChannelMetadata defines model for ChannelMetadata.

type ChannelUserMetadata

type ChannelUserMetadata struct {
	Deafened  bool   `json:"deafened"`
	Id        string `json:"id"`
	Muted     bool   `json:"muted"`
	Name      string `json:"name"`
	Streaming bool   `json:"streaming"`
}

ChannelUserMetadata defines model for ChannelUserMetadata.

type Configuration

type Configuration struct {
	ExpirationTime                int `json:"expiration_time"`
	TemporaryAccessExpirationTime int `json:"temporary_access_expiration_time"`

	// WorldLinks List of worlds links
	WorldLinks map[string]WorldLinks `json:"world_links"`
}

Configuration defines model for Configuration.

type EphemeralAssociation

type EphemeralAssociation struct {
	AccessType *AccessType `bun:"-" json:"access_type,omitempty"`
	Until      *time.Time  `json:"until,omitempty"`
	UserID     int64       `json:"user_id,omitempty"`
	World      *int        `json:"world,omitempty"`
}

EphemeralAssociation defines model for EphemeralAssociation.

type Error

type Error struct {
	Error            string `json:"error"`
	SafeDisplayError string `json:"safe-display-error"`
}

Error defines model for Error.

type GetPlatformUserAPIKeyNameParams

type GetPlatformUserAPIKeyNameParams struct {
	World *TraitWorldViewOptional `form:"world,omitempty" json:"world,omitempty"`
}

GetPlatformUserAPIKeyNameParams defines parameters for GetPlatformUserAPIKeyName.

type GetPlatformUserParams

type GetPlatformUserParams struct {
	// DisplayName Display name of the user of the platform user. Will be stored as the latest used display name by that user
	DisplayName *TraitPlatformUserDisplayName `form:"display_name,omitempty" json:"display_name,omitempty"`
}

GetPlatformUserParams defines parameters for GetPlatformUser.

type GetPlatformUserUpdatesParams

type GetPlatformUserUpdatesParams struct {
	World TraitWorldView `form:"world" json:"world"`
}

GetPlatformUserUpdatesParams defines parameters for GetPlatformUserUpdates.

type GetV1ConfigurationParams

type GetV1ConfigurationParams struct {
	World *TraitWorldViewOptional `form:"world,omitempty" json:"world,omitempty"`
}

GetV1ConfigurationParams defines parameters for GetV1Configuration.

type GetVerificationPlatformUserStatusParams

type GetVerificationPlatformUserStatusParams struct {
	World TraitWorldView `form:"world" json:"world"`

	// DisplayName Display name of the user of the platform user. Will be stored as the latest used display name by that user
	DisplayName *TraitPlatformUserDisplayName `form:"display_name,omitempty" json:"display_name,omitempty"`
}

GetVerificationPlatformUserStatusParams defines parameters for GetVerificationPlatformUserStatus.

type GetVerificationPlatformUserUpdatesParams

type GetVerificationPlatformUserUpdatesParams struct {
	World TraitWorldView `form:"world" json:"world"`
}

GetVerificationPlatformUserUpdatesParams defines parameters for GetVerificationPlatformUserUpdates.

type GinServerOptions

type GinServerOptions struct {
	BaseURL      string
	Middlewares  []MiddlewareFunc
	ErrorHandler func(*gin.Context, error, int)
}

GinServerOptions provides options for the Gin server.

type GuildIdent

type GuildIdent = string

GuildIdent defines model for guild_ident.

type MiddlewareFunc

type MiddlewareFunc func(c *gin.Context)

type PlatformId

type PlatformId = int

PlatformId defines model for platform_id.

type PlatformLink struct {
	DisplayName *string `json:"display_name,omitempty"`

	// PlatformId ID of the platform the user id belongs to
	PlatformID     int    `bun:",pk" json:"platform_id"`
	PlatformUserID string `bun:",pk" json:"platform_user_id"`
	Primary        bool   `json:"primary"`
	UserID         int64  `json:"user_id"`
}

PlatformLink defines model for PlatformLink.

type PlatformUserId

type PlatformUserId = string

PlatformUserId defines model for platform_user_id.

type PostChannelPlatformStatisticsJSONRequestBody

type PostChannelPlatformStatisticsJSONRequestBody = ChannelMetadata

PostChannelPlatformStatisticsJSONRequestBody defines body for PostChannelPlatformStatistics for application/json ContentType.

type PostChannelPlatformStatisticsParams

type PostChannelPlatformStatisticsParams struct {
	World TraitWorldView `form:"world" json:"world"`
}

PostChannelPlatformStatisticsParams defines parameters for PostChannelPlatformStatistics.

type PostVerificationPlatformUserRefreshParams

type PostVerificationPlatformUserRefreshParams struct {
	World TraitWorldView `form:"world" json:"world"`
}

PostVerificationPlatformUserRefreshParams defines parameters for PostVerificationPlatformUserRefresh.

type Property

type Property struct {
	Name    string  `json:"name"`
	Subject *string `json:"subject,omitempty"`
	Value   string  `json:"value"`
}

Property defines model for Property.

type PropertyName

type PropertyName = string

PropertyName defines model for property_name.

type PutPlatformUserAPIKeyJSONRequestBody

type PutPlatformUserAPIKeyJSONRequestBody = APIKeyData

PutPlatformUserAPIKeyJSONRequestBody defines body for PutPlatformUserAPIKey for application/json ContentType.

type PutPlatformUserAPIKeyParams

type PutPlatformUserAPIKeyParams struct {
	// SkipRequirements Skip the variuse apikey requirements that might be in place
	SkipRequirements *bool                   `form:"skip-requirements,omitempty" json:"skip-requirements,omitempty"`
	World            *TraitWorldViewOptional `form:"world,omitempty" json:"world,omitempty"`
}

PutPlatformUserAPIKeyParams defines parameters for PutPlatformUserAPIKey.

type PutPlatformUserBanJSONRequestBody

type PutPlatformUserBanJSONRequestBody = Ban

PutPlatformUserBanJSONRequestBody defines body for PutPlatformUserBan for application/json ContentType.

type PutVerificationPlatformUserTemporaryJSONRequestBody

type PutVerificationPlatformUserTemporaryJSONRequestBody = EphemeralAssociation

PutVerificationPlatformUserTemporaryJSONRequestBody defines body for PutVerificationPlatformUserTemporary for application/json ContentType.

type PutVerificationPlatformUserTemporaryParams

type PutVerificationPlatformUserTemporaryParams struct {
	World TraitWorldView `form:"world" json:"world"`
}

PutVerificationPlatformUserTemporaryParams defines parameters for PutVerificationPlatformUserTemporary.

type ServerInterface

type ServerInterface interface {

	// (POST /v1/channels/{platform_id}/{channel}/statistics)
	PostChannelPlatformStatistics(c *gin.Context, platformId PlatformId, channel string, params PostChannelPlatformStatisticsParams)

	// (GET /v1/configuration)
	GetV1Configuration(c *gin.Context, params GetV1ConfigurationParams)

	// (GET /v1/guilds/{guild_ident}/users)
	GetGuildUsers(c *gin.Context, guildIdent GuildIdent)

	// (GET /v1/platform/{platform_id}/users/updates)
	GetPlatformUserUpdates(c *gin.Context, platformId PlatformId, params GetPlatformUserUpdatesParams)

	// (GET /v1/platform/{platform_id}/users/{platform_user_id})
	GetPlatformUser(c *gin.Context, platformId PlatformId, platformUserId PlatformUserId, params GetPlatformUserParams)

	// (PUT /v1/platform/{platform_id}/users/{platform_user_id}/apikey)
	PutPlatformUserAPIKey(c *gin.Context, platformId PlatformId, platformUserId PlatformUserId, params PutPlatformUserAPIKeyParams)

	// (GET /v1/platform/{platform_id}/users/{platform_user_id}/apikey/name)
	GetPlatformUserAPIKeyName(c *gin.Context, platformId PlatformId, platformUserId PlatformUserId, params GetPlatformUserAPIKeyNameParams)

	// (PUT /v1/platform/{platform_id}/users/{platform_user_id}/ban)
	PutPlatformUserBan(c *gin.Context, platformId PlatformId, platformUserId PlatformUserId)

	// (POST /v1/platform/{platform_id}/users/{platform_user_id}/refresh)
	PostPlatformUserRefresh(c *gin.Context, platformId PlatformId, platformUserId PlatformUserId)

	// (GET /v1/services/{service_uuid}/properties)
	GetServiceProperties(c *gin.Context, serviceUuid ServiceUuid)

	// (GET /v1/services/{service_uuid}/properties/{subject})
	GetServiceSubjectProperties(c *gin.Context, serviceUuid ServiceUuid, subject Subject)

	// (PUT /v1/services/{service_uuid}/properties/{subject})
	PutServiceSubjectProperties(c *gin.Context, serviceUuid ServiceUuid, subject Subject)

	// (GET /v1/services/{service_uuid}/properties/{subject}/{property_name})
	GetServiceSubjectProperty(c *gin.Context, serviceUuid ServiceUuid, subject Subject, propertyName PropertyName)

	// (PUT /v1/services/{service_uuid}/properties/{subject}/{property_name})
	PutServiceSubjectProperty(c *gin.Context, serviceUuid ServiceUuid, subject Subject, propertyName PropertyName)

	// (GET /v1/verification/platform/{platform_id}/users/updates)
	GetVerificationPlatformUserUpdates(c *gin.Context, platformId PlatformId, params GetVerificationPlatformUserUpdatesParams)

	// (GET /v1/verification/platform/{platform_id}/users/{platform_user_id})
	GetVerificationPlatformUserStatus(c *gin.Context, platformId PlatformId, platformUserId PlatformUserId, params GetVerificationPlatformUserStatusParams)

	// (POST /v1/verification/platform/{platform_id}/users/{platform_user_id}/refresh)
	PostVerificationPlatformUserRefresh(c *gin.Context, platformId PlatformId, platformUserId PlatformUserId, params PostVerificationPlatformUserRefreshParams)

	// (PUT /v1/verification/platform/{platform_id}/users/{platform_user_id}/temporary)
	PutVerificationPlatformUserTemporary(c *gin.Context, platformId PlatformId, platformUserId PlatformUserId, params PutVerificationPlatformUserTemporaryParams)
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandler       func(*gin.Context, error, int)
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) GetGuildUsers

func (siw *ServerInterfaceWrapper) GetGuildUsers(c *gin.Context)

GetGuildUsers operation middleware

func (*ServerInterfaceWrapper) GetPlatformUser

func (siw *ServerInterfaceWrapper) GetPlatformUser(c *gin.Context)

GetPlatformUser operation middleware

func (*ServerInterfaceWrapper) GetPlatformUserAPIKeyName

func (siw *ServerInterfaceWrapper) GetPlatformUserAPIKeyName(c *gin.Context)

GetPlatformUserAPIKeyName operation middleware

func (*ServerInterfaceWrapper) GetPlatformUserUpdates

func (siw *ServerInterfaceWrapper) GetPlatformUserUpdates(c *gin.Context)

GetPlatformUserUpdates operation middleware

func (*ServerInterfaceWrapper) GetServiceProperties

func (siw *ServerInterfaceWrapper) GetServiceProperties(c *gin.Context)

GetServiceProperties operation middleware

func (*ServerInterfaceWrapper) GetServiceSubjectProperties

func (siw *ServerInterfaceWrapper) GetServiceSubjectProperties(c *gin.Context)

GetServiceSubjectProperties operation middleware

func (*ServerInterfaceWrapper) GetServiceSubjectProperty

func (siw *ServerInterfaceWrapper) GetServiceSubjectProperty(c *gin.Context)

GetServiceSubjectProperty operation middleware

func (*ServerInterfaceWrapper) GetV1Configuration

func (siw *ServerInterfaceWrapper) GetV1Configuration(c *gin.Context)

GetV1Configuration operation middleware

func (*ServerInterfaceWrapper) GetVerificationPlatformUserStatus

func (siw *ServerInterfaceWrapper) GetVerificationPlatformUserStatus(c *gin.Context)

GetVerificationPlatformUserStatus operation middleware

func (*ServerInterfaceWrapper) GetVerificationPlatformUserUpdates

func (siw *ServerInterfaceWrapper) GetVerificationPlatformUserUpdates(c *gin.Context)

GetVerificationPlatformUserUpdates operation middleware

func (*ServerInterfaceWrapper) PostChannelPlatformStatistics

func (siw *ServerInterfaceWrapper) PostChannelPlatformStatistics(c *gin.Context)

PostChannelPlatformStatistics operation middleware

func (*ServerInterfaceWrapper) PostPlatformUserRefresh

func (siw *ServerInterfaceWrapper) PostPlatformUserRefresh(c *gin.Context)

PostPlatformUserRefresh operation middleware

func (*ServerInterfaceWrapper) PostVerificationPlatformUserRefresh

func (siw *ServerInterfaceWrapper) PostVerificationPlatformUserRefresh(c *gin.Context)

PostVerificationPlatformUserRefresh operation middleware

func (*ServerInterfaceWrapper) PutPlatformUserAPIKey

func (siw *ServerInterfaceWrapper) PutPlatformUserAPIKey(c *gin.Context)

PutPlatformUserAPIKey operation middleware

func (*ServerInterfaceWrapper) PutPlatformUserBan

func (siw *ServerInterfaceWrapper) PutPlatformUserBan(c *gin.Context)

PutPlatformUserBan operation middleware

func (*ServerInterfaceWrapper) PutServiceSubjectProperties

func (siw *ServerInterfaceWrapper) PutServiceSubjectProperties(c *gin.Context)

PutServiceSubjectProperties operation middleware

func (*ServerInterfaceWrapper) PutServiceSubjectProperty

func (siw *ServerInterfaceWrapper) PutServiceSubjectProperty(c *gin.Context)

PutServiceSubjectProperty operation middleware

func (*ServerInterfaceWrapper) PutVerificationPlatformUserTemporary

func (siw *ServerInterfaceWrapper) PutVerificationPlatformUserTemporary(c *gin.Context)

PutVerificationPlatformUserTemporary operation middleware

type ServiceUuid

type ServiceUuid = string

ServiceUuid defines model for service_uuid.

type Status

type Status string

Status defines model for Status.

const (
	ACCESSDENIEDACCOUNTNOTLINKED      Status = "ACCESS_DENIED_ACCOUNT_NOT_LINKED"
	ACCESSDENIEDBANNED                Status = "ACCESS_DENIED_BANNED"
	ACCESSDENIEDEXPIRED               Status = "ACCESS_DENIED_EXPIRED"
	ACCESSDENIEDINVALIDWORLD          Status = "ACCESS_DENIED_INVALID_WORLD"
	ACCESSDENIEDREQUIREMENTNOTMET     Status = "ACCESS_DENIED_REQUIREMENT_NOT_MET"
	ACCESSDENIEDUNKNOWN               Status = "ACCESS_DENIED_UNKNOWN"
	ACCESSGRANTEDHOMEWORLD            Status = "ACCESS_GRANTED_HOME_WORLD"
	ACCESSGRANTEDHOMEWORLDTEMPORARY   Status = "ACCESS_GRANTED_HOME_WORLD_TEMPORARY"
	ACCESSGRANTEDLINKEDWORLD          Status = "ACCESS_GRANTED_LINKED_WORLD"
	ACCESSGRANTEDLINKEDWORLDTEMPORARY Status = "ACCESS_GRANTED_LINKED_WORLD_TEMPORARY"
)

Defines values for Status.

func (Status) AccessDenied

func (s Status) AccessDenied() bool

func (Status) AccessGranted

func (s Status) AccessGranted() bool

func (Status) ID

func (s Status) ID() int

func (Status) Priority

func (s Status) Priority() int

type Subject

type Subject = string

Subject defines model for subject.

type TraitErrorResp

type TraitErrorResp = Error

TraitErrorResp defines model for trait_error_resp.

type TraitPlatformUserDisplayName

type TraitPlatformUserDisplayName = string

TraitPlatformUserDisplayName defines model for trait_platform_user_display_name.

type TraitSecuredAuthentication

type TraitSecuredAuthentication = string

TraitSecuredAuthentication defines model for trait_secured_authentication.

type TraitWorldView

type TraitWorldView = int

TraitWorldView defines model for trait_world_view.

type TraitWorldViewOptional

type TraitWorldViewOptional = int

TraitWorldViewOptional defines model for trait_world_view_optional.

type User

type User struct {
	Accounts              []Account              `bun:"rel:has-many,join:id=user_id" json:"accounts,omitempty"`
	Bans                  []Ban                  `bun:"rel:has-many,join:id=user_id" json:"bans,omitempty"`
	DbCreated             time.Time              `bun:",nullzero,notnull,default:current_timestamp,scanonly" json:"db_created,omitempty"`
	DbUpdated             time.Time              `bun:",nullzero,notnull,default:current_timestamp" json:"db_updated,omitempty"`
	EphemeralAssociations []EphemeralAssociation `bun:"rel:has-many,join:id=user_id" json:"ephemeral_associations,omitempty"`
	Id                    int64                  `bun:",pk,autoincrement" json:"id"`
	PlatformLinks         []PlatformLink         `bun:"rel:has-many,join:id=user_id" json:"platform_links,omitempty"`
}

User defines model for User.

func (*User) BeforeAppendModel

func (m *User) BeforeAppendModel(ctx context.Context, query bun.Query) error

type VerificationStatus

type VerificationStatus struct {
	Ban          *Ban          `json:"ban,omitempty"`
	PlatformLink *PlatformLink `json:"platform_link,omitempty"`
	Status       Status        `bun:"-" json:"status"`
}

VerificationStatus defines model for VerificationStatus.

func (*VerificationStatus) WithStatus

func (s *VerificationStatus) WithStatus(status Status) *VerificationStatus

func (*VerificationStatus) WithStatusIfHigher

func (s *VerificationStatus) WithStatusIfHigher(status Status) *VerificationStatus
type WorldLinks = []int

WorldLinks defines model for WorldLinks.

Jump to

Keyboard shortcuts

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