You've already forked focalboard
							
							
				mirror of
				https://github.com/mattermost/focalboard.git
				synced 2025-10-31 00:17:42 +02:00 
			
		
		
		
	OctoClient Sharing APIs
This commit is contained in:
		| @@ -7,8 +7,8 @@ import ( | ||||
|  | ||||
| type Sharing struct { | ||||
| 	ID         string `json:"id"` | ||||
| 	Token      string `json:"token"` | ||||
| 	Enabled    bool   `json:"enabled"` | ||||
| 	Token      string `json:"token"` | ||||
| 	ModifiedBy string `json:"modifiedBy"` | ||||
| 	UpdateAt   int64  `json:"update_at,omitempty"` | ||||
| } | ||||
|   | ||||
							
								
								
									
										12
									
								
								webapp/src/blocks/sharing.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								webapp/src/blocks/sharing.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | ||||
|  | ||||
| // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. | ||||
| // See LICENSE.txt for license information. | ||||
| interface ISharing { | ||||
|     id: string, | ||||
|     enabled: boolean, | ||||
|     token: string, | ||||
|     modifiedBy: string, | ||||
|     updateAt: number, | ||||
| } | ||||
|  | ||||
| export {ISharing} | ||||
| @@ -1,6 +1,7 @@ | ||||
| // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. | ||||
| // See LICENSE.txt for license information. | ||||
| import {IBlock, IMutableBlock} from './blocks/block' | ||||
| import {ISharing} from './blocks/sharing' | ||||
| import {IUser} from './user' | ||||
| import {Utils} from './utils' | ||||
|  | ||||
| @@ -203,6 +204,33 @@ class OctoClient { | ||||
|  | ||||
|         return undefined | ||||
|     } | ||||
|  | ||||
|     // Sharing | ||||
|  | ||||
|     async getSharing(rootId: string): Promise<ISharing> { | ||||
|         const path = `/api/v1/sharing/${rootId}` | ||||
|         const response = await fetch(this.serverUrl + path, {headers: this.headers()}) | ||||
|         const sharing = (await response.json()) as ISharing || null | ||||
|         return sharing | ||||
|     } | ||||
|  | ||||
|     async setSharing(sharing: ISharing): Promise<boolean> { | ||||
|         const path = `/api/v1/sharing/${sharing.id}` | ||||
|         const body = JSON.stringify(sharing) | ||||
|         const response = await fetch( | ||||
|             this.serverUrl + path, | ||||
|             { | ||||
|                 method: 'POST', | ||||
|                 headers: this.headers(), | ||||
|                 body, | ||||
|             }, | ||||
|         ) | ||||
|  | ||||
|         if (response.status === 200) { | ||||
|             return true | ||||
|         } | ||||
|         return false | ||||
|     } | ||||
| } | ||||
|  | ||||
| const client = new OctoClient(undefined, localStorage.getItem('sessionId') || '') | ||||
|   | ||||
		Reference in New Issue
	
	Block a user