Skip to content

owncloud/libre-graph-api-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go API client for libregraph

Libre Graph is a free API for cloud collaboration inspired by the MS Graph API.

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: v1.0.4
  • Package version: 1.0.0
  • Generator version: 7.8.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import libregraph "github.com/owncloud/libre-graph-api-go"

To use a proxy, set the environment variable HTTP_PROXY:

os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value libregraph.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), libregraph.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value libregraph.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), libregraph.ContextServerVariables, map[string]string{
	"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identified by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using libregraph.ContextOperationServerIndices and libregraph.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), libregraph.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), libregraph.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

All URIs are relative to https://ocis.ocis.rolling.owncloud.works/graph

Class Method HTTP request Description
ActivitiesApi GetActivities Get /v1beta1/extensions/org.libregraph/activities Get activities
ApplicationsApi GetApplication Get /v1.0/applications/{application-id} Get application by id
ApplicationsApi ListApplications Get /v1.0/applications Get all applications
DriveItemApi DeleteDriveItem Delete /v1beta1/drives/{drive-id}/items/{item-id} Delete a DriveItem.
DriveItemApi GetDriveItem Get /v1beta1/drives/{drive-id}/items/{item-id} Get a DriveItem.
DriveItemApi UpdateDriveItem Patch /v1beta1/drives/{drive-id}/items/{item-id} Update a DriveItem.
DrivesApi CreateDrive Post /v1.0/drives Create a new drive of a specific type
DrivesApi DeleteDrive Delete /v1.0/drives/{drive-id} Delete a specific space
DrivesApi GetDrive Get /v1.0/drives/{drive-id} Get drive by id
DrivesApi UpdateDrive Patch /v1.0/drives/{drive-id} Update the drive
DrivesGetDrivesApi ListAllDrives Get /v1.0/drives Get all available drives
DrivesGetDrivesApi ListAllDrivesBeta Get /v1beta1/drives Alias for '/v1.0/drives', the difference is that grantedtoV2 is used and roles contain unified roles instead of cs3 roles
DrivesPermissionsApi CreateLink Post /v1beta1/drives/{drive-id}/items/{item-id}/createLink Create a sharing link for a DriveItem
DrivesPermissionsApi DeletePermission Delete /v1beta1/drives/{drive-id}/items/{item-id}/permissions/{perm-id} Remove access to a DriveItem
DrivesPermissionsApi GetPermission Get /v1beta1/drives/{drive-id}/items/{item-id}/permissions/{perm-id} Get sharing permission for a file or folder
DrivesPermissionsApi Invite Post /v1beta1/drives/{drive-id}/items/{item-id}/invite Send a sharing invitation
DrivesPermissionsApi ListPermissions Get /v1beta1/drives/{drive-id}/items/{item-id}/permissions List the effective sharing permissions on a driveItem.
DrivesPermissionsApi SetPermissionPassword Post /v1beta1/drives/{drive-id}/items/{item-id}/permissions/{perm-id}/setPassword Set sharing link password
DrivesPermissionsApi UpdatePermission Patch /v1beta1/drives/{drive-id}/items/{item-id}/permissions/{perm-id} Update sharing permission
DrivesRootApi CreateDriveItem Post /v1beta1/drives/{drive-id}/root/children Create a drive item
DrivesRootApi CreateLinkSpaceRoot Post /v1beta1/drives/{drive-id}/root/createLink Create a sharing link for the root item of a Drive
DrivesRootApi DeletePermissionSpaceRoot Delete /v1beta1/drives/{drive-id}/root/permissions/{perm-id} Remove access to a Drive
DrivesRootApi GetPermissionSpaceRoot Get /v1beta1/drives/{drive-id}/root/permissions/{perm-id} Get a single sharing permission for the root item of a drive
DrivesRootApi GetRoot Get /v1.0/drives/{drive-id}/root Get root from arbitrary space
DrivesRootApi InviteSpaceRoot Post /v1beta1/drives/{drive-id}/root/invite Send a sharing invitation
DrivesRootApi ListPermissionsSpaceRoot Get /v1beta1/drives/{drive-id}/root/permissions List the effective permissions on the root item of a drive.
DrivesRootApi SetPermissionPasswordSpaceRoot Post /v1beta1/drives/{drive-id}/root/permissions/{perm-id}/setPassword Set sharing link password for the root item of a drive
DrivesRootApi UpdatePermissionSpaceRoot Patch /v1beta1/drives/{drive-id}/root/permissions/{perm-id} Update sharing permission
EducationClassApi AddUserToClass Post /v1.0/education/classes/{class-id}/members/$ref Assign a user to a class
EducationClassApi CreateClass Post /v1.0/education/classes Add new education class
EducationClassApi DeleteClass Delete /v1.0/education/classes/{class-id} Delete education class
EducationClassApi DeleteUserFromClass Delete /v1.0/education/classes/{class-id}/members/{user-id}/$ref Unassign user from a class
EducationClassApi GetClass Get /v1.0/education/classes/{class-id} Get class by key
EducationClassApi ListClassMembers Get /v1.0/education/classes/{class-id}/members Get the educationClass resources owned by an educationSchool
EducationClassApi ListClasses Get /v1.0/education/classes list education classes
EducationClassApi UpdateClass Patch /v1.0/education/classes/{class-id} Update properties of a education class
EducationClassTeachersApi AddTeacherToClass Post /v1.0/education/classes/{class-id}/teachers/$ref Assign a teacher to a class
EducationClassTeachersApi DeleteTeacherFromClass Delete /v1.0/education/classes/{class-id}/teachers/{user-id}/$ref Unassign user as teacher of a class
EducationClassTeachersApi GetTeachers Get /v1.0/education/classes/{class-id}/teachers Get the teachers for a class
EducationSchoolApi AddClassToSchool Post /v1.0/education/schools/{school-id}/classes/$ref Assign a class to a school
EducationSchoolApi AddUserToSchool Post /v1.0/education/schools/{school-id}/users/$ref Assign a user to a school
EducationSchoolApi CreateSchool Post /v1.0/education/schools Add new school
EducationSchoolApi DeleteClassFromSchool Delete /v1.0/education/schools/{school-id}/classes/{class-id}/$ref Unassign class from a school
EducationSchoolApi DeleteSchool Delete /v1.0/education/schools/{school-id} Delete school
EducationSchoolApi DeleteUserFromSchool Delete /v1.0/education/schools/{school-id}/users/{user-id}/$ref Unassign user from a school
EducationSchoolApi GetSchool Get /v1.0/education/schools/{school-id} Get the properties of a specific school
EducationSchoolApi ListSchoolClasses Get /v1.0/education/schools/{school-id}/classes Get the educationClass resources owned by an educationSchool
EducationSchoolApi ListSchoolUsers Get /v1.0/education/schools/{school-id}/users Get the educationUser resources associated with an educationSchool
EducationSchoolApi ListSchools Get /v1.0/education/schools Get a list of schools and their properties
EducationSchoolApi UpdateSchool Patch /v1.0/education/schools/{school-id} Update properties of a school
EducationUserApi CreateEducationUser Post /v1.0/education/users Add new education user
EducationUserApi DeleteEducationUser Delete /v1.0/education/users/{user-id} Delete educationUser
EducationUserApi GetEducationUser Get /v1.0/education/users/{user-id} Get properties of educationUser
EducationUserApi ListEducationUsers Get /v1.0/education/users Get entities from education users
EducationUserApi UpdateEducationUser Patch /v1.0/education/users/{user-id} Update properties of educationUser
GroupApi AddMember Post /v1.0/groups/{group-id}/members/$ref Add a member to a group
GroupApi DeleteGroup Delete /v1.0/groups/{group-id} Delete entity from groups
GroupApi DeleteMember Delete /v1.0/groups/{group-id}/members/{directory-object-id}/$ref Delete member from a group
GroupApi GetGroup Get /v1.0/groups/{group-id} Get entity from groups by key
GroupApi ListMembers Get /v1.0/groups/{group-id}/members Get a list of the group's direct members
GroupApi UpdateGroup Patch /v1.0/groups/{group-id} Update entity in groups
GroupsApi CreateGroup Post /v1.0/groups Add new entity to groups
GroupsApi ListGroups Get /v1.0/groups Get entities from groups
MeChangepasswordApi ChangeOwnPassword Post /v1.0/me/changePassword Change your own password
MeDriveApi GetHome Get /v1.0/me/drive Get personal space for user
MeDriveApi ListSharedByMe Get /v1beta1/me/drive/sharedByMe Get a list of driveItem objects shared by the current user.
MeDriveApi ListSharedWithMe Get /v1beta1/me/drive/sharedWithMe Get a list of driveItem objects shared with the owner of a drive.
MeDriveRootApi HomeGetRoot Get /v1.0/me/drive/root Get root from personal space
MeDriveRootChildrenApi HomeGetChildren Get /v1.0/me/drive/root/children Get children from drive
MeDrivesApi ListMyDrives Get /v1.0/me/drives Get all drives where the current user is a regular member of
MeDrivesApi ListMyDrivesBeta Get /v1beta1/me/drives Alias for '/v1.0/drives', the difference is that grantedtoV2 is used and roles contain unified roles instead of cs3 roles
MeUserApi GetOwnUser Get /v1.0/me Get current user
MeUserApi UpdateOwnUser Patch /v1.0/me Update the current user
RoleManagementApi GetPermissionRoleDefinition Get /v1beta1/roleManagement/permissions/roleDefinitions/{role-id} Get unifiedRoleDefinition
RoleManagementApi ListPermissionRoleDefinitions Get /v1beta1/roleManagement/permissions/roleDefinitions List roleDefinitions
TagsApi AssignTags Put /v1.0/extensions/org.libregraph/tags Assign tags to a resource
TagsApi GetTags Get /v1.0/extensions/org.libregraph/tags Get all known tags
TagsApi UnassignTags Delete /v1.0/extensions/org.libregraph/tags Unassign tags from a resource
UserApi DeleteUser Delete /v1.0/users/{user-id} Delete entity from users
UserApi ExportPersonalData Post /v1.0/users/{user-id}/exportPersonalData export personal data of a user
UserApi GetUser Get /v1.0/users/{user-id} Get entity from users by key
UserApi UpdateUser Patch /v1.0/users/{user-id} Update entity in users
UserAppRoleAssignmentApi UserCreateAppRoleAssignments Post /v1.0/users/{user-id}/appRoleAssignments Grant an appRoleAssignment to a user
UserAppRoleAssignmentApi UserDeleteAppRoleAssignments Delete /v1.0/users/{user-id}/appRoleAssignments/{appRoleAssignment-id} Delete the appRoleAssignment from a user
UserAppRoleAssignmentApi UserListAppRoleAssignments Get /v1.0/users/{user-id}/appRoleAssignments Get appRoleAssignments from a user
UsersApi CreateUser Post /v1.0/users Add new entity to users
UsersApi ListUsers Get /v1.0/users Get entities from users

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

openId

bearerAuth

  • Type: HTTP Bearer token authentication

Example

auth := context.WithValue(context.Background(), libregraph.ContextAccessToken, "BEARER_TOKEN_STRING")
r, err := client.Service.Operation(auth, args)

basicAuth

  • Type: HTTP basic authentication

Example

auth := context.WithValue(context.Background(), libregraph.ContextBasicAuth, libregraph.BasicAuth{
	UserName: "username",
	Password: "password",
})
r, err := client.Service.Operation(auth, args)

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author