Bitrix API

MyOfficeHandler extends DocumentHandler

Table of Contents

Constants

API_URL_V1  = 'https://coapi.myoffice.ru/api/v1'
ERROR_BAD_JSON  = 'DISK_MYOFFICE_HANDLER_22005'
ERROR_CODE_APP_IN_BLACKLIST  = 'DISK_DOC_HANDLER_220028'
ERROR_CODE_APP_NOT_CONFIGURED  = 'DISK_DOC_HANDLER_220027'
ERROR_CODE_INSUFFICIENT_SCOPE  = 'DISK_DOC_HANDLER_220022'
ERROR_CODE_INVALID_ACCESS_LEVEL  = 'DISK_DOC_HANDLER_220026'
ERROR_CODE_INVALID_CREDENTIALS  = 'DISK_DOC_HANDLER_220023'
ERROR_CODE_NOT_FOUND  = 'DISK_DOC_HANDLER_220030'
ERROR_CODE_NOT_FOUND_ETAG  = 'DISK_DOC_HANDLER_220031'
ERROR_CODE_NOT_GRANTED_APP  = 'DISK_DOC_HANDLER_220025'
ERROR_CODE_NOT_INSTALLED_APP  = 'DISK_DOC_HANDLER_220024'
ERROR_CODE_UNKNOWN  = 'DISK_DOC_HANDLER_220029'
ERROR_COULD_NOT_FIND_EMBED_LINK  = 'DISK_MYOFFICE_HANDLER_22016'
ERROR_COULD_NOT_VIEW_FILE  = 'DISK_MYOFFICE_HANDLER_22013'
ERROR_HTTP_DELETE_FILE  = 'DISK_MYOFFICE_HANDLER_22006'
ERROR_HTTP_DOWNLOAD_FILE  = 'DISK_MYOFFICE_HANDLER_22007'
ERROR_HTTP_FILE_INTERNAL  = 'DISK_MYOFFICE_HANDLER_22009'
ERROR_HTTP_GET_METADATA  = 'DISK_MYOFFICE_HANDLER_22008'
ERROR_HTTP_LIST_FOLDER  = 'DISK_MYOFFICE_HANDLER_22017'
ERROR_INVALID_RESPONSE_STATUS  = 'DISK_DOC_HANDLER_22002'
ERROR_NOT_INSTALLED_SOCSERV  = 'DISK_MYOFFICE_HANDLER_22002'
ERROR_REQUIRED_PARAMETER  = 'DISK_DOC_HANDLER_22003'
ERROR_SHARED_EDIT_LINK  = 'DISK_MYOFFICE_HANDLER_22014'
ERROR_SHARED_EMBED_LINK  = 'DISK_MYOFFICE_HANDLER_22015'
SPECIFIC_FOLDER_CODE  = \Bitrix\Disk\SpecificFolder::CODE_FOR_UPLOADED_FILES

Methods

__construct()  : mixed
checkAccessibleTokenService()  : bool
Execute this method for check potential possibility get access token.
checkHttpResponse()  : bool
checkViewFile()  : bool|null
Check success view file in service.
className()  : string
createBlankFile()  : FileData|null
Create new blank file in cloud service.
createFile()  : FileData
Create file in cloud service by upload from us server.
deleteFile()  : bool
Delete file from cloud service by FileData::id
downloadFile()  : FileData|null
Download file from cloud service by FileData::id, put contents in FileData::src
downloadPartFile()  : FileData|null
Downloads part of file from cloud service by FileData::id, put contents in FileData::src
getAccessToken()  : string
getCode()  : string
Internal code. Identificate document handler
getConvertExtension()  : mixed
getDataForViewFile()  : array<string|int, mixed>|null
Get data for showing preview file.
getErrorByCode()  : array<string|int, Error>
Getting once error with the necessary code.
getErrorContainer()  : mixed
getErrors()  : array<string|int, Error>
Getting array of errors.
getErrorsByCode()  : array<string|int, Error>
Getting array of errors with the necessary code.
getFileMetadata()  : array<string|int, mixed>|null
Gets a file's metadata by ID.
getName()  : string
Public name document handler. May show in user interface.
getUrlForAuthorizeInTokenService()  : string
Return link for authorize user in external service.
getUserId()  : int
Returns user id.
hasAccessToken()  : bool
isEditable()  : bool
Detect by extension editable or not
isNeedConvertExtension()  : bool
Detect by extension needle or not convert? We work with latest office
isRequiredAuthorization()  : bool
Need re-run oauth authorization?
listEditableExtensions()  : array<string|int, mixed>
queryAccessToken()  : $this
Request and store access token (self::accessToken) for self::userId
setUserId()  : int
Sets user id.
wasChangedAfterCreation()  : bool
Tells if file in cloud service was changed. For example, the method compares created date and modified date.

