Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Dependency Review Action
#
# This Action will scan dependency manifest files that change as part of a Pull Request,
# surfacing known-vulnerable versions of the packages declared or updated in the PR.
# Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable
# packages will be blocked from merging.
#
# Source repository: https://github.com/actions/dependency-review-action
# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement
name: 'Dependency review'
on:
pull_request:
branches: [ "master" ]

# If using a dependency submission action in this workflow this permission will need to be set to:
#
# permissions:
# contents: write
#
# https://docs.github.com/en/enterprise-cloud@latest/code-security/supply-chain-security/understanding-your-software-supply-chain/using-the-dependency-submission-api
permissions:
contents: read
# Write permissions for pull-requests are required for using the `comment-summary-in-pr` option, comment out if you aren't using this option
pull-requests: write

jobs:
dependency-review:
runs-on: ubuntu-latest
steps:
- name: 'Checkout repository'
uses: actions/checkout@v4
- name: 'Dependency Review'
uses: actions/dependency-review-action@v4
# Commonly enabled options, see https://github.com/actions/dependency-review-action#configuration-options for all available options.
with:
comment-summary-in-pr: always
# fail-on-severity: moderate
# deny-licenses: GPL-1.0-or-later, LGPL-2.0-or-later
# retry-on-snapshot-warnings: true
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2016-2021 Jan Vales <jan@jvales.net> (aka. Someone <someone@somenet.org>)
Copyright (c) 2024 Skorm11x

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@ In productive use on a 6k+ users E10 instance at https://mattermost.fsinf.at
+ Others may be out of scope (I cannot test E20-stuff)
+ Beware: I love to rebase git. :)

## If you use this or find this stuff useful, consider paying me a beer/club-mate :)
+ ``btc: bc1q9vxqzd58683ky9c2yaddaxx3wrxakggfa0dmdt``
+ ``eth: 0x839326860d74cf61f03719c5c63db3ae5d2b443f``
+ ``bch: qqxpm8py3flkaqdt4ehatzvx250634fuvgsgvft6z4``
+ ``doge: DLeQq2u7gdnidaNwEtj9fYrstUaU4banNg``
+ ``xmr: 47WwuQssrZRHLXYBRoEPmqhyG8e4PxorwWn1Xvyg6QShKAjZ83UHWJmYd9PFkpH6vPQFgNbnKvaRz1EzoQHSeeQvEGQ6ihA``


