akams

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

akams package provides a client for the aka.ms API. See https://aka.ms/akaapi for more information.

Index

Constants

View Source
const Scope = "https://microsoft.onmicrosoft.com/redirectionapi"

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is a client for the aka.ms API.

func NewClient

func NewClient(tenant string, httpClient *http.Client) (*Client, error)

NewClient creates a new Client.

func NewClientCustom

func NewClientCustom(apiBaseURL string, host Host, tenant string, httpClient *http.Client) (*Client, error)

NewClientCustom creates a new Client with a custom API base URL and host.

func (*Client) CreateBulk

func (c *Client) CreateBulk(ctx context.Context, links []CreateLinkRequest) error

CreateBulk creates multiple links in bulk.

func (*Client) CreateOrUpdateBulk

func (c *Client) CreateOrUpdateBulk(ctx context.Context, links []CreateLinkRequest) error

CreateOrUpdateBulk creates or updates multiple links in bulk. If a link already exists, it will be updated. If a link does not exist, it will be created. If any link fails to be created or updated, the function will return an error.

func (*Client) SetBulkLimit

func (c *Client) SetBulkLimit(bulkSize int, maxSizeBytes int)

SetBulkLimit sets the maximum number of items and the maximum size in bytes for bulk operations. The default is 300 items and 50_000 bytes. Setting a value of 0 or negative for bulkSize or maxSizeBytes will reset the limit to the default.

func (*Client) UpdateBulk

func (c *Client) UpdateBulk(ctx context.Context, links []UpdateLinkRequest) error

UpdateBulk updates multiple links in bulk.

type CreateLinkRequest

type CreateLinkRequest struct {
	ShortURL                    string `json:"shortUrl,omitempty"`
	TargetURL                   string `json:"targetUrl"`
	MobileURL                   string `json:"mobileUrl,omitempty"`
	CreatedBy                   string `json:"createdBy"`
	LastModifiedBy              string `json:"lastModifiedBy"`
	IsVanity                    bool   `json:"isVanity,omitempty"`
	IsAllowParam                bool   `json:"isAllowParam,omitempty"`
	IsTrackParam                bool   `json:"isTrackParam,omitempty"`
	Description                 string `json:"description,omitempty"`
	GroupOwner                  string `json:"groupOwner,omitempty"`
	Owners                      string `json:"owners"`
	Category                    string `json:"category,omitempty"`
	IsActive                    bool   `json:"isActive,omitempty"`
	BypassCvsCheck              bool   `json:"bypassCvsCheck,omitempty"`
	BypassCvsCheckJustification string `json:"bypassCvsCheckJustification,omitempty"`
}

func (*CreateLinkRequest) ToUpdateLinkRequest

func (c *CreateLinkRequest) ToUpdateLinkRequest() UpdateLinkRequest

type Host

type Host string

Host is the host identifier.

const (
	HostAkaMs           Host = "1"
	HostGoMicrosoftCOM  Host = "2"
	HostSpoMs           Host = "3"
	HostOfficeCOM       Host = "4"
	HostOffice365COM    Host = "5"
	HostO365COM         Host = "6"
	HostMicrosoft365COM Host = "7"
)

type ResponseError

type ResponseError struct {
	StatusCode int
	Body       string
}

ResponseError is an error returned by the aka.ms API.

func (*ResponseError) Error

func (e *ResponseError) Error() string

type UpdateLinkRequest

type UpdateLinkRequest struct {
	ShortURL       string `json:"shortUrl,omitempty"`
	TargetURL      string `json:"targetUrl"`
	MobileURL      string `json:"mobileUrl,omitempty"`
	IsAllowParam   bool   `json:"isAllowParam,omitempty"`
	IsTrackParam   bool   `json:"isTrackParam,omitempty"`
	Description    string `json:"description,omitempty"`
	GroupOwner     string `json:"groupOwner,omitempty"`
	LastModifiedBy string `json:"lastModifiedBy"`
	Owners         string `json:"owners"`
	Category       string `json:"category,omitempty"`
	IsActive       bool   `json:"isActive,omitempty"`
}

Jump to

Keyboard shortcuts

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