Constants

API_URL_V1

public mixed API_URL_V1 = 'https://coapi.myoffice.ru/api/v1'

ERROR_BAD_JSON

public mixed ERROR_BAD_JSON = 'DISK_MYOFFICE_HANDLER_22005'

ERROR_CODE_APP_IN_BLACKLIST

public mixed ERROR_CODE_APP_IN_BLACKLIST = 'DISK_DOC_HANDLER_220028'

ERROR_CODE_APP_NOT_CONFIGURED

public mixed ERROR_CODE_APP_NOT_CONFIGURED = 'DISK_DOC_HANDLER_220027'

ERROR_CODE_INSUFFICIENT_SCOPE

public mixed ERROR_CODE_INSUFFICIENT_SCOPE = 'DISK_DOC_HANDLER_220022'

ERROR_CODE_INVALID_ACCESS_LEVEL

public mixed ERROR_CODE_INVALID_ACCESS_LEVEL = 'DISK_DOC_HANDLER_220026'

ERROR_CODE_INVALID_CREDENTIALS

public mixed ERROR_CODE_INVALID_CREDENTIALS = 'DISK_DOC_HANDLER_220023'

ERROR_CODE_NOT_FOUND

public mixed ERROR_CODE_NOT_FOUND = 'DISK_DOC_HANDLER_220030'

ERROR_CODE_NOT_FOUND_ETAG

public mixed ERROR_CODE_NOT_FOUND_ETAG = 'DISK_DOC_HANDLER_220031'

ERROR_CODE_NOT_GRANTED_APP

public mixed ERROR_CODE_NOT_GRANTED_APP = 'DISK_DOC_HANDLER_220025'

ERROR_CODE_NOT_INSTALLED_APP

public mixed ERROR_CODE_NOT_INSTALLED_APP = 'DISK_DOC_HANDLER_220024'

ERROR_CODE_UNKNOWN

public mixed ERROR_CODE_UNKNOWN = 'DISK_DOC_HANDLER_220029'
public mixed ERROR_COULD_NOT_FIND_EMBED_LINK = 'DISK_MYOFFICE_HANDLER_22016'

ERROR_COULD_NOT_VIEW_FILE

public mixed ERROR_COULD_NOT_VIEW_FILE = 'DISK_MYOFFICE_HANDLER_22013'

ERROR_HTTP_DELETE_FILE

public mixed ERROR_HTTP_DELETE_FILE = 'DISK_MYOFFICE_HANDLER_22006'

ERROR_HTTP_DOWNLOAD_FILE

public mixed ERROR_HTTP_DOWNLOAD_FILE = 'DISK_MYOFFICE_HANDLER_22007'

ERROR_HTTP_FILE_INTERNAL

public mixed ERROR_HTTP_FILE_INTERNAL = 'DISK_MYOFFICE_HANDLER_22009'

ERROR_HTTP_GET_METADATA

public mixed ERROR_HTTP_GET_METADATA = 'DISK_MYOFFICE_HANDLER_22008'

ERROR_HTTP_LIST_FOLDER

public mixed ERROR_HTTP_LIST_FOLDER = 'DISK_MYOFFICE_HANDLER_22017'

ERROR_INVALID_RESPONSE_STATUS

public mixed ERROR_INVALID_RESPONSE_STATUS = 'DISK_DOC_HANDLER_22002'

ERROR_NOT_INSTALLED_SOCSERV

public mixed ERROR_NOT_INSTALLED_SOCSERV = 'DISK_MYOFFICE_HANDLER_22002'

ERROR_REQUIRED_PARAMETER

public mixed ERROR_REQUIRED_PARAMETER = 'DISK_DOC_HANDLER_22003'
public mixed ERROR_SHARED_EDIT_LINK = 'DISK_MYOFFICE_HANDLER_22014'
public mixed ERROR_SHARED_EMBED_LINK = 'DISK_MYOFFICE_HANDLER_22015'