## Setup
``pip3 install --user --upgrade mattermost``
Expand Down Expand Up @@ -163,7 +156,6 @@ Ordered by https://api.mattermost.com/
+ *``patch_team() #NOT_IMPLEMENTED``*
+ *``update_team_privacy() #NOT_IMPLEMENTED``*
+ *``restore_team() #NOT_IMPLEMENTED``*
+ *``get_team_by_name() #NOT_IMPLEMENTED``*
+ *``search_teams() #NOT_IMPLEMENTED``*
+ *``exists_team() #NOT_IMPLEMENTED``*
+ *``get_teams_for_user() #NOT_IMPLEMENTED``*
Expand Down
42 changes: 35 additions & 7 deletions mattermost/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""
Someone's Mattermost API v4 bindings.
Copyright (c) 2016-2021 by Someone <someone@somenet.org> (aka. Jan Vales <jan@jvales.net>)
Forked 2024 skorm11x.
published under MIT-License
"""

Expand Down Expand Up @@ -204,8 +204,19 @@ def logout(self, **kwargs):
################################################
#+ **USERS**


#def create_user() #NOT_IMPLEMENTED
#merged this: https://github.com/someone-somenet-org/mattermost-python-api/pull/2
# credit for @haalcala 4SEP2022
def create_user(self, props=None, **kwargs):
"""
Create user.
Args:
props (dict, optional): fields for creating the user (See https://api.mattermost.com/#tag/users/operation/CreateUser).
Returns:
dict: User.
Raises:
ApiException: Passed on from lower layers.
"""
return self._post("/v4/users", data=props, **kwargs)



Expand Down Expand Up @@ -555,7 +566,21 @@ def get_team(self, team_id, **kwargs):
#def patch_team() #NOT_IMPLEMENTED
#def update_team_privacy() #NOT_IMPLEMENTED
#def restore_team() #NOT_IMPLEMENTED
#def get_team_by_name() #NOT_IMPLEMENTED
def get_team_by_name(self, team_name, **kwargs):
"""
Get a team on the system.

Args:
team_name (string): team_name.

Returns:
dict: Team.

Raises:
ApiException: Passed on from lower layers.
"""

return self._get("/v4/teams/name/" + team_name, **kwargs)
#def search_teams() #NOT_IMPLEMENTED
#def exists_team() #NOT_IMPLEMENTED
#def get_teams_for_user() #NOT_IMPLEMENTED
Expand Down Expand Up @@ -913,6 +938,7 @@ def search_channel(self, team_id, term, **kwargs):


def get_channel_by_name(self, team_id, channel_name, include_deleted=None, **kwargs):
# TODO FIX# this does not find channels by display names!
"""
Gets channel from the provided team id and channel name strings.

Expand Down Expand Up @@ -1071,8 +1097,9 @@ def get_channels_for_user(self, user_id, team_id, **kwargs):
################################################
#+ **POSTS**


def create_post(self, channel_id, message, props=None, filepaths=None, root_id=None, **kwargs):
# merged this: https://github.com/someone-somenet-org/mattermost-python-api/pull/3/commits/e71961e62460f0f1bafa15dbf79896c4078a7c80
# credit 21JUL2023 @serbeh
def create_post(self, channel_id, message, props=None, filepaths=None, root_id=None, metadata=None, **kwargs):
"""
Create a new post in a channel. To create the post as a comment on another post, provide root_id.

Expand All @@ -1082,6 +1109,7 @@ def create_post(self, channel_id, message, props=None, filepaths=None, root_id=N
props (string, optional): see MM-API docs.
filepaths (list, optional): Paths to upload files from and attach to post.
root_id (string, optional): see MM-API docs.
metadata (dict, optional): Priority metadata. see MM-API docs.

Returns:
dict: created Post.
Expand All @@ -1098,12 +1126,12 @@ def create_post(self, channel_id, message, props=None, filepaths=None, root_id=N
"channel_id": channel_id,
"message": message,
**({"props": props} if props else {"props": {"from_webhook":"true"}}),
**({"metadata": metadata} if metadata else {"metadata": {}}),
"root_id":root_id,
"file_ids": file_ids,
}, **kwargs)



def create_ephemeral_post(self, channel_id, message, user_id, **kwargs):
"""
Create a new ephemeral post in a channel.
Expand Down
3 changes: 1 addition & 2 deletions mattermost/stdin2channel.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#!/usr/bin/env python3
"""
Someone's Mattermost API v4 bindings.
Copyright (c) 2016-2021 by Someone <someone@somenet.org> (aka. Jan Vales <jan@jvales.net>)
published under MIT-License

Forked 2024 skorm11x.
post stdin to a channel.
"""

Expand Down
6 changes: 3 additions & 3 deletions mattermost/version.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env python3
"""
Someone's Mattermost API v4 bindings.
Copyright (c) 2016-2021 by Someone <someone@somenet.org> (aka. Jan Vales <jan@jvales.net>)
Copyright (c) 2024 by skorm11x
Forked 2024 skorm11x.
published under MIT-License
"""

# Set this package's version.
__version__ = "6.5.0"
__version__ = "0.0.1"
2 changes: 1 addition & 1 deletion mattermost/ws.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""
Someone's Mattermost API v4 bindings.
Copyright (c) 2016-2021 by Someone <someone@somenet.org> (aka. Jan Vales <jan@jvales.net>)
Forked 2024 skorm11x.
published under MIT-License
"""

Expand Down