Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

(no description)

File Size: 139 lines (5 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

moodlenet_client:: (3 methods):
  __construct()
  create_resource_from_stored_file()
  prepare_file_share_request_data()


Class: moodlenet_client  - X-Ref

MoodleNet client which handles direct outbound communication with MoodleNet instances.

__construct(protected http_client $httpclient,protected client $oauthclient,)   X-Ref
Constructor.

param: http_client $httpclient The httpclient object being used to perform the share.
param: client $oauthclient The OAuth 2 client for the MoodleNet site being shared to.

create_resource_from_stored_file(stored_file $file,string $resourcename,string $resourcedescription,)   X-Ref
Create a resource on MoodleNet which includes a file.

param: stored_file $file The file data to send to MoodleNet.
param: string $resourcename The name of the resource being shared.
param: string $resourcedescription A description of the resource being shared.
return: \Psr\Http\Message\ResponseInterface The HTTP client response from MoodleNet.

prepare_file_share_request_data(string $filename,string $mimetype,StreamInterface $stream,string $resourcename,string $resourcedescription,)   X-Ref
Prepare the request data required for sharing a file to MoodleNet.
This creates an array in the format used by \core\httpclient options to send a multipart request.

param: string $filename Name of the file being shared.
param: string $mimetype Mime type of the file being shared.
param: StreamInterface $stream Stream of the file being shared.
param: string $resourcename The name of the resource being shared.
param: string $resourcedescription A description of the resource being shared.
return: array Data in the format required to send a file to MoodleNet using \core\httpclient.