SPECIFIC_FOLDER_CODE

public mixed SPECIFIC_FOLDER_CODE = \Bitrix\Disk\SpecificFolder::CODE_FOR_UPLOADED_FILES

Methods

__construct()

public __construct(mixed $userId) : mixed
Parameters
$userId : mixed

checkAccessibleTokenService()

Execute this method for check potential possibility get access token.

public checkAccessibleTokenService() : bool
Tags
throws
LoaderException
Return values
bool

checkViewFile()

Check success view file in service.

public checkViewFile(FileData $fileData) : bool|null
Parameters
$fileData : FileData
Return values
bool|null

className()

public static className() : string
Return values
string

the fully qualified name of this class.

deleteFile()

Delete file from cloud service by FileData::id

public deleteFile(FileData $fileData) : bool
Parameters
$fileData : FileData
Return values
bool

downloadPartFile()

Downloads part of file from cloud service by FileData::id, put contents in FileData::src

public downloadPartFile(FileData $fileData, mixed $startRange, mixed $chunkSize) : FileData|null
Parameters
$fileData : FileData
$startRange : mixed
$chunkSize : mixed
Return values
FileData|null

getAccessToken()

public getAccessToken() : string
Return values
string

getCode()

Internal code. Identificate document handler

public static getCode() : string
Tags
inheritdoc
Return values
string

getConvertExtension()

public static getConvertExtension(mixed $extension) : mixed
Parameters
$extension : mixed

getDataForViewFile()

Get data for showing preview file.

public getDataForViewFile(FileData $fileData) : array<string|int, mixed>|null

Array must be contains keys: id, viewUrl, neededDelete, neededCheckView

Parameters
$fileData : FileData
Return values
array<string|int, mixed>|null

getErrorByCode()

Getting once error with the necessary code.

public getErrorByCode(mixed $code) : array<string|int, Error>
Parameters
$code : mixed

Code of error.

Tags
inheritdoc
Return values
array<string|int, Error>

getErrors()

Getting array of errors.

public getErrors() : array<string|int, Error>
Return values
array<string|int, Error>

getErrorsByCode()

Getting array of errors with the necessary code.

public getErrorsByCode(mixed $code) : array<string|int, Error>
Parameters
$code : mixed

Code of error.

Tags
inheritdoc
Return values
array<string|int, Error>

getFileMetadata()

Gets a file's metadata by ID.

public getFileMetadata(FileData $fileData) : array<string|int, mixed>|null
Parameters
$fileData : FileData
Return values
array<string|int, mixed>|null

Describes file (id, title, size)

getName()

Public name document handler. May show in user interface.

public static getName() : string
Tags
inheritdoc
Return values
string

getUrlForAuthorizeInTokenService()

Return link for authorize user in external service.

public getUrlForAuthorizeInTokenService([string $mode = 'modal' ]) : string
Parameters
$mode : string = 'modal'
Return values
string

getUserId()

Returns user id.

public getUserId() : int
Return values
int

isEditable()

Detect by extension editable or not

public static isEditable(mixed $extension) : bool
Parameters
$extension : mixed
Return values
bool

isNeedConvertExtension()

Detect by extension needle or not convert? We work with latest office

public static isNeedConvertExtension(mixed $extension) : bool
Parameters
$extension : mixed
Return values
bool

isRequiredAuthorization()

Need re-run oauth authorization?

public isRequiredAuthorization() : bool
Return values
bool

listEditableExtensions()

public static listEditableExtensions() : array<string|int, mixed>
Return values
array<string|int, mixed>

queryAccessToken()

Request and store access token (self::accessToken) for self::userId

public queryAccessToken() : $this
Return values
$this

setUserId()

Sets user id.

public setUserId(mixed $userId) : int
Parameters
$userId : mixed
Return values
int

wasChangedAfterCreation()

Tells if file in cloud service was changed. For example, the method compares created date and modified date.

public wasChangedAfterCreation(array<string|int, mixed> $currentMetadata[, array<string|int, mixed> $oldMetadata = array() ]) : bool
Parameters
$currentMetadata : array<string|int, mixed>

Metadata (@see \Bitrix\Disk\Document::getFileMetadata());

$oldMetadata : array<string|int, mixed> = array()

Old metadata.

Return values
bool

        
On this page

Search results